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