31 #include "ns3/address.h"
32 #include "ns3/header.h"
33 #include "ns3/buffer.h"
34 #include "ns3/simple-ref-count.h"
40 class PbbAddressBlock;
58 typedef std::list< Ptr<PbbTlv> >::iterator Iterator;
59 typedef std::list< Ptr<PbbTlv> >::const_iterator ConstIterator;
67 Iterator
Begin (
void);
72 ConstIterator
Begin (
void)
const;
82 ConstIterator
End (
void)
const;
87 int Size (
void)
const;
92 bool Empty (
void)
const;
140 Iterator
Erase (Iterator position);
149 Iterator
Erase (Iterator first, Iterator last);
183 void Print (std::ostream &os)
const;
193 void Print (std::ostream &os,
int level)
const;
199 std::list< Ptr<PbbTlv> > m_tlvList;
210 typedef std::list< Ptr<PbbAddressTlv> >::iterator Iterator;
211 typedef std::list< Ptr<PbbAddressTlv> >::const_iterator ConstIterator;
219 Iterator
Begin (
void);
224 ConstIterator
Begin (
void)
const;
234 ConstIterator
End (
void)
const;
239 int Size (
void)
const;
244 bool Empty (
void)
const;
292 Iterator
Erase (Iterator position);
303 Iterator
Erase (Iterator first, Iterator last);
337 void Print (std::ostream &os)
const;
347 void Print (std::ostream &os,
int level)
const;
353 std::list< Ptr<PbbAddressTlv> > m_tlvList;
367 typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;
368 typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator;
369 typedef std::list< Ptr<PbbMessage> >::iterator MessageIterator;
370 typedef std::list< Ptr<PbbMessage> >::const_iterator ConstMessageIterator;
415 ConstTlvIterator
TlvBegin (
void)
const;
420 TlvIterator
TlvEnd (
void);
426 ConstTlvIterator
TlvEnd (
void)
const;
485 TlvIterator
Erase (TlvIterator position);
496 TlvIterator
Erase (TlvIterator first, TlvIterator last);
583 MessageIterator
Erase (MessageIterator position);
592 MessageIterator
Erase (MessageIterator first, MessageIterator last);
600 static TypeId GetTypeId (
void);
628 virtual void Print (std::ostream &os)
const;
630 bool operator== (
const PbbPacket &other)
const;
631 bool operator!= (
const PbbPacket &other)
const;
637 std::list< Ptr<PbbMessage> > m_messageList;
655 typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;
656 typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator;
657 typedef std::list< Ptr<PbbAddressBlock> >::iterator AddressBlockIterator;
658 typedef std::list< Ptr<PbbAddressBlock> >::const_iterator ConstAddressBlockIterator;
778 ConstTlvIterator
TlvEnd ()
const;
837 TlvIterator
TlvErase (TlvIterator position);
848 TlvIterator
TlvErase (TlvIterator first, TlvIterator last);
949 AddressBlockIterator last);
994 void Print (std::ostream &os)
const;
1005 void Print (std::ostream &os,
int level)
const;
1007 bool operator== (
const PbbMessage &other)
const;
1008 bool operator!= (
const PbbMessage &other)
const;
1017 virtual void SerializeOriginatorAddress (
Buffer::Iterator &start)
const = 0;
1019 virtual void PrintOriginatorAddress (std::ostream &os)
const = 0;
1025 std::list< Ptr<PbbAddressBlock> > m_addressBlockList;
1030 bool m_hasOriginatorAddress;
1039 bool m_hasSequenceNumber;
1040 uint16_t m_sequenceNumber;
1058 virtual void PrintOriginatorAddress (std::ostream &os)
const;
1078 virtual void PrintOriginatorAddress (std::ostream &os)
const;
1092 typedef std::list< Address >::iterator AddressIterator;
1093 typedef std::list< Address >::const_iterator ConstAddressIterator;
1095 typedef std::list<uint8_t>::iterator PrefixIterator;
1096 typedef std::list<uint8_t>::const_iterator ConstPrefixIterator;
1098 typedef PbbAddressTlvBlock::Iterator TlvIterator;
1099 typedef PbbAddressTlvBlock::ConstIterator ConstTlvIterator;
1124 ConstAddressIterator
AddressEnd (
void)
const;
1183 AddressIterator
AddressErase (AddressIterator position);
1194 AddressIterator
AddressErase (AddressIterator first, AddressIterator last);
1221 ConstPrefixIterator
PrefixEnd (
void)
const;
1272 PrefixIterator
PrefixInsert (PrefixIterator position,
const uint8_t value);
1279 PrefixIterator
PrefixErase (PrefixIterator position);
1290 PrefixIterator
PrefixErase (PrefixIterator first, PrefixIterator last);
1307 ConstTlvIterator
TlvBegin (
void)
const;
1312 TlvIterator
TlvEnd (
void);
1317 ConstTlvIterator
TlvEnd (
void)
const;
1385 TlvIterator
TlvErase (TlvIterator position);
1396 TlvIterator
TlvErase (TlvIterator first, TlvIterator last);
1430 void Print (std::ostream &os)
const;
1441 void Print (std::ostream &os,
int level)
const;
1447 virtual uint8_t GetAddressLength (
void)
const = 0;
1449 virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter)
const = 0;
1450 virtual Address DeserializeAddress (uint8_t *buffer)
const = 0;
1451 virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter)
const = 0;
1454 uint8_t GetPrefixFlags (
void)
const;
1455 void GetHeadTail (uint8_t *head, uint8_t &headlen,
1456 uint8_t *tail, uint8_t &taillen)
const;
1457 bool HasZeroTail (
const uint8_t *tail, uint8_t taillen)
const;
1459 std::list<Address> m_addressList;
1460 std::list<uint8_t> m_prefixList;
1476 virtual uint8_t GetAddressLength (
void)
const;
1478 virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter)
const;
1479 virtual Address DeserializeAddress (uint8_t *buffer)
const;
1480 virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter)
const;
1495 virtual uint8_t GetAddressLength (
void)
const;
1497 virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter)
const;
1498 virtual Address DeserializeAddress (uint8_t *buffer)
const;
1499 virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter)
const;
1565 void SetValue (
const uint8_t * buffer, uint32_t size);
1611 void Print (std::ostream &os)
const;
1621 void Print (std::ostream &os,
int level)
const;
1623 bool operator== (
const PbbTlv &other)
const;
1624 bool operator!= (
const PbbTlv &other)
const;
1627 void SetIndexStart (uint8_t index);
1628 uint8_t GetIndexStart (
void)
const;
1629 bool HasIndexStart (
void)
const;
1631 void SetIndexStop (uint8_t index);
1632 uint8_t GetIndexStop (
void)
const;
1633 bool HasIndexStop (
void)
const;
1635 void SetMultivalue (
bool isMultivalue);
1636 bool IsMultivalue (
void)
const;
1644 bool m_hasIndexStart;
1645 uint8_t m_indexStart;
1647 bool m_hasIndexStop;
1648 uint8_t m_indexStop;
1650 bool m_isMultivalue;
PrefixIterator PrefixEnd(void)
AddressBlockIterator AddressBlockEnd()
void Print(std::ostream &os) const
Pretty-prints the contents of this message.
void TlvPushBack(Ptr< PbbTlv > tlv)
Appends a packet TLV to the back of this packet.
void AddressBlockPushBack(Ptr< PbbAddressBlock > block)
Appends an address block to the front of this message.
TlvIterator TlvBegin(void)
smart pointer class similar to boost::intrusive_ptr
void MessagePushFront(Ptr< PbbMessage > message)
Prepends a message to the front of this packet.
Ptr< PbbMessage > MessageBack(void)
void PushFront(Ptr< PbbTlv > tlv)
Prepends a TLV to the front of this block.
uint16_t GetSequenceNumber(void) const
Main PacketBB Packet object.
void MessagePushBack(Ptr< PbbMessage > message)
Appends a message to the back of this packet.
void PopFront(void)
Removes an AddressTLV from the front of this block.
uint32_t GetSerializedSize(void) const
Concrete IPv4 specific PbbAddressBlock.
void PushFront(Ptr< PbbAddressTlv > tlv)
Prepends an Address TLV to the front of this block.
void SetSequenceNumber(uint16_t number)
Sets the sequence number of this packet.
bool HasSequenceNumber(void) const
Tests whether or not this message has a sequence number.
automatically resized byte buffer
int PrefixSize(void) const
void AddressBlockPopBack(void)
Removes an address block from the back of this message.
void SetIndexStop(uint8_t index)
Sets the index of the last address in the associated address block that this address TLV applies to...
bool TlvEmpty(void) const
void TlvPushFront(Ptr< PbbTlv > tlv)
Prepends a packet TLV to the front of this packet.
Ptr< PbbAddressBlock > AddressBlockBack(void)
void PrefixPopBack(void)
Removes a prefix from the back of this block.
TlvIterator TlvInsert(TlvIterator position, const Ptr< PbbTlv > value)
Inserts an address TLV at the specified position in this block.
bool HasTypeExt(void) const
Tests whether or not this TLV has a type extension.
AddressIterator AddressEnd(void)
void SetMultivalue(bool isMultivalue)
Sets whether or not this address TLV is "multivalue".
A message within a PbbPacket packet.
void MessageClear(void)
Removes all messages from this packet.
void PushBack(Ptr< PbbTlv > tlv)
Appends a TLV to the back of this block.
Ptr< PbbAddressTlv > Back(void) const
void Print(std::ostream &os) const
Pretty-prints the contents of this block.
bool HasIndexStart(void) const
Tests whether or not this address TLV has a start index.
bool HasIndexStop(void) const
Tests whether or not this address TLV has a stop index.
void MessagePopFront(void)
Removes a message from the front of this packet.
void SetSequenceNumber(uint16_t seqnum)
Sets the sequence number of this message.
void TlvPopBack(void)
Removes a message TLV from the back of this message.
uint8_t GetIndexStart(void) const
Ptr< PbbAddressTlv > TlvFront(void)
bool IsMultivalue(void) const
Tests whether or not this address TLV is "multivalue".
Ptr< PbbTlv > TlvBack(void)
iterator in a Buffer instance
a polymophic address class
MessageIterator MessageEnd(void)
AddressBlockIterator AddressBlockBegin()
void SetType(uint8_t type)
Sets the type of this TLV.
void PopBack(void)
Removes an Address TLV from the back of this block.
bool TlvEmpty(void) const
bool AddressEmpty(void) const
void AddressBlockClear(void)
Removes all address blocks from this message.
Address GetOriginatorAddress(void) const
uint8_t GetTypeExt(void) const
Concrete IPv4 specific PbbMessage.
void TlvPushFront(Ptr< PbbAddressTlv > address)
Prepends an address TLV to the front of this message.
Iterator Erase(Iterator position)
Removes the Address TLV at the specified position.
void AddressPopFront(void)
Removes an address from the front of this block.
TlvIterator TlvBegin(void)
TlvIterator Erase(TlvIterator position)
Removes the packet TLV at the specified position.
void SetIndexStart(uint8_t index)
Sets the index of the first address in the associated address block that this address TLV applies to...
Ptr< PbbAddressTlv > TlvBack(void)
uint8_t GetVersion(void) const
void PushBack(Ptr< PbbAddressTlv > tlv)
Appends an Address TLV to the back of this block.
void SetType(uint8_t type)
Sets the type for this message.
void Serialize(Buffer::Iterator &start) const
Serializes this message into the specified buffer.
void TlvPopBack(void)
Removes an address TLV from the back of this message.
uint16_t GetSequenceNumber(void) const
int MessageSize(void) const
void AddressPushBack(Address address)
Appends an address to the back of this block.
Address AddressFront(void) const
void TlvClear(void)
Removes all message TLVs from this block.
Ptr< PbbAddressBlock > AddressBlockFront(void)
bool TlvEmpty(void) const
uint8_t PrefixBack(void) const
Ptr< PbbTlv > Front(void) const
bool HasHopCount(void) const
Tests whether or not this message has a hop count.
uint8_t GetType(void) const
Ptr< PbbTlv > Back(void) const
void Deserialize(Buffer::Iterator &start)
Deserializes a block from the specified buffer.
uint32_t GetSerializedSize(void) const
int AddressBlockSize(void) const
void Deserialize(Buffer::Iterator &start)
Deserializes a block from the specified buffer.
virtual uint32_t GetSerializedSize(void) const
void Deserialize(Buffer::Iterator &start)
Deserializes a message from the specified buffer.
void TlvPopFront(void)
Removes a message TLV from the front of this message.
bool HasValue(void) const
Tests whether or not this TLV has a value.
void Deserialize(Buffer::Iterator &start)
Deserializes a TLV from the specified buffer.
void TlvPopBack(void)
Removes a packet TLV from the back of this block.
void SetHopLimit(uint8_t hoplimit)
Sets the maximum number of hops this message should travel.
bool HasOriginatorAddress(void) const
Tests whether or not this message has an originator address.
Concrete IPv6 specific PbbAddressBlock.
uint8_t PrefixFront(void) const
void PrefixPushFront(uint8_t prefix)
Prepends a prefix to the front of this block.
bool HasHopLimit(void) const
Tests whether or not this message has a hop limit.
AddressBlockIterator AddressBlockErase(AddressBlockIterator position)
Removes the address block at the specified position.
void Serialize(Buffer::Iterator &start) const
Serializes this address block into the specified buffer.
void Print(std::ostream &os) const
Pretty-prints the contents of this TLV.
void Print(std::ostream &os) const
Pretty-prints the contents of this address block.
void TlvClear(void)
Removes all address TLVs from this block.
uint32_t GetSerializedSize(void) const
void PrefixPushBack(uint8_t prefix)
Appends a prefix to the back of this block.
void AddressBlockPopFront(void)
Removes an address block from the front of this message.
A block of packet or message TLVs (PbbTlv).
uint8_t GetType(void) const
bool MessageEmpty(void) const
uint8_t GetIndexStop(void) const
void Print(std::ostream &os) const
Pretty-prints the contents of this block.
void TlvPushBack(Ptr< PbbAddressTlv > address)
Appends an address TLV to the back of this message.
int AddressSize(void) const
A block of Address TLVs (PbbAddressTlv).
uint8_t GetHopCount(void) const
bool HasSequenceNumber(void) const
Tests whether or not this packet has a sequence number.
void PopBack(void)
Removes a TLV from the back of this block.
void TlvPopFront(void)
Removes a packet TLV from the front of this packet.
uint8_t GetHopLimit(void) const
PrefixIterator PrefixInsert(PrefixIterator position, const uint8_t value)
Inserts a prefix at the specified position in this block.
Ptr< PbbTlv > TlvBack(void)
TlvIterator TlvErase(TlvIterator position)
Removes the message TLV at the specified position.
uint32_t GetSerializedSize(void) const
void AddressBlockPushFront(Ptr< PbbAddressBlock > block)
Prepends an address block to the front of this message.
void MessagePopBack(void)
Removes a message from the back of this packet.
Ptr< PbbTlv > TlvFront(void)
Iterator Insert(Iterator position, const Ptr< PbbAddressTlv > tlv)
Inserts an Address TLV at the specified position in this block.
void SetTypeExt(uint8_t type)
Sets the type extension of this TLV.
AddressIterator AddressBegin(void)
void AddressClear(void)
Removes all addresses from this block.
void SetHopCount(uint8_t hopcount)
Sets the current number of hops this message has traveled.
Ptr< PbbTlv > TlvFront(void)
void PrefixPopFront(void)
Removes a prefix from the front of this block.
Address AddressBack(void) const
PrefixIterator PrefixErase(PrefixIterator position)
Removes the prefix at the specified position.
void Serialize(Buffer::Iterator &start) const
Serializes this block into the specified buffer.
void SetOriginatorAddress(Address address)
Sets the address for the node that created this packet.
uint32_t GetSerializedSize(void) const
void Deserialize(Buffer::Iterator &start)
Deserializes an address block from the specified buffer.
Iterator Insert(Iterator position, const Ptr< PbbTlv > tlv)
Inserts a TLV at the specified position in this block.
void TlvPopFront(void)
Removes an address TLV from the front of this message.
Buffer GetValue(void) const
void Clear(void)
Removes all Address TLVs from this block.
void SetValue(Buffer start)
Sets the value of this message to the specified buffer.
PrefixIterator PrefixBegin(void)
virtual void Print(std::ostream &os) const
Pretty-prints the contents of this block.
Ptr< PbbMessage > MessageFront(void)
void TlvPushFront(Ptr< PbbTlv > tlv)
Prepends a message TLV to the front of this message.
MessageIterator MessageBegin(void)
void Clear(void)
Removes all TLVs from this block.
AddressIterator AddressErase(AddressIterator position)
Removes the address at the specified position.
void AddressPopBack(void)
Removes an address from the back of this block.
Concrete IPv6 specific PbbMessage class.
A template-based reference counting class.
void Serialize(Buffer::Iterator &start) const
Serializes this block into the specified buffer.
a unique identifier for an interface.
virtual void Serialize(Buffer::Iterator start) const
Serializes this packet into the specified buffer.
static Ptr< PbbMessage > DeserializeMessage(Buffer::Iterator &start)
Deserializes a message, returning the correct object depending on whether it is an IPv4 message or an...
bool AddressBlockEmpty(void) const
An Address Block and its associated Address TLV Blocks.
void Serialize(Buffer::Iterator &start) const
Serializes this TLV into the specified buffer.
void TlvPushBack(Ptr< PbbTlv > tlv)
Appends a message TLV to the back of this message.
virtual TypeId GetInstanceTypeId(void) const
AddressIterator AddressInsert(AddressIterator position, const Address value)
Inserts an address at the specified position in this block.
void AddressPushFront(Address address)
Prepends an address to the front of this block.
void PrefixClear(void)
Removes all prefixes from this block.
bool PrefixEmpty(void) const
Ptr< PbbAddressTlv > Front(void) const
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserializes a packet from the specified buffer.
void TlvClear(void)
Removes all packet TLVs from this packet.
TlvIterator TlvErase(TlvIterator position)
Removes the address TLV at the specified position.
Iterator Erase(Iterator position)
Removes the TLV at the specified position.
void PopFront(void)
Removes a TLV from the front of this block.