File tree Expand file tree Collapse file tree 6 files changed +269
-184
lines changed
include/RTC/TestSerializable Expand file tree Collapse file tree 6 files changed +269
-184
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ namespace RTC
6565 };
6666
6767 public:
68- static const size_t HeaderSize { 4 };
68+ static const size_t HeaderLength { 4 };
6969
7070 /* *
7171 * Parses given `data` with length `len` and returns an allocated instance
@@ -131,7 +131,7 @@ namespace RTC
131131 */
132132 uint16_t GetValueLength () const
133133 {
134- return uint16_t { ntohs (this ->header ->length ) } - HeaderSize ;
134+ return uint16_t { ntohs (this ->header ->length ) } - Chunk::HeaderLength ;
135135 }
136136
137137 private:
Original file line number Diff line number Diff line change @@ -137,6 +137,8 @@ namespace RTC
137137
138138 // void AddChunk(Chunk* chunk)
139139 // {
140+ // AssertNotFrozen();
141+ //
140142 // this->chunks.push_back(chunk);
141143 // }
142144
@@ -155,6 +157,11 @@ namespace RTC
155157 return GetBuffer () + Packet::CommonHeaderLength;
156158 }
157159
160+ virtual const uint8_t * GetEndPointer () const final
161+ {
162+ return GetBuffer () + GetBufferLength ();
163+ }
164+
158165 /* *
159166 * Must be used within Parse() static method (instead than AddChunk()).
160167 * This method doesn't serializa the given Chunk into Packet's buffer
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ namespace RTC
4040 MS_TRACE ();
4141
4242 // Ensure there are at least 4 bytes (chunk value is zero-length).
43- if (len < HeaderSize )
43+ if (len < Chunk::HeaderLength )
4444 {
4545 MS_WARN_TAG (sctp, " not an SCTP chunk" );
4646
@@ -53,8 +53,8 @@ namespace RTC
5353 // incremented to point to other parts of the chunk.
5454 auto * ptr = const_cast <uint8_t *>(data);
5555
56- // Inspect data after the header size , so move to the chunk value.
57- ptr += HeaderSize ;
56+ // Inspect data after the header length , so move to the chunk value.
57+ ptr += Chunk::HeaderLength ;
5858
5959 auto valueLengthWithPadding = Utils::Byte::PadTo4Bytes (chunk->GetValueLength ());
6060
You can’t perform that action at this time.
0 commit comments