A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
app-key.h
Go to the documentation of this file.
1
/*
2
* Copyright(c) 2020 DOTFEESA www.tk.etf.unsa.ba
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
*
7
*
8
* Author: Emir Dervisevic <emir.dervisevic@etf.unsa.ba>
9
* Miralem Mehic <miralem.mehic@ieee.org>
10
*/
11
#ifndef APP_KEY_H
12
#define APP_KEY_H
13
14
#include <stdint.h>
15
#include <algorithm>
16
#include <stdint.h>
17
18
#include "ns3/packet.h"
19
#include "ns3/object.h"
20
#include "ns3/callback.h"
21
#include "ns3/assert.h"
22
#include "ns3/ptr.h"
23
#include "ns3/simulator.h"
24
#include "ns3/nstime.h"
25
#include "ns3/traced-callback.h"
26
#include "ns3/deprecated.h"
27
#include "
qkd-key.h
"
28
29
30
namespace
ns3
{
31
32
/**
33
* @ingroup qkd
34
* @brief The key at the application layer. It has lifetime and type attributes in addition
35
* to QKD key class attributes.
36
*/
37
class
AppKey
:
public
QKDKey
{
38
public
:
39
40
enum
Type
41
{
42
ENCRYPTION
,
43
AUTHENTICATION
44
};
45
46
AppKey
(
47
std::string
id
,
48
std::string
value
,
49
Type
type,
50
uint32_t
lifetime
51
) :
QKDKey
(id,
value
) {
52
m_type
= type;
53
m_lifetime
= lifetime;
54
55
}
56
57
AppKey
(
58
uint32_t
index,
59
std::string
value
,
60
Type
type,
61
uint32_t
lifetime
62
) :
QKDKey
(
""
,
value
) {
63
m_index
= index;
64
m_type
= type;
65
m_lifetime
= lifetime;
66
}
67
68
uint32_t
GetLifetime
()
const
{
69
return
m_lifetime
;
70
}
71
72
void
SetLifetime
(
uint32_t
lifetime) {
73
m_lifetime
= lifetime;
74
}
75
76
void
UseLifetime
(
uint32_t
amount
) {
77
if
(
m_lifetime
>=
amount
)
78
m_lifetime
-=
amount
;
79
else
80
m_lifetime
= 0;
81
}
82
83
Type
GetType
()
const
{
84
return
m_type
;
85
}
86
87
void
SetType
(
Type
type) {
88
m_type
= type;
89
}
90
91
void
SetIndex
(
uint32_t
index){
92
m_index
= index;
93
}
94
95
uint32_t
GetIndex
()
const
{
96
return
m_index
;
97
}
98
99
100
private
:
101
102
Type
m_type
;
//<!Key type
103
uint32_t
m_index
;
//<!Key index(for ETSI 004 clients)
104
uint32_t
m_lifetime
;
//<!Key lifetime value in bytes
105
106
};
107
108
}
// namespace ns3
109
110
#endif
/* APP_KEY_H */
ns3::AppKey
The key at the application layer.
Definition
app-key.h:37
ns3::AppKey::AppKey
AppKey(uint32_t index, std::string value, Type type, uint32_t lifetime)
Definition
app-key.h:57
ns3::AppKey::AppKey
AppKey(std::string id, std::string value, Type type, uint32_t lifetime)
Definition
app-key.h:46
ns3::AppKey::m_index
uint32_t m_index
Definition
app-key.h:103
ns3::AppKey::m_type
Type m_type
Definition
app-key.h:102
ns3::AppKey::GetLifetime
uint32_t GetLifetime() const
Definition
app-key.h:68
ns3::AppKey::SetLifetime
void SetLifetime(uint32_t lifetime)
Definition
app-key.h:72
ns3::AppKey::Type
Type
Definition
app-key.h:41
ns3::AppKey::ENCRYPTION
@ ENCRYPTION
Definition
app-key.h:42
ns3::AppKey::AUTHENTICATION
@ AUTHENTICATION
Definition
app-key.h:43
ns3::AppKey::m_lifetime
uint32_t m_lifetime
Definition
app-key.h:104
ns3::AppKey::GetType
Type GetType() const
Definition
app-key.h:83
ns3::AppKey::GetIndex
uint32_t GetIndex() const
Definition
app-key.h:95
ns3::AppKey::SetType
void SetType(Type type)
Definition
app-key.h:87
ns3::AppKey::SetIndex
void SetIndex(uint32_t index)
Definition
app-key.h:91
ns3::AppKey::UseLifetime
void UseLifetime(uint32_t amount)
Definition
app-key.h:76
ns3::QKDKey
The QKD key is an elementary class of QKDNetSim.
Definition
qkd-key.h:59
uint32_t
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::value
static unsigned int value(char c)
Definition
qkd-encryptor.cc:267
qkd-key.h
src
qkd
model
app-key.h
Generated on Mon Dec 15 2025 15:22:03 for ns-3 by
1.9.8