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