mediasoup 3.20.0 → 3.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node/lib/Consumer.d.ts.map +1 -1
- package/node/lib/Consumer.js +5 -4
- package/node/lib/DataConsumer.d.ts +2 -3
- package/node/lib/DataConsumer.d.ts.map +1 -1
- package/node/lib/DataConsumer.js +10 -7
- package/node/lib/DataConsumerTypes.d.ts +5 -4
- package/node/lib/DataConsumerTypes.d.ts.map +1 -1
- package/node/lib/DataProducer.d.ts.map +1 -1
- package/node/lib/DataProducer.js +2 -1
- package/node/lib/PipeTransport.d.ts.map +1 -1
- package/node/lib/PipeTransport.js +5 -4
- package/node/lib/PlainTransport.d.ts.map +1 -1
- package/node/lib/PlainTransport.js +6 -5
- package/node/lib/Producer.d.ts.map +1 -1
- package/node/lib/Producer.js +4 -3
- package/node/lib/Router.js +1 -1
- package/node/lib/WebRtcTransport.d.ts.map +1 -1
- package/node/lib/WebRtcTransport.js +6 -5
- package/node/lib/fbs/consumer/degrade-request.d.ts +30 -0
- package/node/lib/fbs/consumer/degrade-request.d.ts.map +1 -0
- package/node/lib/fbs/consumer/degrade-request.js +124 -0
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts +24 -0
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts.map +1 -0
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.js +102 -0
- package/node/lib/fbs/data-consumer/send-response.d.ts +21 -0
- package/node/lib/fbs/data-consumer/send-response.d.ts.map +1 -0
- package/node/lib/fbs/data-consumer/send-response.js +91 -0
- package/node/lib/fbs/data-consumer.d.ts +1 -0
- package/node/lib/fbs/data-consumer.d.ts.map +1 -1
- package/node/lib/fbs/data-consumer.js +4 -1
- package/node/lib/fbs/producer/degrade-request.d.ts +30 -0
- package/node/lib/fbs/producer/degrade-request.d.ts.map +1 -0
- package/node/lib/fbs/producer/degrade-request.js +124 -0
- package/node/lib/fbs/response/body.d.ts +7 -5
- package/node/lib/fbs/response/body.d.ts.map +1 -1
- package/node/lib/fbs/response/body.js +7 -3
- package/node/lib/fbs/response/response.d.ts +3 -2
- package/node/lib/fbs/response/response.d.ts.map +1 -1
- package/node/lib/fbs/sctp-parameters/num-sctp-streams.d.ts.map +1 -1
- package/node/lib/fbs/sctp-parameters/num-sctp-streams.js +5 -5
- package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.d.ts +24 -0
- package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.d.ts.map +1 -0
- package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.js +102 -0
- package/node/lib/fbs/transport/sctp-negotiated-options-notification.d.ts +24 -0
- package/node/lib/fbs/transport/sctp-negotiated-options-notification.d.ts.map +1 -0
- package/node/lib/fbs/transport/sctp-negotiated-options-notification.js +102 -0
- package/node/lib/fbs/worker/close-notification.d.ts +18 -0
- package/node/lib/fbs/worker/close-notification.d.ts.map +1 -0
- package/node/lib/fbs/worker/close-notification.js +78 -0
- package/node/lib/fbs/worker/close-request.d.ts +18 -0
- package/node/lib/fbs/worker/close-request.d.ts.map +1 -0
- package/node/lib/fbs/worker/close-request.js +78 -0
- package/node/lib/fbs/worker/close-worker-notification.d.ts +18 -0
- package/node/lib/fbs/worker/close-worker-notification.d.ts.map +1 -0
- package/node/lib/fbs/worker/close-worker-notification.js +78 -0
- package/node/lib/sctpParametersTypes.d.ts +23 -0
- package/node/lib/sctpParametersTypes.d.ts.map +1 -1
- package/node/lib/test/test-Consumer.js +194 -0
- package/node/lib/test/test-DataConsumer.js +6 -0
- package/node/lib/test/test-Router.js +11 -0
- package/node/lib/test/test-werift-sctp.js +7 -0
- package/npm-scripts.mjs +2 -2
- package/package.json +7 -6
- package/worker/Makefile +5 -1
- package/worker/deps/libwebrtc/meson.build +5 -1
- package/worker/fbs/dataConsumer.fbs +4 -0
- package/worker/fbs/response.fbs +1 -0
- package/worker/fuzzer/src/RTC/RTP/FuzzerPacket.cpp +2 -2
- package/worker/include/Channel/ChannelMessageRegistrator.hpp +4 -3
- package/worker/include/Channel/ChannelNotification.hpp +0 -4
- package/worker/include/Channel/ChannelRequest.hpp +3 -4
- package/worker/include/DepLibSRTP.hpp +2 -2
- package/worker/include/RTC/ActiveSpeakerObserver.hpp +2 -2
- package/worker/include/RTC/AudioLevelObserver.hpp +2 -2
- package/worker/include/RTC/Consumer.hpp +1 -1
- package/worker/include/RTC/DataConsumer.hpp +2 -2
- package/worker/include/RTC/DtlsTransport.hpp +4 -4
- package/worker/include/RTC/ICE/IceServer.hpp +2 -2
- package/worker/include/RTC/ICE/StunPacket.hpp +34 -34
- package/worker/include/RTC/KeyFrameRequestManager.hpp +3 -3
- package/worker/include/RTC/Parameters.hpp +2 -2
- package/worker/include/RTC/PipeConsumer.hpp +6 -5
- package/worker/include/RTC/PlainTransport.hpp +0 -1
- package/worker/include/RTC/PortManager.hpp +92 -12
- package/worker/include/RTC/Producer.hpp +7 -6
- package/worker/include/RTC/RTCP/Feedback.hpp +1 -2
- package/worker/include/RTC/RTCP/FeedbackRtpTransport.hpp +2 -2
- package/worker/include/RTC/RTCP/Packet.hpp +2 -2
- package/worker/include/RTC/RTCP/Sdes.hpp +1 -1
- package/worker/include/RTC/RTP/Codecs/DependencyDescriptor.hpp +2 -1
- package/worker/include/RTC/RTP/Packet.hpp +57 -57
- package/worker/include/RTC/RTP/ProbationGenerator.hpp +2 -2
- package/worker/include/RTC/RTP/SharedPacket.hpp +4 -4
- package/worker/include/RTC/Router.hpp +12 -11
- package/worker/include/RTC/RtcLogger.hpp +2 -2
- package/worker/include/RTC/RtpDictionaries.hpp +6 -6
- package/worker/include/RTC/RtpListener.hpp +4 -4
- package/worker/include/RTC/SCTP/association/Association.hpp +13 -13
- package/worker/include/RTC/SCTP/association/HeartbeatHandler.hpp +2 -2
- package/worker/include/RTC/SCTP/association/NegotiatedCapabilities.hpp +2 -2
- package/worker/include/RTC/SCTP/association/PacketSender.hpp +3 -3
- package/worker/include/RTC/SCTP/association/StateCookie.hpp +9 -9
- package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +4 -4
- package/worker/include/RTC/SCTP/association/TransmissionControlBlock.hpp +24 -24
- package/worker/include/RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/Chunk.hpp +86 -86
- package/worker/include/RTC/SCTP/packet/ErrorCause.hpp +18 -18
- package/worker/include/RTC/SCTP/packet/Packet.hpp +33 -33
- package/worker/include/RTC/SCTP/packet/Parameter.hpp +24 -24
- package/worker/include/RTC/SCTP/packet/TLV.hpp +13 -13
- package/worker/include/RTC/SCTP/packet/UserData.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/chunks/AbortAssociationChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/AnyDataChunk.hpp +9 -9
- package/worker/include/RTC/SCTP/packet/chunks/AnyForwardTsnChunk.hpp +3 -3
- package/worker/include/RTC/SCTP/packet/chunks/CookieAckChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/CookieEchoChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/DataChunk.hpp +11 -11
- package/worker/include/RTC/SCTP/packet/chunks/ForwardTsnChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/HeartbeatAckChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/HeartbeatRequestChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/IDataChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/IForwardTsnChunk.hpp +7 -7
- package/worker/include/RTC/SCTP/packet/chunks/InitAckChunk.hpp +10 -10
- package/worker/include/RTC/SCTP/packet/chunks/InitChunk.hpp +8 -8
- package/worker/include/RTC/SCTP/packet/chunks/OperationErrorChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/ReConfigChunk.hpp +10 -10
- package/worker/include/RTC/SCTP/packet/chunks/SackChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/ShutdownAckChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/ShutdownChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/ShutdownCompleteChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/UnknownChunk.hpp +2 -2
- package/worker/include/RTC/SCTP/packet/errorCauses/CookieReceivedWhileShuttingDownErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/InvalidMandatoryParameterErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/InvalidStreamIdentifierErrorCause.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/errorCauses/MissingMandatoryParameterErrorCause.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/errorCauses/NoUserDataErrorCause.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/errorCauses/OutOfResourceErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/ProtocolViolationErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/RestartOfAnAssociationWithNewAddressesErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/StaleCookieErrorCause.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/errorCauses/UnknownErrorCause.hpp +2 -2
- package/worker/include/RTC/SCTP/packet/errorCauses/UnrecognizedChunkTypeErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/UnrecognizedParametersErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/UnresolvableAddressErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/UserInitiatedAbortErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/AddIncomingStreamsRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/AddOutgoingStreamsRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/CookiePreservativeParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/ForwardTsnSupportedParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/HeartbeatInfoParameter.hpp +3 -3
- package/worker/include/RTC/SCTP/packet/parameters/IPv4AddressParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/IPv6AddressParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/IncomingSsnResetRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.hpp +7 -7
- package/worker/include/RTC/SCTP/packet/parameters/SsnTsnResetRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/StateCookieParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/SupportedAddressTypesParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/SupportedExtensionsParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/UnknownParameter.hpp +2 -2
- package/worker/include/RTC/SCTP/packet/parameters/UnrecognizedParameterParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.hpp +7 -7
- package/worker/include/RTC/SCTP/public/AssociationInterface.hpp +7 -7
- package/worker/include/RTC/SCTP/public/AssociationListenerInterface.hpp +26 -26
- package/worker/include/RTC/SCTP/public/AssociationMetrics.hpp +7 -7
- package/worker/include/RTC/SCTP/public/Message.hpp +1 -1
- package/worker/include/RTC/SCTP/public/SctpOptions.hpp +4 -4
- package/worker/include/RTC/SCTP/public/SctpTypes.hpp +10 -10
- package/worker/include/RTC/SCTP/rx/DataTracker.hpp +1 -1
- package/worker/include/RTC/SCTP/rx/ReassemblyStreamsInterface.hpp +1 -1
- package/worker/include/RTC/SCTP/tx/OutstandingData.hpp +39 -39
- package/worker/include/RTC/SCTP/tx/RetransmissionErrorCounter.hpp +1 -1
- package/worker/include/RTC/SCTP/tx/RetransmissionQueue.hpp +14 -14
- package/worker/include/RTC/SCTP/tx/RoundRobinSendQueue.hpp +1 -1
- package/worker/include/RTC/SctpListener.hpp +2 -2
- package/worker/include/RTC/SimulcastConsumer.hpp +2 -1
- package/worker/include/RTC/TcpServer.hpp +3 -2
- package/worker/include/RTC/Transport.hpp +8 -8
- package/worker/include/RTC/UdpSocket.hpp +3 -2
- package/worker/include/RTC/WebRtcServer.hpp +4 -5
- package/worker/include/RTC/WebRtcTransport.hpp +2 -2
- package/worker/include/Settings.hpp +3 -3
- package/worker/include/Worker.hpp +3 -3
- package/worker/include/handles/TcpServerHandle.hpp +2 -2
- package/worker/meson.build +9 -4
- package/worker/mocks/include/Channel/MockChannelMessageRegistrator.hpp +4 -3
- package/worker/src/Channel/ChannelNotification.cpp +5 -4
- package/worker/src/Channel/ChannelRequest.cpp +9 -6
- package/worker/src/DepLibSRTP.cpp +1 -1
- package/worker/src/RTC/AudioLevelObserver.cpp +2 -2
- package/worker/src/RTC/DataConsumer.cpp +13 -3
- package/worker/src/RTC/DataProducer.cpp +1 -1
- package/worker/src/RTC/DtlsTransport.cpp +3 -3
- package/worker/src/RTC/ICE/IceServer.cpp +1 -1
- package/worker/src/RTC/ICE/StunPacket.cpp +77 -77
- package/worker/src/RTC/PipeTransport.cpp +5 -4
- package/worker/src/RTC/PlainTransport.cpp +9 -8
- package/worker/src/RTC/PortManager.cpp +174 -114
- package/worker/src/RTC/Producer.cpp +0 -1
- package/worker/src/RTC/RTCP/Feedback.cpp +6 -6
- package/worker/src/RTC/RTCP/FeedbackPs.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackPsAfb.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackPsPli.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackPsRemb.cpp +2 -2
- package/worker/src/RTC/RTCP/FeedbackRtp.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackRtpSrReq.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +2 -2
- package/worker/src/RTC/RTCP/Packet.cpp +2 -2
- package/worker/src/RTC/RTCP/Sdes.cpp +1 -1
- package/worker/src/RTC/RTP/Codecs/DependencyDescriptor.cpp +2 -1
- package/worker/src/RTC/RTP/Packet.cpp +68 -68
- package/worker/src/RTC/RTP/ProbationGenerator.cpp +3 -3
- package/worker/src/RTC/RTP/RtpStreamRecv.cpp +3 -3
- package/worker/src/RTC/RTP/RtxStream.cpp +2 -2
- package/worker/src/RTC/RTP/SharedPacket.cpp +4 -4
- package/worker/src/RTC/Router.cpp +5 -5
- package/worker/src/RTC/RtcLogger.cpp +1 -1
- package/worker/src/RTC/RtpDictionaries/RtpCodecMimeType.cpp +4 -4
- package/worker/src/RTC/RtpDictionaries/RtpParameters.cpp +2 -3
- package/worker/src/RTC/SCTP/association/Association.cpp +100 -97
- package/worker/src/RTC/SCTP/association/HeartbeatHandler.cpp +6 -6
- package/worker/src/RTC/SCTP/association/NegotiatedCapabilities.cpp +3 -3
- package/worker/src/RTC/SCTP/association/PacketSender.cpp +1 -1
- package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +2 -2
- package/worker/src/RTC/SCTP/association/TransmissionControlBlock.cpp +5 -5
- package/worker/src/RTC/SCTP/packet/Chunk.cpp +52 -52
- package/worker/src/RTC/SCTP/packet/ErrorCause.cpp +14 -14
- package/worker/src/RTC/SCTP/packet/Packet.cpp +17 -17
- package/worker/src/RTC/SCTP/packet/Parameter.cpp +17 -17
- package/worker/src/RTC/SCTP/packet/TLV.cpp +8 -8
- package/worker/src/RTC/SCTP/packet/chunks/AbortAssociationChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/CookieAckChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/CookieEchoChunk.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/chunks/DataChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/ForwardTsnChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/HeartbeatAckChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/HeartbeatRequestChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/IDataChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/IForwardTsnChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/InitAckChunk.cpp +4 -4
- package/worker/src/RTC/SCTP/packet/chunks/InitChunk.cpp +4 -4
- package/worker/src/RTC/SCTP/packet/chunks/OperationErrorChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/ReConfigChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/SackChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/ShutdownAckChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/ShutdownChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/ShutdownCompleteChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/CookieReceivedWhileShuttingDownErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/InvalidMandatoryParameterErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/InvalidStreamIdentifierErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/MissingMandatoryParameterErrorCause.cpp +4 -4
- package/worker/src/RTC/SCTP/packet/errorCauses/NoUserDataErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/OutOfResourceErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/ProtocolViolationErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/RestartOfAnAssociationWithNewAddressesErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/StaleCookieErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/UnrecognizedChunkTypeErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/UnrecognizedParametersErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/UnresolvableAddressErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/UserInitiatedAbortErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/AddIncomingStreamsRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/AddOutgoingStreamsRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/CookiePreservativeParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/ForwardTsnSupportedParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/HeartbeatInfoParameter.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/IPv4AddressParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/IPv6AddressParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/IncomingSsnResetRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/parameters/SsnTsnResetRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/StateCookieParameter.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/parameters/SupportedAddressTypesParameter.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/parameters/SupportedExtensionsParameter.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/UnrecognizedParameterParameter.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.cpp +3 -3
- package/worker/src/RTC/SCTP/rx/InterleavedReassemblyStreams.cpp +1 -0
- package/worker/src/RTC/SCTP/rx/TraditionalReassemblyStreams.cpp +1 -0
- package/worker/src/RTC/SCTP/tx/OutstandingData.cpp +8 -8
- package/worker/src/RTC/SCTP/tx/RoundRobinSendQueue.cpp +1 -1
- package/worker/src/RTC/SvcConsumer.cpp +6 -2
- package/worker/src/RTC/TcpServer.cpp +4 -4
- package/worker/src/RTC/Transport.cpp +42 -19
- package/worker/src/RTC/UdpSocket.cpp +4 -4
- package/worker/src/RTC/WebRtcServer.cpp +8 -8
- package/worker/src/RTC/WebRtcTransport.cpp +9 -8
- package/worker/src/Settings.cpp +2 -2
- package/worker/src/lib.cpp +1 -2
- package/worker/subprojects/packagefiles/ankerl-unordered-dense/meson.build +5 -0
- package/worker/subprojects/unordered-dense.wrap +9 -0
- package/worker/tasks.py +293 -196
- package/worker/test/src/RTC/ICE/TestStunPacket.cpp +22 -22
- package/worker/test/src/RTC/ICE/iceCommon.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpEcn.cpp +8 -8
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpNack.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpSrReq.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpTllei.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpTmmb.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestSenderReport.cpp +1 -1
- package/worker/test/src/RTC/RTP/TestPacket.cpp +26 -26
- package/worker/test/src/RTC/RTP/TestSharedPacket.cpp +1 -1
- package/worker/test/src/RTC/RTP/rtpCommon.cpp +1 -1
- package/worker/test/src/RTC/SCTP/association/TestNegotiatedCapabilities.cpp +4 -4
- package/worker/test/src/RTC/SCTP/packet/TestPacket.cpp +14 -14
- package/worker/test/src/RTC/SCTP/packet/chunks/TestAbortAssociationChunk.cpp +4 -4
- package/worker/test/src/RTC/SCTP/packet/chunks/TestCookieAckChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestCookieEchoChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestForwardTsnChunk.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestHeartbeatAckChunk.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestHeartbeatRequestChunk.cpp +9 -9
- package/worker/test/src/RTC/SCTP/packet/chunks/TestIDataChunk.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/chunks/TestIForwardTsnChunk.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestInitAckChunk.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestInitChunk.cpp +8 -8
- package/worker/test/src/RTC/SCTP/packet/chunks/TestOperationErrorChunk.cpp +7 -7
- package/worker/test/src/RTC/SCTP/packet/chunks/TestReConfigChunk.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/chunks/TestSackChunk.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/chunks/TestShutdownAckChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestShutdownCompleteChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestUnknownChunk.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestCookieReceivedWhileShuttingDownErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestInvalidMandatoryParameterErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestInvalidStreamIdentifierErrorCause.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestMissingMandatoryParameterErrorCause.cpp +11 -11
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestNoUserDataErrorCause.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestOutOfResourceErrorCause.cpp +5 -5
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestProtocolViolationErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestRestartOfAnAssociationWithNewAddressesErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestStaleCookieErrorCause.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnknownErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnrecognizedChunkTypeErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnrecognizedParametersErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnresolvableAddressErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUserInitiatedAbortErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/parameters/TestAddIncomingStreamsRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestAddOutgoingStreamsRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestCookiePreservativeParameter.cpp +7 -7
- package/worker/test/src/RTC/SCTP/packet/parameters/TestForwardTsnSupportedParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestHeartbeatInfoParameter.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv4AddressParameter.cpp +7 -7
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv6AddressParameter.cpp +7 -7
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIncomingSsnResetRequestParameter.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/parameters/TestOutgoingSsnResetRequestParameter.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/parameters/TestReconfigurationResponseParameter.cpp +5 -5
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSsnTsnResetRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestStateCookieParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSupportedAddressTypesParameter.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSupportedExtensionsParameter.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/parameters/TestUnknownParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestUnrecognizedParameterParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestZeroChecksumAcceptableParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/sctpCommon.cpp +1 -1
- package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +3 -3
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionQueue.cpp +1 -1
- package/worker/test/src/RTC/TestNackGenerator.cpp +1 -1
- package/worker/test/src/RTC/TestPortManager.cpp +126 -0
- package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +2 -2
- package/worker/test/src/RTC/TestTransportTuple.cpp +3 -2
- package/worker/test/src/Utils/TestCrypto.cpp +3 -3
- package/worker/test/src/Utils/TestString.cpp +1 -1
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
#include "RTC/SCTP/packet/ErrorCause.hpp"
|
|
6
6
|
#include "RTC/SCTP/packet/Parameter.hpp"
|
|
7
7
|
#include "RTC/SCTP/packet/TLV.hpp"
|
|
8
|
+
#include <ankerl/unordered_dense.h>
|
|
8
9
|
#include <string>
|
|
9
|
-
#include <unordered_map>
|
|
10
10
|
#include <vector>
|
|
11
11
|
|
|
12
12
|
namespace RTC
|
|
@@ -28,13 +28,13 @@ namespace RTC
|
|
|
28
28
|
* \ \
|
|
29
29
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
30
30
|
*
|
|
31
|
-
* - Chunk
|
|
32
|
-
* - Chunk
|
|
33
|
-
* - Chunk
|
|
34
|
-
* excluding padding bytes. Minimum value is 4 (if
|
|
31
|
+
* - Chunk type (8 bits).
|
|
32
|
+
* - Chunk flags (8 bits).
|
|
33
|
+
* - Chunk length (16 bits): Total length of the chunk
|
|
34
|
+
* excluding padding bytes. Minimum value is 4 (if chunk value is 0
|
|
35
35
|
* bytes). Maximum value is 65535, which means 1 byte of padding.
|
|
36
|
-
* - Chunk
|
|
37
|
-
* - Padding: Bytes of padding to make the
|
|
36
|
+
* - Chunk value (variable length).
|
|
37
|
+
* - Padding: Bytes of padding to make the chunk total length be
|
|
38
38
|
* multiple of 4 bytes.
|
|
39
39
|
*/
|
|
40
40
|
|
|
@@ -43,7 +43,7 @@ namespace RTC
|
|
|
43
43
|
|
|
44
44
|
class Chunk : public TLV
|
|
45
45
|
{
|
|
46
|
-
// We need that
|
|
46
|
+
// We need that packet calls protected and private methods in this class.
|
|
47
47
|
friend class Packet;
|
|
48
48
|
|
|
49
49
|
public:
|
|
@@ -79,7 +79,7 @@ namespace RTC
|
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Action that is taken if the processing endpoint does not recognize the
|
|
82
|
-
*
|
|
82
|
+
* chunk type.
|
|
83
83
|
*/
|
|
84
84
|
enum class ActionForUnknownChunkType : uint8_t
|
|
85
85
|
{
|
|
@@ -100,10 +100,10 @@ namespace RTC
|
|
|
100
100
|
ChunkType type;
|
|
101
101
|
uint8_t flags;
|
|
102
102
|
/**
|
|
103
|
-
* The value of the
|
|
104
|
-
* length of the
|
|
105
|
-
*
|
|
106
|
-
* zero-length, the
|
|
103
|
+
* The value of the chunk length field, which represents the total
|
|
104
|
+
* length of the chunk in bytes, including the chunk type, chunk flags,
|
|
105
|
+
* chunk length and chunk value fields. So if the chunk value field is
|
|
106
|
+
* zero-length, the length field must be 4. The chunk length field does
|
|
107
107
|
* not count any padding.
|
|
108
108
|
*/
|
|
109
109
|
uint16_t length;
|
|
@@ -149,16 +149,16 @@ namespace RTC
|
|
|
149
149
|
|
|
150
150
|
public:
|
|
151
151
|
/**
|
|
152
|
-
* Whether given buffer could be a a valid
|
|
152
|
+
* Whether given buffer could be a a valid chunk.
|
|
153
153
|
*
|
|
154
154
|
* @param buffer
|
|
155
|
-
* @param bufferLength - Can be greater than real
|
|
156
|
-
* @param chunkType - If given buffer is a valid
|
|
155
|
+
* @param bufferLength - Can be greater than real chunk length.
|
|
156
|
+
* @param chunkType - If given buffer is a valid chunk then `chunkType`
|
|
157
157
|
* is rewritten to parsed ChunkType.
|
|
158
|
-
* @param chunkLength - If given buffer is a valid
|
|
159
|
-
* `chunkLength` is rewritten to the value of the
|
|
160
|
-
* @param padding - If given buffer is a valid
|
|
161
|
-
* rewritten to the number of padding bytes in the
|
|
158
|
+
* @param chunkLength - If given buffer is a valid chunk then
|
|
159
|
+
* `chunkLength` is rewritten to the value of the chunk length field.
|
|
160
|
+
* @param padding - If given buffer is a valid chunk then `padding` is
|
|
161
|
+
* rewritten to the number of padding bytes in the chunk (only the
|
|
162
162
|
* necessary ones to make total length multiple of 4).
|
|
163
163
|
*/
|
|
164
164
|
static bool IsChunk(
|
|
@@ -171,11 +171,11 @@ namespace RTC
|
|
|
171
171
|
static const std::string& ChunkTypeToString(ChunkType chunkType);
|
|
172
172
|
|
|
173
173
|
private:
|
|
174
|
-
static const
|
|
174
|
+
static const ankerl::unordered_dense::map<ChunkType, std::string> ChunkType2String;
|
|
175
175
|
|
|
176
176
|
protected:
|
|
177
177
|
/**
|
|
178
|
-
* Constructor is protected because we only want to create
|
|
178
|
+
* Constructor is protected because we only want to create chunk
|
|
179
179
|
* instances via Parse() and Factory() in subclasses.
|
|
180
180
|
*/
|
|
181
181
|
Chunk(uint8_t* buffer, size_t bufferLength);
|
|
@@ -217,7 +217,7 @@ namespace RTC
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
|
-
* Whether this type of
|
|
220
|
+
* Whether this type of chunk can have parameters. Subclasses must
|
|
221
221
|
* override this method.
|
|
222
222
|
*/
|
|
223
223
|
virtual bool CanHaveParameters() const = 0;
|
|
@@ -267,42 +267,42 @@ namespace RTC
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
/**
|
|
270
|
-
* Clone given
|
|
270
|
+
* Clone given parameter into chunk's buffer.
|
|
271
271
|
*
|
|
272
272
|
* @remarks
|
|
273
273
|
* - Once this method is called, the caller may want to free the original
|
|
274
|
-
* given
|
|
274
|
+
* given parameter (otherwise it will leak since the chunk manages a clone
|
|
275
275
|
* of it).
|
|
276
276
|
*
|
|
277
277
|
* @throw
|
|
278
|
-
* - MediaSoupError - If the
|
|
278
|
+
* - MediaSoupError - If the chunk subclass cannot have parameters.
|
|
279
279
|
* - MediaSoupError - If `BuildParameterInPlace()` or
|
|
280
280
|
* `BuildErrorCauseInPlace()` was called before and the caller didn't
|
|
281
|
-
* invoke `Consolidate()` on the returned
|
|
281
|
+
* invoke `Consolidate()` on the returned parameter or error cause yet.
|
|
282
282
|
*/
|
|
283
283
|
virtual void AddParameter(const Parameter* parameter) final;
|
|
284
284
|
|
|
285
285
|
/**
|
|
286
|
-
* Build a
|
|
287
|
-
* of
|
|
288
|
-
* and those will affect the
|
|
289
|
-
* The desired
|
|
286
|
+
* Build a parameter within the chunk's buffer and append it to the list
|
|
287
|
+
* of parameters. The caller can perform modifications in that parameter
|
|
288
|
+
* and those will affect the chunk body where the parameter is serialized.
|
|
289
|
+
* The desired parameter class type is given via template argument.
|
|
290
290
|
*
|
|
291
|
-
* @returns Pointer of the created
|
|
291
|
+
* @returns Pointer of the created parameter specific class.
|
|
292
292
|
*
|
|
293
293
|
* @throw
|
|
294
|
-
* - MediaSoupError - If the
|
|
294
|
+
* - MediaSoupError - If the chunk subclass cannot have parameters.
|
|
295
295
|
* - MediaSoupError - If `BuildParameterInPlace()` or
|
|
296
296
|
* `BuildErrorCauseInPlace()` was called before and the caller didn't
|
|
297
|
-
* invoke `Consolidate()` on the returned
|
|
297
|
+
* invoke `Consolidate()` on the returned parameter or error cause yet.
|
|
298
298
|
*
|
|
299
299
|
* @remarks
|
|
300
|
-
* - The caller MUST invoke `Consolidate()` once the
|
|
300
|
+
* - The caller MUST invoke `Consolidate()` once the parameter is
|
|
301
301
|
* completed.
|
|
302
|
-
* - The caller MUST NOT free the obtained
|
|
303
|
-
* now part of the
|
|
304
|
-
* - The caller MUST free the obtained
|
|
305
|
-
* `Consolidate()` method on the
|
|
302
|
+
* - The caller MUST NOT free the obtained parameter pointer since it's
|
|
303
|
+
* now part of the chunk.
|
|
304
|
+
* - The caller MUST free the obtained parameter only in case the
|
|
305
|
+
* `Consolidate()` method on the parameter throws.
|
|
306
306
|
* - Method implemented in header file due to C++ template usage.
|
|
307
307
|
*
|
|
308
308
|
* @example
|
|
@@ -317,18 +317,18 @@ namespace RTC
|
|
|
317
317
|
AssertCanHaveParameters();
|
|
318
318
|
AssertDoesNotNeedConsolidation();
|
|
319
319
|
|
|
320
|
-
// The new
|
|
321
|
-
// this is, at the end of the
|
|
322
|
-
// 4 bytes, and each
|
|
320
|
+
// The new parameter will be added after other parameters in the chunk,
|
|
321
|
+
// this is, at the end of the chunk, whose length we know it's padded to
|
|
322
|
+
// 4 bytes, and each parameter total length is also multiple of 4 bytes.
|
|
323
323
|
auto* ptr = const_cast<uint8_t*>(GetBuffer()) + GetLength();
|
|
324
324
|
// The remaining length in the buffer is the potential buffer length
|
|
325
|
-
// of the
|
|
325
|
+
// of the parameter.
|
|
326
326
|
size_t parameterMaxBufferLength = GetBufferLength() - (ptr - GetBuffer());
|
|
327
327
|
|
|
328
328
|
auto* parameter = T::Factory(ptr, parameterMaxBufferLength);
|
|
329
329
|
|
|
330
|
-
// NOTE: Do not fix/update the
|
|
331
|
-
// probably wants to modify the
|
|
330
|
+
// NOTE: Do not fix/update the parameter buffer length since the caller
|
|
331
|
+
// probably wants to modify the parameter.
|
|
332
332
|
|
|
333
333
|
HandleInPlaceParameter(parameter);
|
|
334
334
|
|
|
@@ -336,7 +336,7 @@ namespace RTC
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
/**
|
|
339
|
-
* Whether this type of
|
|
339
|
+
* Whether this type of chunk can have error causes. Subclasses must
|
|
340
340
|
* override this method.
|
|
341
341
|
*/
|
|
342
342
|
virtual bool CanHaveErrorCauses() const = 0;
|
|
@@ -386,43 +386,43 @@ namespace RTC
|
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
/**
|
|
389
|
-
* Clone given
|
|
389
|
+
* Clone given error cause into chunk's buffer.
|
|
390
390
|
*
|
|
391
391
|
* @remarks
|
|
392
392
|
* - Once this method is called, the caller may want to free the original
|
|
393
|
-
* given
|
|
393
|
+
* given error cause (otherwise it will leak since the chunk manages a
|
|
394
394
|
* clone of it).
|
|
395
395
|
*
|
|
396
396
|
* @throw
|
|
397
|
-
* - MediaSoupError - If the
|
|
397
|
+
* - MediaSoupError - If the chunk subclass cannot have error causes.
|
|
398
398
|
* - MediaSoupError - If `BuildParameterInPlace()` or
|
|
399
399
|
* `BuildErrorCauseInPlace()` was called before and the caller didn't
|
|
400
|
-
* invoke `Consolidate()` on the returned
|
|
400
|
+
* invoke `Consolidate()` on the returned parameter or error cause yet.
|
|
401
401
|
*/
|
|
402
402
|
virtual void AddErrorCause(const ErrorCause* errorCause) final;
|
|
403
403
|
|
|
404
404
|
/**
|
|
405
|
-
* Build a
|
|
406
|
-
* list of
|
|
407
|
-
*
|
|
408
|
-
* is serialzed. The desired
|
|
405
|
+
* Build a error cause within the chunk's buffer and append it to the
|
|
406
|
+
* list of error causes. The caller can perform modifications in that
|
|
407
|
+
* error cause and those will affect the chunk body where the error cause
|
|
408
|
+
* is serialzed. The desired error cause class type is given via template
|
|
409
409
|
* argument.
|
|
410
410
|
*
|
|
411
|
-
* @returns Pointer of the created
|
|
411
|
+
* @returns Pointer of the created error cause specific class.
|
|
412
412
|
*
|
|
413
413
|
* @throw
|
|
414
|
-
* - MediaSoupError - If the
|
|
414
|
+
* - MediaSoupError - If the chunk subclass cannot have error causes.
|
|
415
415
|
* - MediaSoupError - If `BuildParameterInPlace()` or
|
|
416
416
|
* `BuildErrorCauseInPlace()` was called before and the caller didn't
|
|
417
|
-
* invoke `Consolidate()` on the returned
|
|
417
|
+
* invoke `Consolidate()` on the returned parameter or error cause yet.
|
|
418
418
|
*
|
|
419
419
|
* @remarks
|
|
420
|
-
* - The caller MUST invoke `Consolidate()` once the
|
|
420
|
+
* - The caller MUST invoke `Consolidate()` once the error cause is
|
|
421
421
|
* completed.
|
|
422
|
-
* - The caller MUST NOT free the obtained
|
|
423
|
-
* now part of the
|
|
424
|
-
* - The caller MUST free the obtained
|
|
425
|
-
* `Consolidate()` method on the
|
|
422
|
+
* - The caller MUST NOT free the obtained error cause pointer since it's
|
|
423
|
+
* now part of the chunk.
|
|
424
|
+
* - The caller MUST free the obtained error cause only in case the
|
|
425
|
+
* `Consolidate()` method on the error cause throws.
|
|
426
426
|
* - Method implemented in header file due to C++ template usage.
|
|
427
427
|
*
|
|
428
428
|
* @example
|
|
@@ -437,19 +437,19 @@ namespace RTC
|
|
|
437
437
|
AssertCanHaveErrorCauses();
|
|
438
438
|
AssertDoesNotNeedConsolidation();
|
|
439
439
|
|
|
440
|
-
// The new
|
|
441
|
-
//
|
|
442
|
-
// padded to 4 bytes, and each
|
|
440
|
+
// The new error cause will be added after other error causes in the
|
|
441
|
+
// chunk, this is, at the end of the chunk, whose length we know it's
|
|
442
|
+
// padded to 4 bytes, and each error cause total length is also
|
|
443
443
|
// multiple of 4 bytes.
|
|
444
444
|
auto* ptr = const_cast<uint8_t*>(GetBuffer()) + GetLength();
|
|
445
445
|
// The remaining length in the buffer is the potential buffer length
|
|
446
|
-
// of the
|
|
446
|
+
// of the error cause.
|
|
447
447
|
size_t errorCauseMaxBufferLength = GetBufferLength() - (ptr - GetBuffer());
|
|
448
448
|
|
|
449
449
|
auto* errorCause = T::Factory(ptr, errorCauseMaxBufferLength);
|
|
450
450
|
|
|
451
|
-
// NOTE: Do not fix/update the
|
|
452
|
-
// caller probably wants to modify the
|
|
451
|
+
// NOTE: Do not fix/update the error cause buffer length since the
|
|
452
|
+
// caller probably wants to modify the error cause.
|
|
453
453
|
|
|
454
454
|
HandleInPlaceErrorCause(errorCause);
|
|
455
455
|
|
|
@@ -459,7 +459,7 @@ namespace RTC
|
|
|
459
459
|
/**
|
|
460
460
|
* Whether `BuildParameterInPlace()` or `BuildErrorCauseInPlace()` was
|
|
461
461
|
* called before and the caller didn't invoke `Consolidate()` on the
|
|
462
|
-
* returned
|
|
462
|
+
* returned parameter or error cause yet.
|
|
463
463
|
*/
|
|
464
464
|
virtual bool NeedsConsolidation() const final
|
|
465
465
|
{
|
|
@@ -576,8 +576,8 @@ namespace RTC
|
|
|
576
576
|
/**
|
|
577
577
|
* Chunk subclasses with header bigger than default one (4 bytes) must
|
|
578
578
|
* override this method and return their header length (excluding
|
|
579
|
-
* variable-length field considered "value", Optional/
|
|
580
|
-
*
|
|
579
|
+
* variable-length field considered "value", Optional/variable-length
|
|
580
|
+
* parameters and error causes).
|
|
581
581
|
*/
|
|
582
582
|
size_t GetHeaderLength() const override
|
|
583
583
|
{
|
|
@@ -585,34 +585,34 @@ namespace RTC
|
|
|
585
585
|
}
|
|
586
586
|
|
|
587
587
|
/**
|
|
588
|
-
* To be called by each subclass of
|
|
589
|
-
* needed. It creates
|
|
588
|
+
* To be called by each subclass of chunk if parameters parsing is
|
|
589
|
+
* needed. It creates parameter subclasses and adds them to the chunk.
|
|
590
590
|
*
|
|
591
591
|
* @remarks
|
|
592
|
-
* - This method assumes that the
|
|
593
|
-
* already so current length of the
|
|
594
|
-
* specific
|
|
592
|
+
* - This method assumes that the chunk basic parsing has been made
|
|
593
|
+
* already so current length of the chunk is the fixed length of the
|
|
594
|
+
* specific chunk class.
|
|
595
595
|
*
|
|
596
|
-
* @return True if no error happened while parsing
|
|
596
|
+
* @return True if no error happened while parsing parameters.
|
|
597
597
|
*
|
|
598
598
|
* @throw
|
|
599
|
-
* - MediaSoupError - If the
|
|
599
|
+
* - MediaSoupError - If the chunk subclass cannot have chunk parameters.
|
|
600
600
|
*/
|
|
601
601
|
virtual bool ParseParameters() final;
|
|
602
602
|
|
|
603
603
|
/**
|
|
604
|
-
* To be called by each subclass of
|
|
605
|
-
* needed. It creates ErrorCause subclasses and adds them to the
|
|
604
|
+
* To be called by each subclass of chunk if error causes parsing is
|
|
605
|
+
* needed. It creates ErrorCause subclasses and adds them to the chunk.
|
|
606
606
|
*
|
|
607
607
|
* @remarks
|
|
608
|
-
* - This method assumes that the
|
|
609
|
-
* already so current length of the
|
|
610
|
-
* specific
|
|
608
|
+
* - This method assumes that the chunk basic parsing has been made
|
|
609
|
+
* already so current length of the chunk is the fixed length of the
|
|
610
|
+
* specific chunk class.
|
|
611
611
|
*
|
|
612
|
-
* @return True if no error happened while parsing
|
|
612
|
+
* @return True if no error happened while parsing error causes.
|
|
613
613
|
*
|
|
614
614
|
* @throw
|
|
615
|
-
* - MediaSoupError - If the
|
|
615
|
+
* - MediaSoupError - If the chunk subclass cannot have chunk parameters.
|
|
616
616
|
*/
|
|
617
617
|
virtual bool ParseErrorCauses() final;
|
|
618
618
|
|
|
@@ -658,7 +658,7 @@ namespace RTC
|
|
|
658
658
|
std::vector<ErrorCause*> errorCauses;
|
|
659
659
|
// Whether `BuildParameterInPlace()` or `BuildErrorCauseInPlace()` was
|
|
660
660
|
// called and the caller didn't invoke `Consolidate()` on the returned
|
|
661
|
-
//
|
|
661
|
+
// parameter or error cause yet.
|
|
662
662
|
bool needsConsolidation{ false };
|
|
663
663
|
};
|
|
664
664
|
} // namespace SCTP
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
5
|
#include "RTC/SCTP/packet/TLV.hpp"
|
|
6
|
+
#include <ankerl/unordered_dense.h>
|
|
6
7
|
#include <string>
|
|
7
|
-
#include <unordered_map>
|
|
8
8
|
|
|
9
9
|
namespace RTC
|
|
10
10
|
{
|
|
@@ -25,12 +25,12 @@ namespace RTC
|
|
|
25
25
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
26
26
|
*
|
|
27
27
|
* - Cause Code (16 bits).
|
|
28
|
-
* - Cause
|
|
29
|
-
* including the Cause Code, Cause
|
|
28
|
+
* - Cause length (16 bits): Set to the size of the error cause in bytes,
|
|
29
|
+
* including the Cause Code, Cause length, and Cause-Specific Information
|
|
30
30
|
* fields (padding excluded).
|
|
31
31
|
* - Cause-Specific Information (variable length): This field carries the
|
|
32
32
|
* details of the error condition.
|
|
33
|
-
* - Padding: Bytes of padding to make the
|
|
33
|
+
* - Padding: Bytes of padding to make the error cause total length be
|
|
34
34
|
* multiple of 4 bytes.
|
|
35
35
|
*/
|
|
36
36
|
|
|
@@ -39,7 +39,7 @@ namespace RTC
|
|
|
39
39
|
|
|
40
40
|
class ErrorCause : public TLV
|
|
41
41
|
{
|
|
42
|
-
// We need that
|
|
42
|
+
// We need that chunk calls protected and private methods in this class.
|
|
43
43
|
friend class Chunk;
|
|
44
44
|
|
|
45
45
|
public:
|
|
@@ -75,11 +75,11 @@ namespace RTC
|
|
|
75
75
|
{
|
|
76
76
|
ErrorCauseCode code;
|
|
77
77
|
/**
|
|
78
|
-
* The value of the
|
|
79
|
-
* total length of the
|
|
80
|
-
* Cause
|
|
81
|
-
* Cause-Specific Information field is zero-length, the
|
|
82
|
-
* must be 4. The Cause
|
|
78
|
+
* The value of the error cause length field, which represents the
|
|
79
|
+
* total length of the error cause in bytes, including the Cause Code,
|
|
80
|
+
* Cause length and Cause-Specific Information fields. So if the
|
|
81
|
+
* Cause-Specific Information field is zero-length, the length field
|
|
82
|
+
* must be 4. The Cause length field does not count any padding.
|
|
83
83
|
*/
|
|
84
84
|
uint16_t length;
|
|
85
85
|
};
|
|
@@ -89,16 +89,16 @@ namespace RTC
|
|
|
89
89
|
|
|
90
90
|
public:
|
|
91
91
|
/**
|
|
92
|
-
* Whether given buffer could be a a valid
|
|
92
|
+
* Whether given buffer could be a a valid error cause.
|
|
93
93
|
*
|
|
94
94
|
* @param buffer
|
|
95
|
-
* @param bufferLength - Can be greater than real
|
|
96
|
-
* @param causeCode - If given buffer is a valid
|
|
95
|
+
* @param bufferLength - Can be greater than real error cause length.
|
|
96
|
+
* @param causeCode - If given buffer is a valid error cause then
|
|
97
97
|
* `causeCode` is rewritten to parsed ErrorCauseCode.
|
|
98
|
-
* @param causeLength - If given buffer is a valid
|
|
99
|
-
* `causeLength` is rewritten to the value of the Cause
|
|
100
|
-
* @param padding - If given buffer is a valid
|
|
101
|
-
* is rewritten to the number of padding bytes in the
|
|
98
|
+
* @param causeLength - If given buffer is a valid error cause then
|
|
99
|
+
* `causeLength` is rewritten to the value of the Cause length field.
|
|
100
|
+
* @param padding - If given buffer is a valid error cause then `padding`
|
|
101
|
+
* is rewritten to the number of padding bytes in the error cause (only
|
|
102
102
|
* the necessary ones to make total length multiple of 4).
|
|
103
103
|
*/
|
|
104
104
|
static bool IsErrorCause(
|
|
@@ -111,7 +111,7 @@ namespace RTC
|
|
|
111
111
|
static const std::string& ErrorCauseCodeToString(ErrorCauseCode causeCode);
|
|
112
112
|
|
|
113
113
|
private:
|
|
114
|
-
static const
|
|
114
|
+
static const ankerl::unordered_dense::map<ErrorCauseCode, std::string> ErrorCauseCode2String;
|
|
115
115
|
|
|
116
116
|
protected:
|
|
117
117
|
/**
|
|
@@ -27,7 +27,7 @@ namespace RTC
|
|
|
27
27
|
* | Chunk #n |
|
|
28
28
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
29
29
|
*
|
|
30
|
-
* It's mandatory that the
|
|
30
|
+
* It's mandatory that the packet total length is multiple of 4 bytes.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -73,28 +73,28 @@ namespace RTC
|
|
|
73
73
|
static const size_t CommonHeaderLength{ 12 };
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* Whether given buffer could be a valid SCTP
|
|
76
|
+
* Whether given buffer could be a valid SCTP packet.
|
|
77
77
|
*
|
|
78
78
|
* @remarks
|
|
79
|
-
* - `bufferLength` must be the exact length of the
|
|
79
|
+
* - `bufferLength` must be the exact length of the packet.
|
|
80
80
|
* - This check is very lazy. It should NEVER be done before checking if
|
|
81
81
|
* given buffer is an RTP or RTCP packet.
|
|
82
82
|
*/
|
|
83
83
|
static bool IsSctp(const uint8_t* buffer, size_t bufferLength);
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* Parse an SCTP
|
|
86
|
+
* Parse an SCTP packet.
|
|
87
87
|
*
|
|
88
88
|
* @remarks
|
|
89
|
-
* - `bufferLength` must be the exact length of the
|
|
89
|
+
* - `bufferLength` must be the exact length of the packet.
|
|
90
90
|
*/
|
|
91
91
|
static Packet* Parse(const uint8_t* buffer, size_t bufferLength);
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* Create an SCTP
|
|
94
|
+
* Create an SCTP packet.
|
|
95
95
|
*
|
|
96
96
|
* @remarks
|
|
97
|
-
* - `bufferLength` must be the exact length of the STUN
|
|
97
|
+
* - `bufferLength` must be the exact length of the STUN packet.
|
|
98
98
|
* - If `transactionId` is not given then a random Transaction ID is
|
|
99
99
|
* generated.
|
|
100
100
|
*/
|
|
@@ -102,8 +102,8 @@ namespace RTC
|
|
|
102
102
|
|
|
103
103
|
private:
|
|
104
104
|
/**
|
|
105
|
-
* Constructor is private because we only want to create
|
|
106
|
-
* via Parse() and Factory()
|
|
105
|
+
* Constructor is private because we only want to create packet instances
|
|
106
|
+
* via `Parse()` and `Factory()`.
|
|
107
107
|
*/
|
|
108
108
|
Packet(uint8_t* buffer, size_t bufferLength);
|
|
109
109
|
|
|
@@ -189,39 +189,39 @@ namespace RTC
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
* Clone given
|
|
192
|
+
* Clone given chunk into packet's buffer.
|
|
193
193
|
*
|
|
194
194
|
* @remarks
|
|
195
195
|
* - Once this method is called, the caller may want to free the original
|
|
196
|
-
* given
|
|
196
|
+
* given chunk (otherwise it will leak since the packet manages a clone
|
|
197
197
|
* of it).
|
|
198
198
|
*
|
|
199
199
|
* @throw
|
|
200
200
|
* - MediaSoupError - If `BuildChunkInPlace()` was called before and the
|
|
201
|
-
* caller didn't invoke `Consolidate()` on the returned
|
|
201
|
+
* caller didn't invoke `Consolidate()` on the returned chunk yet.
|
|
202
202
|
*/
|
|
203
203
|
void AddChunk(const Chunk* chunk);
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
|
-
* Build a
|
|
207
|
-
*
|
|
208
|
-
* will affect the
|
|
209
|
-
*
|
|
206
|
+
* Build a chunk within the packet's buffer and append it to the list of
|
|
207
|
+
* chunks. The caller can perform modifications in that chunk and those
|
|
208
|
+
* will affect the packet body where the chunk is serialzed. The desired
|
|
209
|
+
* chunk class type is given via template argument.
|
|
210
210
|
*
|
|
211
|
-
* @returns Pointer of the created
|
|
211
|
+
* @returns Pointer of the created chunk specific class.
|
|
212
212
|
*
|
|
213
213
|
* @throw
|
|
214
214
|
* - MediaSoupError - If `BuildChunkInPlace()` was called before and the
|
|
215
|
-
* caller didn't invoke `Consolidate()` on the returned
|
|
215
|
+
* caller didn't invoke `Consolidate()` on the returned chunk yet.
|
|
216
216
|
*
|
|
217
217
|
* @remarks
|
|
218
|
-
* - The caller MUST invoke `Consolidate()` once the
|
|
219
|
-
* - The caller MUST NOT call `BuildChunkInPlace()` while other
|
|
218
|
+
* - The caller MUST invoke `Consolidate()` once the chunk is completed.
|
|
219
|
+
* - The caller MUST NOT call `BuildChunkInPlace()` while other chunk is
|
|
220
220
|
* in progress.
|
|
221
|
-
* - The caller MUST NOT free the obtained
|
|
222
|
-
* part of the
|
|
223
|
-
* - The caller MUST free the obtained
|
|
224
|
-
* `Consolidate()` method on the
|
|
221
|
+
* - The caller MUST NOT free the obtained chunk pointer since it's now
|
|
222
|
+
* part of the packet.
|
|
223
|
+
* - The caller MUST free the obtained chunk only in case the
|
|
224
|
+
* `Consolidate()` method on the chunk throws.
|
|
225
225
|
* - Method implemented in header file due to C++ template usage.
|
|
226
226
|
*
|
|
227
227
|
* @example
|
|
@@ -234,18 +234,18 @@ namespace RTC
|
|
|
234
234
|
{
|
|
235
235
|
AssertDoesNotNeedConsolidation();
|
|
236
236
|
|
|
237
|
-
// The new
|
|
238
|
-
// at the end of the
|
|
239
|
-
//
|
|
237
|
+
// The new chunk will be added after other chunks in the packet, this is,
|
|
238
|
+
// at the end of the packet, whose length we know it's padded to 4 bytes,
|
|
239
|
+
// and each parameter total length is also multiple of 4 bytes.
|
|
240
240
|
auto* ptr = const_cast<uint8_t*>(GetBuffer()) + GetLength();
|
|
241
241
|
// The remaining length in the buffer is the potential buffer length
|
|
242
|
-
// of the
|
|
242
|
+
// of the chunk.
|
|
243
243
|
size_t chunkMaxBufferLength = GetBufferLength() - (ptr - GetBuffer());
|
|
244
244
|
|
|
245
245
|
auto* chunk = T::Factory(ptr, chunkMaxBufferLength);
|
|
246
246
|
|
|
247
|
-
// NOTE: Do not fix/update the
|
|
248
|
-
// probably wants to modify the
|
|
247
|
+
// NOTE: Do not fix/update the chunk buffer length since the caller
|
|
248
|
+
// probably wants to modify the chunk.
|
|
249
249
|
|
|
250
250
|
HandleInPlaceChunk(chunk);
|
|
251
251
|
|
|
@@ -254,7 +254,7 @@ namespace RTC
|
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
256
|
* Whether `BuildChunkInPlace()` was called and the caller didn't invoke
|
|
257
|
-
* `Consolidate()` on the returned
|
|
257
|
+
* `Consolidate()` on the returned chunk yet.
|
|
258
258
|
*/
|
|
259
259
|
bool NeedsConsolidation() const
|
|
260
260
|
{
|
|
@@ -262,7 +262,7 @@ namespace RTC
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
/**
|
|
265
|
-
* Calculate CRC32C value of the whole
|
|
265
|
+
* Calculate CRC32C value of the whole packet and insert it into the
|
|
266
266
|
* Checksum field.
|
|
267
267
|
*/
|
|
268
268
|
void WriteCRC32cChecksum();
|
|
@@ -295,7 +295,7 @@ namespace RTC
|
|
|
295
295
|
// Chunks.
|
|
296
296
|
std::vector<Chunk*> chunks;
|
|
297
297
|
// Whether `BuildChunkInPlace()` was called and the caller didn't invoke
|
|
298
|
-
// `Consolidate()` on the returned
|
|
298
|
+
// `Consolidate()` on the returned chunk yet.
|
|
299
299
|
bool needsConsolidation{ false };
|
|
300
300
|
};
|
|
301
301
|
} // namespace SCTP
|