Represent the LinkLayer Header. More...
#include "ble-linklayer-header.h"
Public Types | |
enum | AdvPacketType { ADV_IND = 0, ADV_DIRECT_IND = 1, ADV_NONCONN_IND = 2, SCAN_REQ = 3, SCAN_RESP = 4, CONNECT_REQ = 5, ADV_SCAN_IND = 6 } |
enum | BlePacketType { ADV = 0, DATA = 1 } |
enum | BlePreamble { PREAMBLE_END_0 = 0xaa, PREAMBLE_END_1 = 0x55 } |
The possible Preamble types. More... | |
enum | LinkLayerId { LL_CONTROL_PKT = 3, LL_START_PKT = 2, LL_CONT_PKT = 1 } |
enum | RxAddrType { RX_ADDR_PUBLIC = 0, RX_ADDR_RANDOM = 1 } |
enum | TxAddrType { TX_ADDR_PUBLIC = 0, TX_ADDR_RANDOM = 1 } |
Public Member Functions | |
BleLinkLayerHeader (void) | |
~BleLinkLayerHeader (void) | |
uint32_t | Deserialize (Buffer::Iterator start) |
BleAccessAddress | GetAccessAddress (void) const |
Get accessAddress. More... | |
AdvPacketType | GetAdvPktType (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
uint8_t | GetLength (void) const |
LinkLayerId | GetLinkLayerId (void) const |
Mac48Address | GetMacAddress (void) const |
Get LinkLayer Device Address. More... | |
bool | GetMoreData (void) const |
bool | GetNextSequenceNo (void) const |
RxAddrType | GetRxAddrType (void) const |
Mac48Address | GetRxMacAddress (void) const |
Get LinkLayer Device Address of RxDevice. More... | |
bool | GetSequenceNo (void) const |
uint32_t | GetSerializedSize (void) const |
TxAddrType | GetTxAddrType (void) const |
enum BlePacketType | GetType (void) const |
void | Print (std::ostream &os) const |
void | Serialize (Buffer::Iterator start) const |
void | SetAccessAddress (BleAccessAddress addr) |
Set accessAddress. More... | |
void | SetAdvPktType (AdvPacketType type) |
void | SetLength (uint8_t len) |
void | SetLinkLayerId (LinkLayerId llid) |
void | SetMacAddress (Mac48Address addr) |
Set LinkLayerDevice Address. More... | |
void | SetMoreData (bool md) |
void | SetNextSequenceNo (bool nesn) |
void | SetRxAddrType (RxAddrType type) |
void | SetRxMacAddress (Mac48Address addr) |
Set LinkLayerDevice Address of RxDevice. More... | |
void | SetSequenceNo (bool sn) |
void | SetTxAddrType (TxAddrType type) |
void | SetType (BlePacketType t) |
Public Member Functions inherited from ns3::Header | |
virtual | ~Header () |
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 erros. 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 (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Header | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Chunk | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Attributes | |
BleAccessAddress | m_accessAddr |
Access Address (4 Octets) More... | |
AdvPacketType | m_advType |
ADV Packet type (2 bits) More... | |
uint8_t | m_length |
Length of Data. More... | |
LinkLayerId | m_linkLayerId |
LinkLayerIdentifier (2 bits) More... | |
Mac48Address | m_macAddress |
LinkLayer address for ADV Packets. More... | |
bool | m_moreData |
More Data (1 bit) More... | |
bool | m_nextSeqNo |
Next Sequence # (1 bit) More... | |
BlePreamble | m_preamble |
One of 2 preamble (1 Octet) More... | |
RxAddrType | m_rxAddrType |
Rx Address Type (1 bit) More... | |
Mac48Address | m_rxMacAddress |
Receiver LinkLayer address for ADV Packets. More... | |
bool | m_seqNo |
Sequence # (1 bit) More... | |
TxAddrType | m_txAddrType |
Tx Address Type (1 bit) More... | |
BlePacketType | m_type |
Type of packet. 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 (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Represent the LinkLayer Header.
Introspection did not find any typical Config paths.
No Attributes are defined for this type.
No TraceSources are defined for this type.
Size of this type is 56 bytes (on a 64-bit architecture).
Definition at line 50 of file ble-linklayer-header.h.
Enumerator | |
---|---|
ADV_IND | |
ADV_DIRECT_IND | |
ADV_NONCONN_IND | |
SCAN_REQ | |
SCAN_RESP | |
CONNECT_REQ | |
ADV_SCAN_IND |
Definition at line 68 of file ble-linklayer-header.h.
Enumerator | |
---|---|
ADV | |
DATA |
Definition at line 62 of file ble-linklayer-header.h.
The possible Preamble types.
Enumerator | |
---|---|
PREAMBLE_END_0 |
Preamble 10101010b. |
PREAMBLE_END_1 |
Preamble 01010101b. |
Definition at line 56 of file ble-linklayer-header.h.
Enumerator | |
---|---|
LL_CONTROL_PKT | |
LL_START_PKT | |
LL_CONT_PKT |
Definition at line 91 of file ble-linklayer-header.h.
Enumerator | |
---|---|
RX_ADDR_PUBLIC |
When the address is fix. |
RX_ADDR_RANDOM |
When the address is changing at each connection. |
Definition at line 85 of file ble-linklayer-header.h.
Enumerator | |
---|---|
TX_ADDR_PUBLIC |
When the address is fix. |
TX_ADDR_RANDOM |
When the address is changing at each connection. |
Definition at line 79 of file ble-linklayer-header.h.
ns3::BleLinkLayerHeader::BleLinkLayerHeader | ( | void | ) |
Definition at line 259 of file ble-linklayer-header.cc.
References NS_LOG_FUNCTION.
ns3::BleLinkLayerHeader::~BleLinkLayerHeader | ( | void | ) |
Definition at line 264 of file ble-linklayer-header.cc.
References NS_LOG_FUNCTION.
|
virtual |
start | an iterator which points to where the header should read from. |
This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.
Note that data is not actually removed from the buffer to which the iterator points. Both Packet::RemoveHeader() and Packet::PeekHeader() call Deserialize(), but only the RemoveHeader() has additional statements to remove the header bytes from the underlying buffer and associated metadata.
Implements ns3::Header.
Definition at line 206 of file ble-linklayer-header.cc.
References ADV, ADV_DIRECT_IND, CONNECT_REQ, ns3::BleAccessAddress::CopyFrom(), ns3::Mac48Address::CopyFrom(), ns3::Buffer::Iterator::GetDistanceFrom(), m_accessAddr, m_advType, m_length, m_linkLayerId, m_macAddress, m_moreData, m_nextSeqNo, m_preamble, m_rxAddrType, m_rxMacAddress, m_seqNo, m_txAddrType, m_type, NS_LOG_FUNCTION, ns3::Buffer::Iterator::ReadU8(), SCAN_REQ, SCAN_RESP, and visualizer.core::start().
BleAccessAddress ns3::BleLinkLayerHeader::GetAccessAddress | ( | void | ) | const |
Get accessAddress.
Definition at line 291 of file ble-linklayer-header.cc.
References m_accessAddr, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::RxFromPhy().
BleLinkLayerHeader::AdvPacketType ns3::BleLinkLayerHeader::GetAdvPktType | ( | void | ) | const |
Definition at line 357 of file ble-linklayer-header.cc.
References ADV, m_advType, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::RxFromPhy(), and ns3::BleLinkLayer::TxToPhy().
|
virtual |
Get the most derived TypeId for this Object.
This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.
Implements ns3::ObjectBase.
Definition at line 46 of file ble-linklayer-header.cc.
References GetTypeId().
uint8_t ns3::BleLinkLayerHeader::GetLength | ( | void | ) | const |
Definition at line 476 of file ble-linklayer-header.cc.
References m_length, and NS_LOG_FUNCTION.
BleLinkLayerHeader::LinkLayerId ns3::BleLinkLayerHeader::GetLinkLayerId | ( | void | ) | const |
Definition at line 405 of file ble-linklayer-header.cc.
References DATA, m_linkLayerId, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::RxFromPhy().
Mac48Address ns3::BleLinkLayerHeader::GetMacAddress | ( | void | ) | const |
Get LinkLayer Device Address.
Definition at line 319 of file ble-linklayer-header.cc.
References m_macAddress, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::RxFromPhy().
bool ns3::BleLinkLayerHeader::GetMoreData | ( | void | ) | const |
Definition at line 453 of file ble-linklayer-header.cc.
References DATA, m_moreData, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::RxFromPhy().
bool ns3::BleLinkLayerHeader::GetNextSequenceNo | ( | void | ) | const |
Definition at line 421 of file ble-linklayer-header.cc.
References DATA, m_nextSeqNo, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::RxFromPhy().
BleLinkLayerHeader::RxAddrType ns3::BleLinkLayerHeader::GetRxAddrType | ( | void | ) | const |
Definition at line 389 of file ble-linklayer-header.cc.
References ADV, m_rxAddrType, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Mac48Address ns3::BleLinkLayerHeader::GetRxMacAddress | ( | void | ) | const |
Get LinkLayer Device Address of RxDevice.
Used in DirectAdv
Definition at line 305 of file ble-linklayer-header.cc.
References m_rxMacAddress, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::RxFromPhy().
bool ns3::BleLinkLayerHeader::GetSequenceNo | ( | void | ) | const |
Definition at line 437 of file ble-linklayer-header.cc.
References DATA, m_seqNo, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::RxFromPhy().
|
virtual |
This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. This method should return the number of bytes which are needed to store the full header data by Serialize.
Implements ns3::Header.
Definition at line 117 of file ble-linklayer-header.cc.
References ADV, ADV_DIRECT_IND, CONNECT_REQ, m_advType, m_type, NS_LOG_FUNCTION, SCAN_REQ, and SCAN_RESP.
BleLinkLayerHeader::TxAddrType ns3::BleLinkLayerHeader::GetTxAddrType | ( | void | ) | const |
Definition at line 373 of file ble-linklayer-header.cc.
References ADV, m_txAddrType, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
BleLinkLayerHeader::BlePacketType ns3::BleLinkLayerHeader::GetType | ( | void | ) | const |
Definition at line 342 of file ble-linklayer-header.cc.
References m_type, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 36 of file ble-linklayer-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
virtual |
os | output stream This method is used by Packet::Print to print the content of a header as ascii data to a c++ output stream. Although the header is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace. i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5 |
Implements ns3::Header.
Definition at line 52 of file ble-linklayer-header.cc.
References ADV, ADV_DIRECT_IND, ADV_IND, ADV_NONCONN_IND, ADV_SCAN_IND, CONNECT_REQ, LL_CONT_PKT, LL_CONTROL_PKT, LL_START_PKT, m_accessAddr, m_advType, m_length, m_linkLayerId, m_macAddress, m_nextSeqNo, m_preamble, m_rxAddrType, m_rxMacAddress, m_seqNo, m_txAddrType, m_type, NS_LOG_FUNCTION, SCAN_REQ, and SCAN_RESP.
|
virtual |
start | an iterator which points to where the header should be written. |
This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.
Implements ns3::Header.
Definition at line 139 of file ble-linklayer-header.cc.
References first::address, ADV, ADV_DIRECT_IND, CONNECT_REQ, ns3::BleAccessAddress::CopyTo(), ns3::Mac48Address::CopyTo(), m_accessAddr, m_advType, m_length, m_linkLayerId, m_macAddress, m_moreData, m_nextSeqNo, m_preamble, m_rxAddrType, m_rxMacAddress, m_seqNo, m_txAddrType, m_type, NS_LOG_FUNCTION, SCAN_REQ, SCAN_RESP, visualizer.core::start(), and ns3::Buffer::Iterator::WriteU8().
void ns3::BleLinkLayerHeader::SetAccessAddress | ( | BleAccessAddress | addr | ) |
Set accessAddress.
addr | Object of BleAccessAddress |
Definition at line 270 of file ble-linklayer-header.cc.
References first::address, ns3::BleAccessAddress::CopyTo(), m_accessAddr, m_preamble, NS_LOG_FUNCTION, PREAMBLE_END_0, and PREAMBLE_END_1.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetAdvPktType | ( | BleLinkLayerHeader::AdvPacketType | type | ) |
Definition at line 349 of file ble-linklayer-header.cc.
References ADV, m_advType, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetLength | ( | uint8_t | len | ) |
Definition at line 461 of file ble-linklayer-header.cc.
References ADV, m_length, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetLinkLayerId | ( | BleLinkLayerHeader::LinkLayerId | llid | ) |
Definition at line 397 of file ble-linklayer-header.cc.
References DATA, m_linkLayerId, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetMacAddress | ( | Mac48Address | addr | ) |
Set LinkLayerDevice Address.
ll | Mac48Address |
Definition at line 312 of file ble-linklayer-header.cc.
References m_macAddress, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetMoreData | ( | bool | md | ) |
Definition at line 445 of file ble-linklayer-header.cc.
References DATA, m_moreData, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetNextSequenceNo | ( | bool | nesn | ) |
Definition at line 413 of file ble-linklayer-header.cc.
References DATA, m_nextSeqNo, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetRxAddrType | ( | BleLinkLayerHeader::RxAddrType | type | ) |
Definition at line 381 of file ble-linklayer-header.cc.
References ADV, m_rxAddrType, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetRxMacAddress | ( | Mac48Address | addr | ) |
Set LinkLayerDevice Address of RxDevice.
Used in DirectAdv
ll | Mac48Address |
Definition at line 298 of file ble-linklayer-header.cc.
References m_rxMacAddress, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetSequenceNo | ( | bool | sn | ) |
Definition at line 429 of file ble-linklayer-header.cc.
References DATA, m_seqNo, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetTxAddrType | ( | BleLinkLayerHeader::TxAddrType | type | ) |
Definition at line 365 of file ble-linklayer-header.cc.
References ADV, m_txAddrType, m_type, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::TxToPhy().
void ns3::BleLinkLayerHeader::SetType | ( | BleLinkLayerHeader::BlePacketType | t | ) |
Definition at line 326 of file ble-linklayer-header.cc.
References ADV, DATA, m_accessAddr, m_preamble, m_type, NS_LOG_FUNCTION, and PREAMBLE_END_1.
Referenced by ns3::BleLinkLayer::RxFromPhy(), and ns3::BleLinkLayer::TxToPhy().
|
private |
Access Address (4 Octets)
Definition at line 244 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetAccessAddress(), Print(), Serialize(), SetAccessAddress(), and SetType().
|
private |
ADV Packet type (2 bits)
Definition at line 247 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetAdvPktType(), GetSerializedSize(), Print(), Serialize(), and SetAdvPktType().
|
private |
Length of Data.
Definition at line 259 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetLength(), Print(), Serialize(), and SetLength().
|
private |
LinkLayerIdentifier (2 bits)
Definition at line 254 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetLinkLayerId(), Print(), Serialize(), and SetLinkLayerId().
|
private |
LinkLayer address for ADV Packets.
Definition at line 250 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetMacAddress(), Print(), Serialize(), and SetMacAddress().
|
private |
More Data (1 bit)
Definition at line 257 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetMoreData(), Serialize(), and SetMoreData().
|
private |
Next Sequence # (1 bit)
Definition at line 255 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetNextSequenceNo(), Print(), Serialize(), and SetNextSequenceNo().
|
private |
One of 2 preamble (1 Octet)
Definition at line 241 of file ble-linklayer-header.h.
Referenced by Deserialize(), Print(), Serialize(), SetAccessAddress(), and SetType().
|
private |
Rx Address Type (1 bit)
Definition at line 249 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetRxAddrType(), Print(), Serialize(), and SetRxAddrType().
|
private |
Receiver LinkLayer address for ADV Packets.
Definition at line 251 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetRxMacAddress(), Print(), Serialize(), and SetRxMacAddress().
|
private |
Sequence # (1 bit)
Definition at line 256 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetSequenceNo(), Print(), Serialize(), and SetSequenceNo().
|
private |
Tx Address Type (1 bit)
Definition at line 248 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetTxAddrType(), Print(), Serialize(), and SetTxAddrType().
|
private |
Type of packet.
1 for DATA and 0 for ADV
Definition at line 239 of file ble-linklayer-header.h.
Referenced by Deserialize(), GetAdvPktType(), GetLinkLayerId(), GetMoreData(), GetNextSequenceNo(), GetRxAddrType(), GetSequenceNo(), GetSerializedSize(), GetTxAddrType(), GetType(), Print(), Serialize(), SetAdvPktType(), SetLength(), SetLinkLayerId(), SetMoreData(), SetNextSequenceNo(), SetRxAddrType(), SetSequenceNo(), SetTxAddrType(), and SetType().