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