Skip to content

Commit 88ec66d

Browse files
committed
more
1 parent d4fd579 commit 88ec66d

File tree

6 files changed

+269
-184
lines changed

6 files changed

+269
-184
lines changed

worker/include/RTC/SCTP/Chunk.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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:

worker/include/RTC/SCTP/Packet.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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

worker/src/RTC/SCTP/Chunk.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)