A Discrete-Event Network Simulator
API
packetbb.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/* vim: set ts=2 sw=2 sta expandtab ai si cin: */
3/*
4 * Copyright (c) 2009 Drexel University
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Author: Tom Wambold <tom5760@gmail.com>
20 */
21/* These classes implement RFC 5444 - The Generalized Mobile Ad Hoc Network
22 * (MANET) Packet/PbbMessage Format
23 * See: https://datatracker.ietf.org/doc/html/rfc5444 for details */
24
25#ifndef PACKETBB_H
26#define PACKETBB_H
27
28#include <list>
29
30#include "ns3/ptr.h"
31#include "ns3/address.h"
32#include "ns3/header.h"
33#include "ns3/buffer.h"
34#include "ns3/simple-ref-count.h"
35
36namespace ns3 {
37
38/* Forward declare objects */
39class PbbMessage;
40class PbbAddressBlock;
41class PbbTlv;
42class PbbAddressTlv;
43
46 IPV4 = 3,
47 IPV6 = 15,
48};
49
56{
57public:
59 typedef std::list< Ptr<PbbTlv> >::iterator Iterator;
61 typedef std::list< Ptr<PbbTlv> >::const_iterator ConstIterator;
62
63 PbbTlvBlock (void);
64 ~PbbTlvBlock (void);
65
69 Iterator Begin (void);
70
74 ConstIterator Begin (void) const;
75
79 Iterator End (void);
80
84 ConstIterator End (void) const;
85
89 int Size (void) const;
90
94 bool Empty (void) const;
95
99 Ptr<PbbTlv> Front (void) const;
100
104 Ptr<PbbTlv> Back (void) const;
105
110 void PushFront (Ptr<PbbTlv> tlv);
111
115 void PopFront (void);
116
121 void PushBack (Ptr<PbbTlv> tlv);
122
126 void PopBack (void);
127
135 Iterator Insert (Iterator position, const Ptr<PbbTlv> tlv);
136
142 Iterator Erase (Iterator position);
143
152
156 void Clear (void);
157
161 uint32_t GetSerializedSize (void) const;
162
170 void Serialize (Buffer::Iterator &start) const;
171
180
185 void Print (std::ostream &os) const;
186
195 void Print (std::ostream &os, int level) const;
196
202 bool operator== (const PbbTlvBlock &other) const;
208 bool operator!= (const PbbTlvBlock &other) const;
209
210private:
211 std::list< Ptr<PbbTlv> > m_tlvList;
212};
213
220{
221public:
223 typedef std::list< Ptr<PbbAddressTlv> >::iterator Iterator;
225 typedef std::list< Ptr<PbbAddressTlv> >::const_iterator ConstIterator;
226
227 PbbAddressTlvBlock (void);
228 ~PbbAddressTlvBlock (void);
229
233 Iterator Begin (void);
234
238 ConstIterator Begin (void) const;
239
243 Iterator End (void);
244
248 ConstIterator End (void) const;
249
253 int Size (void) const;
254
258 bool Empty (void) const;
259
263 Ptr<PbbAddressTlv> Front (void) const;
264
268 Ptr<PbbAddressTlv> Back (void) const;
269
274 void PushFront (Ptr<PbbAddressTlv> tlv);
275
279 void PopFront (void);
280
285 void PushBack (Ptr<PbbAddressTlv> tlv);
286
290 void PopBack (void);
291
299 Iterator Insert (Iterator position, const Ptr<PbbAddressTlv> tlv);
300
306 Iterator Erase (Iterator position);
307
318
322 void Clear (void);
323
327 uint32_t GetSerializedSize (void) const;
328
336 void Serialize (Buffer::Iterator &start) const;
337
346
351 void Print (std::ostream &os) const;
352
361 void Print (std::ostream &os, int level) const;
362
368 bool operator== (const PbbAddressTlvBlock &other) const;
369
375 bool operator!= (const PbbAddressTlvBlock &other) const;
376
377private:
378 std::list< Ptr<PbbAddressTlv> > m_tlvList;
379};
380
389class PbbPacket : public SimpleRefCount<PbbPacket,Header>
390{
391public:
393 typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;
395 typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator;
397 typedef std::list< Ptr<PbbMessage> >::iterator MessageIterator;
399 typedef std::list< Ptr<PbbMessage> >::const_iterator ConstMessageIterator;
400
401 PbbPacket (void);
402 ~PbbPacket (void);
403
409 uint8_t GetVersion (void) const;
410
415 void SetSequenceNumber (uint16_t number);
416
423 uint16_t GetSequenceNumber (void) const;
424
432 bool HasSequenceNumber (void) const;
433
434 /* Manipulating Packet TLVs */
435
439 TlvIterator TlvBegin (void);
440
444 ConstTlvIterator TlvBegin (void) const;
445
449 TlvIterator TlvEnd (void);
450
455 ConstTlvIterator TlvEnd (void) const;
456
460 int TlvSize (void) const;
461
465 bool TlvEmpty (void) const;
466
470 Ptr<PbbTlv> TlvFront (void);
471
475 const Ptr<PbbTlv> TlvFront (void) const;
476
480 Ptr<PbbTlv> TlvBack (void);
481
485 const Ptr<PbbTlv> TlvBack (void) const;
486
491 void TlvPushFront (Ptr<PbbTlv> tlv);
492
496 void TlvPopFront (void);
497
502 void TlvPushBack (Ptr<PbbTlv> tlv);
503
507 void TlvPopBack (void);
508
514 TlvIterator Erase (TlvIterator position);
515
526
530 void TlvClear (void);
531
532 /* Manipulating Packet Messages */
533
538
543
548
553 ConstMessageIterator MessageEnd (void) const;
554
558 int MessageSize (void) const;
559
563 bool MessageEmpty (void) const;
564
569
573 const Ptr<PbbMessage> MessageFront (void) const;
574
579
583 const Ptr<PbbMessage> MessageBack (void) const;
584
589 void MessagePushFront (Ptr<PbbMessage> message);
590
594 void MessagePopFront (void);
595
600 void MessagePushBack (Ptr<PbbMessage> message);
601
605 void MessagePopBack (void);
606
613
622
626 void MessageClear (void);
627
632 static TypeId GetTypeId (void);
633 virtual TypeId GetInstanceTypeId (void) const;
634
638 virtual uint32_t GetSerializedSize (void) const;
639
644 virtual void Serialize (Buffer::Iterator start) const;
645
655
660 virtual void Print (std::ostream &os) const;
661
667 bool operator== (const PbbPacket &other) const;
668
674 bool operator!= (const PbbPacket &other) const;
675
676protected:
677
678private:
680 std::list< Ptr<PbbMessage> > m_messageList;
681
682 uint8_t m_version;
683
685 uint16_t m_seqnum;
686};
687
695class PbbMessage : public SimpleRefCount<PbbMessage>
696{
697public:
699 typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;
701 typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator;
703 typedef std::list< Ptr<PbbAddressBlock> >::iterator AddressBlockIterator;
705 typedef std::list< Ptr<PbbAddressBlock> >::const_iterator ConstAddressBlockIterator;
706
707 PbbMessage ();
708 virtual ~PbbMessage ();
709
714 void SetType (uint8_t type);
715
719 uint8_t GetType (void) const;
720
726
733 Address GetOriginatorAddress (void) const;
734
739 bool HasOriginatorAddress (void) const;
740
745 void SetHopLimit (uint8_t hoplimit);
746
753 uint8_t GetHopLimit (void) const;
754
761 bool HasHopLimit (void) const;
762
767 void SetHopCount (uint8_t hopcount);
768
775 uint8_t GetHopCount (void) const;
776
781 bool HasHopCount (void) const;
782
787 void SetSequenceNumber (uint16_t seqnum);
788
795 uint16_t GetSequenceNumber (void) const;
796
801 bool HasSequenceNumber (void) const;
802
803 /* Manipulating PbbMessage TLVs */
804
809
813 ConstTlvIterator TlvBegin () const;
814
820
825 ConstTlvIterator TlvEnd () const;
826
830 int TlvSize (void) const;
831
835 bool TlvEmpty (void) const;
836
840 Ptr<PbbTlv> TlvFront (void);
841
845 const Ptr<PbbTlv> TlvFront (void) const;
846
850 Ptr<PbbTlv> TlvBack (void);
851
855 const Ptr<PbbTlv> TlvBack (void) const;
856
861 void TlvPushFront (Ptr<PbbTlv> tlv);
862
866 void TlvPopFront (void);
867
872 void TlvPushBack (Ptr<PbbTlv> tlv);
873
877 void TlvPopBack (void);
878
885
896
900 void TlvClear (void);
901
902 /* Manipulating Address Block and Address TLV pairs */
903
908
913
919
925
929 int AddressBlockSize (void) const;
930
935 bool AddressBlockEmpty (void) const;
936
941
945 const Ptr<PbbAddressBlock> AddressBlockFront (void) const;
946
951
955 const Ptr<PbbAddressBlock> AddressBlockBack (void) const;
956
962
966 void AddressBlockPopFront (void);
967
973
977 void AddressBlockPopBack (void);
978
985
997
1001 void AddressBlockClear (void);
1002
1013
1017 uint32_t GetSerializedSize (void) const;
1018
1026 void Serialize (Buffer::Iterator &start) const;
1027
1036
1041 void Print (std::ostream &os) const;
1042
1052 void Print (std::ostream &os, int level) const;
1053
1059 bool operator== (const PbbMessage &other) const;
1065 bool operator!= (const PbbMessage &other) const;
1066
1067protected:
1076 virtual PbbAddressLength GetAddressLength (void) const = 0;
1077
1093 virtual void PrintOriginatorAddress (std::ostream &os) const = 0;
1094
1101
1102private:
1104 std::list< Ptr<PbbAddressBlock> > m_addressBlockList;
1105
1106 uint8_t m_type;
1108
1111
1113 uint8_t m_hopLimit;
1114
1116 uint8_t m_hopCount;
1117
1120};
1121
1128public:
1129 PbbMessageIpv4 ();
1130 virtual ~PbbMessageIpv4 ();
1131
1132protected:
1141 virtual PbbAddressLength GetAddressLength (void) const;
1142
1145 virtual void PrintOriginatorAddress (std::ostream &os) const;
1146
1148};
1149
1156public:
1157 PbbMessageIpv6 ();
1158 virtual ~PbbMessageIpv6 ();
1159
1160protected:
1169 virtual PbbAddressLength GetAddressLength (void) const;
1170
1173 virtual void PrintOriginatorAddress (std::ostream &os) const;
1174
1176};
1177
1184class PbbAddressBlock : public SimpleRefCount<PbbAddressBlock>
1185{
1186public:
1188 typedef std::list< Address >::iterator AddressIterator;
1190 typedef std::list< Address >::const_iterator ConstAddressIterator;
1191
1193 typedef std::list<uint8_t>::iterator PrefixIterator;
1195 typedef std::list<uint8_t>::const_iterator ConstPrefixIterator;
1196
1201
1202 PbbAddressBlock ();
1203 virtual ~PbbAddressBlock ();
1204
1205 /* Manipulating the address block */
1206
1211
1216
1221
1225 ConstAddressIterator AddressEnd (void) const;
1226
1230 int AddressSize (void) const;
1231
1235 bool AddressEmpty (void) const;
1236
1240 Address AddressFront (void) const;
1241
1245 Address AddressBack (void) const;
1246
1252
1256 void AddressPopFront (void);
1257
1263
1267 void AddressPopBack (void);
1268
1277 const Address value);
1278
1285
1296
1300 void AddressClear (void);
1301
1302 /* Prefix methods */
1303
1308
1312 ConstPrefixIterator PrefixBegin (void) const;
1313
1318
1322 ConstPrefixIterator PrefixEnd (void) const;
1323
1327 int PrefixSize (void) const;
1328
1332 bool PrefixEmpty (void) const;
1333
1337 uint8_t PrefixFront (void) const;
1338
1342 uint8_t PrefixBack (void) const;
1343
1348 void PrefixPushFront (uint8_t prefix);
1349
1353 void PrefixPopFront (void);
1354
1359 void PrefixPushBack (uint8_t prefix);
1360
1364 void PrefixPopBack (void);
1365
1373 PrefixIterator PrefixInsert (PrefixIterator position, const uint8_t value);
1374
1381
1392
1396 void PrefixClear (void);
1397
1398 /* Manipulating the TLV block */
1399
1403 TlvIterator TlvBegin (void);
1404
1408 ConstTlvIterator TlvBegin (void) const;
1409
1413 TlvIterator TlvEnd (void);
1414
1418 ConstTlvIterator TlvEnd (void) const;
1419
1423 int TlvSize (void) const;
1424
1428 bool TlvEmpty (void) const;
1429
1434
1438 const Ptr<PbbAddressTlv> TlvFront (void) const;
1439
1444
1448 const Ptr<PbbAddressTlv> TlvBack (void) const;
1449
1455
1459 void TlvPopFront (void);
1460
1466
1470 void TlvPopBack (void);
1471
1480
1486 TlvIterator TlvErase (TlvIterator position);
1487
1498
1502 void TlvClear (void);
1503
1507 uint32_t GetSerializedSize (void) const;
1508
1516 void Serialize (Buffer::Iterator &start) const;
1517
1526
1531 void Print (std::ostream &os) const;
1532
1542 void Print (std::ostream &os, int level) const;
1543
1549 bool operator== (const PbbAddressBlock &other) const;
1550
1556 bool operator!= (const PbbAddressBlock &other) const;
1557
1558protected:
1563 virtual uint8_t GetAddressLength (void) const = 0;
1569 virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const = 0;
1575 virtual Address DeserializeAddress (uint8_t *buffer) const = 0;
1581 virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const = 0;
1582
1583private:
1588 uint8_t GetPrefixFlags (void) const;
1596 void GetHeadTail (uint8_t *head, uint8_t &headlen,
1597 uint8_t *tail, uint8_t &taillen) const;
1598
1605 bool HasZeroTail (const uint8_t *tail, uint8_t taillen) const;
1606
1607 std::list<Address> m_addressList;
1608 std::list<uint8_t> m_prefixList;
1610};
1611
1618{
1619public:
1621 virtual ~PbbAddressBlockIpv4 ();
1622
1623protected:
1628 virtual uint8_t GetAddressLength (void) const;
1629 virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const;
1630 virtual Address DeserializeAddress (uint8_t *buffer) const;
1631 virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const;
1632};
1633
1640{
1641public:
1643 virtual ~PbbAddressBlockIpv6 ();
1644
1645protected:
1650 virtual uint8_t GetAddressLength (void) const;
1651 virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const;
1652 virtual Address DeserializeAddress (uint8_t *buffer) const;
1653 virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const;
1654};
1655
1659class PbbTlv : public SimpleRefCount<PbbTlv>
1660{
1661public:
1662 PbbTlv (void);
1663 virtual ~PbbTlv (void);
1664
1669 void SetType (uint8_t type);
1670
1674 uint8_t GetType (void) const;
1675
1683 void SetTypeExt (uint8_t type);
1684
1691 uint8_t GetTypeExt (void) const;
1692
1700 bool HasTypeExt (void) const;
1701
1709 void SetValue (Buffer start);
1710
1719 void SetValue (const uint8_t * buffer, uint32_t size);
1720
1727 Buffer GetValue (void) const;
1728
1736 bool HasValue (void) const;
1737
1741 uint32_t GetSerializedSize (void) const;
1742
1750 void Serialize (Buffer::Iterator &start) const;
1751
1760
1765 void Print (std::ostream &os) const;
1766
1775 void Print (std::ostream &os, int level) const;
1776
1782 bool operator== (const PbbTlv &other) const;
1783
1789 bool operator!= (const PbbTlv &other) const;
1790
1791protected:
1796 void SetIndexStart (uint8_t index);
1801 uint8_t GetIndexStart (void) const;
1806 bool HasIndexStart (void) const;
1807
1812 void SetIndexStop (uint8_t index);
1817 uint8_t GetIndexStop (void) const;
1822 bool HasIndexStop (void) const;
1823
1828 void SetMultivalue (bool isMultivalue);
1833 bool IsMultivalue (void) const;
1834
1835private:
1836 uint8_t m_type;
1837
1839 uint8_t m_typeExt;
1840
1843
1845 uint8_t m_indexStop;
1846
1850};
1851
1855class PbbAddressTlv : public PbbTlv
1856{
1857public:
1863 void SetIndexStart (uint8_t index);
1864
1872 uint8_t GetIndexStart (void) const;
1873
1881 bool HasIndexStart (void) const;
1882
1888 void SetIndexStop (uint8_t index);
1889
1897 uint8_t GetIndexStop (void) const;
1898
1906 bool HasIndexStop (void) const;
1907
1916 void SetMultivalue (bool isMultivalue);
1917
1922 bool IsMultivalue (void) const;
1923};
1924
1925} /* namespace ns3 */
1926
1927#endif /* PACKETBB_H */
a polymophic address class
Definition: address.h:91
iterator in a Buffer instance
Definition: buffer.h:99
automatically resized byte buffer
Definition: buffer.h:93
An Address Block and its associated Address TLV Blocks.
Definition: packetbb.h:1185
Ptr< PbbAddressTlv > TlvFront(void)
Definition: packetbb.cc:2115
virtual uint8_t GetAddressLength(void) const =0
Returns address length.
std::list< uint8_t >::iterator PrefixIterator
Prefix iterator.
Definition: packetbb.h:1193
PrefixIterator PrefixEnd(void)
Definition: packetbb.cc:1973
void PrefixPushFront(uint8_t prefix)
Prepends a prefix to the front of this block.
Definition: packetbb.cc:2015
TlvIterator TlvEnd(void)
Definition: packetbb.cc:2087
void Print(std::ostream &os) const
Pretty-prints the contents of this address block.
Definition: packetbb.cc:2378
Address AddressBack(void) const
Definition: packetbb.cc:1900
std::list< Address > m_addressList
Addresses container.
Definition: packetbb.h:1607
TlvIterator TlvInsert(TlvIterator position, const Ptr< PbbTlv > value)
Inserts an address TLV at the specified position in this block.
PrefixIterator PrefixBegin(void)
Definition: packetbb.cc:1959
bool PrefixEmpty(void) const
Definition: packetbb.cc:1994
bool operator!=(const PbbAddressBlock &other) const
Inequality operator for PbbAddressBlock.
Definition: packetbb.cc:2460
uint8_t PrefixFront(void) const
Definition: packetbb.cc:2001
void Serialize(Buffer::Iterator &start) const
Serializes this address block into the specified buffer.
Definition: packetbb.cc:2240
void PrefixClear(void)
Removes all prefixes from this block.
Definition: packetbb.cc:2064
PbbAddressTlvBlock::Iterator TlvIterator
tlvblock iterator
Definition: packetbb.h:1198
AddressIterator AddressBegin(void)
Definition: packetbb.cc:1851
int PrefixSize(void) const
Definition: packetbb.cc:1987
virtual void PrintAddress(std::ostream &os, ConstAddressIterator iter) const =0
Print one or more addresses.
void GetHeadTail(uint8_t *head, uint8_t &headlen, uint8_t *tail, uint8_t &taillen) const
Get head and tail.
Definition: packetbb.cc:2487
AddressIterator AddressInsert(AddressIterator position, const Address value)
Inserts an address at the specified position in this block.
virtual void SerializeAddress(uint8_t *buffer, ConstAddressIterator iter) const =0
Serialize one or more addresses.
std::list< Address >::const_iterator ConstAddressIterator
Address const iterator.
Definition: packetbb.h:1190
Ptr< PbbAddressTlv > TlvBack(void)
Definition: packetbb.cc:2129
void TlvPushBack(Ptr< PbbAddressTlv > address)
Appends an address TLV to the back of this message.
Definition: packetbb.cc:2157
TlvIterator TlvBegin(void)
Definition: packetbb.cc:2073
int TlvSize(void) const
Definition: packetbb.cc:2101
uint8_t PrefixBack(void) const
Definition: packetbb.cc:2008
void AddressPopFront(void)
Removes an address from the front of this block.
Definition: packetbb.cc:1914
Address AddressFront(void) const
Definition: packetbb.cc:1893
void AddressPushBack(Address address)
Appends an address to the back of this block.
Definition: packetbb.cc:1921
AddressIterator AddressErase(AddressIterator position)
Removes the address at the specified position.
Definition: packetbb.cc:1935
int AddressSize(void) const
Definition: packetbb.cc:1879
bool HasZeroTail(const uint8_t *tail, uint8_t taillen) const
Check if the tail is empty.
Definition: packetbb.cc:2552
std::list< uint8_t > m_prefixList
Prefixes container.
Definition: packetbb.h:1608
void PrefixPushBack(uint8_t prefix)
Appends a prefix to the back of this block.
Definition: packetbb.cc:2029
void PrefixPopFront(void)
Removes a prefix from the front of this block.
Definition: packetbb.cc:2022
PrefixIterator PrefixErase(PrefixIterator position)
Removes the prefix at the specified position.
Definition: packetbb.cc:2050
virtual Address DeserializeAddress(uint8_t *buffer) const =0
Deserialize one address.
PbbAddressTlvBlock::ConstIterator ConstTlvIterator
tlvblock const iterator
Definition: packetbb.h:1200
PrefixIterator PrefixInsert(PrefixIterator position, const uint8_t value)
Inserts a prefix at the specified position in this block.
Definition: packetbb.cc:2043
void PrefixPopBack(void)
Removes a prefix from the back of this block.
Definition: packetbb.cc:2036
void AddressClear(void)
Removes all addresses from this block.
Definition: packetbb.cc:1950
void TlvPushFront(Ptr< PbbAddressTlv > address)
Prepends an address TLV to the front of this message.
Definition: packetbb.cc:2143
bool TlvEmpty(void) const
Definition: packetbb.cc:2108
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:2192
virtual ~PbbAddressBlock()
Definition: packetbb.cc:1843
void Deserialize(Buffer::Iterator &start)
Deserializes an address block from the specified buffer.
Definition: packetbb.cc:2324
bool AddressEmpty(void) const
Definition: packetbb.cc:1886
TlvIterator TlvErase(TlvIterator position)
Removes the address TLV at the specified position.
Definition: packetbb.cc:2171
std::list< uint8_t >::const_iterator ConstPrefixIterator
Prefix const iterator.
Definition: packetbb.h:1195
AddressIterator AddressEnd(void)
Definition: packetbb.cc:1865
void AddressPushFront(Address address)
Prepends an address to the front of this block.
Definition: packetbb.cc:1907
std::list< Address >::iterator AddressIterator
Address iterator.
Definition: packetbb.h:1188
void TlvPopBack(void)
Removes an address TLV from the back of this message.
Definition: packetbb.cc:2164
bool operator==(const PbbAddressBlock &other) const
Equality operator for PbbAddressBlock.
Definition: packetbb.cc:2417
void TlvClear(void)
Removes all address TLVs from this block.
Definition: packetbb.cc:2186
PbbAddressTlvBlock m_addressTlvList
PbbAddressTlv container.
Definition: packetbb.h:1609
void AddressPopBack(void)
Removes an address from the back of this block.
Definition: packetbb.cc:1928
void TlvPopFront(void)
Removes an address TLV from the front of this message.
Definition: packetbb.cc:2150
uint8_t GetPrefixFlags(void) const
Get the prefix flags.
Definition: packetbb.cc:2466
Concrete IPv4 specific PbbAddressBlock.
Definition: packetbb.h:1618
virtual void SerializeAddress(uint8_t *buffer, ConstAddressIterator iter) const
Serialize one or more addresses.
Definition: packetbb.cc:2586
virtual Address DeserializeAddress(uint8_t *buffer) const
Deserialize one address.
Definition: packetbb.cc:2593
virtual void PrintAddress(std::ostream &os, ConstAddressIterator iter) const
Print one or more addresses.
Definition: packetbb.cc:2600
virtual uint8_t GetAddressLength(void) const
Returns address length.
Definition: packetbb.cc:2579
virtual ~PbbAddressBlockIpv4()
Definition: packetbb.cc:2573
Concrete IPv6 specific PbbAddressBlock.
Definition: packetbb.h:1640
virtual ~PbbAddressBlockIpv6()
Definition: packetbb.cc:2613
virtual void SerializeAddress(uint8_t *buffer, ConstAddressIterator iter) const
Serialize one or more addresses.
Definition: packetbb.cc:2626
virtual void PrintAddress(std::ostream &os, ConstAddressIterator iter) const
Print one or more addresses.
Definition: packetbb.cc:2640
virtual Address DeserializeAddress(uint8_t *buffer) const
Deserialize one address.
Definition: packetbb.cc:2633
virtual uint8_t GetAddressLength(void) const
Returns address length.
Definition: packetbb.cc:2619
A block of Address TLVs (PbbAddressTlv).
Definition: packetbb.h:220
Iterator End(void)
Definition: packetbb.cc:331
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:433
void Serialize(Buffer::Iterator &start) const
Serializes this block into the specified buffer.
Definition: packetbb.cc:446
void PushBack(Ptr< PbbAddressTlv > tlv)
Appends an Address TLV to the back of this block.
Definition: packetbb.cc:387
void Print(std::ostream &os) const
Pretty-prints the contents of this block.
Definition: packetbb.cc:487
Iterator Erase(Iterator position)
Removes the Address TLV at the specified position.
Definition: packetbb.cc:408
bool operator!=(const PbbAddressTlvBlock &other) const
Inequality operator for PbbAddressTlvBlock.
Definition: packetbb.cc:538
Iterator Begin(void)
Definition: packetbb.cc:317
std::list< Ptr< PbbAddressTlv > >::const_iterator ConstIterator
PbbAddressTlv const iterator for PbbAddressTlvBlock.
Definition: packetbb.h:225
std::list< Ptr< PbbAddressTlv > >::iterator Iterator
PbbAddressTlv iterator for PbbAddressTlvBlock.
Definition: packetbb.h:223
std::list< Ptr< PbbAddressTlv > > m_tlvList
PbbAddressTlv container.
Definition: packetbb.h:378
bool Empty(void) const
Definition: packetbb.cc:352
void Deserialize(Buffer::Iterator &start)
Deserializes a block from the specified buffer.
Definition: packetbb.cc:469
int Size(void) const
Definition: packetbb.cc:345
void PopBack(void)
Removes an Address TLV from the back of this block.
Definition: packetbb.cc:394
Ptr< PbbAddressTlv > Back(void) const
Definition: packetbb.cc:366
void PopFront(void)
Removes an AddressTLV from the front of this block.
Definition: packetbb.cc:380
void Clear(void)
Removes all Address TLVs from this block.
Definition: packetbb.cc:422
Ptr< PbbAddressTlv > Front(void) const
Definition: packetbb.cc:359
Iterator Insert(Iterator position, const Ptr< PbbAddressTlv > tlv)
Inserts an Address TLV at the specified position in this block.
Definition: packetbb.cc:401
void PushFront(Ptr< PbbAddressTlv > tlv)
Prepends an Address TLV to the front of this block.
Definition: packetbb.cc:373
bool operator==(const PbbAddressTlvBlock &other) const
Equality operator for PbbAddressTlvBlock.
Definition: packetbb.cc:517
An Address TLV.
Definition: packetbb.h:1856
uint8_t GetIndexStop(void) const
Definition: packetbb.cc:3060
bool IsMultivalue(void) const
Tests whether or not this address TLV is "multivalue".
Definition: packetbb.cc:3081
void SetMultivalue(bool isMultivalue)
Sets whether or not this address TLV is "multivalue".
Definition: packetbb.cc:3074
bool HasIndexStop(void) const
Tests whether or not this address TLV has a stop index.
Definition: packetbb.cc:3067
void SetIndexStart(uint8_t index)
Sets the index of the first address in the associated address block that this address TLV applies to.
Definition: packetbb.cc:3032
bool HasIndexStart(void) const
Tests whether or not this address TLV has a start index.
Definition: packetbb.cc:3046
uint8_t GetIndexStart(void) const
Definition: packetbb.cc:3039
void SetIndexStop(uint8_t index)
Sets the index of the last address in the associated address block that this address TLV applies to.
Definition: packetbb.cc:3053
A message within a PbbPacket packet.
Definition: packetbb.h:696
std::list< Ptr< PbbAddressBlock > > m_addressBlockList
PbbAddressBlock container.
Definition: packetbb.h:1104
void AddressBlockPushFront(Ptr< PbbAddressBlock > block)
Prepends an address block to the front of this message.
Definition: packetbb.cc:1349
uint16_t m_sequenceNumber
Sequence number.
Definition: packetbb.h:1119
std::list< Ptr< PbbAddressBlock > >::iterator AddressBlockIterator
PbbAddressBlock iterator.
Definition: packetbb.h:703
bool m_hasHopLimit
Hop limit present.
Definition: packetbb.h:1112
void TlvPushFront(Ptr< PbbTlv > tlv)
Prepends a message TLV to the front of this message.
Definition: packetbb.cc:1228
int AddressBlockSize(void) const
Definition: packetbb.cc:1307
Address m_originatorAddress
originator address
Definition: packetbb.h:1110
bool operator!=(const PbbMessage &other) const
Inequality operator for PbbMessage.
Definition: packetbb.cc:1719
AddressBlockIterator AddressBlockBegin()
Definition: packetbb.cc:1279
void Deserialize(Buffer::Iterator &start)
Deserializes a message from the specified buffer.
Definition: packetbb.cc:1534
Ptr< PbbAddressBlock > AddressBlockFront(void)
Definition: packetbb.cc:1321
uint8_t GetHopCount(void) const
Definition: packetbb.cc:1118
std::list< Ptr< PbbTlv > >::const_iterator ConstTlvIterator
PbbTlv const iterator.
Definition: packetbb.h:701
AddressBlockIterator AddressBlockEnd()
Definition: packetbb.cc:1293
Ptr< PbbTlv > TlvBack(void)
Definition: packetbb.cc:1214
void SetType(uint8_t type)
Sets the type for this message.
Definition: packetbb.cc:1043
std::list< Ptr< PbbAddressBlock > >::const_iterator ConstAddressBlockIterator
PbbAddressBlock const iterator.
Definition: packetbb.h:705
void Serialize(Buffer::Iterator &start) const
Serializes this message into the specified buffer.
Definition: packetbb.cc:1444
int TlvSize(void) const
Definition: packetbb.cc:1186
TlvIterator TlvErase(TlvIterator position)
Removes the message TLV at the specified position.
Definition: packetbb.cc:1256
void SetOriginatorAddress(Address address)
Sets the address for the node that created this packet.
Definition: packetbb.cc:1064
void SetHopLimit(uint8_t hoplimit)
Sets the maximum number of hops this message should travel.
Definition: packetbb.cc:1087
uint16_t GetSequenceNumber(void) const
Definition: packetbb.cc:1141
bool HasHopLimit(void) const
Tests whether or not this message has a hop limit.
Definition: packetbb.cc:1103
static Ptr< PbbMessage > DeserializeMessage(Buffer::Iterator &start)
Deserializes a message, returning the correct object depending on whether it is an IPv4 message or an...
Definition: packetbb.cc:1501
Ptr< PbbAddressBlock > AddressBlockBack(void)
Definition: packetbb.cc:1335
uint8_t m_hopLimit
Hop limit.
Definition: packetbb.h:1113
void AddressBlockPushBack(Ptr< PbbAddressBlock > block)
Appends an address block to the front of this message.
Definition: packetbb.cc:1363
void AddressBlockPopFront(void)
Removes an address block from the front of this message.
Definition: packetbb.cc:1356
TlvIterator TlvBegin()
Definition: packetbb.cc:1158
bool m_hasOriginatorAddress
Originator address present.
Definition: packetbb.h:1109
virtual void PrintOriginatorAddress(std::ostream &os) const =0
Print the originator address.
bool HasOriginatorAddress(void) const
Tests whether or not this message has an originator address.
Definition: packetbb.cc:1080
std::list< Ptr< PbbTlv > >::iterator TlvIterator
PbbTlv iterator.
Definition: packetbb.h:699
virtual Address DeserializeOriginatorAddress(Buffer::Iterator &start) const =0
Deserialize the originator address.
void TlvPopFront(void)
Removes a message TLV from the front of this message.
Definition: packetbb.cc:1235
void SetHopCount(uint8_t hopcount)
Sets the current number of hops this message has traveled.
Definition: packetbb.cc:1110
void Print(std::ostream &os) const
Pretty-prints the contents of this message.
Definition: packetbb.cc:1576
void SetSequenceNumber(uint16_t seqnum)
Sets the sequence number of this message.
Definition: packetbb.cc:1133
void TlvPopBack(void)
Removes a message TLV from the back of this message.
Definition: packetbb.cc:1249
bool m_hasHopCount
Hop count present.
Definition: packetbb.h:1115
virtual ~PbbMessage()
Definition: packetbb.cc:1036
virtual Ptr< PbbAddressBlock > AddressBlockDeserialize(Buffer::Iterator &start) const =0
Deserialize an address block.
PbbTlvBlock m_tlvList
PbbTlvBlock.
Definition: packetbb.h:1103
bool TlvEmpty(void) const
Definition: packetbb.cc:1193
void AddressBlockClear(void)
Removes all address blocks from this message.
Definition: packetbb.cc:1392
bool HasSequenceNumber(void) const
Tests whether or not this message has a sequence number.
Definition: packetbb.cc:1149
void TlvClear(void)
Removes all message TLVs from this block.
Definition: packetbb.cc:1270
void TlvPushBack(Ptr< PbbTlv > tlv)
Appends a message TLV to the back of this message.
Definition: packetbb.cc:1242
bool HasHopCount(void) const
Tests whether or not this message has a hop count.
Definition: packetbb.cc:1126
virtual void SerializeOriginatorAddress(Buffer::Iterator &start) const =0
Serialize the originator address.
bool AddressBlockEmpty(void) const
Definition: packetbb.cc:1314
uint8_t GetHopLimit(void) const
Definition: packetbb.cc:1095
AddressBlockIterator AddressBlockErase(AddressBlockIterator position)
Removes the address block at the specified position.
Definition: packetbb.cc:1377
virtual PbbAddressLength GetAddressLength(void) const =0
Returns address length (IPV4 3 or IPV6 15)
Definition: packetbb.cc:1057
bool operator==(const PbbMessage &other) const
Equality operator for PbbMessage.
Definition: packetbb.cc:1631
PbbAddressLength m_addrSize
the address size
Definition: packetbb.h:1107
uint8_t m_hopCount
Hop count.
Definition: packetbb.h:1116
uint8_t GetType(void) const
Definition: packetbb.cc:1050
bool m_hasSequenceNumber
Sequence number present.
Definition: packetbb.h:1118
Ptr< PbbTlv > TlvFront(void)
Definition: packetbb.cc:1200
Address GetOriginatorAddress(void) const
Definition: packetbb.cc:1072
TlvIterator TlvEnd()
Definition: packetbb.cc:1172
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:1405
void AddressBlockPopBack(void)
Removes an address block from the back of this message.
Definition: packetbb.cc:1370
uint8_t m_type
the type for this message
Definition: packetbb.h:1106
Concrete IPv4 specific PbbMessage.
Definition: packetbb.h:1127
virtual void SerializeOriginatorAddress(Buffer::Iterator &start) const
Serialize the originator address.
Definition: packetbb.cc:1744
virtual Ptr< PbbAddressBlock > AddressBlockDeserialize(Buffer::Iterator &start) const
Deserialize an address block.
Definition: packetbb.cc:1772
virtual ~PbbMessageIpv4()
Definition: packetbb.cc:1731
virtual void PrintOriginatorAddress(std::ostream &os) const
Print the originator address.
Definition: packetbb.cc:1765
virtual Address DeserializeOriginatorAddress(Buffer::Iterator &start) const
Deserialize the originator address.
Definition: packetbb.cc:1754
virtual PbbAddressLength GetAddressLength(void) const
Returns address length (IPV4 3 or IPV6 15)
Definition: packetbb.cc:1737
Concrete IPv6 specific PbbMessage class.
Definition: packetbb.h:1155
virtual Ptr< PbbAddressBlock > AddressBlockDeserialize(Buffer::Iterator &start) const
Deserialize an address block.
Definition: packetbb.cc:1828
virtual void PrintOriginatorAddress(std::ostream &os) const
Print the originator address.
Definition: packetbb.cc:1821
virtual Address DeserializeOriginatorAddress(Buffer::Iterator &start) const
Deserialize the originator address.
Definition: packetbb.cc:1810
virtual void SerializeOriginatorAddress(Buffer::Iterator &start) const
Serialize the originator address.
Definition: packetbb.cc:1800
virtual PbbAddressLength GetAddressLength(void) const
Returns address length (IPV4 3 or IPV6 15)
Definition: packetbb.cc:1793
virtual ~PbbMessageIpv6()
Definition: packetbb.cc:1787
Main PacketBB Packet object.
Definition: packetbb.h:390
std::list< Ptr< PbbMessage > >::iterator MessageIterator
PbbMessage Iterator for PbbPacket.
Definition: packetbb.h:397
uint8_t m_version
version
Definition: packetbb.h:682
void MessageClear(void)
Removes all messages from this packet.
Definition: packetbb.cc:826
bool MessageEmpty(void) const
Definition: packetbb.cc:748
std::list< Ptr< PbbMessage > >::const_iterator ConstMessageIterator
PbbMessage Const Iterator for PbbPacket.
Definition: packetbb.h:399
virtual uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:855
MessageIterator MessageEnd(void)
Definition: packetbb.cc:727
TlvIterator TlvBegin(void)
Definition: packetbb.cc:592
bool m_hasseqnum
Sequence number present.
Definition: packetbb.h:684
int TlvSize(void) const
Definition: packetbb.cc:620
void TlvPopBack(void)
Removes a packet TLV from the back of this block.
Definition: packetbb.cc:683
Ptr< PbbTlv > TlvFront(void)
Definition: packetbb.cc:634
int MessageSize(void) const
Definition: packetbb.cc:741
void TlvPushBack(Ptr< PbbTlv > tlv)
Appends a packet TLV to the back of this packet.
Definition: packetbb.cc:676
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: packetbb.cc:849
std::list< Ptr< PbbMessage > > m_messageList
PbbTlvBlock container.
Definition: packetbb.h:680
void MessagePushBack(Ptr< PbbMessage > message)
Appends a message to the back of this packet.
Definition: packetbb.cc:797
std::list< Ptr< PbbTlv > >::iterator TlvIterator
PbbTlv iterator for PbbPacket.
Definition: packetbb.h:393
TlvIterator TlvEnd(void)
Definition: packetbb.cc:606
void TlvPopFront(void)
Removes a packet TLV from the front of this packet.
Definition: packetbb.cc:669
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserializes a packet from the specified buffer.
Definition: packetbb.cc:917
MessageIterator MessageBegin(void)
Definition: packetbb.cc:713
bool HasSequenceNumber(void) const
Tests whether or not this packet has a sequence number.
Definition: packetbb.cc:583
void SetSequenceNumber(uint16_t number)
Sets the sequence number of this packet.
Definition: packetbb.cc:567
void TlvPushFront(Ptr< PbbTlv > tlv)
Prepends a packet TLV to the front of this packet.
Definition: packetbb.cc:662
uint16_t GetSequenceNumber(void) const
Definition: packetbb.cc:575
Ptr< PbbTlv > TlvBack(void)
Definition: packetbb.cc:648
void MessagePopFront(void)
Removes a message from the front of this packet.
Definition: packetbb.cc:790
Ptr< PbbMessage > MessageBack(void)
Definition: packetbb.cc:769
MessageIterator Erase(MessageIterator first, MessageIterator last)
Removes all messages from [first, last) (includes first, not includes last).
void MessagePopBack(void)
Removes a message from the back of this packet.
Definition: packetbb.cc:804
TlvIterator Erase(TlvIterator position)
Removes the packet TLV at the specified position.
Definition: packetbb.cc:690
MessageIterator Erase(MessageIterator position)
Removes the message at the specified position.
void MessagePushFront(Ptr< PbbMessage > message)
Prepends a message to the front of this packet.
Definition: packetbb.cc:783
PbbPacket(void)
Definition: packetbb.cc:546
static TypeId GetTypeId(void)
Get the type ID.
Definition: packetbb.cc:838
bool operator!=(const PbbPacket &other) const
Inequality operator for PbbPacket.
Definition: packetbb.cc:1018
uint8_t GetVersion(void) const
Definition: packetbb.cc:560
uint16_t m_seqnum
Sequence number.
Definition: packetbb.h:685
void TlvClear(void)
Removes all packet TLVs from this packet.
Definition: packetbb.cc:704
virtual void Serialize(Buffer::Iterator start) const
Serializes this packet into the specified buffer.
Definition: packetbb.cc:882
std::list< Ptr< PbbTlv > >::const_iterator ConstTlvIterator
PbbTlv const iterator for PbbPacket.
Definition: packetbb.h:395
~PbbPacket(void)
Definition: packetbb.cc:553
bool TlvEmpty(void) const
Definition: packetbb.cc:627
virtual void Print(std::ostream &os) const
Pretty-prints the contents of this block.
Definition: packetbb.cc:951
PbbTlvBlock m_tlvList
PbbTlv container.
Definition: packetbb.h:679
Ptr< PbbMessage > MessageFront(void)
Definition: packetbb.cc:755
bool operator==(const PbbPacket &other) const
Equality operator for PbbPacket.
Definition: packetbb.cc:976
A block of packet or message TLVs (PbbTlv).
Definition: packetbb.h:56
Iterator Erase(Iterator position)
Removes the TLV at the specified position.
Definition: packetbb.cc:167
std::list< Ptr< PbbTlv > > m_tlvList
PbbTlv container.
Definition: packetbb.h:211
int Size(void) const
Definition: packetbb.cc:104
void PushBack(Ptr< PbbTlv > tlv)
Appends a TLV to the back of this block.
Definition: packetbb.cc:146
void PopBack(void)
Removes a TLV from the back of this block.
Definition: packetbb.cc:153
void Clear(void)
Removes all TLVs from this block.
Definition: packetbb.cc:181
bool operator==(const PbbTlvBlock &other) const
Equality operator for PbbTlvBlock.
Definition: packetbb.cc:276
void Serialize(Buffer::Iterator &start) const
Serializes this block into the specified buffer.
Definition: packetbb.cc:205
void PushFront(Ptr< PbbTlv > tlv)
Prepends a TLV to the front of this block.
Definition: packetbb.cc:132
void PopFront(void)
Removes a TLV from the front of this block.
Definition: packetbb.cc:139
std::list< Ptr< PbbTlv > >::iterator Iterator
PbbTlv container iterator.
Definition: packetbb.h:59
Ptr< PbbTlv > Back(void) const
Definition: packetbb.cc:125
Iterator End(void)
Definition: packetbb.cc:90
bool Empty(void) const
Definition: packetbb.cc:111
Iterator Insert(Iterator position, const Ptr< PbbTlv > tlv)
Inserts a TLV at the specified position in this block.
Definition: packetbb.cc:160
std::list< Ptr< PbbTlv > >::const_iterator ConstIterator
PbbTlv container const iterator.
Definition: packetbb.h:61
Ptr< PbbTlv > Front(void) const
Definition: packetbb.cc:118
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:192
Iterator Begin(void)
Definition: packetbb.cc:76
void Deserialize(Buffer::Iterator &start)
Deserializes a block from the specified buffer.
Definition: packetbb.cc:228
PbbTlvBlock(void)
Definition: packetbb.cc:63
void Print(std::ostream &os) const
Pretty-prints the contents of this block.
Definition: packetbb.cc:246
bool operator!=(const PbbTlvBlock &other) const
Inequality operator for PbbTlvBlock.
Definition: packetbb.cc:297
~PbbTlvBlock(void)
Definition: packetbb.cc:69
A packet or message TLV.
Definition: packetbb.h:1660
bool m_isMultivalue
Is multivalue.
Definition: packetbb.h:1847
uint8_t m_indexStop
Stop index.
Definition: packetbb.h:1845
void SetValue(Buffer start)
Sets the value of this message to the specified buffer.
Definition: packetbb.cc:2762
uint8_t GetTypeExt(void) const
Definition: packetbb.cc:2687
bool operator!=(const PbbTlv &other) const
Inequality operator for PbbTlv.
Definition: packetbb.cc:3024
bool HasValue(void) const
Tests whether or not this TLV has a value.
Definition: packetbb.cc:2787
uint8_t GetIndexStop(void) const
Get the stop point index.
Definition: packetbb.cc:2733
uint8_t m_indexStart
Start index.
Definition: packetbb.h:1842
uint8_t GetIndexStart(void) const
Get the starting point index.
Definition: packetbb.cc:2710
uint8_t m_type
Type of this TLV.
Definition: packetbb.h:1836
Buffer m_value
Value.
Definition: packetbb.h:1849
bool m_hasIndexStart
Start index present.
Definition: packetbb.h:1841
bool operator==(const PbbTlv &other) const
Equality operator for PbbTlv.
Definition: packetbb.cc:2979
void Serialize(Buffer::Iterator &start) const
Serializes this TLV into the specified buffer.
Definition: packetbb.cc:2832
Buffer GetValue(void) const
Definition: packetbb.cc:2779
bool HasIndexStart(void) const
Checks if there is a starting index.
Definition: packetbb.cc:2718
void SetType(uint8_t type)
Sets the type of this TLV.
Definition: packetbb.cc:2665
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:2794
bool m_hasIndexStop
Stop index present.
Definition: packetbb.h:1844
void SetIndexStop(uint8_t index)
Set an index as stop point.
Definition: packetbb.cc:2725
void SetMultivalue(bool isMultivalue)
Set the multivalue parameter.
Definition: packetbb.cc:2748
bool IsMultivalue(void) const
Check the multivalue parameter.
Definition: packetbb.cc:2755
void Print(std::ostream &os) const
Pretty-prints the contents of this TLV.
Definition: packetbb.cc:2934
void SetIndexStart(uint8_t index)
Set an index as starting point.
Definition: packetbb.cc:2702
uint8_t m_typeExt
Extended type.
Definition: packetbb.h:1839
PbbTlv(void)
Definition: packetbb.cc:2648
bool m_hasTypeExt
Extended type present.
Definition: packetbb.h:1838
bool HasTypeExt(void) const
Tests whether or not this TLV has a type extension.
Definition: packetbb.cc:2695
bool HasIndexStop(void) const
Checks if there is a stop index.
Definition: packetbb.cc:2741
uint8_t GetType(void) const
Definition: packetbb.cc:2672
virtual ~PbbTlv(void)
Definition: packetbb.cc:2658
void SetTypeExt(uint8_t type)
Sets the type extension of this TLV.
Definition: packetbb.cc:2679
void Deserialize(Buffer::Iterator &start)
Deserializes a TLV from the specified buffer.
Definition: packetbb.cc:2889
bool m_hasValue
Has value.
Definition: packetbb.h:1848
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
A template-based reference counting class.
a unique identifier for an interface.
Definition: type-id.h:59
Definition: first.py:1
address
Definition: first.py:40
Every class exported by the ns3 library is enclosed in the ns3 namespace.
PbbAddressLength
Used in Messages to determine whether it contains IPv4 or IPv6 addresses.
Definition: packetbb.h:45
@ IPV6
Definition: packetbb.h:47
@ IPV4
Definition: packetbb.h:46
def start()
Definition: core.py:1852