A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
packetbb.h
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: http://tools.ietf.org/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 
36 namespace ns3 {
37 
38 /* Forward declare objects */
39 class PbbMessage;
40 class PbbAddressBlock;
41 class PbbTlv;
42 class PbbAddressTlv;
43 
46  IPV4 = 3,
47  IPV6 = 15,
48 };
49 
56 {
57 public:
58  typedef std::list< Ptr<PbbTlv> >::iterator Iterator;
59  typedef std::list< Ptr<PbbTlv> >::const_iterator ConstIterator;
60 
61  PbbTlvBlock (void);
62  ~PbbTlvBlock (void);
63 
67  Iterator Begin (void);
68 
72  ConstIterator Begin (void) const;
73 
77  Iterator End (void);
78 
82  ConstIterator End (void) const;
83 
87  int Size (void) const;
88 
92  bool Empty (void) const;
93 
97  Ptr<PbbTlv> Front (void) const;
98 
102  Ptr<PbbTlv> Back (void) const;
103 
108  void PushFront (Ptr<PbbTlv> tlv);
109 
113  void PopFront (void);
114 
119  void PushBack (Ptr<PbbTlv> tlv);
120 
124  void PopBack (void);
125 
133  Iterator Insert (Iterator position, const Ptr<PbbTlv> tlv);
134 
140  Iterator Erase (Iterator position);
141 
149  Iterator Erase (Iterator first, Iterator last);
150 
154  void Clear (void);
155 
159  uint32_t GetSerializedSize (void) const;
160 
168  void Serialize (Buffer::Iterator &start) const;
169 
177  void Deserialize (Buffer::Iterator &start);
178 
183  void Print (std::ostream &os) const;
184 
193  void Print (std::ostream &os, int level) const;
194 
195  bool operator== (const PbbTlvBlock &other) const;
196  bool operator!= (const PbbTlvBlock &other) const;
197 
198 private:
199  std::list< Ptr<PbbTlv> > m_tlvList;
200 };
201 
208 {
209 public:
210  typedef std::list< Ptr<PbbAddressTlv> >::iterator Iterator;
211  typedef std::list< Ptr<PbbAddressTlv> >::const_iterator ConstIterator;
212 
213  PbbAddressTlvBlock (void);
214  ~PbbAddressTlvBlock (void);
215 
219  Iterator Begin (void);
220 
224  ConstIterator Begin (void) const;
225 
229  Iterator End (void);
230 
234  ConstIterator End (void) const;
235 
239  int Size (void) const;
240 
244  bool Empty (void) const;
245 
249  Ptr<PbbAddressTlv> Front (void) const;
250 
254  Ptr<PbbAddressTlv> Back (void) const;
255 
260  void PushFront (Ptr<PbbAddressTlv> tlv);
261 
265  void PopFront (void);
266 
271  void PushBack (Ptr<PbbAddressTlv> tlv);
272 
276  void PopBack (void);
277 
285  Iterator Insert (Iterator position, const Ptr<PbbAddressTlv> tlv);
286 
292  Iterator Erase (Iterator position);
293 
303  Iterator Erase (Iterator first, Iterator last);
304 
308  void Clear (void);
309 
313  uint32_t GetSerializedSize (void) const;
314 
322  void Serialize (Buffer::Iterator &start) const;
323 
331  void Deserialize (Buffer::Iterator &start);
332 
337  void Print (std::ostream &os) const;
338 
347  void Print (std::ostream &os, int level) const;
348 
349  bool operator== (const PbbAddressTlvBlock &other) const;
350  bool operator!= (const PbbAddressTlvBlock &other) const;
351 
352 private:
353  std::list< Ptr<PbbAddressTlv> > m_tlvList;
354 };
355 
364 class PbbPacket : public SimpleRefCount<PbbPacket,Header>
365 {
366 public:
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;
371 
372  PbbPacket (void);
373  ~PbbPacket (void);
374 
380  uint8_t GetVersion (void) const;
381 
386  void SetSequenceNumber (uint16_t number);
387 
394  uint16_t GetSequenceNumber (void) const;
395 
403  bool HasSequenceNumber (void) const;
404 
405  /* Manipulating Packet TLVs */
406 
410  TlvIterator TlvBegin (void);
411 
415  ConstTlvIterator TlvBegin (void) const;
416 
420  TlvIterator TlvEnd (void);
421 
426  ConstTlvIterator TlvEnd (void) const;
427 
431  int TlvSize (void) const;
432 
436  bool TlvEmpty (void) const;
437 
441  Ptr<PbbTlv> TlvFront (void);
442 
446  const Ptr<PbbTlv> TlvFront (void) const;
447 
451  Ptr<PbbTlv> TlvBack (void);
452 
456  const Ptr<PbbTlv> TlvBack (void) const;
457 
462  void TlvPushFront (Ptr<PbbTlv> tlv);
463 
467  void TlvPopFront (void);
468 
473  void TlvPushBack (Ptr<PbbTlv> tlv);
474 
478  void TlvPopBack (void);
479 
485  TlvIterator Erase (TlvIterator position);
486 
496  TlvIterator Erase (TlvIterator first, TlvIterator last);
497 
501  void TlvClear (void);
502 
503  /* Manipulating Packet Messages */
504 
508  MessageIterator MessageBegin (void);
509 
513  ConstMessageIterator MessageBegin (void) const;
514 
518  MessageIterator MessageEnd (void);
519 
524  ConstMessageIterator MessageEnd (void) const;
525 
529  int MessageSize (void) const;
530 
534  bool MessageEmpty (void) const;
535 
540 
544  const Ptr<PbbMessage> MessageFront (void) const;
545 
550 
554  const Ptr<PbbMessage> MessageBack (void) const;
555 
560  void MessagePushFront (Ptr<PbbMessage> message);
561 
565  void MessagePopFront (void);
566 
571  void MessagePushBack (Ptr<PbbMessage> message);
572 
576  void MessagePopBack (void);
577 
583  MessageIterator Erase (MessageIterator position);
584 
592  MessageIterator Erase (MessageIterator first, MessageIterator last);
593 
597  void MessageClear (void);
598 
599  /* Methods implemented by all headers */
600  static TypeId GetTypeId (void);
601  virtual TypeId GetInstanceTypeId (void) const;
602 
606  virtual uint32_t GetSerializedSize (void) const;
607 
612  virtual void Serialize (Buffer::Iterator start) const;
613 
622  virtual uint32_t Deserialize (Buffer::Iterator start);
623 
628  virtual void Print (std::ostream &os) const;
629 
630  bool operator== (const PbbPacket &other) const;
631  bool operator!= (const PbbPacket &other) const;
632 
633 protected:
634 
635 private:
636  PbbTlvBlock m_tlvList;
637  std::list< Ptr<PbbMessage> > m_messageList;
638 
639  uint8_t m_version;
640 
641  bool m_hasseqnum;
642  uint16_t m_seqnum;
643 };
644 
652 class PbbMessage : public SimpleRefCount<PbbMessage>
653 {
654 public:
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;
659 
660  PbbMessage ();
661  virtual ~PbbMessage ();
662 
667  void SetType (uint8_t type);
668 
672  uint8_t GetType (void) const;
673 
678  void SetOriginatorAddress (Address address);
679 
686  Address GetOriginatorAddress (void) const;
687 
692  bool HasOriginatorAddress (void) const;
693 
698  void SetHopLimit (uint8_t hoplimit);
699 
706  uint8_t GetHopLimit (void) const;
707 
714  bool HasHopLimit (void) const;
715 
720  void SetHopCount (uint8_t hopcount);
721 
728  uint8_t GetHopCount (void) const;
729 
734  bool HasHopCount (void) const;
735 
740  void SetSequenceNumber (uint16_t seqnum);
741 
748  uint16_t GetSequenceNumber (void) const;
749 
754  bool HasSequenceNumber (void) const;
755 
756  /* Manipulating PbbMessage TLVs */
757 
761  TlvIterator TlvBegin ();
762 
766  ConstTlvIterator TlvBegin () const;
767 
772  TlvIterator TlvEnd ();
773 
778  ConstTlvIterator TlvEnd () const;
779 
783  int TlvSize (void) const;
784 
788  bool TlvEmpty (void) const;
789 
793  Ptr<PbbTlv> TlvFront (void);
794 
798  const Ptr<PbbTlv> TlvFront (void) const;
799 
803  Ptr<PbbTlv> TlvBack (void);
804 
808  const Ptr<PbbTlv> TlvBack (void) const;
809 
814  void TlvPushFront (Ptr<PbbTlv> tlv);
815 
819  void TlvPopFront (void);
820 
825  void TlvPushBack (Ptr<PbbTlv> tlv);
826 
830  void TlvPopBack (void);
831 
837  TlvIterator TlvErase (TlvIterator position);
838 
848  TlvIterator TlvErase (TlvIterator first, TlvIterator last);
849 
853  void TlvClear (void);
854 
855  /* Manipulating Address Block and Address TLV pairs */
856 
860  AddressBlockIterator AddressBlockBegin ();
861 
865  ConstAddressBlockIterator AddressBlockBegin () const;
866 
871  AddressBlockIterator AddressBlockEnd ();
872 
877  ConstAddressBlockIterator AddressBlockEnd () const;
878 
882  int AddressBlockSize (void) const;
883 
888  bool AddressBlockEmpty (void) const;
889 
894 
898  const Ptr<PbbAddressBlock> AddressBlockFront (void) const;
899 
904 
908  const Ptr<PbbAddressBlock> AddressBlockBack (void) const;
909 
915 
919  void AddressBlockPopFront (void);
920 
926 
930  void AddressBlockPopBack (void);
931 
937  AddressBlockIterator AddressBlockErase (AddressBlockIterator position);
938 
948  AddressBlockIterator AddressBlockErase (AddressBlockIterator first,
949  AddressBlockIterator last);
950 
954  void AddressBlockClear (void);
955 
966 
970  uint32_t GetSerializedSize (void) const;
971 
979  void Serialize (Buffer::Iterator &start) const;
980 
988  void Deserialize (Buffer::Iterator &start);
989 
994  void Print (std::ostream &os) const;
995 
1005  void Print (std::ostream &os, int level) const;
1006 
1007  bool operator== (const PbbMessage &other) const;
1008  bool operator!= (const PbbMessage &other) const;
1009 
1010 protected:
1011  /* PbbMessage size in bytes - 1.
1012  *
1013  * IPv4 = 4 - 1 = 3, IPv6 = 16 - 1 = 15
1014  */
1015  virtual PbbAddressLength GetAddressLength (void) const = 0;
1016 
1017  virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const = 0;
1018  virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const = 0;
1019  virtual void PrintOriginatorAddress (std::ostream &os) const = 0;
1020 
1021  virtual Ptr<PbbAddressBlock> AddressBlockDeserialize (Buffer::Iterator &start) const = 0;
1022 
1023 private:
1024  PbbTlvBlock m_tlvList;
1025  std::list< Ptr<PbbAddressBlock> > m_addressBlockList;
1026 
1027  uint8_t m_type;
1028  PbbAddressLength m_addrSize;
1029 
1030  bool m_hasOriginatorAddress;
1031  Address m_originatorAddress;
1032 
1033  bool m_hasHopLimit;
1034  uint8_t m_hopLimit;
1035 
1036  bool m_hasHopCount;
1037  uint8_t m_hopCount;
1038 
1039  bool m_hasSequenceNumber;
1040  uint16_t m_sequenceNumber;
1041 };
1042 
1048 class PbbMessageIpv4 : public PbbMessage {
1049 public:
1050  PbbMessageIpv4 ();
1051  virtual ~PbbMessageIpv4 ();
1052 
1053 protected:
1054  virtual PbbAddressLength GetAddressLength (void) const;
1055 
1056  virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const;
1057  virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const;
1058  virtual void PrintOriginatorAddress (std::ostream &os) const;
1059 
1060  virtual Ptr<PbbAddressBlock> AddressBlockDeserialize (Buffer::Iterator &start) const;
1061 };
1062 
1068 class PbbMessageIpv6 : public PbbMessage {
1069 public:
1070  PbbMessageIpv6 ();
1071  virtual ~PbbMessageIpv6 ();
1072 
1073 protected:
1074  virtual PbbAddressLength GetAddressLength (void) const;
1075 
1076  virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const;
1077  virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const;
1078  virtual void PrintOriginatorAddress (std::ostream &os) const;
1079 
1080  virtual Ptr<PbbAddressBlock> AddressBlockDeserialize (Buffer::Iterator &start) const;
1081 };
1082 
1089 class PbbAddressBlock : public SimpleRefCount<PbbAddressBlock>
1090 {
1091 public:
1092  typedef std::list< Address >::iterator AddressIterator;
1093  typedef std::list< Address >::const_iterator ConstAddressIterator;
1094 
1095  typedef std::list<uint8_t>::iterator PrefixIterator;
1096  typedef std::list<uint8_t>::const_iterator ConstPrefixIterator;
1097 
1098  typedef PbbAddressTlvBlock::Iterator TlvIterator;
1099  typedef PbbAddressTlvBlock::ConstIterator ConstTlvIterator;
1100 
1101  PbbAddressBlock ();
1102  virtual ~PbbAddressBlock ();
1103 
1104  /* Manipulating the address block */
1105 
1109  AddressIterator AddressBegin (void);
1110 
1114  ConstAddressIterator AddressBegin (void) const;
1115 
1119  AddressIterator AddressEnd (void);
1120 
1124  ConstAddressIterator AddressEnd (void) const;
1125 
1129  int AddressSize (void) const;
1130 
1134  bool AddressEmpty (void) const;
1135 
1139  Address AddressFront (void) const;
1140 
1144  Address AddressBack (void) const;
1145 
1150  void AddressPushFront (Address address);
1151 
1155  void AddressPopFront (void);
1156 
1161  void AddressPushBack (Address address);
1162 
1166  void AddressPopBack (void);
1167 
1175  AddressIterator AddressInsert (AddressIterator position,
1176  const Address value);
1177 
1183  AddressIterator AddressErase (AddressIterator position);
1184 
1194  AddressIterator AddressErase (AddressIterator first, AddressIterator last);
1195 
1199  void AddressClear (void);
1200 
1201  /* Prefix methods */
1202 
1206  PrefixIterator PrefixBegin (void);
1207 
1211  ConstPrefixIterator PrefixBegin (void) const;
1212 
1216  PrefixIterator PrefixEnd (void);
1217 
1221  ConstPrefixIterator PrefixEnd (void) const;
1222 
1226  int PrefixSize (void) const;
1227 
1231  bool PrefixEmpty (void) const;
1232 
1236  uint8_t PrefixFront (void) const;
1237 
1241  uint8_t PrefixBack (void) const;
1242 
1247  void PrefixPushFront (uint8_t prefix);
1248 
1252  void PrefixPopFront (void);
1253 
1258  void PrefixPushBack (uint8_t prefix);
1259 
1263  void PrefixPopBack (void);
1264 
1272  PrefixIterator PrefixInsert (PrefixIterator position, const uint8_t value);
1273 
1279  PrefixIterator PrefixErase (PrefixIterator position);
1280 
1290  PrefixIterator PrefixErase (PrefixIterator first, PrefixIterator last);
1291 
1295  void PrefixClear (void);
1296 
1297  /* Manipulating the TLV block */
1298 
1302  TlvIterator TlvBegin (void);
1303 
1307  ConstTlvIterator TlvBegin (void) const;
1308 
1312  TlvIterator TlvEnd (void);
1313 
1317  ConstTlvIterator TlvEnd (void) const;
1318 
1322  int TlvSize (void) const;
1323 
1327  bool TlvEmpty (void) const;
1328 
1333 
1337  const Ptr<PbbAddressTlv> TlvFront (void) const;
1338 
1342  Ptr<PbbAddressTlv> TlvBack (void);
1343 
1347  const Ptr<PbbAddressTlv> TlvBack (void) const;
1348 
1353  void TlvPushFront (Ptr<PbbAddressTlv> address);
1354 
1358  void TlvPopFront (void);
1359 
1364  void TlvPushBack (Ptr<PbbAddressTlv> address);
1365 
1369  void TlvPopBack (void);
1370 
1378  TlvIterator TlvInsert (TlvIterator position, const Ptr<PbbTlv> value);
1379 
1385  TlvIterator TlvErase (TlvIterator position);
1386 
1396  TlvIterator TlvErase (TlvIterator first, TlvIterator last);
1397 
1401  void TlvClear (void);
1402 
1406  uint32_t GetSerializedSize (void) const;
1407 
1415  void Serialize (Buffer::Iterator &start) const;
1416 
1424  void Deserialize (Buffer::Iterator &start);
1425 
1430  void Print (std::ostream &os) const;
1431 
1441  void Print (std::ostream &os, int level) const;
1442 
1443  bool operator== (const PbbAddressBlock &other) const;
1444  bool operator!= (const PbbAddressBlock &other) const;
1445 
1446 protected:
1447  virtual uint8_t GetAddressLength (void) const = 0;
1448 
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;
1452 
1453 private:
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;
1458 
1459  std::list<Address> m_addressList;
1460  std::list<uint8_t> m_prefixList;
1461  PbbAddressTlvBlock m_addressTlvList;
1462 };
1463 
1470 {
1471 public:
1473  virtual ~PbbAddressBlockIpv4 ();
1474 
1475 protected:
1476  virtual uint8_t GetAddressLength (void) const;
1477 
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;
1481 };
1482 
1489 {
1490 public:
1492  virtual ~PbbAddressBlockIpv6 ();
1493 
1494 protected:
1495  virtual uint8_t GetAddressLength (void) const;
1496 
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;
1500 };
1501 
1505 class PbbTlv : public SimpleRefCount<PbbTlv>
1506 {
1507 public:
1508  PbbTlv (void);
1509  virtual ~PbbTlv (void);
1510 
1515  void SetType (uint8_t type);
1516 
1520  uint8_t GetType (void) const;
1521 
1529  void SetTypeExt (uint8_t type);
1530 
1537  uint8_t GetTypeExt (void) const;
1538 
1546  bool HasTypeExt (void) const;
1547 
1555  void SetValue (Buffer start);
1556 
1565  void SetValue (const uint8_t * buffer, uint32_t size);
1566 
1573  Buffer GetValue (void) const;
1574 
1582  bool HasValue (void) const;
1583 
1587  uint32_t GetSerializedSize (void) const;
1588 
1596  void Serialize (Buffer::Iterator &start) const;
1597 
1605  void Deserialize (Buffer::Iterator &start);
1606 
1611  void Print (std::ostream &os) const;
1612 
1621  void Print (std::ostream &os, int level) const;
1622 
1623  bool operator== (const PbbTlv &other) const;
1624  bool operator!= (const PbbTlv &other) const;
1625 
1626 protected:
1627  void SetIndexStart (uint8_t index);
1628  uint8_t GetIndexStart (void) const;
1629  bool HasIndexStart (void) const;
1630 
1631  void SetIndexStop (uint8_t index);
1632  uint8_t GetIndexStop (void) const;
1633  bool HasIndexStop (void) const;
1634 
1635  void SetMultivalue (bool isMultivalue);
1636  bool IsMultivalue (void) const;
1637 
1638 private:
1639  uint8_t m_type;
1640 
1641  bool m_hasTypeExt;
1642  uint8_t m_typeExt;
1643 
1644  bool m_hasIndexStart;
1645  uint8_t m_indexStart;
1646 
1647  bool m_hasIndexStop;
1648  uint8_t m_indexStop;
1649 
1650  bool m_isMultivalue;
1651  bool m_hasValue;
1652  Buffer m_value;
1653 };
1654 
1658 class PbbAddressTlv : public PbbTlv
1659 {
1660 public:
1666  void SetIndexStart (uint8_t index);
1667 
1675  uint8_t GetIndexStart (void) const;
1676 
1684  bool HasIndexStart (void) const;
1685 
1691  void SetIndexStop (uint8_t index);
1692 
1700  uint8_t GetIndexStop (void) const;
1701 
1709  bool HasIndexStop (void) const;
1710 
1719  void SetMultivalue (bool isMultivalue);
1720 
1725  bool IsMultivalue (void) const;
1726 };
1727 
1728 } /* namespace ns3 */
1729 
1730 #endif /* PACKETBB_H */
PrefixIterator PrefixEnd(void)
Definition: packetbb.cc:1972
AddressBlockIterator AddressBlockEnd()
Definition: packetbb.cc:1292
void Print(std::ostream &os) const
Pretty-prints the contents of this message.
Definition: packetbb.cc:1575
void TlvPushBack(Ptr< PbbTlv > tlv)
Appends a packet TLV to the back of this packet.
Definition: packetbb.cc:676
void AddressBlockPushBack(Ptr< PbbAddressBlock > block)
Appends an address block to the front of this message.
Definition: packetbb.cc:1362
TlvIterator TlvBegin(void)
Definition: packetbb.cc:592
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
void MessagePushFront(Ptr< PbbMessage > message)
Prepends a message to the front of this packet.
Definition: packetbb.cc:783
Ptr< PbbMessage > MessageBack(void)
Definition: packetbb.cc:769
A packet or message TLV.
Definition: packetbb.h:1505
void PushFront(Ptr< PbbTlv > tlv)
Prepends a TLV to the front of this block.
Definition: packetbb.cc:132
uint16_t GetSequenceNumber(void) const
Definition: packetbb.cc:1140
int Size(void) const
Definition: packetbb.cc:104
Main PacketBB Packet object.
Definition: packetbb.h:364
void MessagePushBack(Ptr< PbbMessage > message)
Appends a message to the back of this packet.
Definition: packetbb.cc:797
void PopFront(void)
Removes an AddressTLV from the front of this block.
Definition: packetbb.cc:380
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:2793
Concrete IPv4 specific PbbAddressBlock.
Definition: packetbb.h:1469
void PushFront(Ptr< PbbAddressTlv > tlv)
Prepends an Address TLV to the front of this block.
Definition: packetbb.cc:373
void SetSequenceNumber(uint16_t number)
Sets the sequence number of this packet.
Definition: packetbb.cc:567
bool HasSequenceNumber(void) const
Tests whether or not this message has a sequence number.
Definition: packetbb.cc:1148
int TlvSize(void) const
Definition: packetbb.cc:2100
automatically resized byte buffer
Definition: buffer.h:92
int PrefixSize(void) const
Definition: packetbb.cc:1986
void AddressBlockPopBack(void)
Removes an address block from the back of this message.
Definition: packetbb.cc:1369
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:3052
TlvIterator TlvEnd()
Definition: packetbb.cc:1171
bool TlvEmpty(void) const
Definition: packetbb.cc:627
void TlvPushFront(Ptr< PbbTlv > tlv)
Prepends a packet TLV to the front of this packet.
Definition: packetbb.cc:662
PbbAddressLength
Definition: packetbb.h:45
Ptr< PbbAddressBlock > AddressBlockBack(void)
Definition: packetbb.cc:1334
void PrefixPopBack(void)
Removes a prefix from the back of this block.
Definition: packetbb.cc:2035
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.
Definition: packetbb.cc:2694
AddressIterator AddressEnd(void)
Definition: packetbb.cc:1864
void SetMultivalue(bool isMultivalue)
Sets whether or not this address TLV is "multivalue".
Definition: packetbb.cc:3073
A message within a PbbPacket packet.
Definition: packetbb.h:652
void MessageClear(void)
Removes all messages from this packet.
Definition: packetbb.cc:826
void PushBack(Ptr< PbbTlv > tlv)
Appends a TLV to the back of this block.
Definition: packetbb.cc:146
TlvIterator TlvBegin()
Definition: packetbb.cc:1157
Ptr< PbbAddressTlv > Back(void) const
Definition: packetbb.cc:366
void Print(std::ostream &os) const
Pretty-prints the contents of this block.
Definition: packetbb.cc:487
bool HasIndexStart(void) const
Tests whether or not this address TLV has a start index.
Definition: packetbb.cc:3045
bool HasIndexStop(void) const
Tests whether or not this address TLV has a stop index.
Definition: packetbb.cc:3066
void MessagePopFront(void)
Removes a message from the front of this packet.
Definition: packetbb.cc:790
void SetSequenceNumber(uint16_t seqnum)
Sets the sequence number of this message.
Definition: packetbb.cc:1132
void TlvPopBack(void)
Removes a message TLV from the back of this message.
Definition: packetbb.cc:1248
uint8_t GetIndexStart(void) const
Definition: packetbb.cc:3038
Ptr< PbbAddressTlv > TlvFront(void)
Definition: packetbb.cc:2114
bool IsMultivalue(void) const
Tests whether or not this address TLV is "multivalue".
Definition: packetbb.cc:3080
Ptr< PbbTlv > TlvBack(void)
Definition: packetbb.cc:648
iterator in a Buffer instance
Definition: buffer.h:98
a polymophic address class
Definition: address.h:86
MessageIterator MessageEnd(void)
Definition: packetbb.cc:727
AddressBlockIterator AddressBlockBegin()
Definition: packetbb.cc:1278
void SetType(uint8_t type)
Sets the type of this TLV.
Definition: packetbb.cc:2664
void PopBack(void)
Removes an Address TLV from the back of this block.
Definition: packetbb.cc:394
bool TlvEmpty(void) const
Definition: packetbb.cc:2107
bool AddressEmpty(void) const
Definition: packetbb.cc:1885
void AddressBlockClear(void)
Removes all address blocks from this message.
Definition: packetbb.cc:1391
Address GetOriginatorAddress(void) const
Definition: packetbb.cc:1071
uint8_t GetTypeExt(void) const
Definition: packetbb.cc:2686
Concrete IPv4 specific PbbMessage.
Definition: packetbb.h:1048
void TlvPushFront(Ptr< PbbAddressTlv > address)
Prepends an address TLV to the front of this message.
Definition: packetbb.cc:2142
Iterator Erase(Iterator position)
Removes the Address TLV at the specified position.
Definition: packetbb.cc:408
void AddressPopFront(void)
Removes an address from the front of this block.
Definition: packetbb.cc:1913
TlvIterator TlvBegin(void)
Definition: packetbb.cc:2072
TlvIterator Erase(TlvIterator position)
Removes the packet TLV at the specified position.
Definition: packetbb.cc:690
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:3031
Ptr< PbbAddressTlv > TlvBack(void)
Definition: packetbb.cc:2128
uint8_t GetVersion(void) const
Definition: packetbb.cc:560
void PushBack(Ptr< PbbAddressTlv > tlv)
Appends an Address TLV to the back of this block.
Definition: packetbb.cc:387
void SetType(uint8_t type)
Sets the type for this message.
Definition: packetbb.cc:1042
void Serialize(Buffer::Iterator &start) const
Serializes this message into the specified buffer.
Definition: packetbb.cc:1443
void TlvPopBack(void)
Removes an address TLV from the back of this message.
Definition: packetbb.cc:2163
uint16_t GetSequenceNumber(void) const
Definition: packetbb.cc:575
int MessageSize(void) const
Definition: packetbb.cc:741
void AddressPushBack(Address address)
Appends an address to the back of this block.
Definition: packetbb.cc:1920
Address AddressFront(void) const
Definition: packetbb.cc:1892
void TlvClear(void)
Removes all message TLVs from this block.
Definition: packetbb.cc:1269
Ptr< PbbAddressBlock > AddressBlockFront(void)
Definition: packetbb.cc:1320
bool TlvEmpty(void) const
Definition: packetbb.cc:1192
TlvIterator TlvEnd(void)
Definition: packetbb.cc:2086
uint8_t PrefixBack(void) const
Definition: packetbb.cc:2007
Ptr< PbbTlv > Front(void) const
Definition: packetbb.cc:118
bool HasHopCount(void) const
Tests whether or not this message has a hop count.
Definition: packetbb.cc:1125
uint8_t GetType(void) const
Definition: packetbb.cc:2671
bool Empty(void) const
Definition: packetbb.cc:352
Ptr< PbbTlv > Back(void) const
Definition: packetbb.cc:125
void Deserialize(Buffer::Iterator &start)
Deserializes a block from the specified buffer.
Definition: packetbb.cc:469
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:192
int AddressBlockSize(void) const
Definition: packetbb.cc:1306
void Deserialize(Buffer::Iterator &start)
Deserializes a block from the specified buffer.
Definition: packetbb.cc:228
virtual uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:854
void Deserialize(Buffer::Iterator &start)
Deserializes a message from the specified buffer.
Definition: packetbb.cc:1533
void TlvPopFront(void)
Removes a message TLV from the front of this message.
Definition: packetbb.cc:1234
bool HasValue(void) const
Tests whether or not this TLV has a value.
Definition: packetbb.cc:2786
void Deserialize(Buffer::Iterator &start)
Deserializes a TLV from the specified buffer.
Definition: packetbb.cc:2888
void TlvPopBack(void)
Removes a packet TLV from the back of this block.
Definition: packetbb.cc:683
void SetHopLimit(uint8_t hoplimit)
Sets the maximum number of hops this message should travel.
Definition: packetbb.cc:1086
bool HasOriginatorAddress(void) const
Tests whether or not this message has an originator address.
Definition: packetbb.cc:1079
Concrete IPv6 specific PbbAddressBlock.
Definition: packetbb.h:1488
uint8_t PrefixFront(void) const
Definition: packetbb.cc:2000
void PrefixPushFront(uint8_t prefix)
Prepends a prefix to the front of this block.
Definition: packetbb.cc:2014
bool HasHopLimit(void) const
Tests whether or not this message has a hop limit.
Definition: packetbb.cc:1102
AddressBlockIterator AddressBlockErase(AddressBlockIterator position)
Removes the address block at the specified position.
Definition: packetbb.cc:1376
void Serialize(Buffer::Iterator &start) const
Serializes this address block into the specified buffer.
Definition: packetbb.cc:2239
void Print(std::ostream &os) const
Pretty-prints the contents of this TLV.
Definition: packetbb.cc:2933
int Size(void) const
Definition: packetbb.cc:345
void Print(std::ostream &os) const
Pretty-prints the contents of this address block.
Definition: packetbb.cc:2377
int TlvSize(void) const
Definition: packetbb.cc:620
void TlvClear(void)
Removes all address TLVs from this block.
Definition: packetbb.cc:2185
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:433
void PrefixPushBack(uint8_t prefix)
Appends a prefix to the back of this block.
Definition: packetbb.cc:2028
An Address TLV.
Definition: packetbb.h:1658
void AddressBlockPopFront(void)
Removes an address block from the front of this message.
Definition: packetbb.cc:1355
A block of packet or message TLVs (PbbTlv).
Definition: packetbb.h:55
uint8_t GetType(void) const
Definition: packetbb.cc:1049
bool MessageEmpty(void) const
Definition: packetbb.cc:748
uint8_t GetIndexStop(void) const
Definition: packetbb.cc:3059
void Print(std::ostream &os) const
Pretty-prints the contents of this block.
Definition: packetbb.cc:246
void TlvPushBack(Ptr< PbbAddressTlv > address)
Appends an address TLV to the back of this message.
Definition: packetbb.cc:2156
int AddressSize(void) const
Definition: packetbb.cc:1878
bool Empty(void) const
Definition: packetbb.cc:111
Iterator End(void)
Definition: packetbb.cc:90
A block of Address TLVs (PbbAddressTlv).
Definition: packetbb.h:207
uint8_t GetHopCount(void) const
Definition: packetbb.cc:1117
bool HasSequenceNumber(void) const
Tests whether or not this packet has a sequence number.
Definition: packetbb.cc:583
void PopBack(void)
Removes a TLV from the back of this block.
Definition: packetbb.cc:153
void TlvPopFront(void)
Removes a packet TLV from the front of this packet.
Definition: packetbb.cc:669
uint8_t GetHopLimit(void) const
Definition: packetbb.cc:1094
PrefixIterator PrefixInsert(PrefixIterator position, const uint8_t value)
Inserts a prefix at the specified position in this block.
Definition: packetbb.cc:2042
Ptr< PbbTlv > TlvBack(void)
Definition: packetbb.cc:1213
TlvIterator TlvErase(TlvIterator position)
Removes the message TLV at the specified position.
Definition: packetbb.cc:1255
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:1404
void AddressBlockPushFront(Ptr< PbbAddressBlock > block)
Prepends an address block to the front of this message.
Definition: packetbb.cc:1348
void MessagePopBack(void)
Removes a message from the back of this packet.
Definition: packetbb.cc:804
Ptr< PbbTlv > TlvFront(void)
Definition: packetbb.cc:1199
Iterator Insert(Iterator position, const Ptr< PbbAddressTlv > tlv)
Inserts an Address TLV at the specified position in this block.
Definition: packetbb.cc:401
TlvIterator TlvEnd(void)
Definition: packetbb.cc:606
void SetTypeExt(uint8_t type)
Sets the type extension of this TLV.
Definition: packetbb.cc:2678
AddressIterator AddressBegin(void)
Definition: packetbb.cc:1850
int TlvSize(void) const
Definition: packetbb.cc:1185
void AddressClear(void)
Removes all addresses from this block.
Definition: packetbb.cc:1949
void SetHopCount(uint8_t hopcount)
Sets the current number of hops this message has traveled.
Definition: packetbb.cc:1109
Ptr< PbbTlv > TlvFront(void)
Definition: packetbb.cc:634
void PrefixPopFront(void)
Removes a prefix from the front of this block.
Definition: packetbb.cc:2021
Address AddressBack(void) const
Definition: packetbb.cc:1899
PrefixIterator PrefixErase(PrefixIterator position)
Removes the prefix at the specified position.
Definition: packetbb.cc:2049
void Serialize(Buffer::Iterator &start) const
Serializes this block into the specified buffer.
Definition: packetbb.cc:205
Iterator Begin(void)
Definition: packetbb.cc:76
void SetOriginatorAddress(Address address)
Sets the address for the node that created this packet.
Definition: packetbb.cc:1063
uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:2191
void Deserialize(Buffer::Iterator &start)
Deserializes an address block from the specified buffer.
Definition: packetbb.cc:2323
Iterator Insert(Iterator position, const Ptr< PbbTlv > tlv)
Inserts a TLV at the specified position in this block.
Definition: packetbb.cc:160
void TlvPopFront(void)
Removes an address TLV from the front of this message.
Definition: packetbb.cc:2149
Buffer GetValue(void) const
Definition: packetbb.cc:2778
void Clear(void)
Removes all Address TLVs from this block.
Definition: packetbb.cc:422
void SetValue(Buffer start)
Sets the value of this message to the specified buffer.
Definition: packetbb.cc:2761
Iterator Begin(void)
Definition: packetbb.cc:317
PrefixIterator PrefixBegin(void)
Definition: packetbb.cc:1958
virtual void Print(std::ostream &os) const
Pretty-prints the contents of this block.
Definition: packetbb.cc:950
Ptr< PbbMessage > MessageFront(void)
Definition: packetbb.cc:755
void TlvPushFront(Ptr< PbbTlv > tlv)
Prepends a message TLV to the front of this message.
Definition: packetbb.cc:1227
MessageIterator MessageBegin(void)
Definition: packetbb.cc:713
void Clear(void)
Removes all TLVs from this block.
Definition: packetbb.cc:181
Iterator End(void)
Definition: packetbb.cc:331
AddressIterator AddressErase(AddressIterator position)
Removes the address at the specified position.
Definition: packetbb.cc:1934
void AddressPopBack(void)
Removes an address from the back of this block.
Definition: packetbb.cc:1927
Concrete IPv6 specific PbbMessage class.
Definition: packetbb.h:1068
A template-based reference counting class.
void Serialize(Buffer::Iterator &start) const
Serializes this block into the specified buffer.
Definition: packetbb.cc:446
a unique identifier for an interface.
Definition: type-id.h:44
virtual void Serialize(Buffer::Iterator start) const
Serializes this packet into the specified buffer.
Definition: packetbb.cc:881
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:1500
bool AddressBlockEmpty(void) const
Definition: packetbb.cc:1313
An Address Block and its associated Address TLV Blocks.
Definition: packetbb.h:1089
void Serialize(Buffer::Iterator &start) const
Serializes this TLV into the specified buffer.
Definition: packetbb.cc:2831
void TlvPushBack(Ptr< PbbTlv > tlv)
Appends a message TLV to the back of this message.
Definition: packetbb.cc:1241
virtual TypeId GetInstanceTypeId(void) const
Definition: packetbb.cc:848
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.
Definition: packetbb.cc:1906
void PrefixClear(void)
Removes all prefixes from this block.
Definition: packetbb.cc:2063
bool PrefixEmpty(void) const
Definition: packetbb.cc:1993
Ptr< PbbAddressTlv > Front(void) const
Definition: packetbb.cc:359
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserializes a packet from the specified buffer.
Definition: packetbb.cc:916
void TlvClear(void)
Removes all packet TLVs from this packet.
Definition: packetbb.cc:704
TlvIterator TlvErase(TlvIterator position)
Removes the address TLV at the specified position.
Definition: packetbb.cc:2170
Iterator Erase(Iterator position)
Removes the TLV at the specified position.
Definition: packetbb.cc:167
void PopFront(void)
Removes a TLV from the front of this block.
Definition: packetbb.cc:139