|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/assert.h"
24 #include "ns3/abort.h"
25 #include "ns3/ipv6-header.h"
26 #include "ns3/mac64-address.h"
27 #include "ns3/mac16-address.h"
28 #include "ns3/ipv6-header.h"
111 .SetGroupName (
"SixLowPan")
134 os <<
"encoding " << +encoding <<
", hopLimit " << +
m_hopLimit;
139 uint32_t serializedSize = 3;
144 serializedSize += 16;
158 serializedSize += 16;
180 return serializedSize;
203 for (
int j = 0; j < 8; j++ )
207 for (
int j = 0; j < 8; j++ )
213 for (
int j = 0; j < 8; j++ )
219 for (
int j = 0; j < 8; j++ )
230 for (
int j = 0; j < 8; j++ )
234 for (
int j = 0; j < 8; j++ )
240 for (
int j = 0; j < 8; j++ )
246 for (
int j = 0; j < 8; j++ )
277 uint32_t serializedSize = 3;
279 uint8_t dispatch = i.
ReadU8 ();
285 uint8_t encoding = i.
ReadU8 ();
297 for (
int j = 0; j < 8; j++)
301 for (
int j = 0; j < 8; j++)
305 serializedSize += 16;
308 for (
int j = 0; j < 8; j++)
315 for (
int j = 0; j < 8; j++)
327 for (
int j = 0; j < 8; j++)
331 for (
int j = 0; j < 8; j++)
335 serializedSize += 16;
338 for (
int j = 0; j < 8; j++)
345 for (
int j = 0; j < 8; j++)
460 for (
int i = 0; i < 8; i++)
468 for (
int i = 0; i < 8; i++)
507 for (
int i = 0; i < 8; i++)
515 for (
int i = 0; i < 8; i++)
550 : m_datagramSize (0),
559 .SetGroupName (
"SixLowPan")
585 i.
WriteU8 (uint8_t (temp >> 8));
586 i.
WriteU8 (uint8_t (temp & 0xff));
595 uint8_t temp = i.
ReadU8 ();
637 : m_datagramSize (0),
649 .SetGroupName (
"SixLowPan")
675 i.
WriteU8 (uint8_t (temp >> 8));
676 i.
WriteU8 (uint8_t (temp & 0xff));
686 uint8_t temp = i.
ReadU8 ();
746 .SetGroupName (
"SixLowPan")
758 os <<
"Uncompressed IPv6";
811 .SetGroupName (
"SixLowPan")
832 os <<
"TF_FL_ELIDED(" << +
m_ecn <<
", " << +
m_dscp <<
")";
839 GetNh () ? os <<
" NH(1)" : os <<
" NH(0)";
847 os <<
" HLIM_COMPR_1(1)";
850 os <<
" HLIM_COMPR_64(64)";
853 os <<
" HLIM_COMPR_255(255)";
859 GetSac () ? os <<
" SAC(1)" : os <<
" SAC(0)";
860 os <<
" SAM (" <<
GetSam () <<
")";
862 GetM () ? os <<
" M(1)" : os <<
" M(0)";
863 GetDac () ? os <<
" DAC(1)" : os <<
" DAC(0)";
864 os <<
" DAM (" <<
GetDam () <<
")";
869 uint32_t serializedSize = 2;
889 if (
GetNh () ==
false )
902 serializedSize += 16;
915 if (
GetM () ==
false)
922 serializedSize += 16;
943 serializedSize += 16;
974 return serializedSize;
1017 if (
GetNh () == false )
1030 if (
GetSac () == false )
1046 if (
GetM () ==
false)
1135 if (
GetNh () == false )
1162 if (
GetSac () ==
false )
1180 if (
GetM () ==
false)
1226 uint16_t field = tfField;
1237 uint16_t field = nhField;
1248 uint16_t field = hlimField;
1259 uint16_t field = cidField;
1270 uint16_t field = sacField;
1281 uint16_t field = samField;
1305 uint16_t field = mField;
1316 uint16_t field = dacField;
1327 uint16_t field = damField;
1351 NS_ASSERT_MSG (srcContextId < 16,
"Src Context ID too large");
1362 NS_ASSERT_MSG (dstContextId < 16,
"Dst Context ID too large");
1395 NS_ASSERT_MSG (flowLabel < 0x100000,
"Flow Label too large");
1445 static TypeId tid =
TypeId (
"ns3::SixLowPanNhcExtension")
1447 .SetGroupName (
"SixLowPan")
1464 uint32_t serializedSize = 2;
1465 if (
GetNh () ==
false )
1476 if (
GetNh () ==
false )
1488 if (
GetNh () ==
false )
1506 uint8_t field = extensionHeaderType;
1527 uint8_t field = nhField;
1574 static TypeId tid =
TypeId (
"ns3::SixLowPanUdpNhcExtension")
1576 .SetGroupName (
"SixLowPan")
1593 uint32_t serializedSize = 1;
1596 serializedSize += 2;
1601 serializedSize += 4;
1605 serializedSize += 3;
1608 serializedSize += 1;
1613 return serializedSize;
1700 uint16_t field = ports;
1731 uint16_t field = cField;
1770 .SetGroupName (
"SixLowPan")
1801 uint8_t dispatch = i.
ReadU8 ();
1803 if (dispatch != 0x50)
1847 .SetGroupName (
"SixLowPan")
1859 os <<
"Hops left: " << +
m_hopsLeft <<
", src: ";
1881 uint32_t serializedSize = 1;
1890 serializedSize += 2;
1894 serializedSize += 8;
1899 serializedSize += 2;
1903 serializedSize += 8;
1906 return serializedSize;
1913 uint8_t dispatch = 0x80;
1941 i.
Write (buffer, 2);
1945 i.
Write (buffer, 8);
1951 i.
Write (buffer, 2);
1955 i.
Write (buffer, 8);
1962 uint8_t temp = i.
ReadU8 ();
1964 if ((temp & 0xC0) != 0x80)
1989 i.
Read (buffer, addrSize);
2000 i.
Read (buffer, addrSize);
2018 NS_ABORT_MSG (
"SixLowPanMesh::SetOriginator - incompatible address");
2041 NS_ABORT_MSG (
"SixLowPanMesh::SetFinalDst - incompatible address");
void SetSam(HeaderCompression_e samField)
Set the SAM (Source Address Mode) compression.
uint16_t GetDatagramSize(void) const
Get the datagram size.
a unique identifier for an interface.
void Write(uint8_t const *buffer, uint32_t size)
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Address GetOriginator(void) const
Get the "Originator" address.
6LoWPAN BC0 header - see RFC 4944.
SixLowPanUdpNhcExtension(void)
uint8_t m_nextHeader
Next header.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
const uint8_t * GetDstPrefix() const
Get the destination prefix.
LOWPAN_NHC Extension Header Encoding - see RFC 6282.
uint8_t GetNextHeader(void) const
Get the Next Header field.
NhcDispatch_e
Dispatch values for Next Header compression.
const uint8_t * GetDstInlinePart(void) const
brief Get the destination address inline part
LowPanHc1Addr_e m_srcCompression
Source compression type.
void SetDatagramOffset(uint8_t datagramOffset)
Set the datagram offset.
uint8_t m_srcdstContextId
Src and Dst Context ID.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
bool IsTcflCompression() const
Check if the Traffic Class and Flow Labels are compressed.
uint16_t GetDatagramSize(void) const
Get the datagram size.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
uint16_t m_datagramSize
Datagram size.
void Read(uint8_t *buffer, uint32_t size)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t m_datagramSize
Datagram size.
uint8_t m_baseFormat
Dispatch + encoding fields.
6LoWPAN Mesh header - see RFC 4944.
uint8_t m_dstInlinePart[16]
destination address inline part.
void SetTf(TrafficClassFlowLabel_e tfField)
Set the TF (Traffic Class, Flow Label) compression.
const uint8_t * GetSrcInlinePart(void) const
brief Get the source address inline part
void SetTcflCompression(bool tcflCompression)
Set the Traffic Class and Flow Labels as compressed.
uint16_t m_dstPort
Destination port.
static bool IsMatchingType(const Address &address)
static Mac64Address ConvertFrom(const Address &address)
void SetFinalDst(Address finalDst)
Set the "Final Destination" address.
void SetC(bool cField)
Set the C (Checksum).
void SetDatagramTag(uint16_t datagramTag)
Set the datagram tag.
void SetSrcInterface(const uint8_t *srcInterface)
Set the source interface.
static Dispatch_e GetDispatchType(uint8_t dispatch)
Get the Dispatch type.
void SetDac(bool dacField)
Set the DAC (Destination Address Compression) compression.
uint16_t ReadNtohU16(void)
void SetDstCompression(LowPanHc1Addr_e dstCompression)
Set Destination Compression type.
6LoWPAN FRAGN header - see RFC 4944.
HeaderCompression_e GetDam(void) const
Get the DAM (Destination Address Mode) compression.
bool GetSac(void) const
Get the SAC (Source Address Compression) compression.
void WriteU8(uint8_t data)
uint16_t GetDatagramTag(void) const
Get the datagram tag.
void WriteU16(uint16_t data)
uint16_t m_srcPort
Source port.
Address m_src
Originator (source) address.
void SetHlim(Hlim_e hlimField)
Set the HLIM (Hop Limit) compression.
uint8_t GetDatagramOffset(void) const
Get the datagram offset.
6LoWPAN HC1 header - see RFC 4944.
static TypeId GetTypeId(void)
Get the type ID.
uint8_t m_srcInterface[8]
Source interface.
virtual void Print(std::ostream &os) const
void SetHopLimit(uint8_t limit)
Set the "Hop limit" field (TTL).
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
HeaderCompression_e GetSam(void) const
Get the SAM (Source Address Mode) compression.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
void SetFlowLabel(uint32_t flowLabel)
Set the Flow Label (20bits).
LowPanHc1Addr_e GetSrcCompression() const
Get Source Compression type.
uint8_t m_hopLimit
Hop Limit.
bool GetNh(void) const
Get the Next Header field value.
void SetNh(bool nhField)
Set the NH (Next Header) compression.
void WriteHtonU16(uint16_t data)
void SetDstPrefix(const uint8_t *dstPrefix)
Set the destination prefix.
uint32_t m_flowLabel
Flow Label.
static TypeId GetTypeId(void)
Get the type ID.
bool m_hc2HeaderPresent
Is next header HC2 compressed.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
bool IsHc2HeaderPresent() const
Check if there is a HC2 compressed header.
void SetFlowLabel(uint32_t flowLabel)
Set the Flow Label value.
uint16_t GetChecksum(void) const
Get the Checksum field value.
void SetChecksum(uint16_t checksum)
Set the Checksum field values.
bool m_v
True if Originator address is 16 bit.
uint8_t m_srcPrefix[8]
Source prefix.
void SetSrcCompression(LowPanHc1Addr_e srcCompression)
Set Source Compression type.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
uint8_t GetHopLimit(void) const
Get the Hop Limit field.
TrafficClassFlowLabel_e GetTf(void) const
Get the TF (Traffic Class, Flow Label) compression.
void SetSac(bool sacField)
Set the SAC (Source Address Compression) compression.
void SetCid(bool cidField)
Set the CID (Context Identifier Extension) compression.
bool GetM(void) const
Get the M (Multicast) compression.
void SetHopLimit(uint8_t hopLimit)
Set the Hop Limit field.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
static TypeId GetTypeId(void)
Get the type ID.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual void Print(std::ostream &os) const
uint8_t GetNextHeader(void) const
Get the Next Header field value.
a polymophic address class
uint16_t GetSrcPort() const
Get the Source Port.
6LoWPAN FRAG1 header - see RFC 4944.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header value.
uint8_t m_datagramOffset
Datagram offset.
virtual void Print(std::ostream &os) const
uint8_t m_nhcBlob[256]
NHC compressed header.
@ PORTS_LAST_SRC_LAST_DST
uint8_t m_nextHeader
Next header.
void SetDstContextId(uint8_t dstContextId)
Set the DstContextId.
void SetSrcInlinePart(uint8_t srcInlinePart[16], uint8_t size)
brief Set the source address inline part
bool GetCid(void) const
Get the CID (Context Identifier Extension) compression.
void SetSrcPrefix(const uint8_t *srcPrefix)
Set the source prefix.
const uint8_t * GetSrcInterface() const
Get the source interface.
uint8_t m_srcInlinePart[16]
source address inline part.
const uint8_t * GetDstInterface() const
Get the destination interface.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t CopyFrom(const uint8_t *buffer, uint8_t len)
LowPanHc1NextHeader_e m_nextHeaderCompression
Next header compression.
uint8_t GetDscp(void) const
Get the DSCP.
SixLowPanNhcExtension(void)
void SetEcn(uint8_t ecn)
Set the ECN (2bits).
uint8_t GetNextHeader() const
Get the Next Header value.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
void SetHopsLeft(uint8_t hopsLeft)
Set the "Hops Left" field.
virtual SixLowPanDispatch::NhcDispatch_e GetNhcDispatchType(void) const
Get the NhcDispatch type.
static TypeId GetTypeId(void)
Get the type ID.
TrafficClassFlowLabel_e
TF: Traffic Class, Flow Label.
uint8_t m_hopsLeft
Hops left.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
bool m_tcflCompression
Is TC and FL compressed.
uint8_t GetDstContextId(void) const
Get the DstContextId.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
uint16_t m_datagramTag
Datagram tag.
uint8_t GetHopLimit(void) const
Get the "Hop limit" field (TTL).
uint8_t m_hopLimit
Hop Limit.
6LoWPAN IPv6 uncompressed header - see RFC 4944.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
static bool IsMatchingType(const Address &address)
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field values.
const uint8_t * GetSrcPrefix() const
Get the source prefix.
bool GetDac(void) const
Get the DAC (Destination Address Compression) compression.
LowPanHc1Addr_e
Kind of address compression.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
void SetDstInterface(const uint8_t *dstInterface)
Set the destination interface.
void SetSrcPort(uint16_t port)
Set the Source Port.
static TypeId GetTypeId(void)
Get the type ID.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
uint16_t m_checksum
Checksum.
Ports_e GetPorts(void) const
Get the compressed Src and Dst Ports.
LowPanHc1Addr_e m_dstCompression
Destination compression type.
void SetDstInlinePart(uint8_t dstInlinePart[16], uint8_t size)
brief Set the destination address inline part
uint8_t m_seqNumber
Sequence number.
uint8_t GetHopsLeft(void) const
Get the "Hops Left" field.
bool GetNh(void) const
Get the NH (Next Header) compression.
iterator in a Buffer instance
LowPanHc1NextHeader_e
Next header information.
void SetBlob(const uint8_t *blob, uint32_t size)
Set the option header data blob.
bool GetC(void) const
Get the C (Checksum).
uint16_t m_datagramTag
Datagram tag.
uint8_t m_nhcExtensionHeader
NHC extension header type.
Address m_dst
Destination (final) address.
uint32_t CopyBlob(uint8_t *blob, uint32_t size) const
Get the option header data blob.
static TypeId GetTypeId(void)
Get the type ID.
Address GetFinalDst(void) const
Get the "Final Destination" address.
virtual void Print(std::ostream &os) const
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
Copy the address bytes into a buffer.
uint8_t m_dstInterface[8]
Destination interface.
Hlim_e GetHlim(void) const
Get the HLIM (Hop Limit) compression.
void SetSrcContextId(uint8_t srcContextId)
Set the SrcContextId.
static Mac16Address ConvertFrom(const Address &address)
virtual void Print(std::ostream &os) const
HeaderCompression_e
Source or Destination Address Mode.
uint8_t m_nhcNextHeader
Next header.
bool m_f
True if Destination address is 16 bit.
virtual void Print(std::ostream &os) const
uint16_t GetDstPort() const
Get the Destination Port.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
void SetNh(bool nhField)
Set the NH field values.
void SetDatagramTag(uint16_t datagramTag)
Set the datagram tag.
void SetTrafficClass(uint8_t trafficClass)
Set the Traffic Class value.
void SetOriginator(Address originator)
Set the "Originator" address.
uint16_t m_baseFormat
Dispatch + encoding fields.
virtual void Print(std::ostream &os) const
void SetSequenceNumber(uint8_t seqNumber)
Set the "Sequence Number" field.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
uint8_t m_trafficClass
Traffic Class.
void SetEid(Eid_e extensionHeaderType)
Set the Extension Header Type.
virtual void Print(std::ostream &os) const
uint8_t m_nhcBlobLength
Length of the NHC compressed header.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
void SetDatagramSize(uint16_t datagramSize)
Set the datagram size.
uint32_t GetFlowLabel() const
Get the Flow Label value.
void SetDam(HeaderCompression_e damField)
Set the DAM (Destination Address Mode) compression.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
LOWPAN_IPHC base Encoding - see RFC 6282.
uint32_t GetFlowLabel(void) const
Get the Flow Label.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
void SetHc2HeaderPresent(bool hc2HeaderPresent)
Set the next header a HC2 compressed header.
uint8_t m_dstPrefix[8]
Destination prefix.
uint8_t GetEcn(void) const
Get the ECN.
uint8_t GetSrcContextId(void) const
Get the SrcContextId.
Eid_e GetEid(void) const
Get the Extension Header Type.
std::ostream & operator<<(std::ostream &os, const Angles &a)
virtual void Print(std::ostream &os) const
void SetDscp(uint8_t dscp)
Set the DSCP (6bits).
Eid_e
EID: IPv6 Extension Header ID.
void SetPorts(Ports_e port)
Set the compressed Src and Dst Ports.
void SetDatagramSize(uint16_t datagramSize)
Set the datagram size.
uint32_t m_flowLabel
Flow Label bits.
static TypeId GetTypeId(void)
Get the type ID.
void SetM(bool mField)
Set the M (Multicast) compression.
void SetDstPort(uint16_t port)
Set the Destination Port.
virtual SixLowPanDispatch::NhcDispatch_e GetNhcDispatchType(void) const
Get the NhcDispatch type.
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
uint8_t GetTrafficClass() const
Get the Traffic Class value.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
uint16_t GetDatagramTag(void) const
Get the datagram tag.
static TypeId GetTypeId(void)
Get the type ID.
UDP LOWPAN_NHC Extension Header Encoding - see RFC 6282.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
uint8_t GetSequenceNumber(void) const
Get the "Sequence Number" field.
static NhcDispatch_e GetNhcDispatchType(uint8_t dispatch)
Get the NhcDispatch type.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
LowPanHc1Addr_e GetDstCompression() const
Get Destination Compression type.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.