Commit graph

7 commits

Author SHA1 Message Date
Evan Shrubsole
4387ad6cdc [Unwrap] Migrate dcsctp sequence numbers to SeqNumUnwrapper
Bug: webrtc:13982
Change-Id: Ic900a967d1b8e96a2b1ec99424674ccb33eb7165
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/288940
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39084}
2023-01-12 12:00:30 +00:00
Evan Shrubsole
aa5897dcc5 Add conformance tests for integer unwrapping.
This tests all of the known integer unwrappers in WebRTC
* rtc::TimestampWrapAroundHandler
* webrtc::Unwrapper<T>
* webrtc::SequenceNumberUnwrapper<T>
* dcsctp::UnwrappedSequenceNumber

The conformance tests show differences between in behavior between the
unwrappers.

This change also adds const accessors for the internal values of dcsctp::UnwrappedSequenceNumber.

Bug: webrtc:13982
Change-Id: Ia1b483d7ef5ceb43fa4d93013a76cd0251a58c22
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/287620
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38900}
2022-12-15 13:22:18 +00:00
Victor Boivie
b918230640 Move StrongAlias to rtc_base
It's useful for other parts of WebRTC and there is no real reason why
it should be located in net/dcsctp.

Bug: None
Change-Id: Iccaed4e943e21ddaea8603182d693114b2da9f6b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232606
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35055}
2021-09-21 15:17:26 +00:00
Victor Boivie
250fbb3c48 dcsctp: Make Sequence Number API more consistent
* `AddTo` and `Difference` are made into static methods, as one may have
  believed that these modified the current object previously. The
  `Increment` method is kept, as it's obvious that it modifies the
  current object as it doesn't have a return value, and `next_value` is
  kept, as its naming (lower-case, snake) indicates that it's a simple
  accessor.
* Difference will return the absolute difference. This is actually the
  only reasonable choice, as the return value was unsigned and any
  negative value would just wrap.

Bug: webrtc:12614
Change-Id: If14a71636e67fc612d12759dc80a9c2518c85281
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215069
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33714}
2021-04-13 18:35:25 +00:00
Victor Boivie
83c726f3e5 dcsctp: UnwrappedSequenceNumber use StrongAlias
As this library will only use StrongAlias types for all its
sequence numbers, the UnwrappedSequenceNumber class should use those
types and not the primitive underlying types (e.g. uint32_t).

This makes e.g. Unwrap() return a strong type, which is preferred.

Bug: webrtc:12614
Change-Id: Icd0900c643a1988d1a3bbf49d87b4d4d1bbfbf1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213663
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33651}
2021-04-08 09:44:14 +00:00
Victor Boivie
a865519e17 dcsctp: Add strong typed identifiers
There are numerous identifiers and sequences in SCTP, all of them being
unsigned 16 or 32-bit integers.

  * Stream identifiers
  * Payload Protocol Identifier (PPID)
  * Stream Sequence Numbers (SSN)
  * Message Identifiers (MID)
  * Fragment Sequence Numbers (FSN)
  * Transmission Sequence Numbers (TSN)

The first two of these are publicly exposed in the API, and the
remaining ones are never exposed to the client and are all part of SCTP
protocol.

Then there are some more not as common sequence numbers, and some
booleans. Not all will be in internal_types.h - it depends on if they
can be scoped to a specific component instead. And not all types will
likely become strong types.

The unwrapped sequence numbers have been renamed to not cause conflicts
and the current UnwrappedSequenceNumber class doesn't support wrapping
strongly typed integers as it can't reach into the type of the
underlying integer. That's something to explore later.

Bug: webrtc:12614
Change-Id: I4e0016be26d5d4826783d6e0962044f56cbfa97d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213422
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33620}
2021-04-02 21:38:13 +00:00
Victor Boivie
a4d5e24c11 dcsctp: Added common utilities
These are quite generic utilities that are used by multiple modules
within dcSCTP. Some would be good to have in rtc_base and are simple
replicas of utilities available in abseil.

Bug: webrtc:12614
Change-Id: I9914286ced7317a34628a71697da9149d6d19d38
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213190
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33609}
2021-04-01 05:45:34 +00:00