-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Unknown Parameters in INIT Chunk
Start to implement section-3.2.1 and respect chunks with a action of Skip. We don't properly report the values back yet. Relates to #2618
- Loading branch information
Showing
6 changed files
with
98 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> | ||
// SPDX-License-Identifier: MIT | ||
|
||
package sctp | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestChunkInit_UnrecognizedParameters(t *testing.T) { | ||
initChunkHeader := []byte{ | ||
0x55, 0xb9, 0x64, 0xa5, 0x00, 0x02, 0x00, 0x00, | ||
0x04, 0x00, 0x08, 0x00, 0xe8, 0x6d, 0x10, 0x30, | ||
} | ||
|
||
unrecognizedSkip := append([]byte{}, initChunkHeader...) | ||
unrecognizedSkip = append(unrecognizedSkip, byte(paramHeaderUnrecognizedActionSkip), 0xFF, 0x00, 0x04, 0x00) | ||
|
||
i := &chunkInitCommon{} | ||
if err := i.unmarshal(unrecognizedSkip); err != nil { | ||
t.Errorf("Unmarshal init Chunk failed: %v", err) | ||
} else if len(i.unrecognizedParams) != 1 || i.unrecognizedParams[0].unrecognizedAction != paramHeaderUnrecognizedActionSkip { | ||
t.Errorf("Unrecognized Param parsed incorrectly") | ||
} | ||
|
||
unrecognizedStop := append([]byte{}, initChunkHeader...) | ||
unrecognizedStop = append(unrecognizedStop, byte(paramHeaderUnrecognizedActionStop), 0xFF, 0x00, 0x04, 0x00) | ||
|
||
i = &chunkInitCommon{} | ||
if err := i.unmarshal(unrecognizedStop); err != nil { | ||
t.Errorf("Unmarshal init Chunk failed: %v", err) | ||
} else if len(i.unrecognizedParams) != 1 || i.unrecognizedParams[0].unrecognizedAction != paramHeaderUnrecognizedActionStop { | ||
t.Errorf("Unrecognized Param parsed incorrectly") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters