A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-asn1-header.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Lluis Parcerisa <lparcerisa@cttc.cat>
7 */
8
9#include "lte-asn1-header.h"
10
11#include "ns3/log.h"
12
13#include <cmath>
14#include <sstream>
15
16namespace ns3
17{
18
19NS_LOG_COMPONENT_DEFINE("Asn1Header");
20
22
23TypeId
25{
26 static TypeId tid = TypeId("ns3::Asn1Header").SetParent<Header>().SetGroupName("Lte");
27 return tid;
28}
29
32{
33 return GetTypeId();
34}
35
42
46
56
57void
66
67void
68Asn1Header::WriteOctet(uint8_t octet) const
69{
72 bIterator.Prev();
73 bIterator.WriteU8(octet);
74}
75
76template <int N>
77void
78Asn1Header::SerializeBitset(std::bitset<N> data) const
79{
80 size_t dataSize = data.size();
81 uint8_t pendingBits = dataSize;
82 uint8_t mask = 1;
83 int j;
84
85 // No extension marker (Clause 16.7 ITU-T X.691),
86 // as 3GPP TS 36.331 does not use it in its IE's.
87
88 // Clause 16.8 ITU-T X.691
89 if (dataSize == 0)
90 {
91 return;
92 }
93
94 // Clause 16.9 ITU-T X.691
95 // Clause 16.10 ITU-T X.691
96 if (dataSize <= 65536)
97 {
98 // If there are bits pending to be processed,
99 // append first bits in data to complete an octet.
101 {
102 mask = 0x80 >> m_numSerializationPendingBits;
103 while (pendingBits > 0 && m_numSerializationPendingBits < 8)
104 {
105 m_serializationPendingBits |= (data[pendingBits - 1]) ? mask : 0;
106 pendingBits--;
108 mask = (mask >> 1) & (~mask);
109 }
110
112 {
116 }
117 }
118
119 while (pendingBits > 0)
120 {
121 mask = 1;
122 j = 8;
123
124 // If there are less than 8 remaining bits,
125 // store it to m_serializationPendingBits.
126 if (pendingBits < 8)
127 {
128 mask = 0x80;
129 m_numSerializationPendingBits = pendingBits;
130 while (pendingBits > 0)
131 {
132 m_serializationPendingBits |= (data[pendingBits - 1]) ? mask : 0;
133 mask = (mask >> 1) & (~mask);
134 pendingBits--;
135 }
136 }
137
138 // Write the data to buffer
139 else
140 {
141 uint8_t octetToWrite = 0;
142 for (; j > 0; j--)
143 {
144 octetToWrite |= (data[pendingBits - j]) ? mask : 0;
145 mask = (mask << 1) & (~mask);
146 }
147 WriteOctet(octetToWrite);
148 pendingBits -= 8;
149 }
150 }
151 }
152
153 // Clause 16.11 ITU-T X.691
154 else
155 {
156 NS_LOG_DEBUG("Fragmentation needed!");
157 }
158}
159
160template <int N>
161void
163{
165}
166
167void
169{
171}
172
173void
175{
177}
178
179void
181{
183}
184
185void
187{
189}
190
191void
193{
195}
196
197void
199{
201}
202
203void
205{
207}
208
209void
211{
213}
214
215void
217{
218 // Clause 12 ITU-T X.691
219 std::bitset<1> val;
220 (value) ? val.set() : val.reset();
222}
223
224template <int N>
225void
226Asn1Header::SerializeSequence(std::bitset<N> optionalOrDefaultMask,
227 bool isExtensionMarkerPresent) const
228{
229 if (isExtensionMarkerPresent)
230 {
231 // Extension marker present, but no extension
232 SerializeBoolean(false);
233 }
234 SerializeBitstring<N>(optionalOrDefaultMask);
235}
236
237void
238Asn1Header::SerializeSequence(std::bitset<0> optionalOrDefaultMask,
239 bool isExtensionMarkerPresent) const
240{
241 SerializeSequence<0>(optionalOrDefaultMask, isExtensionMarkerPresent);
242}
243
244void
245Asn1Header::SerializeSequence(std::bitset<1> optionalOrDefaultMask,
246 bool isExtensionMarkerPresent) const
247{
248 SerializeSequence<1>(optionalOrDefaultMask, isExtensionMarkerPresent);
249}
250
251void
252Asn1Header::SerializeSequence(std::bitset<2> optionalOrDefaultMask,
253 bool isExtensionMarkerPresent) const
254{
255 SerializeSequence<2>(optionalOrDefaultMask, isExtensionMarkerPresent);
256}
257
258void
259Asn1Header::SerializeSequence(std::bitset<3> optionalOrDefaultMask,
260 bool isExtensionMarkerPresent) const
261{
262 SerializeSequence<3>(optionalOrDefaultMask, isExtensionMarkerPresent);
263}
264
265void
266Asn1Header::SerializeSequence(std::bitset<4> optionalOrDefaultMask,
267 bool isExtensionMarkerPresent) const
268{
269 SerializeSequence<4>(optionalOrDefaultMask, isExtensionMarkerPresent);
270}
271
272void
273Asn1Header::SerializeSequence(std::bitset<5> optionalOrDefaultMask,
274 bool isExtensionMarkerPresent) const
275{
276 SerializeSequence<5>(optionalOrDefaultMask, isExtensionMarkerPresent);
277}
278
279void
280Asn1Header::SerializeSequence(std::bitset<6> optionalOrDefaultMask,
281 bool isExtensionMarkerPresent) const
282{
283 SerializeSequence<6>(optionalOrDefaultMask, isExtensionMarkerPresent);
284}
285
286void
287Asn1Header::SerializeSequence(std::bitset<7> optionalOrDefaultMask,
288 bool isExtensionMarkerPresent) const
289{
290 SerializeSequence<7>(optionalOrDefaultMask, isExtensionMarkerPresent);
291}
292
293void
294Asn1Header::SerializeSequence(std::bitset<9> optionalOrDefaultMask,
295 bool isExtensionMarkerPresent) const
296{
297 SerializeSequence<9>(optionalOrDefaultMask, isExtensionMarkerPresent);
298}
299
300void
301Asn1Header::SerializeSequence(std::bitset<10> optionalOrDefaultMask,
302 bool isExtensionMarkerPresent) const
303{
304 SerializeSequence<10>(optionalOrDefaultMask, isExtensionMarkerPresent);
305}
306
307void
308Asn1Header::SerializeSequence(std::bitset<11> optionalOrDefaultMask,
309 bool isExtensionMarkerPresent) const
310{
311 SerializeSequence<11>(optionalOrDefaultMask, isExtensionMarkerPresent);
312}
313
314void
315Asn1Header::SerializeSequenceOf(int numElems, int nMax, int nMin) const
316{
317 // Clause 20.6 ITU-T X.691
318 SerializeInteger(numElems, nMin, nMax);
319}
320
321void
322Asn1Header::SerializeEnum(int numElems, int selectedElem) const
323{
324 // Clause 14 ITU-T X.691
325 SerializeInteger(selectedElem, 0, numElems - 1);
326}
327
328void
329Asn1Header::SerializeChoice(int numOptions, int selectedOption, bool isExtensionMarkerPresent) const
330{
331 if (isExtensionMarkerPresent)
332 {
333 // Never extended attributes
334 SerializeBoolean(false);
335 }
336
337 // Clause 23.4 ITU-T X.691
338 if (numOptions < 2)
339 {
340 return;
341 }
342
343 SerializeInteger(selectedOption, 0, numOptions - 1);
344}
345
346void
347Asn1Header::SerializeInteger(int n, int nmin, int nmax) const
348{
349 // The following is equivalent to:
350 // NS_ASSERT_MSG (nmin <= n && n <= nmax,
351 // "Integer " << n << " is outside range [" << nmin << ", " << nmax << "]");
352 // This is a workaround to gcc-7 aggressive optimization, see #346, and can be dropped
353 // once gcc-7 will not be anymore supported.
354 long int nComp = nmin;
355 nComp -= n;
356 NS_ASSERT_MSG(nComp <= 0 && n <= nmax,
357 "Integer " << n << " is outside range [" << nmin << ", " << nmax << "]");
358
359 // Clause 11.5.3 ITU-T X.691
360 int range = nmax - nmin + 1;
361 // Subtract nmin to n
362 n -= nmin;
363
364 // Clause 11.5.4 ITU-T X.691
365 if (range <= 1)
366 {
367 return;
368 }
369
370 // Clause 11.5.6 ITU-T X.691
371 int requiredBits = std::ceil(std::log(range) / std::log(2.0));
372
373 switch (requiredBits)
374 {
375 case 1:
376 SerializeBitset<1>(std::bitset<1>(n));
377 break;
378 case 2:
379 SerializeBitset<2>(std::bitset<2>(n));
380 break;
381 case 3:
382 SerializeBitset<3>(std::bitset<3>(n));
383 break;
384 case 4:
385 SerializeBitset<4>(std::bitset<4>(n));
386 break;
387 case 5:
388 SerializeBitset<5>(std::bitset<5>(n));
389 break;
390 case 6:
391 SerializeBitset<6>(std::bitset<6>(n));
392 break;
393 case 7:
394 SerializeBitset<7>(std::bitset<7>(n));
395 break;
396 case 8:
397 SerializeBitset<8>(std::bitset<8>(n));
398 break;
399 case 9:
400 SerializeBitset<9>(std::bitset<9>(n));
401 break;
402 case 10:
403 SerializeBitset<10>(std::bitset<10>(n));
404 break;
405 case 11:
406 SerializeBitset<11>(std::bitset<11>(n));
407 break;
408 case 12:
409 SerializeBitset<12>(std::bitset<12>(n));
410 break;
411 case 13:
412 SerializeBitset<13>(std::bitset<13>(n));
413 break;
414 case 14:
415 SerializeBitset<14>(std::bitset<14>(n));
416 break;
417 case 15:
418 SerializeBitset<15>(std::bitset<15>(n));
419 break;
420 case 16:
421 SerializeBitset<16>(std::bitset<16>(n));
422 break;
423 case 17:
424 SerializeBitset<17>(std::bitset<17>(n));
425 break;
426 case 18:
427 SerializeBitset<18>(std::bitset<18>(n));
428 break;
429 case 19:
430 SerializeBitset<19>(std::bitset<19>(n));
431 break;
432 case 20:
433 SerializeBitset<20>(std::bitset<20>(n));
434 break;
435 default: {
436 std::cout << "SerializeInteger " << requiredBits << " Out of range!!" << std::endl;
437 exit(1);
438 }
439 }
440}
441
442void
444{
445 // Clause 18 ITU-T X.691
446}
447
448void
458
459template <int N>
462{
463 int bitsToRead = N;
464 uint8_t mask;
465
466 // Read bits from pending bits
468 {
469 while (bitsToRead > 0 && m_numSerializationPendingBits > 0)
470 {
471 data->set(bitsToRead - 1, (m_serializationPendingBits & 0x80) ? 1 : 0);
472 bitsToRead--;
475 }
476 }
477
478 // Read bits from buffer
479 while (bitsToRead > 0)
480 {
481 uint8_t octet = bIterator.ReadU8();
482 // If 8 bits can be allocated to the bitset, set the bits
483 if (bitsToRead >= 8)
484 {
485 mask = 0x80;
486 for (int j = 0; j < 8; j++)
487 {
488 data->set(bitsToRead - 1, (octet & mask) ? 1 : 0);
489 bitsToRead--;
490 mask = mask >> 1;
491 }
492 }
493
494 // Otherwise, we'll have to save the remaining bits
495 else
496 {
497 mask = 0x80;
498 m_numSerializationPendingBits = 8 - bitsToRead;
499 m_serializationPendingBits = octet << bitsToRead;
500 while (bitsToRead > 0)
501 {
502 data->set(bitsToRead - 1, (octet & mask) ? 1 : 0);
503 bitsToRead--;
504 mask = mask >> 1;
505 }
506 }
507 }
508
509 return bIterator;
510}
511
512template <int N>
515{
516 return DeserializeBitset<N>(data, bIterator);
517}
518
521{
522 return DeserializeBitstring<1>(data, bIterator);
523}
524
527{
528 return DeserializeBitstring<2>(data, bIterator);
529}
530
533{
534 return DeserializeBitstring<8>(data, bIterator);
535}
536
539{
540 return DeserializeBitstring<10>(data, bIterator);
541}
542
545{
546 return DeserializeBitstring<16>(data, bIterator);
547}
548
551{
552 return DeserializeBitstring<27>(data, bIterator);
553}
554
557{
558 return DeserializeBitstring<28>(data, bIterator);
559}
560
563{
564 return DeserializeBitstring<32>(data, bIterator);
565}
566
569{
570 std::bitset<1> readBit;
571 bIterator = DeserializeBitset<1>(&readBit, bIterator);
572 *value = (readBit[0] == 1);
573 return bIterator;
574}
575
577Asn1Header::DeserializeInteger(int* n, int nmin, int nmax, Buffer::Iterator bIterator)
578{
579 // Misusage check: Ensure nmax>nmin ...
580 if (nmin > nmax)
581 {
582 int aux = nmin;
583 nmin = nmax;
584 nmax = aux;
585 }
586
587 int range = nmax - nmin + 1;
588
589 if (range == 1)
590 {
591 return bIterator;
592 }
593
594 int requiredBits = std::ceil(std::log(range) / std::log(2.0));
595
596 std::bitset<1> bitsRead1;
597 std::bitset<2> bitsRead2;
598 std::bitset<3> bitsRead3;
599 std::bitset<4> bitsRead4;
600 std::bitset<5> bitsRead5;
601 std::bitset<6> bitsRead6;
602 std::bitset<7> bitsRead7;
603 std::bitset<8> bitsRead8;
604 std::bitset<9> bitsRead9;
605 std::bitset<10> bitsRead10;
606 std::bitset<11> bitsRead11;
607 std::bitset<12> bitsRead12;
608 std::bitset<13> bitsRead13;
609 std::bitset<14> bitsRead14;
610 std::bitset<15> bitsRead15;
611 std::bitset<16> bitsRead16;
612 std::bitset<17> bitsRead17;
613 std::bitset<18> bitsRead18;
614 std::bitset<19> bitsRead19;
615 std::bitset<20> bitsRead20;
616
617 switch (requiredBits)
618 {
619 case 1:
620 bIterator = DeserializeBitset<1>(&bitsRead1, bIterator);
621 *n = (int)bitsRead1.to_ulong();
622 break;
623 case 2:
624 bIterator = DeserializeBitset<2>(&bitsRead2, bIterator);
625 *n = (int)bitsRead2.to_ulong();
626 break;
627 case 3:
628 bIterator = DeserializeBitset<3>(&bitsRead3, bIterator);
629 *n = (int)bitsRead3.to_ulong();
630 break;
631 case 4:
632 bIterator = DeserializeBitset<4>(&bitsRead4, bIterator);
633 *n = (int)bitsRead4.to_ulong();
634 break;
635 case 5:
636 bIterator = DeserializeBitset<5>(&bitsRead5, bIterator);
637 *n = (int)bitsRead5.to_ulong();
638 break;
639 case 6:
640 bIterator = DeserializeBitset<6>(&bitsRead6, bIterator);
641 *n = (int)bitsRead6.to_ulong();
642 break;
643 case 7:
644 bIterator = DeserializeBitset<7>(&bitsRead7, bIterator);
645 *n = (int)bitsRead7.to_ulong();
646 break;
647 case 8:
648 bIterator = DeserializeBitset<8>(&bitsRead8, bIterator);
649 *n = (int)bitsRead8.to_ulong();
650 break;
651 case 9:
652 bIterator = DeserializeBitset<9>(&bitsRead9, bIterator);
653 *n = (int)bitsRead9.to_ulong();
654 break;
655 case 10:
656 bIterator = DeserializeBitset<10>(&bitsRead10, bIterator);
657 *n = (int)bitsRead10.to_ulong();
658 break;
659 case 11:
660 bIterator = DeserializeBitset<11>(&bitsRead11, bIterator);
661 *n = (int)bitsRead11.to_ulong();
662 break;
663 case 12:
664 bIterator = DeserializeBitset<12>(&bitsRead12, bIterator);
665 *n = (int)bitsRead12.to_ulong();
666 break;
667 case 13:
668 bIterator = DeserializeBitset<13>(&bitsRead13, bIterator);
669 *n = (int)bitsRead13.to_ulong();
670 break;
671 case 14:
672 bIterator = DeserializeBitset<14>(&bitsRead14, bIterator);
673 *n = (int)bitsRead14.to_ulong();
674 break;
675 case 15:
676 bIterator = DeserializeBitset<15>(&bitsRead15, bIterator);
677 *n = (int)bitsRead15.to_ulong();
678 break;
679 case 16:
680 bIterator = DeserializeBitset<16>(&bitsRead16, bIterator);
681 *n = (int)bitsRead16.to_ulong();
682 break;
683 case 17:
684 bIterator = DeserializeBitset<17>(&bitsRead17, bIterator);
685 *n = (int)bitsRead17.to_ulong();
686 break;
687 case 18:
688 bIterator = DeserializeBitset<18>(&bitsRead18, bIterator);
689 *n = (int)bitsRead18.to_ulong();
690 break;
691 case 19:
692 bIterator = DeserializeBitset<19>(&bitsRead19, bIterator);
693 *n = (int)bitsRead19.to_ulong();
694 break;
695 case 20:
696 bIterator = DeserializeBitset<20>(&bitsRead20, bIterator);
697 *n = (int)bitsRead20.to_ulong();
698 break;
699 default: {
700 std::cout << "SerializeInteger Out of range!!" << std::endl;
701 exit(1);
702 }
703 }
704
705 *n += nmin;
706
707 return bIterator;
708}
709
712 bool isExtensionMarkerPresent,
713 int* selectedOption,
714 Buffer::Iterator bIterator)
715{
716 if (isExtensionMarkerPresent)
717 {
718 bool marker;
719 bIterator = DeserializeBoolean(&marker, bIterator);
720 }
721 return DeserializeInteger(selectedOption, 0, numOptions - 1, bIterator);
722}
723
725Asn1Header::DeserializeEnum(int numElems, int* selectedElem, Buffer::Iterator bIterator)
726{
727 return DeserializeInteger(selectedElem, 0, numElems - 1, bIterator);
728}
729
730template <int N>
732Asn1Header::DeserializeSequence(std::bitset<N>* optionalOrDefaultMask,
733 bool isExtensionMarkerPresent,
734 Buffer::Iterator bIterator)
735{
736 if (isExtensionMarkerPresent)
737 {
738 bool dummy;
739 bIterator = DeserializeBoolean(&dummy, bIterator);
740 }
741 bIterator = DeserializeBitset<N>(optionalOrDefaultMask, bIterator);
742 return bIterator;
743}
744
746Asn1Header::DeserializeSequence(std::bitset<0>* optionalOrDefaultMask,
747 bool isExtensionMarkerPresent,
748 Buffer::Iterator bIterator)
749{
750 return DeserializeSequence<0>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
751}
752
754Asn1Header::DeserializeSequence(std::bitset<1>* optionalOrDefaultMask,
755 bool isExtensionMarkerPresent,
756 Buffer::Iterator bIterator)
757{
758 return DeserializeSequence<1>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
759}
760
762Asn1Header::DeserializeSequence(std::bitset<2>* optionalOrDefaultMask,
763 bool isExtensionMarkerPresent,
764 Buffer::Iterator bIterator)
765{
766 return DeserializeSequence<2>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
767}
768
770Asn1Header::DeserializeSequence(std::bitset<3>* optionalOrDefaultMask,
771 bool isExtensionMarkerPresent,
772 Buffer::Iterator bIterator)
773{
774 return DeserializeSequence<3>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
775}
776
778Asn1Header::DeserializeSequence(std::bitset<4>* optionalOrDefaultMask,
779 bool isExtensionMarkerPresent,
780 Buffer::Iterator bIterator)
781{
782 return DeserializeSequence<4>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
783}
784
786Asn1Header::DeserializeSequence(std::bitset<5>* optionalOrDefaultMask,
787 bool isExtensionMarkerPresent,
788 Buffer::Iterator bIterator)
789{
790 return DeserializeSequence<5>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
791}
792
794Asn1Header::DeserializeSequence(std::bitset<6>* optionalOrDefaultMask,
795 bool isExtensionMarkerPresent,
796 Buffer::Iterator bIterator)
797{
798 return DeserializeSequence<6>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
799}
800
802Asn1Header::DeserializeSequence(std::bitset<7>* optionalOrDefaultMask,
803 bool isExtensionMarkerPresent,
804 Buffer::Iterator bIterator)
805{
806 return DeserializeSequence<7>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
807}
808
810Asn1Header::DeserializeSequence(std::bitset<9>* optionalOrDefaultMask,
811 bool isExtensionMarkerPresent,
812 Buffer::Iterator bIterator)
813{
814 return DeserializeSequence<9>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
815}
816
818Asn1Header::DeserializeSequence(std::bitset<10>* optionalOrDefaultMask,
819 bool isExtensionMarkerPresent,
820 Buffer::Iterator bIterator)
821{
822 return DeserializeSequence<10>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
823}
824
826Asn1Header::DeserializeSequence(std::bitset<11>* optionalOrDefaultMask,
827 bool isExtensionMarkerPresent,
828 Buffer::Iterator bIterator)
829{
830 return DeserializeSequence<11>(optionalOrDefaultMask, isExtensionMarkerPresent, bIterator);
831}
832
835{
836 return bIterator;
837}
838
840Asn1Header::DeserializeSequenceOf(int* numElems, int nMax, int nMin, Buffer::Iterator bIterator)
841{
842 return DeserializeInteger(numElems, nMin, nMax, bIterator);
843}
844
845} // namespace ns3
Buffer::Iterator DeserializeBitset(std::bitset< N > *data, Buffer::Iterator bIterator)
Deserialize a bitset.
Buffer::Iterator DeserializeChoice(int numOptions, bool isExtensionMarkerPresent, int *selectedOption, Buffer::Iterator bIterator)
Deserialize a Choice (set of options)
static TypeId GetTypeId()
Get the type ID.
Buffer::Iterator DeserializeSequenceOf(int *numElems, int nMax, int nMin, Buffer::Iterator bIterator)
Deserialize a Sequence.
Buffer::Iterator DeserializeNull(Buffer::Iterator bIterator)
Deserialize nothing (null op)
void WriteOctet(uint8_t octet) const
Function to write in m_serializationResult, after resizing its size.
void SerializeBitset(std::bitset< N > data) const
Serialize a bitset.
Buffer::Iterator DeserializeInteger(int *n, int nmin, int nmax, Buffer::Iterator bIterator)
Deserialize an integer.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SerializeBitstring(std::bitset< N > bitstring) const
Serialize a bitstring.
Buffer::Iterator DeserializeEnum(int numElems, int *selectedElem, Buffer::Iterator bIterator)
Deserialize an Enum.
virtual void PreSerialize() const =0
This function serializes class attributes to m_serializationResult local Buffer.
Buffer::Iterator DeserializeSequence(std::bitset< N > *optionalOrDefaultMask, bool isExtensionMarkerPresent, Buffer::Iterator bIterator)
Deserialize a sequence.
uint8_t m_numSerializationPendingBits
number of pending bits
void SerializeSequence(std::bitset< N > optionalOrDefaultMask, bool isExtensionMarkerPresent) const
Serialize a sequence.
void SerializeChoice(int numOptions, int selectedOption, bool isExtensionMarkerPresent) const
Serialize a Choice (set of options)
Buffer m_serializationResult
serialization result
void FinalizeSerialization() const
Finalizes an in progress serialization.
~Asn1Header() override
void SerializeInteger(int n, int nmin, int nmax) const
Serialize an Integer.
Buffer::Iterator DeserializeBoolean(bool *value, Buffer::Iterator bIterator)
Deserialize a boolean.
uint8_t m_serializationPendingBits
pending bits
uint32_t GetSerializedSize() const override
void Serialize(Buffer::Iterator bIterator) const override
void SerializeBoolean(bool value) const
Serialize a bool.
Buffer::Iterator DeserializeBitstring(std::bitset< N > *bitstring, Buffer::Iterator bIterator)
Deserialize a bitstring.
void SerializeNull() const
Serialize nothing (null op)
bool m_isDataSerialized
true if data is serialized
void SerializeSequenceOf(int numElems, int nMax, int nMin) const
Serialize a Sequence.
void SerializeEnum(int numElems, int selectedElem) const
Serialize an Enum.
iterator in a Buffer instance
Definition buffer.h:89
void WriteU8(uint8_t data)
Definition buffer.h:870
void Write(const uint8_t *buffer, uint32_t size)
Definition buffer.cc:937
void Prev()
go backward by one byte
Definition buffer.h:849
uint32_t GetSize() const
Definition buffer.h:1057
Buffer::Iterator Begin() const
Definition buffer.h:1063
void AddAtEnd(uint32_t end)
Definition buffer.cc:349
Buffer::Iterator End() const
Definition buffer.h:1070
Protocol header serialization and deserialization.
Definition header.h:33
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition assert.h:75
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t data[writeSize]