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