QKD app packet header that carries info about used encryption, auth tag and other. More...
#include "qkd-app-header.h"
Public Member Functions | |
QKDAppHeader () | |
Constructor. More... | |
uint32_t | Deserialize (Buffer::Iterator start) |
Deserialize the packet. More... | |
uint32_t | GetAuthenticated (void) const |
Read the authentication field. More... | |
std::string | GetAuthenticationKeyId (void) const |
Read the authentication key identifier. More... | |
std::string | GetAuthTag (void) const |
Read the authentication tag. More... | |
uint32_t | GetEncrypted (void) const |
Read the encrypted field. More... | |
std::string | GetEncryptionKeyId (void) const |
Read the encryption key identifier. More... | |
TypeId | GetInstanceTypeId () const |
Get the type ID. More... | |
uint32_t | GetLength (void) const |
Get message length. More... | |
uint32_t | GetMessageId (void) const |
Get message identifier. More... | |
uint32_t | GetSerializedSize () const |
Get the serialized size of a packet. More... | |
bool | IsValid () const |
Check that type is valid. More... | |
bool | operator== (QKDAppHeader const &o) const |
Compare the two QKDApp packets. More... | |
void | Print (std::ostream &os) const |
Print the QKDApp packet. More... | |
void | Serialize (Buffer::Iterator start) const |
Serialize the packet. More... | |
void | SetAuthenticated (uint32_t value) |
Set the authentication field. More... | |
void | SetAuthenticationKeyId (std::string keyID) |
Set the authentication key identifier. More... | |
void | SetAuthTag (std::string value) |
Set the authentication tag. More... | |
void | SetEncrypted (uint32_t value) |
Set the encrypted field. More... | |
void | SetEncryptionKeyId (std::string value) |
Set the encryption key identifier. More... | |
void | SetLength (uint32_t value) |
Set the message length. More... | |
void | SetMessageId (uint32_t value) |
Set message identifier. More... | |
Public Member Functions inherited from ns3::Header | |
~Header () override | |
virtual uint32_t | Deserialize (Buffer::Iterator start)=0 |
Deserialize the object from a buffer iterator. More... | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. More... | |
Public Member Functions inherited from ns3::Chunk | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Header | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Chunk | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Private Attributes | |
uint8_t | m_authenticated |
The authentication flag. More... | |
std::string | m_authenticationKeyId |
The authentication key identifier field. More... | |
std::string | m_authTag |
The authentication tag field. More... | |
uint8_t | m_encryped |
The encryption flag. More... | |
std::string | m_encryptionKeyId |
The encryption key identifier field. More... | |
uint32_t | m_length |
The message length field. More... | |
uint32_t | m_messageId |
The message identifier field. More... | |
bool | m_valid |
Is the header valid or corrupted? More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
QKD app packet header that carries info about used encryption, auth tag and other.
with:
Length: total size of packet, including the length field itself Msg-Id: message number (inside a channel) E: Type of used encryption cipher where value 0 means unencrypted packet A: Type of used authentication algorithm where value 0 means non-authenticated packet E-KeyId: Encryption Key Id A-KeyId: Authentication Key Id A-Tag: Authentication tag
Definition at line 70 of file qkd-app-header.h.
ns3::QKDAppHeader::QKDAppHeader | ( | ) |
Constructor.
Definition at line 33 of file qkd-app-header.cc.
References m_authenticated, m_encryped, m_length, and m_messageId.
|
virtual |
Deserialize the packet.
start | The starting point. |
Implements ns3::Header.
Definition at line 90 of file qkd-app-header.cc.
References ns3::Buffer::Iterator::GetDistanceFrom(), GetSerializedSize(), m_authenticated, m_authenticationKeyId, m_authTag, m_encryped, m_encryptionKeyId, m_length, m_messageId, m_valid, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Buffer::Iterator::Read(), ns3::Buffer::Iterator::ReadNtohU32(), ns3::Buffer::Iterator::ReadU8(), and two-ray-to-three-gpp-ch-calibration::start.
uint32_t ns3::QKDAppHeader::GetAuthenticated | ( | void | ) | const |
Read the authentication field.
Definition at line 264 of file qkd-app-header.cc.
References m_authenticated, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::ProcessDataPacketFromApp(), and ns3::QKDApp014::ProcessDataPacketFromApp().
std::string ns3::QKDAppHeader::GetAuthenticationKeyId | ( | void | ) | const |
Read the authentication key identifier.
Definition at line 224 of file qkd-app-header.cc.
References m_authenticationKeyId, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::ProcessDataPacketFromApp(), and ns3::QKDApp014::ProcessDataPacketFromApp().
std::string ns3::QKDAppHeader::GetAuthTag | ( | void | ) | const |
Read the authentication tag.
Definition at line 238 of file qkd-app-header.cc.
References m_authTag, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::ProcessDataPacketFromApp(), and ns3::QKDApp014::ProcessDataPacketFromApp().
uint32_t ns3::QKDAppHeader::GetEncrypted | ( | void | ) | const |
Read the encrypted field.
Definition at line 251 of file qkd-app-header.cc.
References m_encryped, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::ProcessDataPacketFromApp(), and ns3::QKDApp014::ProcessDataPacketFromApp().
std::string ns3::QKDAppHeader::GetEncryptionKeyId | ( | void | ) | const |
Read the encryption key identifier.
Definition at line 202 of file qkd-app-header.cc.
References m_encryptionKeyId, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::ProcessDataPacketFromApp(), and ns3::QKDApp014::ProcessDataPacketFromApp().
|
virtual |
Get the type ID.
Implements ns3::ObjectBase.
Definition at line 52 of file qkd-app-header.cc.
References GetTypeId().
uint32_t ns3::QKDAppHeader::GetLength | ( | void | ) | const |
Get message length.
Definition at line 168 of file qkd-app-header.cc.
References m_length, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::DataPacketReceivedFromApp(), and ns3::QKDApp014::DataPacketReceivedFromApp().
uint32_t ns3::QKDAppHeader::GetMessageId | ( | void | ) | const |
Get message identifier.
Definition at line 181 of file qkd-app-header.cc.
References m_messageId, and NS_LOG_FUNCTION.
|
virtual |
Get the serialized size of a packet.
Implements ns3::Header.
Definition at line 58 of file qkd-app-header.cc.
Referenced by ns3::QKDApp004::DataPacketReceivedFromApp(), ns3::QKDApp014::DataPacketReceivedFromApp(), Deserialize(), ns3::QKDApp004::SendPacket(), and ns3::QKDApp014::SendPacket().
|
static |
Get the type ID.
Definition at line 42 of file qkd-app-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
inline |
Check that type is valid.
Definition at line 209 of file qkd-app-header.h.
References m_valid.
bool ns3::QKDAppHeader::operator== | ( | QKDAppHeader const & | o | ) | const |
Compare the two QKDApp packets.
o | The other packets. |
Definition at line 148 of file qkd-app-header.cc.
References m_authenticationKeyId, m_authTag, and m_messageId.
|
virtual |
Print the QKDApp packet.
os | The stream. |
Implements ns3::Header.
Definition at line 131 of file qkd-app-header.cc.
References m_authenticated, m_authenticationKeyId, m_authTag, m_encryped, m_encryptionKeyId, m_length, and m_messageId.
Referenced by ns3::operator<<().
|
virtual |
Serialize the packet.
start | The starting point. |
Implements ns3::Header.
Definition at line 66 of file qkd-app-header.cc.
References m_authenticated, m_authenticationKeyId, m_authTag, m_encryped, m_encryptionKeyId, m_length, m_messageId, NS_LOG_FUNCTION, ns3::Buffer::Iterator::Write(), ns3::Buffer::Iterator::WriteHtonU32(), and ns3::Buffer::Iterator::WriteU8().
void ns3::QKDAppHeader::SetAuthenticated | ( | uint32_t | value | ) |
Set the authentication field.
value | The authentication flag. |
Definition at line 258 of file qkd-app-header.cc.
References m_authenticated, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::SendPacket(), and ns3::QKDApp014::SendPacket().
void ns3::QKDAppHeader::SetAuthenticationKeyId | ( | std::string | keyID | ) |
Set the authentication key identifier.
keyID | The authentication key identifier. |
Definition at line 210 of file qkd-app-header.cc.
References m_authenticationKeyId, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::SendPacket(), and ns3::QKDApp014::SendPacket().
void ns3::QKDAppHeader::SetAuthTag | ( | std::string | value | ) |
Set the authentication tag.
value | The authentication tag. |
Definition at line 231 of file qkd-app-header.cc.
References m_authTag, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::SendPacket(), and ns3::QKDApp014::SendPacket().
void ns3::QKDAppHeader::SetEncrypted | ( | uint32_t | value | ) |
Set the encrypted field.
value | The encrypted flag. |
Definition at line 245 of file qkd-app-header.cc.
References m_encryped, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::SendPacket(), and ns3::QKDApp014::SendPacket().
void ns3::QKDAppHeader::SetEncryptionKeyId | ( | std::string | value | ) |
Set the encryption key identifier.
value | The encryption key identifier. |
Definition at line 188 of file qkd-app-header.cc.
References m_encryptionKeyId, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::SendPacket(), and ns3::QKDApp014::SendPacket().
void ns3::QKDAppHeader::SetLength | ( | uint32_t | value | ) |
Set the message length.
value | The length. |
Definition at line 162 of file qkd-app-header.cc.
References m_length, and NS_LOG_FUNCTION.
Referenced by ns3::QKDApp004::SendPacket(), and ns3::QKDApp014::SendPacket().
void ns3::QKDAppHeader::SetMessageId | ( | uint32_t | value | ) |
Set message identifier.
value | The identifier. |
Definition at line 175 of file qkd-app-header.cc.
References m_messageId, and NS_LOG_FUNCTION.
|
private |
The authentication flag.
Definition at line 220 of file qkd-app-header.h.
Referenced by QKDAppHeader(), Deserialize(), GetAuthenticated(), Print(), Serialize(), and SetAuthenticated().
|
private |
The authentication key identifier field.
Definition at line 223 of file qkd-app-header.h.
Referenced by Deserialize(), GetAuthenticationKeyId(), operator==(), Print(), Serialize(), and SetAuthenticationKeyId().
|
private |
The authentication tag field.
Definition at line 224 of file qkd-app-header.h.
Referenced by Deserialize(), GetAuthTag(), operator==(), Print(), Serialize(), and SetAuthTag().
|
private |
The encryption flag.
Definition at line 219 of file qkd-app-header.h.
Referenced by QKDAppHeader(), Deserialize(), GetEncrypted(), Print(), Serialize(), and SetEncrypted().
|
private |
The encryption key identifier field.
Definition at line 222 of file qkd-app-header.h.
Referenced by Deserialize(), GetEncryptionKeyId(), Print(), Serialize(), and SetEncryptionKeyId().
|
private |
The message length field.
Definition at line 216 of file qkd-app-header.h.
Referenced by QKDAppHeader(), Deserialize(), GetLength(), Print(), Serialize(), and SetLength().
|
private |
The message identifier field.
Definition at line 217 of file qkd-app-header.h.
Referenced by QKDAppHeader(), Deserialize(), GetMessageId(), operator==(), Print(), Serialize(), and SetMessageId().
|
private |
Is the header valid or corrupted?
Definition at line 226 of file qkd-app-header.h.
Referenced by Deserialize(), and IsValid().