A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
packetbb-test-suite.cc
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 
22 #include <cstring>
23 #include <iostream>
24 #include "ns3/test.h"
25 #include "ns3/ptr.h"
26 #include "ns3/ipv4-address.h"
27 #include "ns3/ipv6-address.h"
28 #include "ns3/packetbb.h"
29 
30 using namespace ns3;
31 
32 class PbbTestCase : public TestCase
33 {
34 public:
35  PbbTestCase (std::string name, Ptr<PbbPacket> packet,
36  uint8_t * buffer, uint32_t size);
37  virtual ~PbbTestCase (void);
38 
39 protected:
40  virtual void DoRun (void);
41 
42 private:
43  void TestSerialize (void);
44  void TestDeserialize (void);
45 
46  Ptr<PbbPacket> m_refPacket;
47  Buffer m_refBuffer;
48 };
49 
50 PbbTestCase::PbbTestCase (std::string name, Ptr<PbbPacket> packet,
51  uint8_t * buffer, uint32_t size)
52  : TestCase (name)
53 {
54  m_refPacket = packet;
55 
56  m_refBuffer.AddAtStart (size);
57  m_refBuffer.Begin ().Write (buffer, size);
58 }
59 
60 PbbTestCase::~PbbTestCase (void)
61 {
62  return;
63 }
64 
65 void
67 {
68  TestSerialize ();
69  TestDeserialize ();
70 }
71 
72 void
73 PbbTestCase::TestSerialize (void)
74 {
75  Buffer newBuffer;
76  newBuffer.AddAtStart (m_refPacket->GetSerializedSize ());
77  m_refPacket->Serialize (newBuffer.Begin ());
78 
79  NS_TEST_ASSERT_MSG_EQ (newBuffer.GetSize (), m_refBuffer.GetSize (),
80  "serialization failed, buffers have different sizes");
81 
82  int memrv = memcmp (newBuffer.PeekData (), m_refBuffer.PeekData (),
83  newBuffer.GetSize ());
84 
85  NS_TEST_ASSERT_MSG_EQ (memrv, 0,
86  "serialization faled, buffers differ");
87 }
88 
89 void
90 PbbTestCase::TestDeserialize (void)
91 {
92  Ptr<PbbPacket> newPacket = Create<PbbPacket> ();
93  uint32_t numbytes = newPacket->Deserialize (m_refBuffer.Begin ());
94 
95  NS_TEST_ASSERT_MSG_EQ (numbytes, m_refBuffer.GetSize (),
96  "deserialization failed, did not use all bytes");
97 
98  NS_TEST_ASSERT_MSG_EQ (*newPacket, *m_refPacket,
99  "deserialization failed, objects do not match");
100 }
101 
102 class PbbTestSuite : public TestSuite
103 {
104 public:
105  PbbTestSuite ();
106 };
107 
108 PbbTestSuite::PbbTestSuite ()
109  : TestSuite ("packetbb-test-suite", UNIT)
110 {
111  /* Test 1
112  * ,------------------
113  * | PACKET
114  * |------------------
115  * | * Packet version: 0
116  * | * Packet flags: 0
117  * `------------------
118  */
119  {
120  Ptr<PbbPacket> packet = Create<PbbPacket> ();
121  uint8_t buffer[] = { 0x00};
122  AddTestCase (new PbbTestCase ("1", packet, buffer, sizeof(buffer)), TestCase::QUICK);
123  }
124 
125  /* Test 2
126  * ,------------------
127  * | PACKET
128  * |------------------
129  * | * Packet version: 0
130  * | * Packet flags: 8
131  * | * Packet seq number: 2
132  * `------------------
133  */
134  {
135  Ptr<PbbPacket> packet = Create<PbbPacket> ();
136  packet->SetSequenceNumber (2);
137  uint8_t buffer[] = { 0x08, 0x00, 0x02};
138  AddTestCase (new PbbTestCase ("2", packet, buffer, sizeof(buffer)), TestCase::QUICK);
139  }
140 
141  /* Test 3
142  * ,------------------
143  * | PACKET
144  * |------------------
145  * | * Packet version: 0
146  * | * Packet flags: 12
147  * | * Packet seq number: 3
148  * `------------------
149  * This test has the phastlv flag set to 1 with no tlvs.
150  * I'll come back to this one later.
151  */
152 #if 0
153  {
154  Ptr<PbbPacket> packet = Create<PbbPacket> ();
155  packet->SetSequenceNumber (3);
156  uint8_t buffer[] = { 0x0c, 0x00, 0x03, 0x00, 0x00};
157  AddTestCase (new PbbTestCase ("3", packet, buffer, sizeof(buffer)), TestCase::QUICK);
158  }
159 #endif
160 
161  /* Test 4
162  * ,------------------
163  * | PACKET
164  * |------------------
165  * | * Packet version: 0
166  * | * Packet flags: 12
167  * | * Packet seq number: 4
168  * | | * Packet TLV Block
169  * | | - TLV
170  * | | Flags = 0
171  * | | Type = 1; Value = (warning: parameter is NULL)
172  * `------------------
173  */
174  {
175  Ptr<PbbPacket> packet = Create<PbbPacket> ();
176  packet->SetSequenceNumber (4);
177 
178  Ptr<PbbTlv> tlv = Create<PbbTlv>();
179  tlv->SetType (1);
180 
181  packet->TlvPushBack (tlv);
182  uint8_t buffer[] = {
183  0x0c, 0x00, 0x04, 0x00,
184  0x02, 0x01, 0x00
185  };
186  AddTestCase (new PbbTestCase ("4", packet, buffer, sizeof(buffer)), TestCase::QUICK);
187  }
188 
189  /* Test 5
190  * ,------------------
191  * | PACKET
192  * |------------------
193  * | * Packet version: 0
194  * | * Packet flags: 12
195  * | * Packet seq number: 5
196  * | | * Packet TLV Block
197  * | | - TLV
198  * | | Flags = 0
199  * | | Type = 1; Value = (warning: parameter is NULL)
200  * | | - TLV
201  * | | Flags = 128
202  * | | Type = 2; Type ext. = 100; Value = (warning: parameter is NULL)
203  * `------------------
204  */
205  {
206  Ptr<PbbPacket> packet = Create<PbbPacket> ();
207  packet->SetSequenceNumber (5);
208 
209  Ptr<PbbTlv> tlv1 = Create<PbbTlv>();
210  tlv1->SetType (1);
211  packet->TlvPushBack (tlv1);
212 
213  Ptr<PbbTlv> tlv2 = Create<PbbTlv>();
214  tlv2->SetType (2);
215  tlv2->SetTypeExt (100);
216  packet->TlvPushBack (tlv2);
217 
218  uint8_t buffer[] = {
219  0x0c, 0x00, 0x05, 0x00,
220  0x05, 0x01, 0x00, 0x02,
221  0x80, 0x64
222  };
223  AddTestCase (new PbbTestCase ("5", packet, buffer, sizeof(buffer)), TestCase::QUICK);
224  }
225 
226  /* Test 6
227  * ,------------------
228  * | PACKET
229  * |------------------
230  * | * Packet version: 0
231  * | * Packet flags: 12
232  * | * Packet seq number: 6
233  * | | * Packet TLV Block
234  * | | - TLV
235  * | | Flags = 0
236  * | | Type = 1; Value = (warning: parameter is NULL)
237  * | | - TLV
238  * | | Flags = 144
239  * | | Type = 2; Type ext. = 100; Value = 01 02 03 04
240  * | |
241  * `------------------
242  */
243  {
244  Ptr<PbbPacket> packet = Create<PbbPacket> ();
245  packet->SetSequenceNumber (6);
246 
247  Ptr<PbbTlv> tlv1 = Create<PbbTlv>();
248  tlv1->SetType (1);
249  packet->TlvPushBack (tlv1);
250 
251  Ptr<PbbTlv> tlv2 = Create<PbbTlv>();
252  tlv2->SetType (2);
253  tlv2->SetTypeExt (100);
254 
255  uint8_t tlv2val[] = { 1, 2, 3, 4};
256  tlv2->SetValue (tlv2val, sizeof(tlv2val));
257 
258  packet->TlvPushBack (tlv2);
259 
260  uint8_t buffer[] = {
261  0x0c, 0x00, 0x06, 0x00,
262  0x0a, 0x01, 0x00, 0x02,
263  0x90, 0x64, 0x04, 0x01,
264  0x02, 0x03, 0x04
265  };
266  AddTestCase (new PbbTestCase ("6", packet, buffer, sizeof(buffer)), TestCase::QUICK);
267  }
268 
269  /* Test 7
270  * ,------------------
271  * | PACKET
272  * |------------------
273  * | * Packet version: 0
274  * | * Packet flags: 12
275  * | * Packet seq number: 7
276  * | | * Packet TLV Block
277  * | | - TLV
278  * | | Flags = 0
279  * | | Type = 1; Value = (warning: parameter is NULL)
280  * | | - TLV
281  * | | Flags = 152
282  * | | Type = 2; Type ext. = 100; Value = 00 01 02 03
283  * | | 04 05 06 07
284  * | | 08 09 0a 0b
285  * | | 0c 0d 0e 0f
286  * | | 10 11 12 13
287  * | | 14 15 16 17
288  * | | 18 19 1a 1b
289  * | | 1c 1d 1e 1f
290  * | | 20 21 22 23
291  * | | 24 25 26 27
292  * | | 28 29 2a 2b
293  * | | 2c 2d 2e 2f
294  * | | 30 31 32 33
295  * | | 34 35 36 37
296  * | | 38 39 3a 3b
297  * | | 3c 3d 3e 3f
298  * | | 40 41 42 43
299  * | | 44 45 46 47
300  * | | 48 49 4a 4b
301  * | | 4c 4d 4e 4f
302  * | | 50 51 52 53
303  * | | 54 55 56 57
304  * | | 58 59 5a 5b
305  * | | 5c 5d 5e 5f
306  * | | 60 61 62 63
307  * | | 64 65 66 67
308  * | | 68 69 6a 6b
309  * | | 6c 6d 6e 6f
310  * | | 70 71 72 73
311  * | | 74 75 76 77
312  * | | 78 79 7a 7b
313  * | | 7c 7d 7e 7f
314  * | | 80 81 82 83
315  * | | 84 85 86 87
316  * | | 88 89 8a 8b
317  * | | 8c 8d 8e 8f
318  * | | 90 91 92 93
319  * | | 94 95 96 97
320  * | | 98 99 9a 9b
321  * | | 9c 9d 9e 9f
322  * | | a0 a1 a2 a3
323  * | | a4 a5 a6 a7
324  * | | a8 a9 aa ab
325  * | | ac ad ae af
326  * | | b0 b1 b2 b3
327  * | | b4 b5 b6 b7
328  * | | b8 b9 ba bb
329  * | | bc bd be bf
330  * | | c0 c1 c2 c3
331  * | | c4 c5 c6 c7
332  * | | c8 c9 ca cb
333  * | | cc cd ce cf
334  * | | d0 d1 d2 d3
335  * | | d4 d5 d6 d7
336  * | | d8 d9 da db
337  * | | dc dd de df
338  * | | e0 e1 e2 e3
339  * | | e4 e5 e6 e7
340  * | | e8 e9 ea eb
341  * | | ec ed ee ef
342  * | | f0 f1 f2 f3
343  * | | f4 f5 f6 f7
344  * | | f8 f9 fa fb
345  * | | fc fd fe 00
346  * | | 01 02 03 04
347  * | | 05 06 07 08
348  * | | 09 0a 0b 0c
349  * | | 0d 0e 0f 10
350  * | | 11 12 13 14
351  * | | 15 16 17 18
352  * | | 19 1a 1b 1c
353  * | | 1d 1e 1f 20
354  * | | 21 22 23 24
355  * | | 25 26 27 28
356  * | | 29 2a 2b 2c
357  * | |
358  * `------------------
359  */
360  {
361  Ptr<PbbPacket> packet = Create<PbbPacket> ();
362  packet->SetSequenceNumber (7);
363 
364  Ptr<PbbTlv> tlv1 = Create<PbbTlv>();
365  tlv1->SetType (1);
366  packet->TlvPushBack (tlv1);
367 
368  Ptr<PbbTlv> tlv2 = Create<PbbTlv>();
369  tlv2->SetType (2);
370  tlv2->SetTypeExt (100);
371 
372  uint8_t tlv2val[] = {
373  0x00, 0x01, 0x02, 0x03,
374  0x04, 0x05, 0x06, 0x07,
375  0x08, 0x09, 0x0a, 0x0b,
376  0x0c, 0x0d, 0x0e, 0x0f,
377  0x10, 0x11, 0x12, 0x13,
378  0x14, 0x15, 0x16, 0x17,
379  0x18, 0x19, 0x1a, 0x1b,
380  0x1c, 0x1d, 0x1e, 0x1f,
381  0x20, 0x21, 0x22, 0x23,
382  0x24, 0x25, 0x26, 0x27,
383  0x28, 0x29, 0x2a, 0x2b,
384  0x2c, 0x2d, 0x2e, 0x2f,
385  0x30, 0x31, 0x32, 0x33,
386  0x34, 0x35, 0x36, 0x37,
387  0x38, 0x39, 0x3a, 0x3b,
388  0x3c, 0x3d, 0x3e, 0x3f,
389  0x40, 0x41, 0x42, 0x43,
390  0x44, 0x45, 0x46, 0x47,
391  0x48, 0x49, 0x4a, 0x4b,
392  0x4c, 0x4d, 0x4e, 0x4f,
393  0x50, 0x51, 0x52, 0x53,
394  0x54, 0x55, 0x56, 0x57,
395  0x58, 0x59, 0x5a, 0x5b,
396  0x5c, 0x5d, 0x5e, 0x5f,
397  0x60, 0x61, 0x62, 0x63,
398  0x64, 0x65, 0x66, 0x67,
399  0x68, 0x69, 0x6a, 0x6b,
400  0x6c, 0x6d, 0x6e, 0x6f,
401  0x70, 0x71, 0x72, 0x73,
402  0x74, 0x75, 0x76, 0x77,
403  0x78, 0x79, 0x7a, 0x7b,
404  0x7c, 0x7d, 0x7e, 0x7f,
405  0x80, 0x81, 0x82, 0x83,
406  0x84, 0x85, 0x86, 0x87,
407  0x88, 0x89, 0x8a, 0x8b,
408  0x8c, 0x8d, 0x8e, 0x8f,
409  0x90, 0x91, 0x92, 0x93,
410  0x94, 0x95, 0x96, 0x97,
411  0x98, 0x99, 0x9a, 0x9b,
412  0x9c, 0x9d, 0x9e, 0x9f,
413  0xa0, 0xa1, 0xa2, 0xa3,
414  0xa4, 0xa5, 0xa6, 0xa7,
415  0xa8, 0xa9, 0xaa, 0xab,
416  0xac, 0xad, 0xae, 0xaf,
417  0xb0, 0xb1, 0xb2, 0xb3,
418  0xb4, 0xb5, 0xb6, 0xb7,
419  0xb8, 0xb9, 0xba, 0xbb,
420  0xbc, 0xbd, 0xbe, 0xbf,
421  0xc0, 0xc1, 0xc2, 0xc3,
422  0xc4, 0xc5, 0xc6, 0xc7,
423  0xc8, 0xc9, 0xca, 0xcb,
424  0xcc, 0xcd, 0xce, 0xcf,
425  0xd0, 0xd1, 0xd2, 0xd3,
426  0xd4, 0xd5, 0xd6, 0xd7,
427  0xd8, 0xd9, 0xda, 0xdb,
428  0xdc, 0xdd, 0xde, 0xdf,
429  0xe0, 0xe1, 0xe2, 0xe3,
430  0xe4, 0xe5, 0xe6, 0xe7,
431  0xe8, 0xe9, 0xea, 0xeb,
432  0xec, 0xed, 0xee, 0xef,
433  0xf0, 0xf1, 0xf2, 0xf3,
434  0xf4, 0xf5, 0xf6, 0xf7,
435  0xf8, 0xf9, 0xfa, 0xfb,
436  0xfc, 0xfd, 0xfe, 0x00,
437  0x01, 0x02, 0x03, 0x04,
438  0x05, 0x06, 0x07, 0x08,
439  0x09, 0x0a, 0x0b, 0x0c,
440  0x0d, 0x0e, 0x0f, 0x10,
441  0x11, 0x12, 0x13, 0x14,
442  0x15, 0x16, 0x17, 0x18,
443  0x19, 0x1a, 0x1b, 0x1c,
444  0x1d, 0x1e, 0x1f, 0x20,
445  0x21, 0x22, 0x23, 0x24,
446  0x25, 0x26, 0x27, 0x28,
447  0x29, 0x2a, 0x2b, 0x2c
448  };
449  tlv2->SetValue (tlv2val, sizeof(tlv2val));
450 
451  packet->TlvPushBack (tlv2);
452 
453  uint8_t buffer[] = {
454  0x0c, 0x00, 0x07, 0x01,
455  0x33, 0x01, 0x00, 0x02,
456  0x98, 0x64, 0x01, 0x2c,
457  0x00, 0x01, 0x02, 0x03,
458  0x04, 0x05, 0x06, 0x07,
459  0x08, 0x09, 0x0a, 0x0b,
460  0x0c, 0x0d, 0x0e, 0x0f,
461  0x10, 0x11, 0x12, 0x13,
462  0x14, 0x15, 0x16, 0x17,
463  0x18, 0x19, 0x1a, 0x1b,
464  0x1c, 0x1d, 0x1e, 0x1f,
465  0x20, 0x21, 0x22, 0x23,
466  0x24, 0x25, 0x26, 0x27,
467  0x28, 0x29, 0x2a, 0x2b,
468  0x2c, 0x2d, 0x2e, 0x2f,
469  0x30, 0x31, 0x32, 0x33,
470  0x34, 0x35, 0x36, 0x37,
471  0x38, 0x39, 0x3a, 0x3b,
472  0x3c, 0x3d, 0x3e, 0x3f,
473  0x40, 0x41, 0x42, 0x43,
474  0x44, 0x45, 0x46, 0x47,
475  0x48, 0x49, 0x4a, 0x4b,
476  0x4c, 0x4d, 0x4e, 0x4f,
477  0x50, 0x51, 0x52, 0x53,
478  0x54, 0x55, 0x56, 0x57,
479  0x58, 0x59, 0x5a, 0x5b,
480  0x5c, 0x5d, 0x5e, 0x5f,
481  0x60, 0x61, 0x62, 0x63,
482  0x64, 0x65, 0x66, 0x67,
483  0x68, 0x69, 0x6a, 0x6b,
484  0x6c, 0x6d, 0x6e, 0x6f,
485  0x70, 0x71, 0x72, 0x73,
486  0x74, 0x75, 0x76, 0x77,
487  0x78, 0x79, 0x7a, 0x7b,
488  0x7c, 0x7d, 0x7e, 0x7f,
489  0x80, 0x81, 0x82, 0x83,
490  0x84, 0x85, 0x86, 0x87,
491  0x88, 0x89, 0x8a, 0x8b,
492  0x8c, 0x8d, 0x8e, 0x8f,
493  0x90, 0x91, 0x92, 0x93,
494  0x94, 0x95, 0x96, 0x97,
495  0x98, 0x99, 0x9a, 0x9b,
496  0x9c, 0x9d, 0x9e, 0x9f,
497  0xa0, 0xa1, 0xa2, 0xa3,
498  0xa4, 0xa5, 0xa6, 0xa7,
499  0xa8, 0xa9, 0xaa, 0xab,
500  0xac, 0xad, 0xae, 0xaf,
501  0xb0, 0xb1, 0xb2, 0xb3,
502  0xb4, 0xb5, 0xb6, 0xb7,
503  0xb8, 0xb9, 0xba, 0xbb,
504  0xbc, 0xbd, 0xbe, 0xbf,
505  0xc0, 0xc1, 0xc2, 0xc3,
506  0xc4, 0xc5, 0xc6, 0xc7,
507  0xc8, 0xc9, 0xca, 0xcb,
508  0xcc, 0xcd, 0xce, 0xcf,
509  0xd0, 0xd1, 0xd2, 0xd3,
510  0xd4, 0xd5, 0xd6, 0xd7,
511  0xd8, 0xd9, 0xda, 0xdb,
512  0xdc, 0xdd, 0xde, 0xdf,
513  0xe0, 0xe1, 0xe2, 0xe3,
514  0xe4, 0xe5, 0xe6, 0xe7,
515  0xe8, 0xe9, 0xea, 0xeb,
516  0xec, 0xed, 0xee, 0xef,
517  0xf0, 0xf1, 0xf2, 0xf3,
518  0xf4, 0xf5, 0xf6, 0xf7,
519  0xf8, 0xf9, 0xfa, 0xfb,
520  0xfc, 0xfd, 0xfe, 0x00,
521  0x01, 0x02, 0x03, 0x04,
522  0x05, 0x06, 0x07, 0x08,
523  0x09, 0x0a, 0x0b, 0x0c,
524  0x0d, 0x0e, 0x0f, 0x10,
525  0x11, 0x12, 0x13, 0x14,
526  0x15, 0x16, 0x17, 0x18,
527  0x19, 0x1a, 0x1b, 0x1c,
528  0x1d, 0x1e, 0x1f, 0x20,
529  0x21, 0x22, 0x23, 0x24,
530  0x25, 0x26, 0x27, 0x28,
531  0x29, 0x2a, 0x2b, 0x2c
532  };
533  AddTestCase (new PbbTestCase ("7", packet, buffer, sizeof(buffer)), TestCase::QUICK);
534  }
535 
536  /* Test 8
537  * ,------------------
538  * | PACKET
539  * |------------------
540  * | * Packet version: 0
541  * | * Packet flags: 12
542  * | * Packet seq number: 8
543  * | | * Packet TLV Block
544  * | | - TLV
545  * | | Flags = 0
546  * | | Type = 1; Value = (warning: parameter is NULL)
547  * | ,-------------------
548  * | | MESSAGE
549  * | |-------------------
550  * | | * Message type: 1
551  * | | * Message flags: 0
552  * | `-------------------
553  * |
554  * `------------------
555  */
556  {
557  Ptr<PbbPacket> packet = Create<PbbPacket> ();
558  packet->SetSequenceNumber (8);
559 
560  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
561  tlv1->SetType (1);
562  packet->TlvPushBack (tlv1);
563 
564  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
565  msg1->SetType (1);
566  packet->MessagePushBack (msg1);
567 
568  uint8_t buffer[] = {
569  0x0c, 0x00, 0x08, 0x00,
570  0x02, 0x01, 0x00, 0x01,
571  0x03, 0x00, 0x06, 0x00,
572  0x00
573  };
574  AddTestCase (new PbbTestCase ("8", packet, buffer, sizeof(buffer)), TestCase::QUICK);
575  }
576 
577  /* Test 9
578  * ,------------------
579  * | PACKET
580  * |------------------
581  * | * Packet version: 0
582  * | * Packet flags: 12
583  * | * Packet seq number: 9
584  * | | * Packet TLV Block
585  * | | - TLV
586  * | | Flags = 0
587  * | | Type = 1; Value = (warning: parameter is NULL)
588  * | ,-------------------
589  * | | MESSAGE
590  * | |-------------------
591  * | | * Message type: 1
592  * | | * Message flags: 0
593  * | `-------------------
594  * |
595  * | ,-------------------
596  * | | MESSAGE
597  * | |-------------------
598  * | | * Message type: 2
599  * | | * Message flags: 128
600  * | | * Originator address: 10.0.0.1
601  * | `-------------------
602  * |
603  * `------------------
604  */
605  {
606  Ptr<PbbPacket> packet = Create<PbbPacket> ();
607  packet->SetSequenceNumber (9);
608 
609  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
610  tlv1->SetType (1);
611  packet->TlvPushBack (tlv1);
612 
613  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
614  msg1->SetType (1);
615  packet->MessagePushBack (msg1);
616 
617  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
618  msg2->SetType (2);
619  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
620  packet->MessagePushBack (msg2);
621 
622  uint8_t buffer[] = {
623  0x0c, 0x00, 0x09, 0x00,
624  0x02, 0x01, 0x00, 0x01,
625  0x03, 0x00, 0x06, 0x00,
626  0x00, 0x02, 0x83, 0x00, /* [14] used to be 0x80 */
627  0x0a, 0x0a, 0x00, 0x00,
628  0x01, 0x00, 0x00
629  };
630  AddTestCase (new PbbTestCase ("9", packet, buffer, sizeof(buffer)), TestCase::QUICK);
631  }
632 
633  /* Test 10
634  * ,------------------
635  * | PACKET
636  * |------------------
637  * | * Packet version: 0
638  * | * Packet flags: 12
639  * | * Packet seq number: 10
640  * | | * Packet TLV Block
641  * | | - TLV
642  * | | Flags = 0
643  * | | Type = 1; Value = (warning: parameter is NULL)
644  * | ,-------------------
645  * | | MESSAGE
646  * | |-------------------
647  * | | * Message type: 1
648  * | | * Message flags: 0
649  * | `-------------------
650  * |
651  * | ,-------------------
652  * | | MESSAGE
653  * | |-------------------
654  * | | * Message type: 2
655  * | | * Message flags: 160
656  * | | * Originator address: 10.0.0.1
657  * | | * Hop count: 1
658  * | `-------------------
659  * |
660  * `------------------
661  */
662  {
663  Ptr<PbbPacket> packet = Create<PbbPacket> ();
664  packet->SetSequenceNumber (10);
665 
666  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
667  tlv1->SetType (1);
668  packet->TlvPushBack (tlv1);
669 
670  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
671  msg1->SetType (1);
672  packet->MessagePushBack (msg1);
673 
674  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
675  msg2->SetType (2);
676  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
677  msg2->SetHopCount (1);
678  packet->MessagePushBack (msg2);
679 
680  uint8_t buffer[] = {
681  0x0c, 0x00, 0x0a, 0x00,
682  0x02, 0x01, 0x00, 0x01,
683  0x03, 0x00, 0x06, 0x00,
684  0x00, 0x02, 0xa3, 0x00, /* [14] used to be 0xa0 */
685  0x0b, 0x0a, 0x00, 0x00,
686  0x01, 0x01, 0x00, 0x00,
687  };
688  AddTestCase (new PbbTestCase ("10", packet, buffer, sizeof(buffer)), TestCase::QUICK);
689  }
690 
691  /* Test 11
692  * ,------------------
693  * | PACKET
694  * |------------------
695  * | * Packet version: 0
696  * | * Packet flags: 12
697  * | * Packet seq number: 11
698  * | | * Packet TLV Block
699  * | | - TLV
700  * | | Flags = 0
701  * | | Type = 1; Value = (warning: parameter is NULL)
702  * | ,-------------------
703  * | | MESSAGE
704  * | |-------------------
705  * | | * Message type: 1
706  * | | * Message flags: 0
707  * | `-------------------
708  * |
709  * | ,-------------------
710  * | | MESSAGE
711  * | |-------------------
712  * | | * Message type: 2
713  * | | * Message flags: 224
714  * | | * Originator address: 10.0.0.1
715  * | | * Hop limit: 255
716  * | | * Hop count: 1
717  * | `-------------------
718  * |
719  * `------------------
720  */
721  {
722  Ptr<PbbPacket> packet = Create<PbbPacket> ();
723  packet->SetSequenceNumber (11);
724 
725  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
726  tlv1->SetType (1);
727  packet->TlvPushBack (tlv1);
728 
729  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
730  msg1->SetType (1);
731  packet->MessagePushBack (msg1);
732 
733  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
734  msg2->SetType (2);
735  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
736  msg2->SetHopLimit (255);
737  msg2->SetHopCount (1);
738  packet->MessagePushBack (msg2);
739 
740  uint8_t buffer[] = {
741  0x0c, 0x00, 0x0b, 0x00,
742  0x02, 0x01, 0x00, 0x01,
743  0x03, 0x00, 0x06, 0x00,
744  0x00, 0x02, 0xe3, 0x00, /* [14] used to be 0xe0 */
745  0x0c, 0x0a, 0x00, 0x00,
746  0x01, 0xff, 0x01, 0x00,
747  0x00
748  };
749  AddTestCase (new PbbTestCase ("11", packet, buffer, sizeof(buffer)), TestCase::QUICK);
750  }
751 
752  /* Test 12
753  * ,------------------
754  * | PACKET
755  * |------------------
756  * | * Packet version: 0
757  * | * Packet flags: 12
758  * | * Packet seq number: 12
759  * | | * Packet TLV Block
760  * | | - TLV
761  * | | Flags = 0
762  * | | Type = 1; Value = (warning: parameter is NULL)
763  * | ,-------------------
764  * | | MESSAGE
765  * | |-------------------
766  * | | * Message type: 1
767  * | | * Message flags: 0
768  * | `-------------------
769  * |
770  * | ,-------------------
771  * | | MESSAGE
772  * | |-------------------
773  * | | * Message type: 2
774  * | | * Message flags: 240
775  * | | * Originator address: 10.0.0.1
776  * | | * Hop limit: 255
777  * | | * Hop count: 1
778  * | | * Message seq number: 12345
779  * | `-------------------
780  * |
781  * `------------------
782  */
783  {
784  Ptr<PbbPacket> packet = Create<PbbPacket> ();
785  packet->SetSequenceNumber (12);
786 
787  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
788  tlv1->SetType (1);
789  packet->TlvPushBack (tlv1);
790 
791  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
792  msg1->SetType (1);
793  packet->MessagePushBack (msg1);
794 
795  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
796  msg2->SetType (2);
797  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
798  msg2->SetHopLimit (255);
799  msg2->SetHopCount (1);
800  msg2->SetSequenceNumber (12345);
801  packet->MessagePushBack (msg2);
802 
803  uint8_t buffer[] = {
804  0x0c, 0x00, 0x0c, 0x00,
805  0x02, 0x01, 0x00, 0x01,
806  0x03, 0x00, 0x06, 0x00,
807  0x00, 0x02, 0xf3, 0x00, /* [14] - 0xf0 */
808  0x0e, 0x0a, 0x00, 0x00,
809  0x01, 0xff, 0x01, 0x30,
810  0x39, 0x00, 0x00
811  };
812  AddTestCase (new PbbTestCase ("12", packet, buffer, sizeof(buffer)), TestCase::QUICK);
813  }
814 
815  /* Test 13
816  * ,------------------
817  * | PACKET
818  * |------------------
819  * | * Packet version: 0
820  * | * Packet flags: 12
821  * | * Packet seq number: 13
822  * | | * Packet TLV Block
823  * | | - TLV
824  * | | Flags = 0
825  * | | Type = 1; Value = (warning: parameter is NULL)
826  * | ,-------------------
827  * | | MESSAGE
828  * | |-------------------
829  * | | * Message type: 1
830  * | | * Message flags: 0
831  * | `-------------------
832  * |
833  * | ,-------------------
834  * | | MESSAGE
835  * | |-------------------
836  * | | * Message type: 2
837  * | | * Message flags: 240
838  * | | * Originator address: 10.0.0.1
839  * | | * Hop limit: 255
840  * | | * Hop count: 1
841  * | | * Message seq number: 12345
842  * | `-------------------
843  * |
844  * `------------------
845  */
846  {
847  Ptr<PbbPacket> packet = Create<PbbPacket> ();
848  packet->SetSequenceNumber (13);
849 
850  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
851  tlv1->SetType (1);
852  packet->TlvPushBack (tlv1);
853 
854  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
855  msg1->SetType (1);
856  packet->MessagePushBack (msg1);
857 
858  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
859  msg2->SetType (2);
860  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
861  msg2->SetHopLimit (255);
862  msg2->SetHopCount (1);
863  msg2->SetSequenceNumber (12345);
864  packet->MessagePushBack (msg2);
865 
866  uint8_t buffer[] = {
867  0x0c, 0x00, 0x0d, 0x00,
868  0x02, 0x01, 0x00, 0x01,
869  0x03, 0x00, 0x06, 0x00,
870  0x00, 0x02, 0xf3, 0x00, /* [14] - 0xf0 */
871  0x0e, 0x0a, 0x00, 0x00,
872  0x01, 0xff, 0x01, 0x30,
873  0x39, 0x00, 0x00
874  };
875  AddTestCase (new PbbTestCase ("13", packet, buffer, sizeof(buffer)), TestCase::QUICK);
876  }
877 
878  /* Test 14
879  * ,------------------
880  * | PACKET
881  * |------------------
882  * | * Packet version: 0
883  * | * Packet flags: 12
884  * | * Packet seq number: 14
885  * | | * Packet TLV Block
886  * | | - TLV
887  * | | Flags = 0
888  * | | Type = 1; Value = (warning: parameter is NULL)
889  * | ,-------------------
890  * | | MESSAGE
891  * | |-------------------
892  * | | * Message type: 1
893  * | | * Message flags: 0
894  * | | * Message TLV Block
895  * | | - TLV
896  * | | Flags = 0
897  * | | Type = 1; Value = (warning: parameter is NULL)
898  * | `-------------------
899  * |
900  * | ,-------------------
901  * | | MESSAGE
902  * | |-------------------
903  * | | * Message type: 2
904  * | | * Message flags: 240
905  * | | * Originator address: 10.0.0.1
906  * | | * Hop limit: 255
907  * | | * Hop count: 1
908  * | | * Message seq number: 12345
909  * | `-------------------
910  * |
911  * `------------------
912  */
913  {
914  Ptr<PbbPacket> packet = Create<PbbPacket> ();
915  packet->SetSequenceNumber (14);
916 
917  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
918  tlv1->SetType (1);
919  packet->TlvPushBack (tlv1);
920 
921  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
922  msg1->SetType (1);
923 
924  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
925  msg1tlv1->SetType (1);
926  msg1->TlvPushBack (msg1tlv1);
927 
928  packet->MessagePushBack (msg1);
929 
930  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
931  msg2->SetType (2);
932  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
933  msg2->SetHopLimit (255);
934  msg2->SetHopCount (1);
935  msg2->SetSequenceNumber (12345);
936  packet->MessagePushBack (msg2);
937 
938  uint8_t buffer[] = {
939  0x0c, 0x00, 0x0e, 0x00,
940  0x02, 0x01, 0x00, 0x01,
941  0x03, 0x00, 0x08, 0x00,
942  0x02, 0x01, 0x00, 0x02,
943  0xf3, 0x00, 0x0e, 0x0a, /* [16] - 0xf0 */
944  0x00, 0x00, 0x01, 0xff,
945  0x01, 0x30, 0x39, 0x00,
946  0x00
947  };
948  AddTestCase (new PbbTestCase ("14", packet, buffer, sizeof(buffer)), TestCase::QUICK);
949  }
950 
951  /* Test 15
952  * ,------------------
953  * | PACKET
954  * |------------------
955  * | * Packet version: 0
956  * | * Packet flags: 12
957  * | * Packet seq number: 15
958  * | | * Packet TLV Block
959  * | | - TLV
960  * | | Flags = 0
961  * | | Type = 1; Value = (warning: parameter is NULL)
962  * | ,-------------------
963  * | | MESSAGE
964  * | |-------------------
965  * | | * Message type: 1
966  * | | * Message flags: 0
967  * | | * Message TLV Block
968  * | | - TLV
969  * | | Flags = 0
970  * | | Type = 1; Value = (warning: parameter is NULL)
971  * | `-------------------
972  * |
973  * | ,-------------------
974  * | | MESSAGE
975  * | |-------------------
976  * | | * Message type: 2
977  * | | * Message flags: 240
978  * | | * Originator address: 10.0.0.1
979  * | | * Hop limit: 255
980  * | | * Hop count: 1
981  * | | * Message seq number: 12345
982  * | | - Address block (1 addresses)
983  * | | - 0.0.0.0/32
984  * | | - Flags = 0
985  * | | - ADDRESS TLV block (0 TLVs)
986  * | `-------------------
987  * |
988  * `------------------
989  */
990  {
991  Ptr<PbbPacket> packet = Create<PbbPacket> ();
992  packet->SetSequenceNumber (15);
993 
994  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
995  tlv1->SetType (1);
996  packet->TlvPushBack (tlv1);
997 
998  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
999  msg1->SetType (1);
1000 
1001  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1002  msg1tlv1->SetType (1);
1003  msg1->TlvPushBack (msg1tlv1);
1004 
1005  packet->MessagePushBack (msg1);
1006 
1007  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1008  msg2->SetType (2);
1009  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1010  msg2->SetHopLimit (255);
1011  msg2->SetHopCount (1);
1012  msg2->SetSequenceNumber (12345);
1013 
1014  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1015  msg2a1->AddressPushBack (Ipv4Address ("0.0.0.0"));
1016  msg2->AddressBlockPushBack (msg2a1);
1017 
1018  packet->MessagePushBack (msg2);
1019 
1020  uint8_t buffer[] = {
1021  0x0c, 0x00, 0x0f, 0x00,
1022  0x02, 0x01, 0x00, 0x01,
1023  0x03, 0x00, 0x08, 0x00,
1024  0x02, 0x01, 0x00, 0x02,
1025  0xf3, 0x00, 0x16, 0x0a, /* [16] - 0xf0 */
1026  0x00, 0x00, 0x01, 0xff,
1027  0x01, 0x30, 0x39, 0x00,
1028  0x00, 0x01, 0x00, 0x00,
1029  0x00, 0x00, 0x00, 0x00,
1030  0x00
1031  };
1032  AddTestCase (new PbbTestCase ("15", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1033  }
1034 
1035  /* Test 16
1036  * ,------------------
1037  * | PACKET
1038  * |------------------
1039  * | * Packet version: 0
1040  * | * Packet flags: 12
1041  * | * Packet seq number: 16
1042  * | | * Packet TLV Block
1043  * | | - TLV
1044  * | | Flags = 0
1045  * | | Type = 1; Value = (warning: parameter is NULL)
1046  * | ,-------------------
1047  * | | MESSAGE
1048  * | |-------------------
1049  * | | * Message type: 1
1050  * | | * Message flags: 0
1051  * | | * Message TLV Block
1052  * | | - TLV
1053  * | | Flags = 0
1054  * | | Type = 1; Value = (warning: parameter is NULL)
1055  * | `-------------------
1056  * |
1057  * | ,-------------------
1058  * | | MESSAGE
1059  * | |-------------------
1060  * | | * Message type: 2
1061  * | | * Message flags: 240
1062  * | | * Originator address: 10.0.0.1
1063  * | | * Hop limit: 255
1064  * | | * Hop count: 1
1065  * | | * Message seq number: 12345
1066  * | | - Address block (1 addresses)
1067  * | | - 255.255.255.255/32
1068  * | | - Flags = 0
1069  * | | - ADDRESS TLV block (0 TLVs)
1070  * | `-------------------
1071  * |
1072  * `------------------
1073  */
1074  {
1075  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1076  packet->SetSequenceNumber (16);
1077 
1078  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1079  tlv1->SetType (1);
1080  packet->TlvPushBack (tlv1);
1081 
1082  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1083  msg1->SetType (1);
1084 
1085  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1086  msg1tlv1->SetType (1);
1087  msg1->TlvPushBack (msg1tlv1);
1088 
1089  packet->MessagePushBack (msg1);
1090 
1091  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1092  msg2->SetType (2);
1093  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1094  msg2->SetHopLimit (255);
1095  msg2->SetHopCount (1);
1096  msg2->SetSequenceNumber (12345);
1097 
1098  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1099  msg2a1->AddressPushBack (Ipv4Address ("255.255.255.255"));
1100  msg2->AddressBlockPushBack (msg2a1);
1101 
1102  packet->MessagePushBack (msg2);
1103 
1104  uint8_t buffer[] = {
1105  0x0c, 0x00, 0x10, 0x00,
1106  0x02, 0x01, 0x00, 0x01,
1107  0x03, 0x00, 0x08, 0x00,
1108  0x02, 0x01, 0x00, 0x02,
1109  0xf3, 0x00, 0x16, 0x0a, /* [16] - 0xf0 */
1110  0x00, 0x00, 0x01, 0xff,
1111  0x01, 0x30, 0x39, 0x00,
1112  0x00, 0x01, 0x00, 0xff,
1113  0xff, 0xff, 0xff, 0x00,
1114  0x00,
1115  };
1116  AddTestCase (new PbbTestCase ("16", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1117  }
1118 
1119  /* Test 17
1120  * ,------------------
1121  * | PACKET
1122  * |------------------
1123  * | * Packet version: 0
1124  * | * Packet flags: 12
1125  * | * Packet seq number: 17
1126  * | | * Packet TLV Block
1127  * | | - TLV
1128  * | | Flags = 0
1129  * | | Type = 1; Value = (warning: parameter is NULL)
1130  * | ,-------------------
1131  * | | MESSAGE
1132  * | |-------------------
1133  * | | * Message type: 1
1134  * | | * Message flags: 0
1135  * | | * Message TLV Block
1136  * | | - TLV
1137  * | | Flags = 0
1138  * | | Type = 1; Value = (warning: parameter is NULL)
1139  * | `-------------------
1140  * |
1141  * | ,-------------------
1142  * | | MESSAGE
1143  * | |-------------------
1144  * | | * Message type: 2
1145  * | | * Message flags: 240
1146  * | | * Originator address: 10.0.0.1
1147  * | | * Hop limit: 255
1148  * | | * Hop count: 1
1149  * | | * Message seq number: 12345
1150  * | | - Address block (1 addresses)
1151  * | | - 0.0.0.1/32
1152  * | | - Flags = 0
1153  * | | - ADDRESS TLV block (0 TLVs)
1154  * | `-------------------
1155  * |
1156  * `------------------
1157  */
1158  {
1159  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1160  packet->SetSequenceNumber (17);
1161 
1162  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1163  tlv1->SetType (1);
1164  packet->TlvPushBack (tlv1);
1165 
1166  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1167  msg1->SetType (1);
1168 
1169  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1170  msg1tlv1->SetType (1);
1171  msg1->TlvPushBack (msg1tlv1);
1172 
1173  packet->MessagePushBack (msg1);
1174 
1175  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1176  msg2->SetType (2);
1177  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1178  msg2->SetHopLimit (255);
1179  msg2->SetHopCount (1);
1180  msg2->SetSequenceNumber (12345);
1181 
1182  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1183  msg2a1->AddressPushBack (Ipv4Address ("0.0.0.1"));
1184  msg2->AddressBlockPushBack (msg2a1);
1185 
1186  packet->MessagePushBack (msg2);
1187 
1188  uint8_t buffer[] = {
1189  0x0c, 0x00, 0x11, 0x00,
1190  0x02, 0x01, 0x00, 0x01,
1191  0x03, 0x00, 0x08, 0x00,
1192  0x02, 0x01, 0x00, 0x02,
1193  0xf3, 0x00, 0x16, 0x0a, /* [16] - 0xf0 */
1194  0x00, 0x00, 0x01, 0xff,
1195  0x01, 0x30, 0x39, 0x00,
1196  0x00, 0x01, 0x00, 0x00,
1197  0x00, 0x00, 0x01, 0x00,
1198  0x00,
1199  };
1200  AddTestCase (new PbbTestCase ("17", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1201  }
1202 
1203  /* Test 18
1204  * ,------------------
1205  * | PACKET
1206  * |------------------
1207  * | * Packet version: 0
1208  * | * Packet flags: 12
1209  * | * Packet seq number: 18
1210  * | | * Packet TLV Block
1211  * | | - TLV
1212  * | | Flags = 0
1213  * | | Type = 1; Value = (warning: parameter is NULL)
1214  * | ,-------------------
1215  * | | MESSAGE
1216  * | |-------------------
1217  * | | * Message type: 1
1218  * | | * Message flags: 0
1219  * | | * Message TLV Block
1220  * | | - TLV
1221  * | | Flags = 0
1222  * | | Type = 1; Value = (warning: parameter is NULL)
1223  * | `-------------------
1224  * |
1225  * | ,-------------------
1226  * | | MESSAGE
1227  * | |-------------------
1228  * | | * Message type: 2
1229  * | | * Message flags: 240
1230  * | | * Originator address: 10.0.0.1
1231  * | | * Hop limit: 255
1232  * | | * Hop count: 1
1233  * | | * Message seq number: 12345
1234  * | | - Address block (1 addresses)
1235  * | | - 10.0.0.0/32
1236  * | | - Flags = 0
1237  * | | - ADDRESS TLV block (0 TLVs)
1238  * | `-------------------
1239  * |
1240  * `------------------
1241  */
1242  {
1243  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1244  packet->SetSequenceNumber (18);
1245 
1246  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1247  tlv1->SetType (1);
1248  packet->TlvPushBack (tlv1);
1249 
1250  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1251  msg1->SetType (1);
1252 
1253  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1254  msg1tlv1->SetType (1);
1255  msg1->TlvPushBack (msg1tlv1);
1256 
1257  packet->MessagePushBack (msg1);
1258 
1259  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1260  msg2->SetType (2);
1261  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1262  msg2->SetHopLimit (255);
1263  msg2->SetHopCount (1);
1264  msg2->SetSequenceNumber (12345);
1265 
1266  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1267  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.0"));
1268  msg2->AddressBlockPushBack (msg2a1);
1269 
1270  packet->MessagePushBack (msg2);
1271 
1272  uint8_t buffer[] = {
1273  0x0c, 0x00, 0x12, 0x00,
1274  0x02, 0x01, 0x00, 0x01,
1275  0x03, 0x00, 0x08, 0x00,
1276  0x02, 0x01, 0x00, 0x02,
1277  0xf3, 0x00, 0x16, 0x0a, /* [16] - 0xf0 */
1278  0x00, 0x00, 0x01, 0xff,
1279  0x01, 0x30, 0x39, 0x00,
1280  0x00, 0x01, 0x00, 0x0a,
1281  0x00, 0x00, 0x00, 0x00,
1282  0x00,
1283  };
1284  AddTestCase (new PbbTestCase ("18", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1285  }
1286 
1287  /* Test 19
1288  * ,------------------
1289  * | PACKET
1290  * |------------------
1291  * | * Packet version: 0
1292  * | * Packet flags: 12
1293  * | * Packet seq number: 19
1294  * | | * Packet TLV Block
1295  * | | - TLV
1296  * | | Flags = 0
1297  * | | Type = 1; Value = (warning: parameter is NULL)
1298  * | ,-------------------
1299  * | | MESSAGE
1300  * | |-------------------
1301  * | | * Message type: 1
1302  * | | * Message flags: 0
1303  * | | * Message TLV Block
1304  * | | - TLV
1305  * | | Flags = 0
1306  * | | Type = 1; Value = (warning: parameter is NULL)
1307  * | `-------------------
1308  * |
1309  * | ,-------------------
1310  * | | MESSAGE
1311  * | |-------------------
1312  * | | * Message type: 2
1313  * | | * Message flags: 240
1314  * | | * Originator address: 10.0.0.1
1315  * | | * Hop limit: 255
1316  * | | * Hop count: 1
1317  * | | * Message seq number: 12345
1318  * | | - Address block (1 addresses)
1319  * | | - 10.0.0.1/32
1320  * | | - Flags = 0
1321  * | | - ADDRESS TLV block (0 TLVs)
1322  * | `-------------------
1323  * |
1324  * `------------------
1325  */
1326  {
1327  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1328  packet->SetSequenceNumber (19);
1329 
1330  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1331  tlv1->SetType (1);
1332  packet->TlvPushBack (tlv1);
1333 
1334  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1335  msg1->SetType (1);
1336 
1337  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1338  msg1tlv1->SetType (1);
1339  msg1->TlvPushBack (msg1tlv1);
1340 
1341  packet->MessagePushBack (msg1);
1342 
1343  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1344  msg2->SetType (2);
1345  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1346  msg2->SetHopLimit (255);
1347  msg2->SetHopCount (1);
1348  msg2->SetSequenceNumber (12345);
1349 
1350  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1351  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.1"));
1352  msg2->AddressBlockPushBack (msg2a1);
1353 
1354  packet->MessagePushBack (msg2);
1355 
1356  uint8_t buffer[] = {
1357  0x0c, 0x00, 0x13, 0x00,
1358  0x02, 0x01, 0x00, 0x01,
1359  0x03, 0x00, 0x08, 0x00,
1360  0x02, 0x01, 0x00, 0x02,
1361  0xf3, 0x00, 0x16, 0x0a, /* [16] - 0xf0 */
1362  0x00, 0x00, 0x01, 0xff,
1363  0x01, 0x30, 0x39, 0x00,
1364  0x00, 0x01, 0x00, 0x0a,
1365  0x00, 0x00, 0x01, 0x00,
1366  0x00,
1367  };
1368  AddTestCase (new PbbTestCase ("19", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1369  }
1370 
1371  /* Test 20
1372  * ,------------------
1373  * | PACKET
1374  * |------------------
1375  * | * Packet version: 0
1376  * | * Packet flags: 12
1377  * | * Packet seq number: 20
1378  * | | * Packet TLV Block
1379  * | | - TLV
1380  * | | Flags = 0
1381  * | | Type = 1; Value = (warning: parameter is NULL)
1382  * | ,-------------------
1383  * | | MESSAGE
1384  * | |-------------------
1385  * | | * Message type: 1
1386  * | | * Message flags: 0
1387  * | | * Message TLV Block
1388  * | | - TLV
1389  * | | Flags = 0
1390  * | | Type = 1; Value = (warning: parameter is NULL)
1391  * | `-------------------
1392  * |
1393  * | ,-------------------
1394  * | | MESSAGE
1395  * | |-------------------
1396  * | | * Message type: 2
1397  * | | * Message flags: 240
1398  * | | * Originator address: 10.0.0.1
1399  * | | * Hop limit: 255
1400  * | | * Hop count: 1
1401  * | | * Message seq number: 12345
1402  * | | - Address block (2 addresses)
1403  * | | - 10.0.0.1/32
1404  * | | - 10.0.0.2/32
1405  * | | - Flags = 128
1406  * | | - ADDRESS TLV block (0 TLVs)
1407  * | `-------------------
1408  * |
1409  * `------------------
1410  */
1411  {
1412  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1413  packet->SetSequenceNumber (20);
1414 
1415  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1416  tlv1->SetType (1);
1417  packet->TlvPushBack (tlv1);
1418 
1419  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1420  msg1->SetType (1);
1421 
1422  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1423  msg1tlv1->SetType (1);
1424  msg1->TlvPushBack (msg1tlv1);
1425 
1426  packet->MessagePushBack (msg1);
1427 
1428  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1429  msg2->SetType (2);
1430  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1431  msg2->SetHopLimit (255);
1432  msg2->SetHopCount (1);
1433  msg2->SetSequenceNumber (12345);
1434 
1435  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1436  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.1"));
1437  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
1438  msg2->AddressBlockPushBack (msg2a1);
1439 
1440  packet->MessagePushBack (msg2);
1441 
1442  uint8_t buffer[] = {
1443  0x0c, 0x00, 0x14, 0x00,
1444  0x02, 0x01, 0x00, 0x01,
1445  0x03, 0x00, 0x08, 0x00,
1446  0x02, 0x01, 0x00, 0x02,
1447  0xf3, 0x00, 0x18, 0x0a, /* [16] - 0xf0 */
1448  0x00, 0x00, 0x01, 0xff,
1449  0x01, 0x30, 0x39, 0x00,
1450  0x00, 0x02, 0x80, 0x03,
1451  0x0a, 0x00, 0x00, 0x01,
1452  0x02, 0x00, 0x00,
1453  };
1454  AddTestCase (new PbbTestCase ("20", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1455  }
1456 
1457  /* Test 21
1458  * ,------------------
1459  * | PACKET
1460  * |------------------
1461  * | * Packet version: 0
1462  * | * Packet flags: 12
1463  * | * Packet seq number: 21
1464  * | | * Packet TLV Block
1465  * | | - TLV
1466  * | | Flags = 0
1467  * | | Type = 1; Value = (warning: parameter is NULL)
1468  * | ,-------------------
1469  * | | MESSAGE
1470  * | |-------------------
1471  * | | * Message type: 1
1472  * | | * Message flags: 0
1473  * | | * Message TLV Block
1474  * | | - TLV
1475  * | | Flags = 0
1476  * | | Type = 1; Value = (warning: parameter is NULL)
1477  * | `-------------------
1478  * |
1479  * | ,-------------------
1480  * | | MESSAGE
1481  * | |-------------------
1482  * | | * Message type: 2
1483  * | | * Message flags: 240
1484  * | | * Originator address: 10.0.0.1
1485  * | | * Hop limit: 255
1486  * | | * Hop count: 1
1487  * | | * Message seq number: 12345
1488  * | | - Address block (2 addresses)
1489  * | | - 10.0.0.2/32
1490  * | | - 10.1.1.2/32
1491  * | | - Flags = 192
1492  * | | - ADDRESS TLV block (0 TLVs)
1493  * | `-------------------
1494  * |
1495  * `------------------
1496  */
1497  {
1498  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1499  packet->SetSequenceNumber (21);
1500 
1501  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1502  tlv1->SetType (1);
1503  packet->TlvPushBack (tlv1);
1504 
1505  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1506  msg1->SetType (1);
1507 
1508  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1509  msg1tlv1->SetType (1);
1510  msg1->TlvPushBack (msg1tlv1);
1511 
1512  packet->MessagePushBack (msg1);
1513 
1514  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1515  msg2->SetType (2);
1516  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1517  msg2->SetHopLimit (255);
1518  msg2->SetHopCount (1);
1519  msg2->SetSequenceNumber (12345);
1520 
1521  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1522  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
1523  msg2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
1524  msg2->AddressBlockPushBack (msg2a1);
1525 
1526  packet->MessagePushBack (msg2);
1527 
1528  uint8_t buffer[] = {
1529  0x0c, 0x00, 0x15, 0x00,
1530  0x02, 0x01, 0x00, 0x01,
1531  0x03, 0x00, 0x08, 0x00,
1532  0x02, 0x01, 0x00, 0x02,
1533  0xf3, 0x00, 0x1a, 0x0a, /* [16] - 0xf0 */
1534  0x00, 0x00, 0x01, 0xff,
1535  0x01, 0x30, 0x39, 0x00,
1536  0x00, 0x02, 0xc0, 0x01,
1537  0x0a, 0x01, 0x02, 0x00,
1538  0x00, 0x01, 0x01, 0x00,
1539  0x00,
1540  };
1541  AddTestCase (new PbbTestCase ("21", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1542  }
1543 
1544  /* Test 22
1545  * ,------------------
1546  * | PACKET
1547  * |------------------
1548  * | * Packet version: 0
1549  * | * Packet flags: 12
1550  * | * Packet seq number: 22
1551  * | | * Packet TLV Block
1552  * | | - TLV
1553  * | | Flags = 0
1554  * | | Type = 1; Value = (warning: parameter is NULL)
1555  * | ,-------------------
1556  * | | MESSAGE
1557  * | |-------------------
1558  * | | * Message type: 1
1559  * | | * Message flags: 0
1560  * | | * Message TLV Block
1561  * | | - TLV
1562  * | | Flags = 0
1563  * | | Type = 1; Value = (warning: parameter is NULL)
1564  * | `-------------------
1565  * |
1566  * | ,-------------------
1567  * | | MESSAGE
1568  * | |-------------------
1569  * | | * Message type: 2
1570  * | | * Message flags: 240
1571  * | | * Originator address: 10.0.0.1
1572  * | | * Hop limit: 255
1573  * | | * Hop count: 1
1574  * | | * Message seq number: 12345
1575  * | | - Address block (2 addresses)
1576  * | | - 10.0.0.2/32
1577  * | | - 10.1.1.2/32
1578  * | | - Flags = 192
1579  * | | - ADDRESS TLV block (0 TLVs)
1580  * | | - Address block (2 addresses)
1581  * | | - 10.0.0.0/32
1582  * | | - 11.0.0.0/32
1583  * | | - Flags = 32
1584  * | | - ADDRESS TLV block (0 TLVs)
1585  * | `-------------------
1586  * |
1587  * `------------------
1588  */
1589  {
1590  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1591  packet->SetSequenceNumber (22);
1592 
1593  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1594  tlv1->SetType (1);
1595  packet->TlvPushBack (tlv1);
1596 
1597  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1598  msg1->SetType (1);
1599 
1600  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1601  msg1tlv1->SetType (1);
1602  msg1->TlvPushBack (msg1tlv1);
1603 
1604  packet->MessagePushBack (msg1);
1605 
1606  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1607  msg2->SetType (2);
1608  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1609  msg2->SetHopLimit (255);
1610  msg2->SetHopCount (1);
1611  msg2->SetSequenceNumber (12345);
1612 
1613  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1614  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
1615  msg2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
1616  msg2->AddressBlockPushBack (msg2a1);
1617 
1618  Ptr<PbbAddressBlockIpv4> msg2a2 = Create<PbbAddressBlockIpv4> ();
1619  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
1620  msg2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
1621  msg2->AddressBlockPushBack (msg2a2);
1622 
1623  packet->MessagePushBack (msg2);
1624 
1625  uint8_t buffer[] = {
1626  0x0c, 0x00, 0x16, 0x00,
1627  0x02, 0x01, 0x00, 0x01,
1628  0x03, 0x00, 0x08, 0x00,
1629  0x02, 0x01, 0x00, 0x02,
1630  0xf3, 0x00, 0x21, 0x0a, /* [16] - 0xf0 */
1631  0x00, 0x00, 0x01, 0xff,
1632  0x01, 0x30, 0x39, 0x00,
1633  0x00, 0x02, 0xc0, 0x01,
1634  0x0a, 0x01, 0x02, 0x00,
1635  0x00, 0x01, 0x01, 0x00,
1636  0x00, 0x02, 0x20, 0x03,
1637  0x0a, 0x0b, 0x00, 0x00,
1638  };
1639  AddTestCase (new PbbTestCase ("22", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1640  }
1641 
1642  /* Test 23
1643  * ,------------------
1644  * | PACKET
1645  * |------------------
1646  * | * Packet version: 0
1647  * | * Packet flags: 12
1648  * | * Packet seq number: 23
1649  * | | * Packet TLV Block
1650  * | | - TLV
1651  * | | Flags = 0
1652  * | | Type = 1; Value = (warning: parameter is NULL)
1653  * | ,-------------------
1654  * | | MESSAGE
1655  * | |-------------------
1656  * | | * Message type: 1
1657  * | | * Message flags: 0
1658  * | | * Message TLV Block
1659  * | | - TLV
1660  * | | Flags = 0
1661  * | | Type = 1; Value = (warning: parameter is NULL)
1662  * | `-------------------
1663  * |
1664  * | ,-------------------
1665  * | | MESSAGE
1666  * | |-------------------
1667  * | | * Message type: 2
1668  * | | * Message flags: 240
1669  * | | * Originator address: 10.0.0.1
1670  * | | * Hop limit: 255
1671  * | | * Hop count: 1
1672  * | | * Message seq number: 12345
1673  * | | - Address block (2 addresses)
1674  * | | - 10.0.0.2/32
1675  * | | - 10.1.1.2/32
1676  * | | - Flags = 192
1677  * | | - ADDRESS TLV block (0 TLVs)
1678  * | | - Address block (4 addresses)
1679  * | | - 10.0.0.0/32
1680  * | | - 11.0.0.0/32
1681  * | | - 10.0.0.5/16
1682  * | | - 10.0.0.6/24
1683  * | | - Flags = 8
1684  * | | - ADDRESS TLV block (0 TLVs)
1685  * | `-------------------
1686  * |
1687  * `------------------
1688  */
1689  {
1690  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1691  packet->SetSequenceNumber (23);
1692 
1693  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1694  tlv1->SetType (1);
1695  packet->TlvPushBack (tlv1);
1696 
1697  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1698  msg1->SetType (1);
1699 
1700  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1701  msg1tlv1->SetType (1);
1702  msg1->TlvPushBack (msg1tlv1);
1703 
1704  packet->MessagePushBack (msg1);
1705 
1706  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1707  msg2->SetType (2);
1708  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1709  msg2->SetHopLimit (255);
1710  msg2->SetHopCount (1);
1711  msg2->SetSequenceNumber (12345);
1712 
1713  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1714  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
1715  msg2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
1716  msg2->AddressBlockPushBack (msg2a1);
1717 
1718  Ptr<PbbAddressBlockIpv4> msg2a2 = Create<PbbAddressBlockIpv4> ();
1719  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
1720  msg2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
1721  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.5"));
1722  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.6"));
1723 
1724  msg2a2->PrefixPushBack (32);
1725  msg2a2->PrefixPushBack (32);
1726  msg2a2->PrefixPushBack (16);
1727  msg2a2->PrefixPushBack (24);
1728 
1729  msg2->AddressBlockPushBack (msg2a2);
1730 
1731  packet->MessagePushBack (msg2);
1732 
1733  uint8_t buffer[] = {
1734  0x0c, 0x00, 0x17, 0x00,
1735  0x02, 0x01, 0x00, 0x01,
1736  0x03, 0x00, 0x08, 0x00,
1737  0x02, 0x01, 0x00, 0x02,
1738  0xf3, 0x00, 0x32, 0x0a, /* [16] - 0xf0 */
1739  0x00, 0x00, 0x01, 0xff,
1740  0x01, 0x30, 0x39, 0x00,
1741  0x00, 0x02, 0xc0, 0x01,
1742  0x0a, 0x01, 0x02, 0x00,
1743  0x00, 0x01, 0x01, 0x00,
1744  0x00, 0x04, 0x08, 0x0a,
1745  0x00, 0x00, 0x00, 0x0b,
1746  0x00, 0x00, 0x00, 0x0a,
1747  0x00, 0x00, 0x05, 0x0a,
1748  0x00, 0x00, 0x06, 0x20,
1749  0x20, 0x10, 0x18, 0x00,
1750  0x00,
1751  };
1752  AddTestCase (new PbbTestCase ("23", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1753  }
1754 
1755  /* Test 24
1756  * ,------------------
1757  * | PACKET
1758  * |------------------
1759  * | * Packet version: 0
1760  * | * Packet flags: 12
1761  * | * Packet seq number: 24
1762  * | | * Packet TLV Block
1763  * | | - TLV
1764  * | | Flags = 0
1765  * | | Type = 1; Value = (warning: parameter is NULL)
1766  * | ,-------------------
1767  * | | MESSAGE
1768  * | |-------------------
1769  * | | * Message type: 1
1770  * | | * Message flags: 0
1771  * | | * Message TLV Block
1772  * | | - TLV
1773  * | | Flags = 0
1774  * | | Type = 1; Value = (warning: parameter is NULL)
1775  * | `-------------------
1776  * |
1777  * | ,-------------------
1778  * | | MESSAGE
1779  * | |-------------------
1780  * | | * Message type: 2
1781  * | | * Message flags: 240
1782  * | | * Originator address: 10.0.0.1
1783  * | | * Hop limit: 255
1784  * | | * Hop count: 1
1785  * | | * Message seq number: 12345
1786  * | | - Address block (2 addresses)
1787  * | | - 10.0.0.2/32
1788  * | | - 10.1.1.2/32
1789  * | | - Flags = 192
1790  * | | - ADDRESS TLV block (0 TLVs)
1791  * | | - Address block (4 addresses)
1792  * | | - 10.0.0.0/32
1793  * | | - 11.0.0.0/32
1794  * | | - 10.0.0.5/16
1795  * | | - 10.0.0.6/24
1796  * | | - Flags = 8
1797  * | | - ADDRESS TLV block (1 TLVs)
1798  * | | - TLV
1799  * | | Flags = 0
1800  * | | Type = 1; Value = (warning: parameter is NULL)
1801  * | `-------------------
1802  * |
1803  * `------------------
1804  */
1805  {
1806  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1807  packet->SetSequenceNumber (24);
1808 
1809  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1810  tlv1->SetType (1);
1811  packet->TlvPushBack (tlv1);
1812 
1813  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1814  msg1->SetType (1);
1815 
1816  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1817  msg1tlv1->SetType (1);
1818  msg1->TlvPushBack (msg1tlv1);
1819 
1820  packet->MessagePushBack (msg1);
1821 
1822  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1823  msg2->SetType (2);
1824  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1825  msg2->SetHopLimit (255);
1826  msg2->SetHopCount (1);
1827  msg2->SetSequenceNumber (12345);
1828 
1829  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1830  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
1831  msg2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
1832  msg2->AddressBlockPushBack (msg2a1);
1833 
1834  Ptr<PbbAddressBlockIpv4> msg2a2 = Create<PbbAddressBlockIpv4> ();
1835  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
1836  msg2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
1837  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.5"));
1838  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.6"));
1839 
1840  msg2a2->PrefixPushBack (32);
1841  msg2a2->PrefixPushBack (32);
1842  msg2a2->PrefixPushBack (16);
1843  msg2a2->PrefixPushBack (24);
1844 
1845  Ptr<PbbAddressTlv> msg2a2tlv1 = Create<PbbAddressTlv> ();
1846  msg2a2tlv1->SetType (1);
1847  msg2a2->TlvPushBack (msg2a2tlv1);
1848 
1849  msg2->AddressBlockPushBack (msg2a2);
1850 
1851  packet->MessagePushBack (msg2);
1852 
1853  uint8_t buffer[] = {
1854  0x0c, 0x00, 0x18, 0x00,
1855  0x02, 0x01, 0x00, 0x01,
1856  0x03, 0x00, 0x08, 0x00,
1857  0x02, 0x01, 0x00, 0x02,
1858  0xf3, 0x00, 0x34, 0x0a, /* [16] - 0xf0 */
1859  0x00, 0x00, 0x01, 0xff,
1860  0x01, 0x30, 0x39, 0x00,
1861  0x00, 0x02, 0xc0, 0x01,
1862  0x0a, 0x01, 0x02, 0x00,
1863  0x00, 0x01, 0x01, 0x00,
1864  0x00, 0x04, 0x08, 0x0a,
1865  0x00, 0x00, 0x00, 0x0b,
1866  0x00, 0x00, 0x00, 0x0a,
1867  0x00, 0x00, 0x05, 0x0a,
1868  0x00, 0x00, 0x06, 0x20,
1869  0x20, 0x10, 0x18, 0x00,
1870  0x02, 0x01, 0x00,
1871  };
1872  AddTestCase (new PbbTestCase ("24", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1873  }
1874 
1875  /* Test 25
1876  * ,------------------
1877  * | PACKET
1878  * |------------------
1879  * | * Packet version: 0
1880  * | * Packet flags: 12
1881  * | * Packet seq number: 25
1882  * | | * Packet TLV Block
1883  * | | - TLV
1884  * | | Flags = 0
1885  * | | Type = 1; Value = (warning: parameter is NULL)
1886  * | ,-------------------
1887  * | | MESSAGE
1888  * | |-------------------
1889  * | | * Message type: 1
1890  * | | * Message flags: 0
1891  * | | * Message TLV Block
1892  * | | - TLV
1893  * | | Flags = 0
1894  * | | Type = 1; Value = (warning: parameter is NULL)
1895  * | `-------------------
1896  * |
1897  * | ,-------------------
1898  * | | MESSAGE
1899  * | |-------------------
1900  * | | * Message type: 2
1901  * | | * Message flags: 240
1902  * | | * Originator address: 10.0.0.1
1903  * | | * Hop limit: 255
1904  * | | * Hop count: 1
1905  * | | * Message seq number: 12345
1906  * | | - Address block (2 addresses)
1907  * | | - 10.0.0.2/32
1908  * | | - 10.1.1.2/32
1909  * | | - Flags = 192
1910  * | | - ADDRESS TLV block (0 TLVs)
1911  * | | - Address block (4 addresses)
1912  * | | - 10.0.0.0/32
1913  * | | - 11.0.0.0/32
1914  * | | - 10.0.0.5/16
1915  * | | - 10.0.0.6/24
1916  * | | - Flags = 8
1917  * | | - ADDRESS TLV block (1 TLVs)
1918  * | | - TLV
1919  * | | Flags = 64
1920  * | | Index-start = 1
1921  * | | Type = 1; Value = (warning: parameter is NULL)
1922  * | `-------------------
1923  * |
1924  * `------------------
1925  */
1926  {
1927  Ptr<PbbPacket> packet = Create<PbbPacket> ();
1928  packet->SetSequenceNumber (25);
1929 
1930  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
1931  tlv1->SetType (1);
1932  packet->TlvPushBack (tlv1);
1933 
1934  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
1935  msg1->SetType (1);
1936 
1937  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
1938  msg1tlv1->SetType (1);
1939  msg1->TlvPushBack (msg1tlv1);
1940 
1941  packet->MessagePushBack (msg1);
1942 
1943  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
1944  msg2->SetType (2);
1945  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
1946  msg2->SetHopLimit (255);
1947  msg2->SetHopCount (1);
1948  msg2->SetSequenceNumber (12345);
1949 
1950  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
1951  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
1952  msg2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
1953  msg2->AddressBlockPushBack (msg2a1);
1954 
1955  Ptr<PbbAddressBlockIpv4> msg2a2 = Create<PbbAddressBlockIpv4> ();
1956  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
1957  msg2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
1958  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.5"));
1959  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.6"));
1960 
1961  msg2a2->PrefixPushBack (32);
1962  msg2a2->PrefixPushBack (32);
1963  msg2a2->PrefixPushBack (16);
1964  msg2a2->PrefixPushBack (24);
1965 
1966  Ptr<PbbAddressTlv> msg2a2tlv1 = Create<PbbAddressTlv> ();
1967  msg2a2tlv1->SetType (1);
1968  msg2a2tlv1->SetIndexStart (1);
1969  msg2a2->TlvPushBack (msg2a2tlv1);
1970 
1971  msg2->AddressBlockPushBack (msg2a2);
1972 
1973  packet->MessagePushBack (msg2);
1974 
1975  uint8_t buffer[] = {
1976  0x0c, 0x00, 0x19, 0x00,
1977  0x02, 0x01, 0x00, 0x01,
1978  0x03, 0x00, 0x08, 0x00,
1979  0x02, 0x01, 0x00, 0x02,
1980  0xf3, 0x00, 0x35, 0x0a, /* [16] - 0xf0 */
1981  0x00, 0x00, 0x01, 0xff,
1982  0x01, 0x30, 0x39, 0x00,
1983  0x00, 0x02, 0xc0, 0x01,
1984  0x0a, 0x01, 0x02, 0x00,
1985  0x00, 0x01, 0x01, 0x00,
1986  0x00, 0x04, 0x08, 0x0a,
1987  0x00, 0x00, 0x00, 0x0b,
1988  0x00, 0x00, 0x00, 0x0a,
1989  0x00, 0x00, 0x05, 0x0a,
1990  0x00, 0x00, 0x06, 0x20,
1991  0x20, 0x10, 0x18, 0x00,
1992  0x03, 0x01, 0x40, 0x01,
1993  };
1994  AddTestCase (new PbbTestCase ("25", packet, buffer, sizeof(buffer)), TestCase::QUICK);
1995  }
1996 
1997  /* Test 26
1998  * ,------------------
1999  * | PACKET
2000  * |------------------
2001  * | * Packet version: 0
2002  * | * Packet flags: 12
2003  * | * Packet seq number: 26
2004  * | | * Packet TLV Block
2005  * | | - TLV
2006  * | | Flags = 0
2007  * | | Type = 1; Value = (warning: parameter is NULL)
2008  * | ,-------------------
2009  * | | MESSAGE
2010  * | |-------------------
2011  * | | * Message type: 1
2012  * | | * Message flags: 0
2013  * | | * Message TLV Block
2014  * | | - TLV
2015  * | | Flags = 0
2016  * | | Type = 1; Value = (warning: parameter is NULL)
2017  * | `-------------------
2018  * |
2019  * | ,-------------------
2020  * | | MESSAGE
2021  * | |-------------------
2022  * | | * Message type: 2
2023  * | | * Message flags: 240
2024  * | | * Originator address: 10.0.0.1
2025  * | | * Hop limit: 255
2026  * | | * Hop count: 1
2027  * | | * Message seq number: 12345
2028  * | | - Address block (2 addresses)
2029  * | | - 10.0.0.2/32
2030  * | | - 10.1.1.2/32
2031  * | | - Flags = 192
2032  * | | - ADDRESS TLV block (0 TLVs)
2033  * | | - Address block (4 addresses)
2034  * | | - 10.0.0.0/32
2035  * | | - 11.0.0.0/32
2036  * | | - 10.0.0.5/16
2037  * | | - 10.0.0.6/24
2038  * | | - Flags = 8
2039  * | | - ADDRESS TLV block (1 TLVs)
2040  * | | - TLV
2041  * | | Flags = 32
2042  * | | Index-start = 1
2043  * | | Index-stop = 3
2044  * | | Type = 1; Value = (warning: parameter is NULL)
2045  * | `-------------------
2046  * |
2047  * `------------------
2048  */
2049  {
2050  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2051  packet->SetSequenceNumber (26);
2052 
2053  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
2054  tlv1->SetType (1);
2055  packet->TlvPushBack (tlv1);
2056 
2057  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
2058  msg1->SetType (1);
2059 
2060  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
2061  msg1tlv1->SetType (1);
2062  msg1->TlvPushBack (msg1tlv1);
2063 
2064  packet->MessagePushBack (msg1);
2065 
2066  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
2067  msg2->SetType (2);
2068  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
2069  msg2->SetHopLimit (255);
2070  msg2->SetHopCount (1);
2071  msg2->SetSequenceNumber (12345);
2072 
2073  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
2074  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
2075  msg2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
2076  msg2->AddressBlockPushBack (msg2a1);
2077 
2078  Ptr<PbbAddressBlockIpv4> msg2a2 = Create<PbbAddressBlockIpv4> ();
2079  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
2080  msg2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
2081  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.5"));
2082  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.6"));
2083 
2084  msg2a2->PrefixPushBack (32);
2085  msg2a2->PrefixPushBack (32);
2086  msg2a2->PrefixPushBack (16);
2087  msg2a2->PrefixPushBack (24);
2088 
2089  Ptr<PbbAddressTlv> msg2a2tlv1 = Create<PbbAddressTlv> ();
2090  msg2a2tlv1->SetType (1);
2091  msg2a2tlv1->SetIndexStart (1);
2092  msg2a2tlv1->SetIndexStop (3);
2093  msg2a2->TlvPushBack (msg2a2tlv1);
2094 
2095  msg2->AddressBlockPushBack (msg2a2);
2096 
2097  packet->MessagePushBack (msg2);
2098 
2099  uint8_t buffer[] = {
2100  0x0c, 0x00, 0x1a, 0x00,
2101  0x02, 0x01, 0x00, 0x01,
2102  0x03, 0x00, 0x08, 0x00,
2103  0x02, 0x01, 0x00, 0x02,
2104  0xf3, 0x00, 0x36, 0x0a, /* [16] - 0xf0 */
2105  0x00, 0x00, 0x01, 0xff,
2106  0x01, 0x30, 0x39, 0x00,
2107  0x00, 0x02, 0xc0, 0x01,
2108  0x0a, 0x01, 0x02, 0x00,
2109  0x00, 0x01, 0x01, 0x00,
2110  0x00, 0x04, 0x08, 0x0a,
2111  0x00, 0x00, 0x00, 0x0b,
2112  0x00, 0x00, 0x00, 0x0a,
2113  0x00, 0x00, 0x05, 0x0a,
2114  0x00, 0x00, 0x06, 0x20,
2115  0x20, 0x10, 0x18, 0x00,
2116  0x04, 0x01, 0x20, 0x01,
2117  0x03,
2118  };
2119  AddTestCase (new PbbTestCase ("26", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2120  }
2121 
2122  /* Test 27
2123  * ,------------------
2124  * | PACKET
2125  * |------------------
2126  * | * Packet version: 0
2127  * | * Packet flags: 12
2128  * | * Packet seq number: 27
2129  * | | * Packet TLV Block
2130  * | | - TLV
2131  * | | Flags = 0
2132  * | | Type = 1; Value = (warning: parameter is NULL)
2133  * | ,-------------------
2134  * | | MESSAGE
2135  * | |-------------------
2136  * | | * Message type: 1
2137  * | | * Message flags: 0
2138  * | | * Message TLV Block
2139  * | | - TLV
2140  * | | Flags = 0
2141  * | | Type = 1; Value = (warning: parameter is NULL)
2142  * | `-------------------
2143  * |
2144  * | ,-------------------
2145  * | | MESSAGE
2146  * | |-------------------
2147  * | | * Message type: 2
2148  * | | * Message flags: 240
2149  * | | * Originator address: 10.0.0.1
2150  * | | * Hop limit: 255
2151  * | | * Hop count: 1
2152  * | | * Message seq number: 12345
2153  * | | - Address block (2 addresses)
2154  * | | - 10.0.0.2/32
2155  * | | - 10.1.1.2/32
2156  * | | - Flags = 192
2157  * | | - ADDRESS TLV block (0 TLVs)
2158  * | | - Address block (4 addresses)
2159  * | | - 10.0.0.0/32
2160  * | | - 11.0.0.0/32
2161  * | | - 10.0.0.5/16
2162  * | | - 10.0.0.6/24
2163  * | | - Flags = 8
2164  * | | - ADDRESS TLV block (1 TLVs)
2165  * | | - TLV
2166  * | | Flags = 52
2167  * | | Index-start = 1
2168  * | | Index-stop = 3
2169  * | | Type = 1; Value = 01 02 03
2170  * | `-------------------
2171  * |
2172  * `------------------
2173  */
2174  {
2175  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2176  packet->SetSequenceNumber (27);
2177 
2178  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
2179  tlv1->SetType (1);
2180  packet->TlvPushBack (tlv1);
2181 
2182  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
2183  msg1->SetType (1);
2184 
2185  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
2186  msg1tlv1->SetType (1);
2187  msg1->TlvPushBack (msg1tlv1);
2188 
2189  packet->MessagePushBack (msg1);
2190 
2191  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
2192  msg2->SetType (2);
2193  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
2194  msg2->SetHopLimit (255);
2195  msg2->SetHopCount (1);
2196  msg2->SetSequenceNumber (12345);
2197 
2198  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
2199  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
2200  msg2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
2201  msg2->AddressBlockPushBack (msg2a1);
2202 
2203  Ptr<PbbAddressBlockIpv4> msg2a2 = Create<PbbAddressBlockIpv4> ();
2204  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
2205  msg2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
2206  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.5"));
2207  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.6"));
2208 
2209  msg2a2->PrefixPushBack (32);
2210  msg2a2->PrefixPushBack (32);
2211  msg2a2->PrefixPushBack (16);
2212  msg2a2->PrefixPushBack (24);
2213 
2214  Ptr<PbbAddressTlv> msg2a2tlv1 = Create<PbbAddressTlv> ();
2215  msg2a2tlv1->SetType (1);
2216  msg2a2tlv1->SetIndexStart (1);
2217  msg2a2tlv1->SetIndexStop (3);
2218 
2219  uint8_t value[] = { 1, 2, 3};
2220  msg2a2tlv1->SetValue (value, sizeof (value));
2221  msg2a2tlv1->SetMultivalue (true);
2222 
2223  msg2a2->TlvPushBack (msg2a2tlv1);
2224 
2225  msg2->AddressBlockPushBack (msg2a2);
2226 
2227  packet->MessagePushBack (msg2);
2228 
2229  uint8_t buffer[] = {
2230  0x0c, 0x00, 0x1b, 0x00,
2231  0x02, 0x01, 0x00, 0x01,
2232  0x03, 0x00, 0x08, 0x00,
2233  0x02, 0x01, 0x00, 0x02,
2234  0xf3, 0x00, 0x3a, 0x0a, /* [16] - 0xf0 */
2235  0x00, 0x00, 0x01, 0xff,
2236  0x01, 0x30, 0x39, 0x00,
2237  0x00, 0x02, 0xc0, 0x01,
2238  0x0a, 0x01, 0x02, 0x00,
2239  0x00, 0x01, 0x01, 0x00,
2240  0x00, 0x04, 0x08, 0x0a,
2241  0x00, 0x00, 0x00, 0x0b,
2242  0x00, 0x00, 0x00, 0x0a,
2243  0x00, 0x00, 0x05, 0x0a,
2244  0x00, 0x00, 0x06, 0x20,
2245  0x20, 0x10, 0x18, 0x00,
2246  0x08, 0x01, 0x34, 0x01,
2247  0x03, 0x03, 0x01, 0x02,
2248  0x03,
2249  };
2250  AddTestCase (new PbbTestCase ("27", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2251  }
2252 
2253  /* Test 28
2254  * ,------------------
2255  * | PACKET
2256  * |------------------
2257  * | * Packet version: 0
2258  * | * Packet flags: 12
2259  * | * Packet seq number: 28
2260  * | | * Packet TLV Block
2261  * | | - TLV
2262  * | | Flags = 0
2263  * | | Type = 1; Value = (warning: parameter is NULL)
2264  * | ,-------------------
2265  * | | MESSAGE
2266  * | |-------------------
2267  * | | * Message type: 1
2268  * | | * Message flags: 0
2269  * | | * Message TLV Block
2270  * | | - TLV
2271  * | | Flags = 0
2272  * | | Type = 1; Value = (warning: parameter is NULL)
2273  * | `-------------------
2274  * |
2275  * | ,-------------------
2276  * | | MESSAGE
2277  * | |-------------------
2278  * | | * Message type: 2
2279  * | | * Message flags: 240
2280  * | | * Originator address: 10.0.0.1
2281  * | | * Hop limit: 255
2282  * | | * Hop count: 1
2283  * | | * Message seq number: 12345
2284  * | | - Address block (2 addresses)
2285  * | | - 10.0.0.2/32
2286  * | | - 10.1.1.2/32
2287  * | | - Flags = 192
2288  * | | - ADDRESS TLV block (0 TLVs)
2289  * | | - Address block (4 addresses)
2290  * | | - 10.0.0.0/32
2291  * | | - 11.0.0.0/32
2292  * | | - 10.0.0.5/16
2293  * | | - 10.0.0.6/24
2294  * | | - Flags = 8
2295  * | | - ADDRESS TLV block (1 TLVs)
2296  * | | - TLV
2297  * | | Flags = 56
2298  * | | Index-start = 1
2299  * | | Index-stop = 3
2300  * | | Type = 1; Value = 00 01 02 03
2301  * | | 04 05 06 07
2302  * | | 08 09 0a 0b
2303  * | | 0c 0d 0e 0f
2304  * | | 10 11 12 13
2305  * | | 14 15 16 17
2306  * | | 18 19 1a 1b
2307  * | | 1c 1d 1e 1f
2308  * | | 20 21 22 23
2309  * | | 24 25 26 27
2310  * | | 28 29 2a 2b
2311  * | | 2c 2d 2e 2f
2312  * | | 30 31 32 33
2313  * | | 34 35 36 37
2314  * | | 38 39 3a 3b
2315  * | | 3c 3d 3e 3f
2316  * | | 40 41 42 43
2317  * | | 44 45 46 47
2318  * | | 48 49 4a 4b
2319  * | | 4c 4d 4e 4f
2320  * | | 50 51 52 53
2321  * | | 54 55 56 57
2322  * | | 58 59 5a 5b
2323  * | | 5c 5d 5e 5f
2324  * | | 60 61 62 63
2325  * | | 64 65 66 67
2326  * | | 68 69 6a 6b
2327  * | | 6c 6d 6e 6f
2328  * | | 70 71 72 73
2329  * | | 74 75 76 77
2330  * | | 78 79 7a 7b
2331  * | | 7c 7d 7e 7f
2332  * | | 80 81 82 83
2333  * | | 84 85 86 87
2334  * | | 88 89 8a 8b
2335  * | | 8c 8d 8e 8f
2336  * | | 90 91 92 93
2337  * | | 94 95 96 97
2338  * | | 98 99 9a 9b
2339  * | | 9c 9d 9e 9f
2340  * | | a0 a1 a2 a3
2341  * | | a4 a5 a6 a7
2342  * | | a8 a9 aa ab
2343  * | | ac ad ae af
2344  * | | b0 b1 b2 b3
2345  * | | b4 b5 b6 b7
2346  * | | b8 b9 ba bb
2347  * | | bc bd be bf
2348  * | | c0 c1 c2 c3
2349  * | | c4 c5 c6 c7
2350  * | | c8 c9 ca cb
2351  * | | cc cd ce cf
2352  * | | d0 d1 d2 d3
2353  * | | d4 d5 d6 d7
2354  * | | d8 d9 da db
2355  * | | dc dd de df
2356  * | | e0 e1 e2 e3
2357  * | | e4 e5 e6 e7
2358  * | | e8 e9 ea eb
2359  * | | ec ed ee ef
2360  * | | f0 f1 f2 f3
2361  * | | f4 f5 f6 f7
2362  * | | f8 f9 fa fb
2363  * | | fc fd fe 00
2364  * | | 01 02 03 04
2365  * | | 05 06 07 08
2366  * | | 09 0a 0b 0c
2367  * | | 0d 0e 0f 10
2368  * | | 11 12 13 14
2369  * | | 15 16 17 18
2370  * | | 19 1a 1b 1c
2371  * | | 1d 1e 1f 20
2372  * | | 21 22 23 24
2373  * | | 25 26 27 28
2374  * | | 29 2a 2b 2c
2375  * | |
2376  * | `-------------------
2377  * |
2378  * `------------------
2379  */
2380  {
2381  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2382  packet->SetSequenceNumber (28);
2383 
2384  Ptr<PbbTlv> tlv1 = Create<PbbTlv> ();
2385  tlv1->SetType (1);
2386  packet->TlvPushBack (tlv1);
2387 
2388  Ptr<PbbMessageIpv4> msg1 = Create<PbbMessageIpv4> ();
2389  msg1->SetType (1);
2390 
2391  Ptr<PbbTlv> msg1tlv1 = Create<PbbTlv> ();
2392  msg1tlv1->SetType (1);
2393  msg1->TlvPushBack (msg1tlv1);
2394 
2395  packet->MessagePushBack (msg1);
2396 
2397  Ptr<PbbMessageIpv4> msg2 = Create<PbbMessageIpv4> ();
2398  msg2->SetType (2);
2399  msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
2400  msg2->SetHopLimit (255);
2401  msg2->SetHopCount (1);
2402  msg2->SetSequenceNumber (12345);
2403 
2404  Ptr<PbbAddressBlockIpv4> msg2a1 = Create<PbbAddressBlockIpv4> ();
2405  msg2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
2406  msg2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
2407  msg2->AddressBlockPushBack (msg2a1);
2408 
2409  Ptr<PbbAddressBlockIpv4> msg2a2 = Create<PbbAddressBlockIpv4> ();
2410  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
2411  msg2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
2412  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.5"));
2413  msg2a2->AddressPushBack (Ipv4Address ("10.0.0.6"));
2414 
2415  msg2a2->PrefixPushBack (32);
2416  msg2a2->PrefixPushBack (32);
2417  msg2a2->PrefixPushBack (16);
2418  msg2a2->PrefixPushBack (24);
2419 
2420  Ptr<PbbAddressTlv> msg2a2tlv1 = Create<PbbAddressTlv> ();
2421  msg2a2tlv1->SetType (1);
2422  msg2a2tlv1->SetIndexStart (1);
2423  msg2a2tlv1->SetIndexStop (3);
2424 
2425  uint8_t value[] = {
2426  0x00, 0x01, 0x02, 0x03,
2427  0x04, 0x05, 0x06, 0x07,
2428  0x08, 0x09, 0x0a, 0x0b,
2429  0x0c, 0x0d, 0x0e, 0x0f,
2430  0x10, 0x11, 0x12, 0x13,
2431  0x14, 0x15, 0x16, 0x17,
2432  0x18, 0x19, 0x1a, 0x1b,
2433  0x1c, 0x1d, 0x1e, 0x1f,
2434  0x20, 0x21, 0x22, 0x23,
2435  0x24, 0x25, 0x26, 0x27,
2436  0x28, 0x29, 0x2a, 0x2b,
2437  0x2c, 0x2d, 0x2e, 0x2f,
2438  0x30, 0x31, 0x32, 0x33,
2439  0x34, 0x35, 0x36, 0x37,
2440  0x38, 0x39, 0x3a, 0x3b,
2441  0x3c, 0x3d, 0x3e, 0x3f,
2442  0x40, 0x41, 0x42, 0x43,
2443  0x44, 0x45, 0x46, 0x47,
2444  0x48, 0x49, 0x4a, 0x4b,
2445  0x4c, 0x4d, 0x4e, 0x4f,
2446  0x50, 0x51, 0x52, 0x53,
2447  0x54, 0x55, 0x56, 0x57,
2448  0x58, 0x59, 0x5a, 0x5b,
2449  0x5c, 0x5d, 0x5e, 0x5f,
2450  0x60, 0x61, 0x62, 0x63,
2451  0x64, 0x65, 0x66, 0x67,
2452  0x68, 0x69, 0x6a, 0x6b,
2453  0x6c, 0x6d, 0x6e, 0x6f,
2454  0x70, 0x71, 0x72, 0x73,
2455  0x74, 0x75, 0x76, 0x77,
2456  0x78, 0x79, 0x7a, 0x7b,
2457  0x7c, 0x7d, 0x7e, 0x7f,
2458  0x80, 0x81, 0x82, 0x83,
2459  0x84, 0x85, 0x86, 0x87,
2460  0x88, 0x89, 0x8a, 0x8b,
2461  0x8c, 0x8d, 0x8e, 0x8f,
2462  0x90, 0x91, 0x92, 0x93,
2463  0x94, 0x95, 0x96, 0x97,
2464  0x98, 0x99, 0x9a, 0x9b,
2465  0x9c, 0x9d, 0x9e, 0x9f,
2466  0xa0, 0xa1, 0xa2, 0xa3,
2467  0xa4, 0xa5, 0xa6, 0xa7,
2468  0xa8, 0xa9, 0xaa, 0xab,
2469  0xac, 0xad, 0xae, 0xaf,
2470  0xb0, 0xb1, 0xb2, 0xb3,
2471  0xb4, 0xb5, 0xb6, 0xb7,
2472  0xb8, 0xb9, 0xba, 0xbb,
2473  0xbc, 0xbd, 0xbe, 0xbf,
2474  0xc0, 0xc1, 0xc2, 0xc3,
2475  0xc4, 0xc5, 0xc6, 0xc7,
2476  0xc8, 0xc9, 0xca, 0xcb,
2477  0xcc, 0xcd, 0xce, 0xcf,
2478  0xd0, 0xd1, 0xd2, 0xd3,
2479  0xd4, 0xd5, 0xd6, 0xd7,
2480  0xd8, 0xd9, 0xda, 0xdb,
2481  0xdc, 0xdd, 0xde, 0xdf,
2482  0xe0, 0xe1, 0xe2, 0xe3,
2483  0xe4, 0xe5, 0xe6, 0xe7,
2484  0xe8, 0xe9, 0xea, 0xeb,
2485  0xec, 0xed, 0xee, 0xef,
2486  0xf0, 0xf1, 0xf2, 0xf3,
2487  0xf4, 0xf5, 0xf6, 0xf7,
2488  0xf8, 0xf9, 0xfa, 0xfb,
2489  0xfc, 0xfd, 0xfe, 0x00,
2490  0x01, 0x02, 0x03, 0x04,
2491  0x05, 0x06, 0x07, 0x08,
2492  0x09, 0x0a, 0x0b, 0x0c,
2493  0x0d, 0x0e, 0x0f, 0x10,
2494  0x11, 0x12, 0x13, 0x14,
2495  0x15, 0x16, 0x17, 0x18,
2496  0x19, 0x1a, 0x1b, 0x1c,
2497  0x1d, 0x1e, 0x1f, 0x20,
2498  0x21, 0x22, 0x23, 0x24,
2499  0x25, 0x26, 0x27, 0x28,
2500  0x29, 0x2a, 0x2b, 0x2c,
2501  };
2502  msg2a2tlv1->SetValue (value, sizeof (value));
2503 
2504  msg2a2->TlvPushBack (msg2a2tlv1);
2505 
2506  msg2->AddressBlockPushBack (msg2a2);
2507 
2508  packet->MessagePushBack (msg2);
2509 
2510  uint8_t buffer[] = {
2511  0x0c, 0x00, 0x1c, 0x00,
2512  0x02, 0x01, 0x00, 0x01,
2513  0x03, 0x00, 0x08, 0x00,
2514  0x02, 0x01, 0x00, 0x02,
2515  0xf3, 0x01, 0x64, 0x0a, /* [16] - 0xf0 */
2516  0x00, 0x00, 0x01, 0xff,
2517  0x01, 0x30, 0x39, 0x00,
2518  0x00, 0x02, 0xc0, 0x01,
2519  0x0a, 0x01, 0x02, 0x00,
2520  0x00, 0x01, 0x01, 0x00,
2521  0x00, 0x04, 0x08, 0x0a,
2522  0x00, 0x00, 0x00, 0x0b,
2523  0x00, 0x00, 0x00, 0x0a,
2524  0x00, 0x00, 0x05, 0x0a,
2525  0x00, 0x00, 0x06, 0x20,
2526  0x20, 0x10, 0x18, 0x01,
2527  0x32, 0x01, 0x38, 0x01,
2528  0x03, 0x01, 0x2c, 0x00,
2529  0x01, 0x02, 0x03, 0x04,
2530  0x05, 0x06, 0x07, 0x08,
2531  0x09, 0x0a, 0x0b, 0x0c,
2532  0x0d, 0x0e, 0x0f, 0x10,
2533  0x11, 0x12, 0x13, 0x14,
2534  0x15, 0x16, 0x17, 0x18,
2535  0x19, 0x1a, 0x1b, 0x1c,
2536  0x1d, 0x1e, 0x1f, 0x20,
2537  0x21, 0x22, 0x23, 0x24,
2538  0x25, 0x26, 0x27, 0x28,
2539  0x29, 0x2a, 0x2b, 0x2c,
2540  0x2d, 0x2e, 0x2f, 0x30,
2541  0x31, 0x32, 0x33, 0x34,
2542  0x35, 0x36, 0x37, 0x38,
2543  0x39, 0x3a, 0x3b, 0x3c,
2544  0x3d, 0x3e, 0x3f, 0x40,
2545  0x41, 0x42, 0x43, 0x44,
2546  0x45, 0x46, 0x47, 0x48,
2547  0x49, 0x4a, 0x4b, 0x4c,
2548  0x4d, 0x4e, 0x4f, 0x50,
2549  0x51, 0x52, 0x53, 0x54,
2550  0x55, 0x56, 0x57, 0x58,
2551  0x59, 0x5a, 0x5b, 0x5c,
2552  0x5d, 0x5e, 0x5f, 0x60,
2553  0x61, 0x62, 0x63, 0x64,
2554  0x65, 0x66, 0x67, 0x68,
2555  0x69, 0x6a, 0x6b, 0x6c,
2556  0x6d, 0x6e, 0x6f, 0x70,
2557  0x71, 0x72, 0x73, 0x74,
2558  0x75, 0x76, 0x77, 0x78,
2559  0x79, 0x7a, 0x7b, 0x7c,
2560  0x7d, 0x7e, 0x7f, 0x80,
2561  0x81, 0x82, 0x83, 0x84,
2562  0x85, 0x86, 0x87, 0x88,
2563  0x89, 0x8a, 0x8b, 0x8c,
2564  0x8d, 0x8e, 0x8f, 0x90,
2565  0x91, 0x92, 0x93, 0x94,
2566  0x95, 0x96, 0x97, 0x98,
2567  0x99, 0x9a, 0x9b, 0x9c,
2568  0x9d, 0x9e, 0x9f, 0xa0,
2569  0xa1, 0xa2, 0xa3, 0xa4,
2570  0xa5, 0xa6, 0xa7, 0xa8,
2571  0xa9, 0xaa, 0xab, 0xac,
2572  0xad, 0xae, 0xaf, 0xb0,
2573  0xb1, 0xb2, 0xb3, 0xb4,
2574  0xb5, 0xb6, 0xb7, 0xb8,
2575  0xb9, 0xba, 0xbb, 0xbc,
2576  0xbd, 0xbe, 0xbf, 0xc0,
2577  0xc1, 0xc2, 0xc3, 0xc4,
2578  0xc5, 0xc6, 0xc7, 0xc8,
2579  0xc9, 0xca, 0xcb, 0xcc,
2580  0xcd, 0xce, 0xcf, 0xd0,
2581  0xd1, 0xd2, 0xd3, 0xd4,
2582  0xd5, 0xd6, 0xd7, 0xd8,
2583  0xd9, 0xda, 0xdb, 0xdc,
2584  0xdd, 0xde, 0xdf, 0xe0,
2585  0xe1, 0xe2, 0xe3, 0xe4,
2586  0xe5, 0xe6, 0xe7, 0xe8,
2587  0xe9, 0xea, 0xeb, 0xec,
2588  0xed, 0xee, 0xef, 0xf0,
2589  0xf1, 0xf2, 0xf3, 0xf4,
2590  0xf5, 0xf6, 0xf7, 0xf8,
2591  0xf9, 0xfa, 0xfb, 0xfc,
2592  0xfd, 0xfe, 0x00, 0x01,
2593  0x02, 0x03, 0x04, 0x05,
2594  0x06, 0x07, 0x08, 0x09,
2595  0x0a, 0x0b, 0x0c, 0x0d,
2596  0x0e, 0x0f, 0x10, 0x11,
2597  0x12, 0x13, 0x14, 0x15,
2598  0x16, 0x17, 0x18, 0x19,
2599  0x1a, 0x1b, 0x1c, 0x1d,
2600  0x1e, 0x1f, 0x20, 0x21,
2601  0x22, 0x23, 0x24, 0x25,
2602  0x26, 0x27, 0x28, 0x29,
2603  0x2a, 0x2b, 0x2c
2604  };
2605  AddTestCase (new PbbTestCase ("28", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2606  }
2607 
2608  /* Test 29
2609  * ,------------------
2610  * | PACKET
2611  * |------------------
2612  * | * Packet version: 0
2613  * | * Packet flags: 0
2614  * | ,-------------------
2615  * | | MESSAGE
2616  * | |-------------------
2617  * | | * Message type: 1
2618  * | | * Message flags: 1
2619  * | `-------------------
2620  * |
2621  * `------------------
2622  */
2623  {
2624  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2625 
2626  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
2627  m1->SetType (1);
2628 
2629  packet->MessagePushBack (m1);
2630 
2631  uint8_t buffer[] = {
2632  0x00, 0x01, 0x0f, 0x00,
2633  0x06, 0x00, 0x00,
2634  };
2635  AddTestCase (new PbbTestCase ("29", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2636  }
2637 
2638  /* Test 30
2639  * ,------------------
2640  * | PACKET
2641  * |------------------
2642  * | * Packet version: 0
2643  * | * Packet flags: 0
2644  * | ,-------------------
2645  * | | MESSAGE
2646  * | |-------------------
2647  * | | * Message type: 1
2648  * | | * Message flags: 129
2649  * | | * Originator address: abcd::1
2650  * | `-------------------
2651  * |
2652  * `------------------
2653  */
2654  {
2655  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2656 
2657  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
2658  m1->SetType (1);
2659  m1->SetOriginatorAddress (Ipv6Address ("abcd::1"));
2660 
2661  packet->MessagePushBack (m1);
2662 
2663  uint8_t buffer[] = {
2664  0x00, 0x01, 0x8f, 0x00,
2665  0x16, 0xab, 0xcd, 0x00,
2666  0x00, 0x00, 0x00, 0x00,
2667  0x00, 0x00, 0x00, 0x00,
2668  0x00, 0x00, 0x00, 0x00,
2669  0x01, 0x00, 0x00
2670  };
2671  AddTestCase (new PbbTestCase ("30", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2672  }
2673 
2674  /* Test 31
2675  * ,------------------
2676  * | PACKET
2677  * |------------------
2678  * | * Packet version: 0
2679  * | * Packet flags: 0
2680  * | ,-------------------
2681  * | | MESSAGE
2682  * | |-------------------
2683  * | | * Message type: 1
2684  * | | * Message flags: 129
2685  * | | * Originator address: abcd::1
2686  * | | - Address block (1 addresses)
2687  * | | - 10::1/128
2688  * | | - Flags = 0
2689  * | | - ADDRESS TLV block (0 TLVs)
2690  * | `-------------------
2691  * |
2692  * `------------------
2693  */
2694  {
2695  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2696 
2697  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
2698  m1->SetType (1);
2699  m1->SetOriginatorAddress (Ipv6Address ("abcd::1"));
2700 
2701  Ptr<PbbAddressBlockIpv6> m1a1 = Create<PbbAddressBlockIpv6> ();
2702  m1a1->AddressPushBack (Ipv6Address ("10::1"));
2703  m1->AddressBlockPushBack (m1a1);
2704 
2705  packet->MessagePushBack (m1);
2706 
2707  uint8_t buffer[] = {
2708  0x00, 0x01, 0x8f, 0x00,
2709  0x2a, 0xab, 0xcd, 0x00,
2710  0x00, 0x00, 0x00, 0x00,
2711  0x00, 0x00, 0x00, 0x00,
2712  0x00, 0x00, 0x00, 0x00,
2713  0x01, 0x00, 0x00, 0x01,
2714  0x00, 0x00, 0x10, 0x00,
2715  0x00, 0x00, 0x00, 0x00,
2716  0x00, 0x00, 0x00, 0x00,
2717  0x00, 0x00, 0x00, 0x00,
2718  0x01, 0x00, 0x00,
2719  };
2720  AddTestCase (new PbbTestCase ("31", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2721  }
2722 
2723  /* Test 32
2724  * ,------------------
2725  * | PACKET
2726  * |------------------
2727  * | * Packet version: 0
2728  * | * Packet flags: 0
2729  * | ,-------------------
2730  * | | MESSAGE
2731  * | |-------------------
2732  * | | * Message type: 1
2733  * | | * Message flags: 129
2734  * | | * Originator address: abcd::1
2735  * | | - Address block (2 addresses)
2736  * | | - 10::1/128
2737  * | | - 10::2/128
2738  * | | - Flags = 128
2739  * | | - ADDRESS TLV block (0 TLVs)
2740  * | `-------------------
2741  * |
2742  * `------------------
2743  */
2744  {
2745  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2746 
2747  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
2748  m1->SetType (1);
2749  m1->SetOriginatorAddress (Ipv6Address ("abcd::1"));
2750 
2751  Ptr<PbbAddressBlockIpv6> m1a1 = Create<PbbAddressBlockIpv6> ();
2752  m1a1->AddressPushBack (Ipv6Address ("10::1"));
2753  m1a1->AddressPushBack (Ipv6Address ("10::2"));
2754  m1->AddressBlockPushBack (m1a1);
2755 
2756  packet->MessagePushBack (m1);
2757 
2758  uint8_t buffer[] = {
2759  0x00, 0x01, 0x8f, 0x00,
2760  0x2c, 0xab, 0xcd, 0x00,
2761  0x00, 0x00, 0x00, 0x00,
2762  0x00, 0x00, 0x00, 0x00,
2763  0x00, 0x00, 0x00, 0x00,
2764  0x01, 0x00, 0x00, 0x02,
2765  0x80, 0x0f, 0x00, 0x10,
2766  0x00, 0x00, 0x00, 0x00,
2767  0x00, 0x00, 0x00, 0x00,
2768  0x00, 0x00, 0x00, 0x00,
2769  0x00, 0x01, 0x02, 0x00,
2770  0x00,
2771  };
2772  AddTestCase (new PbbTestCase ("32", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2773  }
2774 
2775  /* Test 33
2776  * ,------------------
2777  * | PACKET
2778  * |------------------
2779  * | * Packet version: 0
2780  * | * Packet flags: 0
2781  * | ,-------------------
2782  * | | MESSAGE
2783  * | |-------------------
2784  * | | * Message type: 1
2785  * | | * Message flags: 129
2786  * | | * Originator address: abcd::1
2787  * | | - Address block (2 addresses)
2788  * | | - 10::2/128
2789  * | | - 10::11:2/128
2790  * | | - Flags = 192
2791  * | | - ADDRESS TLV block (0 TLVs)
2792  * | `-------------------
2793  * |
2794  * `------------------
2795  */
2796  {
2797  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2798 
2799  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
2800  m1->SetType (1);
2801  m1->SetOriginatorAddress (Ipv6Address ("abcd::1"));
2802 
2803  Ptr<PbbAddressBlockIpv6> m1a1 = Create<PbbAddressBlockIpv6> ();
2804  m1a1->AddressPushBack (Ipv6Address ("10::2"));
2805  m1a1->AddressPushBack (Ipv6Address ("10::11:2"));
2806  m1->AddressBlockPushBack (m1a1);
2807 
2808  packet->MessagePushBack (m1);
2809 
2810  uint8_t buffer[] = {
2811  0x00, 0x01, 0x8f, 0x00,
2812  0x2d, 0xab, 0xcd, 0x00,
2813  0x00, 0x00, 0x00, 0x00,
2814  0x00, 0x00, 0x00, 0x00,
2815  0x00, 0x00, 0x00, 0x00,
2816  0x01, 0x00, 0x00, 0x02,
2817  0xc0, 0x0d, 0x00, 0x10,
2818  0x00, 0x00, 0x00, 0x00,
2819  0x00, 0x00, 0x00, 0x00,
2820  0x00, 0x00, 0x00, 0x02,
2821  0x00, 0x02, 0x00, 0x11,
2822  0x00, 0x00,
2823  };
2824  AddTestCase (new PbbTestCase ("33", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2825  }
2826 
2827  /* Test 34
2828  * ,------------------
2829  * | PACKET
2830  * |------------------
2831  * | * Packet version: 0
2832  * | * Packet flags: 0
2833  * | ,-------------------
2834  * | | MESSAGE
2835  * | |-------------------
2836  * | | * Message type: 1
2837  * | | * Message flags: 129
2838  * | | * Originator address: abcd::1
2839  * | | - Address block (2 addresses)
2840  * | | - 10::2/128
2841  * | | - 10::11:2/128
2842  * | | - Flags = 192
2843  * | | - ADDRESS TLV block (0 TLVs)
2844  * | | - Address block (2 addresses)
2845  * | | - 10::/128
2846  * | | - 11::/128
2847  * | | - Flags = 160
2848  * | | - ADDRESS TLV block (0 TLVs)
2849  * | `-------------------
2850  * |
2851  * `------------------
2852  */
2853  {
2854  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2855 
2856  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
2857  m1->SetType (1);
2858  m1->SetOriginatorAddress (Ipv6Address ("abcd::1"));
2859 
2860  Ptr<PbbAddressBlockIpv6> m1a1 = Create<PbbAddressBlockIpv6> ();
2861  m1a1->AddressPushBack (Ipv6Address ("10::2"));
2862  m1a1->AddressPushBack (Ipv6Address ("10::11:2"));
2863  m1->AddressBlockPushBack (m1a1);
2864 
2865  Ptr<PbbAddressBlockIpv6> m1a2 = Create<PbbAddressBlockIpv6> ();
2866  m1a2->AddressPushBack (Ipv6Address ("10::"));
2867  m1a2->AddressPushBack (Ipv6Address ("11::"));
2868  m1->AddressBlockPushBack (m1a2);
2869 
2870  packet->MessagePushBack (m1);
2871 
2872  uint8_t buffer[] = {
2873  0x00, 0x01, 0x8f, 0x00,
2874  0x36, 0xab, 0xcd, 0x00,
2875  0x00, 0x00, 0x00, 0x00,
2876  0x00, 0x00, 0x00, 0x00,
2877  0x00, 0x00, 0x00, 0x00,
2878  0x01, 0x00, 0x00, 0x02,
2879  0xc0, 0x0d, 0x00, 0x10,
2880  0x00, 0x00, 0x00, 0x00,
2881  0x00, 0x00, 0x00, 0x00,
2882  0x00, 0x00, 0x00, 0x02,
2883  0x00, 0x02, 0x00, 0x11,
2884  0x00, 0x00, 0x02, 0xa0,
2885  0x01, 0x00, 0x0e, 0x10,
2886  0x11, 0x00, 0x00,
2887  };
2888  AddTestCase (new PbbTestCase ("34", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2889  }
2890 
2891  /* Test 35
2892  * ,------------------
2893  * | PACKET
2894  * |------------------
2895  * | * Packet version: 0
2896  * | * Packet flags: 0
2897  * | ,-------------------
2898  * | | MESSAGE
2899  * | |-------------------
2900  * | | * Message type: 1
2901  * | | * Message flags: 129
2902  * | | * Originator address: abcd::1
2903  * | | - Address block (2 addresses)
2904  * | | - 10::2/128
2905  * | | - 10::11:2/128
2906  * | | - Flags = 192
2907  * | | - ADDRESS TLV block (0 TLVs)
2908  * | | - Address block (4 addresses)
2909  * | | - 10::/128
2910  * | | - 11::/128
2911  * | | - 10::5/64
2912  * | | - 10::6/48
2913  * | | - Flags = 136
2914  * | | - ADDRESS TLV block (0 TLVs)
2915  * | `-------------------
2916  * |
2917  * `------------------
2918  */
2919  {
2920  Ptr<PbbPacket> packet = Create<PbbPacket> ();
2921 
2922  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
2923  m1->SetType (1);
2924  m1->SetOriginatorAddress (Ipv6Address ("abcd::1"));
2925 
2926  Ptr<PbbAddressBlockIpv6> m1a1 = Create<PbbAddressBlockIpv6> ();
2927  m1a1->AddressPushBack (Ipv6Address ("10::2"));
2928  m1a1->AddressPushBack (Ipv6Address ("10::11:2"));
2929  m1->AddressBlockPushBack (m1a1);
2930 
2931  Ptr<PbbAddressBlockIpv6> m1a2 = Create<PbbAddressBlockIpv6> ();
2932  m1a2->AddressPushBack (Ipv6Address ("10::"));
2933  m1a2->AddressPushBack (Ipv6Address ("11::"));
2934  m1a2->AddressPushBack (Ipv6Address ("10::5"));
2935  m1a2->AddressPushBack (Ipv6Address ("10::6"));
2936  m1a2->PrefixPushBack (128);
2937  m1a2->PrefixPushBack (128);
2938  m1a2->PrefixPushBack (64);
2939  m1a2->PrefixPushBack (48);
2940  m1->AddressBlockPushBack (m1a2);
2941 
2942  packet->MessagePushBack (m1);
2943 
2944  uint8_t buffer[] = {
2945  0x00, 0x01, 0x8f, 0x00,
2946  0x73, 0xab, 0xcd, 0x00,
2947  0x00, 0x00, 0x00, 0x00,
2948  0x00, 0x00, 0x00, 0x00,
2949  0x00, 0x00, 0x00, 0x00,
2950  0x01, 0x00, 0x00, 0x02,
2951  0xc0, 0x0d, 0x00, 0x10,
2952  0x00, 0x00, 0x00, 0x00,
2953  0x00, 0x00, 0x00, 0x00,
2954  0x00, 0x00, 0x00, 0x02,
2955  0x00, 0x02, 0x00, 0x11,
2956  0x00, 0x00, 0x04, 0x88,
2957  0x01, 0x00, 0x10, 0x00,
2958  0x00, 0x00, 0x00, 0x00,
2959  0x00, 0x00, 0x00, 0x00,
2960  0x00, 0x00, 0x00, 0x00,
2961  0x00, 0x11, 0x00, 0x00,
2962  0x00, 0x00, 0x00, 0x00,
2963  0x00, 0x00, 0x00, 0x00,
2964  0x00, 0x00, 0x00, 0x00,
2965  0x10, 0x00, 0x00, 0x00,
2966  0x00, 0x00, 0x00, 0x00,
2967  0x00, 0x00, 0x00, 0x00,
2968  0x00, 0x00, 0x05, 0x10,
2969  0x00, 0x00, 0x00, 0x00,
2970  0x00, 0x00, 0x00, 0x00,
2971  0x00, 0x00, 0x00, 0x00,
2972  0x00, 0x06, 0x80, 0x80,
2973  0x40, 0x30, 0x00, 0x00,
2974  };
2975  AddTestCase (new PbbTestCase ("35", packet, buffer, sizeof(buffer)), TestCase::QUICK);
2976  }
2977 
2978  /* Test 36
2979  * ,------------------
2980  * | PACKET
2981  * |------------------
2982  * | * Packet version: 0
2983  * | * Packet flags: 12
2984  * | * Packet seq number: 29
2985  * | | * Packet TLV Block
2986  * | | - TLV
2987  * | | Flags = 0
2988  * | | Type = 1; Value = (warning: parameter is NULL)
2989  * | ,-------------------
2990  * | | MESSAGE
2991  * | |-------------------
2992  * | | * Message type: 1
2993  * | | * Message flags: 0
2994  * | | * Message TLV Block
2995  * | | - TLV
2996  * | | Flags = 0
2997  * | | Type = 1; Value = (warning: parameter is NULL)
2998  * | `-------------------
2999  * |
3000  * | ,-------------------
3001  * | | MESSAGE
3002  * | |-------------------
3003  * | | * Message type: 2
3004  * | | * Message flags: 240
3005  * | | * Originator address: 10.0.0.1
3006  * | | * Hop limit: 255
3007  * | | * Hop count: 1
3008  * | | * Message seq number: 12345
3009  * | | - Address block (2 addresses)
3010  * | | - 10.0.0.2/32
3011  * | | - 10.1.1.2/32
3012  * | | - Flags = 192
3013  * | | - ADDRESS TLV block (0 TLVs)
3014  * | | - Address block (4 addresses)
3015  * | | - 10.0.0.0/32
3016  * | | - 11.0.0.0/32
3017  * | | - 10.0.0.5/16
3018  * | | - 10.0.0.6/24
3019  * | | - Flags = 8
3020  * | | - ADDRESS TLV block (1 TLVs)
3021  * | | - TLV
3022  * | | Flags = 56
3023  * | | Index-start = 1
3024  * | | Index-stop = 3
3025  * | | Type = 1; Value = 00 01 02 03
3026  * | | 04 05 06 07
3027  * | | 08 09 0a 0b
3028  * | | 0c 0d 0e 0f
3029  * | | 10 11 12 13
3030  * | | 14 15 16 17
3031  * | | 18 19 1a 1b
3032  * | | 1c 1d 1e 1f
3033  * | | 20 21 22 23
3034  * | | 24 25 26 27
3035  * | | 28 29 2a 2b
3036  * | | 2c 2d 2e 2f
3037  * | | 30 31 32 33
3038  * | | 34 35 36 37
3039  * | | 38 39 3a 3b
3040  * | | 3c 3d 3e 3f
3041  * | | 40 41 42 43
3042  * | | 44 45 46 47
3043  * | | 48 49 4a 4b
3044  * | | 4c 4d 4e 4f
3045  * | | 50 51 52 53
3046  * | | 54 55 56 57
3047  * | | 58 59 5a 5b
3048  * | | 5c 5d 5e 5f
3049  * | | 60 61 62 63
3050  * | | 64 65 66 67
3051  * | | 68 69 6a 6b
3052  * | | 6c 6d 6e 6f
3053  * | | 70 71 72 73
3054  * | | 74 75 76 77
3055  * | | 78 79 7a 7b
3056  * | | 7c 7d 7e 7f
3057  * | | 80 81 82 83
3058  * | | 84 85 86 87
3059  * | | 88 89 8a 8b
3060  * | | 8c 8d 8e 8f
3061  * | | 90 91 92 93
3062  * | | 94 95 96 97
3063  * | | 98 99 9a 9b
3064  * | | 9c 9d 9e 9f
3065  * | | a0 a1 a2 a3
3066  * | | a4 a5 a6 a7
3067  * | | a8 a9 aa ab
3068  * | | ac ad ae af
3069  * | | b0 b1 b2 b3
3070  * | | b4 b5 b6 b7
3071  * | | b8 b9 ba bb
3072  * | | bc bd be bf
3073  * | | c0 c1 c2 c3
3074  * | | c4 c5 c6 c7
3075  * | | c8 c9 ca cb
3076  * | | cc cd ce cf
3077  * | | d0 d1 d2 d3
3078  * | | d4 d5 d6 d7
3079  * | | d8 d9 da db
3080  * | | dc dd de df
3081  * | | e0 e1 e2 e3
3082  * | | e4 e5 e6 e7
3083  * | | e8 e9 ea eb
3084  * | | ec ed ee ef
3085  * | | f0 f1 f2 f3
3086  * | | f4 f5 f6 f7
3087  * | | f8 f9 fa fb
3088  * | | fc fd fe 00
3089  * | | 01 02 03 04
3090  * | | 05 06 07 08
3091  * | | 09 0a 0b 0c
3092  * | | 0d 0e 0f 10
3093  * | | 11 12 13 14
3094  * | | 15 16 17 18
3095  * | | 19 1a 1b 1c
3096  * | | 1d 1e 1f 20
3097  * | | 21 22 23 24
3098  * | | 25 26 27 28
3099  * | | 29 2a 2b 2c
3100  * | |
3101  * | `-------------------
3102  * |
3103  * | ,-------------------
3104  * | | MESSAGE
3105  * | |-------------------
3106  * | | * Message type: 1
3107  * | | * Message flags: 129
3108  * | | * Originator address: abcd::1
3109  * | | - Address block (2 addresses)
3110  * | | - 10::2/128
3111  * | | - 10::11:2/128
3112  * | | - Flags = 192
3113  * | | - ADDRESS TLV block (0 TLVs)
3114  * | | - Address block (4 addresses)
3115  * | | - 10::/128
3116  * | | - 11::/128
3117  * | | - 10::5/64
3118  * | | - 10::6/48
3119  * | | - Flags = 136
3120  * | | - ADDRESS TLV block (0 TLVs)
3121  * | `-------------------
3122  * |
3123  * `------------------
3124  */
3125  {
3126  Ptr<PbbPacket> packet = Create<PbbPacket> ();
3127  packet->SetSequenceNumber (29);
3128 
3129  Ptr<PbbTlv> ptlv1 = Create<PbbTlv> ();
3130  ptlv1->SetType (1);
3131  packet->TlvPushBack (ptlv1);
3132 
3133  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
3134  m1->SetType (1);
3135 
3136  Ptr<PbbTlv> m1tlv1 = Create<PbbTlv> ();
3137  m1tlv1->SetType (1);
3138  m1->TlvPushBack (m1tlv1);
3139  packet->MessagePushBack (m1);
3140 
3141  Ptr<PbbMessageIpv4> m2 = Create<PbbMessageIpv4> ();
3142  m2->SetType (2);
3143  m2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
3144  m2->SetHopLimit (255);
3145  m2->SetHopCount (1);
3146  m2->SetSequenceNumber (12345);
3147 
3148  Ptr<PbbAddressBlockIpv4> m2a1 = Create<PbbAddressBlockIpv4> ();
3149  m2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
3150  m2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
3151  m2->AddressBlockPushBack (m2a1);
3152 
3153  Ptr<PbbAddressBlockIpv4> m2a2 = Create<PbbAddressBlockIpv4> ();
3154  m2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
3155  m2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
3156  m2a2->AddressPushBack (Ipv4Address ("10.0.0.5"));
3157  m2a2->AddressPushBack (Ipv4Address ("10.0.0.6"));
3158  m2a2->PrefixPushBack (32);
3159  m2a2->PrefixPushBack (32);
3160  m2a2->PrefixPushBack (16);
3161  m2a2->PrefixPushBack (24);
3162 
3163  Ptr<PbbAddressTlv> m2a2tlv1 = Create<PbbAddressTlv> ();
3164  m2a2tlv1->SetType (1);
3165  m2a2tlv1->SetIndexStart (1);
3166  m2a2tlv1->SetIndexStop (3);
3167 
3168  uint8_t value[] = {
3169  0x00, 0x01, 0x02, 0x03,
3170  0x04, 0x05, 0x06, 0x07,
3171  0x08, 0x09, 0x0a, 0x0b,
3172  0x0c, 0x0d, 0x0e, 0x0f,
3173  0x10, 0x11, 0x12, 0x13,
3174  0x14, 0x15, 0x16, 0x17,
3175  0x18, 0x19, 0x1a, 0x1b,
3176  0x1c, 0x1d, 0x1e, 0x1f,
3177  0x20, 0x21, 0x22, 0x23,
3178  0x24, 0x25, 0x26, 0x27,
3179  0x28, 0x29, 0x2a, 0x2b,
3180  0x2c, 0x2d, 0x2e, 0x2f,
3181  0x30, 0x31, 0x32, 0x33,
3182  0x34, 0x35, 0x36, 0x37,
3183  0x38, 0x39, 0x3a, 0x3b,
3184  0x3c, 0x3d, 0x3e, 0x3f,
3185  0x40, 0x41, 0x42, 0x43,
3186  0x44, 0x45, 0x46, 0x47,
3187  0x48, 0x49, 0x4a, 0x4b,
3188  0x4c, 0x4d, 0x4e, 0x4f,
3189  0x50, 0x51, 0x52, 0x53,
3190  0x54, 0x55, 0x56, 0x57,
3191  0x58, 0x59, 0x5a, 0x5b,
3192  0x5c, 0x5d, 0x5e, 0x5f,
3193  0x60, 0x61, 0x62, 0x63,
3194  0x64, 0x65, 0x66, 0x67,
3195  0x68, 0x69, 0x6a, 0x6b,
3196  0x6c, 0x6d, 0x6e, 0x6f,
3197  0x70, 0x71, 0x72, 0x73,
3198  0x74, 0x75, 0x76, 0x77,
3199  0x78, 0x79, 0x7a, 0x7b,
3200  0x7c, 0x7d, 0x7e, 0x7f,
3201  0x80, 0x81, 0x82, 0x83,
3202  0x84, 0x85, 0x86, 0x87,
3203  0x88, 0x89, 0x8a, 0x8b,
3204  0x8c, 0x8d, 0x8e, 0x8f,
3205  0x90, 0x91, 0x92, 0x93,
3206  0x94, 0x95, 0x96, 0x97,
3207  0x98, 0x99, 0x9a, 0x9b,
3208  0x9c, 0x9d, 0x9e, 0x9f,
3209  0xa0, 0xa1, 0xa2, 0xa3,
3210  0xa4, 0xa5, 0xa6, 0xa7,
3211  0xa8, 0xa9, 0xaa, 0xab,
3212  0xac, 0xad, 0xae, 0xaf,
3213  0xb0, 0xb1, 0xb2, 0xb3,
3214  0xb4, 0xb5, 0xb6, 0xb7,
3215  0xb8, 0xb9, 0xba, 0xbb,
3216  0xbc, 0xbd, 0xbe, 0xbf,
3217  0xc0, 0xc1, 0xc2, 0xc3,
3218  0xc4, 0xc5, 0xc6, 0xc7,
3219  0xc8, 0xc9, 0xca, 0xcb,
3220  0xcc, 0xcd, 0xce, 0xcf,
3221  0xd0, 0xd1, 0xd2, 0xd3,
3222  0xd4, 0xd5, 0xd6, 0xd7,
3223  0xd8, 0xd9, 0xda, 0xdb,
3224  0xdc, 0xdd, 0xde, 0xdf,
3225  0xe0, 0xe1, 0xe2, 0xe3,
3226  0xe4, 0xe5, 0xe6, 0xe7,
3227  0xe8, 0xe9, 0xea, 0xeb,
3228  0xec, 0xed, 0xee, 0xef,
3229  0xf0, 0xf1, 0xf2, 0xf3,
3230  0xf4, 0xf5, 0xf6, 0xf7,
3231  0xf8, 0xf9, 0xfa, 0xfb,
3232  0xfc, 0xfd, 0xfe, 0x00,
3233  0x01, 0x02, 0x03, 0x04,
3234  0x05, 0x06, 0x07, 0x08,
3235  0x09, 0x0a, 0x0b, 0x0c,
3236  0x0d, 0x0e, 0x0f, 0x10,
3237  0x11, 0x12, 0x13, 0x14,
3238  0x15, 0x16, 0x17, 0x18,
3239  0x19, 0x1a, 0x1b, 0x1c,
3240  0x1d, 0x1e, 0x1f, 0x20,
3241  0x21, 0x22, 0x23, 0x24,
3242  0x25, 0x26, 0x27, 0x28,
3243  0x29, 0x2a, 0x2b, 0x2c,
3244  };
3245  m2a2tlv1->SetValue (value, sizeof(value));
3246  m2a2->TlvPushBack (m2a2tlv1);
3247 
3248  m2->AddressBlockPushBack (m2a2);
3249  packet->MessagePushBack (m2);
3250 
3251  Ptr<PbbMessageIpv6> m3 = Create<PbbMessageIpv6> ();
3252  m3->SetType (1);
3253  m3->SetOriginatorAddress (Ipv6Address ("abcd::1"));
3254 
3255  Ptr<PbbAddressBlockIpv6> m3a1 = Create<PbbAddressBlockIpv6> ();
3256  m3a1->AddressPushBack (Ipv6Address ("10::2"));
3257  m3a1->AddressPushBack (Ipv6Address ("10::11:2"));
3258  m3->AddressBlockPushBack (m3a1);
3259 
3260  Ptr<PbbAddressBlockIpv6> m3a2 = Create<PbbAddressBlockIpv6> ();
3261  m3a2->AddressPushBack (Ipv6Address ("10::"));
3262  m3a2->AddressPushBack (Ipv6Address ("11::"));
3263  m3a2->AddressPushBack (Ipv6Address ("10::5"));
3264  m3a2->AddressPushBack (Ipv6Address ("10::6"));
3265  m3a2->PrefixPushBack (128);
3266  m3a2->PrefixPushBack (128);
3267  m3a2->PrefixPushBack (64);
3268  m3a2->PrefixPushBack (48);
3269 
3270  m3->AddressBlockPushBack (m3a2);
3271  packet->MessagePushBack (m3);
3272 
3273  uint8_t buffer[] = {
3274  0x0c, 0x00, 0x1d, 0x00,
3275  0x02, 0x01, 0x00, 0x01,
3276  0x0f, 0x00, 0x08, 0x00,
3277  0x02, 0x01, 0x00, 0x02,
3278  0xf3, 0x01, 0x64, 0x0a,
3279  0x00, 0x00, 0x01, 0xff,
3280  0x01, 0x30, 0x39, 0x00,
3281  0x00, 0x02, 0xc0, 0x01,
3282  0x0a, 0x01, 0x02, 0x00,
3283  0x00, 0x01, 0x01, 0x00,
3284  0x00, 0x04, 0x08, 0x0a,
3285  0x00, 0x00, 0x00, 0x0b,
3286  0x00, 0x00, 0x00, 0x0a,
3287  0x00, 0x00, 0x05, 0x0a,
3288  0x00, 0x00, 0x06, 0x20,
3289  0x20, 0x10, 0x18, 0x01,
3290  0x32, 0x01, 0x38, 0x01,
3291  0x03, 0x01, 0x2c, 0x00,
3292  0x01, 0x02, 0x03, 0x04,
3293  0x05, 0x06, 0x07, 0x08,
3294  0x09, 0x0a, 0x0b, 0x0c,
3295  0x0d, 0x0e, 0x0f, 0x10,
3296  0x11, 0x12, 0x13, 0x14,
3297  0x15, 0x16, 0x17, 0x18,
3298  0x19, 0x1a, 0x1b, 0x1c,
3299  0x1d, 0x1e, 0x1f, 0x20,
3300  0x21, 0x22, 0x23, 0x24,
3301  0x25, 0x26, 0x27, 0x28,
3302  0x29, 0x2a, 0x2b, 0x2c,
3303  0x2d, 0x2e, 0x2f, 0x30,
3304  0x31, 0x32, 0x33, 0x34,
3305  0x35, 0x36, 0x37, 0x38,
3306  0x39, 0x3a, 0x3b, 0x3c,
3307  0x3d, 0x3e, 0x3f, 0x40,
3308  0x41, 0x42, 0x43, 0x44,
3309  0x45, 0x46, 0x47, 0x48,
3310  0x49, 0x4a, 0x4b, 0x4c,
3311  0x4d, 0x4e, 0x4f, 0x50,
3312  0x51, 0x52, 0x53, 0x54,
3313  0x55, 0x56, 0x57, 0x58,
3314  0x59, 0x5a, 0x5b, 0x5c,
3315  0x5d, 0x5e, 0x5f, 0x60,
3316  0x61, 0x62, 0x63, 0x64,
3317  0x65, 0x66, 0x67, 0x68,
3318  0x69, 0x6a, 0x6b, 0x6c,
3319  0x6d, 0x6e, 0x6f, 0x70,
3320  0x71, 0x72, 0x73, 0x74,
3321  0x75, 0x76, 0x77, 0x78,
3322  0x79, 0x7a, 0x7b, 0x7c,
3323  0x7d, 0x7e, 0x7f, 0x80,
3324  0x81, 0x82, 0x83, 0x84,
3325  0x85, 0x86, 0x87, 0x88,
3326  0x89, 0x8a, 0x8b, 0x8c,
3327  0x8d, 0x8e, 0x8f, 0x90,
3328  0x91, 0x92, 0x93, 0x94,
3329  0x95, 0x96, 0x97, 0x98,
3330  0x99, 0x9a, 0x9b, 0x9c,
3331  0x9d, 0x9e, 0x9f, 0xa0,
3332  0xa1, 0xa2, 0xa3, 0xa4,
3333  0xa5, 0xa6, 0xa7, 0xa8,
3334  0xa9, 0xaa, 0xab, 0xac,
3335  0xad, 0xae, 0xaf, 0xb0,
3336  0xb1, 0xb2, 0xb3, 0xb4,
3337  0xb5, 0xb6, 0xb7, 0xb8,
3338  0xb9, 0xba, 0xbb, 0xbc,
3339  0xbd, 0xbe, 0xbf, 0xc0,
3340  0xc1, 0xc2, 0xc3, 0xc4,
3341  0xc5, 0xc6, 0xc7, 0xc8,
3342  0xc9, 0xca, 0xcb, 0xcc,
3343  0xcd, 0xce, 0xcf, 0xd0,
3344  0xd1, 0xd2, 0xd3, 0xd4,
3345  0xd5, 0xd6, 0xd7, 0xd8,
3346  0xd9, 0xda, 0xdb, 0xdc,
3347  0xdd, 0xde, 0xdf, 0xe0,
3348  0xe1, 0xe2, 0xe3, 0xe4,
3349  0xe5, 0xe6, 0xe7, 0xe8,
3350  0xe9, 0xea, 0xeb, 0xec,
3351  0xed, 0xee, 0xef, 0xf0,
3352  0xf1, 0xf2, 0xf3, 0xf4,
3353  0xf5, 0xf6, 0xf7, 0xf8,
3354  0xf9, 0xfa, 0xfb, 0xfc,
3355  0xfd, 0xfe, 0x00, 0x01,
3356  0x02, 0x03, 0x04, 0x05,
3357  0x06, 0x07, 0x08, 0x09,
3358  0x0a, 0x0b, 0x0c, 0x0d,
3359  0x0e, 0x0f, 0x10, 0x11,
3360  0x12, 0x13, 0x14, 0x15,
3361  0x16, 0x17, 0x18, 0x19,
3362  0x1a, 0x1b, 0x1c, 0x1d,
3363  0x1e, 0x1f, 0x20, 0x21,
3364  0x22, 0x23, 0x24, 0x25,
3365  0x26, 0x27, 0x28, 0x29,
3366  0x2a, 0x2b, 0x2c, 0x01,
3367  0x8f, 0x00, 0x73, 0xab,
3368  0xcd, 0x00, 0x00, 0x00,
3369  0x00, 0x00, 0x00, 0x00,
3370  0x00, 0x00, 0x00, 0x00,
3371  0x00, 0x00, 0x01, 0x00,
3372  0x00, 0x02, 0xc0, 0x0d,
3373  0x00, 0x10, 0x00, 0x00,
3374  0x00, 0x00, 0x00, 0x00,
3375  0x00, 0x00, 0x00, 0x00,
3376  0x00, 0x02, 0x00, 0x02,
3377  0x00, 0x11, 0x00, 0x00,
3378  0x04, 0x88, 0x01, 0x00,
3379  0x10, 0x00, 0x00, 0x00,
3380  0x00, 0x00, 0x00, 0x00,
3381  0x00, 0x00, 0x00, 0x00,
3382  0x00, 0x00, 0x00, 0x11,
3383  0x00, 0x00, 0x00, 0x00,
3384  0x00, 0x00, 0x00, 0x00,
3385  0x00, 0x00, 0x00, 0x00,
3386  0x00, 0x00, 0x10, 0x00,
3387  0x00, 0x00, 0x00, 0x00,
3388  0x00, 0x00, 0x00, 0x00,
3389  0x00, 0x00, 0x00, 0x00,
3390  0x05, 0x10, 0x00, 0x00,
3391  0x00, 0x00, 0x00, 0x00,
3392  0x00, 0x00, 0x00, 0x00,
3393  0x00, 0x00, 0x00, 0x06,
3394  0x80, 0x80, 0x40, 0x30,
3395  0x00, 0x00,
3396  };
3397  AddTestCase (new PbbTestCase ("36", packet, buffer, sizeof(buffer)), TestCase::QUICK);
3398  }
3399 
3400  /* Test 37
3401  * ,------------------
3402  * | PACKET
3403  * |------------------
3404  * | * Packet version: 0
3405  * | * Packet flags: 12
3406  * | * Packet seq number: 30
3407  * | | * Packet TLV Block
3408  * | | - TLV
3409  * | | Flags = 0
3410  * | | Type = 1; Value = (warning: parameter is NULL)
3411  * | ,-------------------
3412  * | | MESSAGE
3413  * | |-------------------
3414  * | | * Message type: 1
3415  * | | * Message flags: 0
3416  * | | * Message TLV Block
3417  * | | - TLV
3418  * | | Flags = 0
3419  * | | Type = 1; Value = (warning: parameter is NULL)
3420  * | `-------------------
3421  * |
3422  * | ,-------------------
3423  * | | MESSAGE
3424  * | |-------------------
3425  * | | * Message type: 2
3426  * | | * Message flags: 240
3427  * | | * Originator address: 10.0.0.1
3428  * | | * Hop limit: 255
3429  * | | * Hop count: 1
3430  * | | * Message seq number: 12345
3431  * | | - Address block (2 addresses)
3432  * | | - 10.0.0.2/32
3433  * | | - 10.1.1.2/32
3434  * | | - Flags = 192
3435  * | | - ADDRESS TLV block (0 TLVs)
3436  * | | - Address block (4 addresses)
3437  * | | - 10.0.0.0/32
3438  * | | - 11.0.0.0/32
3439  * | | - 10.0.0.5/16
3440  * | | - 10.0.0.6/24
3441  * | | - Flags = 8
3442  * | | - ADDRESS TLV block (1 TLVs)
3443  * | | - TLV
3444  * | | Flags = 56
3445  * | | Index-start = 1
3446  * | | Index-stop = 3
3447  * | | Type = 1; Value = 00 01 02 03
3448  * | | 04 05 06 07
3449  * | | 08 09 0a 0b
3450  * | | 0c 0d 0e 0f
3451  * | | 10 11 12 13
3452  * | | 14 15 16 17
3453  * | | 18 19 1a 1b
3454  * | | 1c 1d 1e 1f
3455  * | | 20 21 22 23
3456  * | | 24 25 26 27
3457  * | | 28 29 2a 2b
3458  * | | 2c 2d 2e 2f
3459  * | | 30 31 32 33
3460  * | | 34 35 36 37
3461  * | | 38 39 3a 3b
3462  * | | 3c 3d 3e 3f
3463  * | | 40 41 42 43
3464  * | | 44 45 46 47
3465  * | | 48 49 4a 4b
3466  * | | 4c 4d 4e 4f
3467  * | | 50 51 52 53
3468  * | | 54 55 56 57
3469  * | | 58 59 5a 5b
3470  * | | 5c 5d 5e 5f
3471  * | | 60 61 62 63
3472  * | | 64 65 66 67
3473  * | | 68 69 6a 6b
3474  * | | 6c 6d 6e 6f
3475  * | | 70 71 72 73
3476  * | | 74 75 76 77
3477  * | | 78 79 7a 7b
3478  * | | 7c 7d 7e 7f
3479  * | | 80 81 82 83
3480  * | | 84 85 86 87
3481  * | | 88 89 8a 8b
3482  * | | 8c 8d 8e 8f
3483  * | | 90 91 92 93
3484  * | | 94 95 96 97
3485  * | | 98 99 9a 9b
3486  * | | 9c 9d 9e 9f
3487  * | | a0 a1 a2 a3
3488  * | | a4 a5 a6 a7
3489  * | | a8 a9 aa ab
3490  * | | ac ad ae af
3491  * | | b0 b1 b2 b3
3492  * | | b4 b5 b6 b7
3493  * | | b8 b9 ba bb
3494  * | | bc bd be bf
3495  * | | c0 c1 c2 c3
3496  * | | c4 c5 c6 c7
3497  * | | c8 c9 ca cb
3498  * | | cc cd ce cf
3499  * | | d0 d1 d2 d3
3500  * | | d4 d5 d6 d7
3501  * | | d8 d9 da db
3502  * | | dc dd de df
3503  * | | e0 e1 e2 e3
3504  * | | e4 e5 e6 e7
3505  * | | e8 e9 ea eb
3506  * | | ec ed ee ef
3507  * | | f0 f1 f2 f3
3508  * | | f4 f5 f6 f7
3509  * | | f8 f9 fa fb
3510  * | | fc fd fe 00
3511  * | | 01 02 03 04
3512  * | | 05 06 07 08
3513  * | | 09 0a 0b 0c
3514  * | | 0d 0e 0f 10
3515  * | | 11 12 13 14
3516  * | | 15 16 17 18
3517  * | | 19 1a 1b 1c
3518  * | | 1d 1e 1f 20
3519  * | | 21 22 23 24
3520  * | | 25 26 27 28
3521  * | | 29 2a 2b 2c
3522  * | |
3523  * | `-------------------
3524  * |
3525  * | ,-------------------
3526  * | | MESSAGE
3527  * | |-------------------
3528  * | | * Message type: 1
3529  * | | * Message flags: 129
3530  * | | * Originator address: abcd::1
3531  * | | - Address block (2 addresses)
3532  * | | - 10::2/128
3533  * | | - 10::11:2/128
3534  * | | - Flags = 192
3535  * | | - ADDRESS TLV block (0 TLVs)
3536  * | | - Address block (4 addresses)
3537  * | | - 10::/128
3538  * | | - 11::/128
3539  * | | - 10::5/64
3540  * | | - 10::6/48
3541  * | | - Flags = 136
3542  * | | - ADDRESS TLV block (0 TLVs)
3543  * | `-------------------
3544  * |
3545  * `------------------
3546  */
3547  {
3548  Ptr<PbbPacket> packet = Create<PbbPacket> ();
3549  packet->SetSequenceNumber (30);
3550 
3551  Ptr<PbbTlv> ptlv1 = Create<PbbTlv> ();
3552  ptlv1->SetType (1);
3553  packet->TlvPushBack (ptlv1);
3554 
3555  Ptr<PbbMessageIpv6> m1 = Create<PbbMessageIpv6> ();
3556  m1->SetType (1);
3557 
3558  Ptr<PbbTlv> m1tlv1 = Create<PbbTlv> ();
3559  m1tlv1->SetType (1);
3560  m1->TlvPushBack (m1tlv1);
3561  packet->MessagePushBack (m1);
3562 
3563  Ptr<PbbMessageIpv4> m2 = Create<PbbMessageIpv4> ();
3564  m2->SetType (2);
3565  m2->SetOriginatorAddress (Ipv4Address ("10.0.0.1"));
3566  m2->SetHopLimit (255);
3567  m2->SetHopCount (1);
3568  m2->SetSequenceNumber (12345);
3569 
3570  Ptr<PbbAddressBlockIpv4> m2a1 = Create<PbbAddressBlockIpv4> ();
3571  m2a1->AddressPushBack (Ipv4Address ("10.0.0.2"));
3572  m2a1->AddressPushBack (Ipv4Address ("10.1.1.2"));
3573  m2->AddressBlockPushBack (m2a1);
3574 
3575  Ptr<PbbAddressBlockIpv4> m2a2 = Create<PbbAddressBlockIpv4> ();
3576  m2a2->AddressPushBack (Ipv4Address ("10.0.0.0"));
3577  m2a2->AddressPushBack (Ipv4Address ("11.0.0.0"));
3578  m2a2->AddressPushBack (Ipv4Address ("10.0.0.5"));
3579  m2a2->AddressPushBack (Ipv4Address ("10.0.0.6"));
3580  m2a2->PrefixPushBack (32);
3581  m2a2->PrefixPushBack (32);
3582  m2a2->PrefixPushBack (16);
3583  m2a2->PrefixPushBack (24);
3584 
3585  Ptr<PbbAddressTlv> m2a2tlv1 = Create<PbbAddressTlv> ();
3586  m2a2tlv1->SetType (1);
3587  m2a2tlv1->SetIndexStart (1);
3588  m2a2tlv1->SetIndexStop (3);
3589 
3590  uint8_t value[] = {
3591  0x00, 0x01, 0x02, 0x03,
3592  0x04, 0x05, 0x06, 0x07,
3593  0x08, 0x09, 0x0a, 0x0b,
3594  0x0c, 0x0d, 0x0e, 0x0f,
3595  0x10, 0x11, 0x12, 0x13,
3596  0x14, 0x15, 0x16, 0x17,
3597  0x18, 0x19, 0x1a, 0x1b,
3598  0x1c, 0x1d, 0x1e, 0x1f,
3599  0x20, 0x21, 0x22, 0x23,
3600  0x24, 0x25, 0x26, 0x27,
3601  0x28, 0x29, 0x2a, 0x2b,
3602  0x2c, 0x2d, 0x2e, 0x2f,
3603  0x30, 0x31, 0x32, 0x33,
3604  0x34, 0x35, 0x36, 0x37,
3605  0x38, 0x39, 0x3a, 0x3b,
3606  0x3c, 0x3d, 0x3e, 0x3f,
3607  0x40, 0x41, 0x42, 0x43,
3608  0x44, 0x45, 0x46, 0x47,
3609  0x48, 0x49, 0x4a, 0x4b,
3610  0x4c, 0x4d, 0x4e, 0x4f,
3611  0x50, 0x51, 0x52, 0x53,
3612  0x54, 0x55, 0x56, 0x57,
3613  0x58, 0x59, 0x5a, 0x5b,
3614  0x5c, 0x5d, 0x5e, 0x5f,
3615  0x60, 0x61, 0x62, 0x63,
3616  0x64, 0x65, 0x66, 0x67,
3617  0x68, 0x69, 0x6a, 0x6b,
3618  0x6c, 0x6d, 0x6e, 0x6f,
3619  0x70, 0x71, 0x72, 0x73,
3620  0x74, 0x75, 0x76, 0x77,
3621  0x78, 0x79, 0x7a, 0x7b,
3622  0x7c, 0x7d, 0x7e, 0x7f,
3623  0x80, 0x81, 0x82, 0x83,
3624  0x84, 0x85, 0x86, 0x87,
3625  0x88, 0x89, 0x8a, 0x8b,
3626  0x8c, 0x8d, 0x8e, 0x8f,
3627  0x90, 0x91, 0x92, 0x93,
3628  0x94, 0x95, 0x96, 0x97,
3629  0x98, 0x99, 0x9a, 0x9b,
3630  0x9c, 0x9d, 0x9e, 0x9f,
3631  0xa0, 0xa1, 0xa2, 0xa3,
3632  0xa4, 0xa5, 0xa6, 0xa7,
3633  0xa8, 0xa9, 0xaa, 0xab,
3634  0xac, 0xad, 0xae, 0xaf,
3635  0xb0, 0xb1, 0xb2, 0xb3,
3636  0xb4, 0xb5, 0xb6, 0xb7,
3637  0xb8, 0xb9, 0xba, 0xbb,
3638  0xbc, 0xbd, 0xbe, 0xbf,
3639  0xc0, 0xc1, 0xc2, 0xc3,
3640  0xc4, 0xc5, 0xc6, 0xc7,
3641  0xc8, 0xc9, 0xca, 0xcb,
3642  0xcc, 0xcd, 0xce, 0xcf,
3643  0xd0, 0xd1, 0xd2, 0xd3,
3644  0xd4, 0xd5, 0xd6, 0xd7,
3645  0xd8, 0xd9, 0xda, 0xdb,
3646  0xdc, 0xdd, 0xde, 0xdf,
3647  0xe0, 0xe1, 0xe2, 0xe3,
3648  0xe4, 0xe5, 0xe6, 0xe7,
3649  0xe8, 0xe9, 0xea, 0xeb,
3650  0xec, 0xed, 0xee, 0xef,
3651  0xf0, 0xf1, 0xf2, 0xf3,
3652  0xf4, 0xf5, 0xf6, 0xf7,
3653  0xf8, 0xf9, 0xfa, 0xfb,
3654  0xfc, 0xfd, 0xfe, 0x00,
3655  0x01, 0x02, 0x03, 0x04,
3656  0x05, 0x06, 0x07, 0x08,
3657  0x09, 0x0a, 0x0b, 0x0c,
3658  0x0d, 0x0e, 0x0f, 0x10,
3659  0x11, 0x12, 0x13, 0x14,
3660  0x15, 0x16, 0x17, 0x18,
3661  0x19, 0x1a, 0x1b, 0x1c,
3662  0x1d, 0x1e, 0x1f, 0x20,
3663  0x21, 0x22, 0x23, 0x24,
3664  0x25, 0x26, 0x27, 0x28,
3665  0x29, 0x2a, 0x2b, 0x2c,
3666  };
3667  m2a2tlv1->SetValue (value, sizeof(value));
3668  m2a2->TlvPushBack (m2a2tlv1);
3669 
3670  m2->AddressBlockPushBack (m2a2);
3671  packet->MessagePushBack (m2);
3672 
3673  Ptr<PbbMessageIpv6> m3 = Create<PbbMessageIpv6> ();
3674  m3->SetType (1);
3675  m3->SetOriginatorAddress (Ipv6Address ("abcd::1"));
3676 
3677  Ptr<PbbAddressBlockIpv6> m3a1 = Create<PbbAddressBlockIpv6> ();
3678  m3a1->AddressPushBack (Ipv6Address ("10::2"));
3679  m3a1->AddressPushBack (Ipv6Address ("10::11:2"));
3680  m3->AddressBlockPushBack (m3a1);
3681 
3682  Ptr<PbbAddressBlockIpv6> m3a2 = Create<PbbAddressBlockIpv6> ();
3683  m3a2->AddressPushBack (Ipv6Address ("10::"));
3684  m3a2->AddressPushBack (Ipv6Address ("11::"));
3685  m3a2->AddressPushBack (Ipv6Address ("10::5"));
3686  m3a2->AddressPushBack (Ipv6Address ("10::6"));
3687  m3a2->PrefixPushBack (128);
3688  m3a2->PrefixPushBack (128);
3689  m3a2->PrefixPushBack (64);
3690  m3a2->PrefixPushBack (48);
3691 
3692  m3->AddressBlockPushBack (m3a2);
3693  packet->MessagePushBack (m3);
3694 
3695  uint8_t buffer[] = {
3696  0x0c, 0x00, 0x1e, 0x00,
3697  0x02, 0x01, 0x00, 0x01,
3698  0x0f, 0x00, 0x08, 0x00,
3699  0x02, 0x01, 0x00, 0x02,
3700  0xf3, 0x01, 0x64, 0x0a,
3701  0x00, 0x00, 0x01, 0xff,
3702  0x01, 0x30, 0x39, 0x00,
3703  0x00, 0x02, 0xc0, 0x01,
3704  0x0a, 0x01, 0x02, 0x00,
3705  0x00, 0x01, 0x01, 0x00,
3706  0x00, 0x04, 0x08, 0x0a,
3707  0x00, 0x00, 0x00, 0x0b,
3708  0x00, 0x00, 0x00, 0x0a,
3709  0x00, 0x00, 0x05, 0x0a,
3710  0x00, 0x00, 0x06, 0x20,
3711  0x20, 0x10, 0x18, 0x01,
3712  0x32, 0x01, 0x38, 0x01,
3713  0x03, 0x01, 0x2c, 0x00,
3714  0x01, 0x02, 0x03, 0x04,
3715  0x05, 0x06, 0x07, 0x08,
3716  0x09, 0x0a, 0x0b, 0x0c,
3717  0x0d, 0x0e, 0x0f, 0x10,
3718  0x11, 0x12, 0x13, 0x14,
3719  0x15, 0x16, 0x17, 0x18,
3720  0x19, 0x1a, 0x1b, 0x1c,
3721  0x1d, 0x1e, 0x1f, 0x20,
3722  0x21, 0x22, 0x23, 0x24,
3723  0x25, 0x26, 0x27, 0x28,
3724  0x29, 0x2a, 0x2b, 0x2c,
3725  0x2d, 0x2e, 0x2f, 0x30,
3726  0x31, 0x32, 0x33, 0x34,
3727  0x35, 0x36, 0x37, 0x38,
3728  0x39, 0x3a, 0x3b, 0x3c,
3729  0x3d, 0x3e, 0x3f, 0x40,
3730  0x41, 0x42, 0x43, 0x44,
3731  0x45, 0x46, 0x47, 0x48,
3732  0x49, 0x4a, 0x4b, 0x4c,
3733  0x4d, 0x4e, 0x4f, 0x50,
3734  0x51, 0x52, 0x53, 0x54,
3735  0x55, 0x56, 0x57, 0x58,
3736  0x59, 0x5a, 0x5b, 0x5c,
3737  0x5d, 0x5e, 0x5f, 0x60,
3738  0x61, 0x62, 0x63, 0x64,
3739  0x65, 0x66, 0x67, 0x68,
3740  0x69, 0x6a, 0x6b, 0x6c,
3741  0x6d, 0x6e, 0x6f, 0x70,
3742  0x71, 0x72, 0x73, 0x74,
3743  0x75, 0x76, 0x77, 0x78,
3744  0x79, 0x7a, 0x7b, 0x7c,
3745  0x7d, 0x7e, 0x7f, 0x80,
3746  0x81, 0x82, 0x83, 0x84,
3747  0x85, 0x86, 0x87, 0x88,
3748  0x89, 0x8a, 0x8b, 0x8c,
3749  0x8d, 0x8e, 0x8f, 0x90,
3750  0x91, 0x92, 0x93, 0x94,
3751  0x95, 0x96, 0x97, 0x98,
3752  0x99, 0x9a, 0x9b, 0x9c,
3753  0x9d, 0x9e, 0x9f, 0xa0,
3754  0xa1, 0xa2, 0xa3, 0xa4,
3755  0xa5, 0xa6, 0xa7, 0xa8,
3756  0xa9, 0xaa, 0xab, 0xac,
3757  0xad, 0xae, 0xaf, 0xb0,
3758  0xb1, 0xb2, 0xb3, 0xb4,
3759  0xb5, 0xb6, 0xb7, 0xb8,
3760  0xb9, 0xba, 0xbb, 0xbc,
3761  0xbd, 0xbe, 0xbf, 0xc0,
3762  0xc1, 0xc2, 0xc3, 0xc4,
3763  0xc5, 0xc6, 0xc7, 0xc8,
3764  0xc9, 0xca, 0xcb, 0xcc,
3765  0xcd, 0xce, 0xcf, 0xd0,
3766  0xd1, 0xd2, 0xd3, 0xd4,
3767  0xd5, 0xd6, 0xd7, 0xd8,
3768  0xd9, 0xda, 0xdb, 0xdc,
3769  0xdd, 0xde, 0xdf, 0xe0,
3770  0xe1, 0xe2, 0xe3, 0xe4,
3771  0xe5, 0xe6, 0xe7, 0xe8,
3772  0xe9, 0xea, 0xeb, 0xec,
3773  0xed, 0xee, 0xef, 0xf0,
3774  0xf1, 0xf2, 0xf3, 0xf4,
3775  0xf5, 0xf6, 0xf7, 0xf8,
3776  0xf9, 0xfa, 0xfb, 0xfc,
3777  0xfd, 0xfe, 0x00, 0x01,
3778  0x02, 0x03, 0x04, 0x05,
3779  0x06, 0x07, 0x08, 0x09,
3780  0x0a, 0x0b, 0x0c, 0x0d,
3781  0x0e, 0x0f, 0x10, 0x11,
3782  0x12, 0x13, 0x14, 0x15,
3783  0x16, 0x17, 0x18, 0x19,
3784  0x1a, 0x1b, 0x1c, 0x1d,
3785  0x1e, 0x1f, 0x20, 0x21,
3786  0x22, 0x23, 0x24, 0x25,
3787  0x26, 0x27, 0x28, 0x29,
3788  0x2a, 0x2b, 0x2c, 0x01,
3789  0x8f, 0x00, 0x73, 0xab,
3790  0xcd, 0x00, 0x00, 0x00,
3791  0x00, 0x00, 0x00, 0x00,
3792  0x00, 0x00, 0x00, 0x00,
3793  0x00, 0x00, 0x01, 0x00,
3794  0x00, 0x02, 0xc0, 0x0d,
3795  0x00, 0x10, 0x00, 0x00,
3796  0x00, 0x00, 0x00, 0x00,
3797  0x00, 0x00, 0x00, 0x00,
3798  0x00, 0x02, 0x00, 0x02,
3799  0x00, 0x11, 0x00, 0x00,
3800  0x04, 0x88, 0x01, 0x00,
3801  0x10, 0x00, 0x00, 0x00,
3802  0x00, 0x00, 0x00, 0x00,
3803  0x00, 0x00, 0x00, 0x00,
3804  0x00, 0x00, 0x00, 0x11,
3805  0x00, 0x00, 0x00, 0x00,
3806  0x00, 0x00, 0x00, 0x00,
3807  0x00, 0x00, 0x00, 0x00,
3808  0x00, 0x00, 0x10, 0x00,
3809  0x00, 0x00, 0x00, 0x00,
3810  0x00, 0x00, 0x00, 0x00,
3811  0x00, 0x00, 0x00, 0x00,
3812  0x05, 0x10, 0x00, 0x00,
3813  0x00, 0x00, 0x00, 0x00,
3814  0x00, 0x00, 0x00, 0x00,
3815  0x00, 0x00, 0x00, 0x06,
3816  0x80, 0x80, 0x40, 0x30,
3817  0x00, 0x00,
3818  };
3819  AddTestCase (new PbbTestCase ("37", packet, buffer, sizeof(buffer)), TestCase::QUICK);
3820  }
3821 }
3822 
3823 static PbbTestSuite pbbTestSuite;
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
void MessagePushBack(Ptr< PbbMessage > message)
Appends a message to the back of this packet.
Definition: packetbb.cc:797
void SetSequenceNumber(uint16_t number)
Sets the sequence number of this packet.
Definition: packetbb.cc:567
A suite of tests to run.
Definition: test.h:962
automatically resized byte buffer
Definition: buffer.h:92
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
void SetMultivalue(bool isMultivalue)
Sets whether or not this address TLV is "multivalue".
Definition: packetbb.cc:3073
encapsulates test code
Definition: test.h:834
void SetSequenceNumber(uint16_t seqnum)
Sets the sequence number of this message.
Definition: packetbb.cc:1132
void SetType(uint8_t type)
Sets the type of this TLV.
Definition: packetbb.cc:2664
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
void SetType(uint8_t type)
Sets the type for this message.
Definition: packetbb.cc:1042
void AddressPushBack(Address address)
Appends an address to the back of this block.
Definition: packetbb.cc:1920
uint8_t const * PeekData(void) const
Definition: buffer.cc:729
virtual uint32_t GetSerializedSize(void) const
Definition: packetbb.cc:854
Buffer::Iterator Begin(void) const
Definition: buffer.h:875
virtual void DoRun(void)
Implementation to actually run this test case.
void SetHopLimit(uint8_t hoplimit)
Sets the maximum number of hops this message should travel.
Definition: packetbb.cc:1086
void PrefixPushBack(uint8_t prefix)
Appends a prefix to the back of this block.
Definition: packetbb.cc:2028
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
Definition: test.cc:172
uint32_t GetSize(void) const
Definition: buffer.h:869
void TlvPushBack(Ptr< PbbAddressTlv > address)
Appends an address TLV to the back of this message.
Definition: packetbb.cc:2156
Describes an IPv6 address.
Definition: ipv6-address.h:44
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
void SetTypeExt(uint8_t type)
Sets the type extension of this TLV.
Definition: packetbb.cc:2678
void SetHopCount(uint8_t hopcount)
Sets the current number of hops this message has traveled.
Definition: packetbb.cc:1109
void Write(uint8_t const *buffer, uint32_t size)
Definition: buffer.cc:978
void SetOriginatorAddress(Address address)
Sets the address for the node that created this packet.
Definition: packetbb.cc:1063
bool AddAtStart(uint32_t start)
Definition: buffer.cc:305
void SetValue(Buffer start)
Sets the value of this message to the specified buffer.
Definition: packetbb.cc:2761
virtual void Serialize(Buffer::Iterator start) const
Serializes this packet into the specified buffer.
Definition: packetbb.cc:881
void TlvPushBack(Ptr< PbbTlv > tlv)
Appends a message TLV to the back of this message.
Definition: packetbb.cc:1241
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserializes a packet from the specified buffer.
Definition: packetbb.cc:916