22#define MS_RTC_SCTP_SOCKET_HPP
33
44#include " common.hpp"
5- #include " RTC/SCTP/association/NegotiatedCapabilities.hpp"
6- #include " RTC/SCTP/association/SocketMetrics.hpp"
7- #include " RTC/SCTP/association/SocketOptions.hpp"
8- #include " RTC/SCTP/association/TransmissionControlBlock.hpp"
5+ #include " RTC/SCTP/NegotiatedCapabilities.hpp"
6+ #include " RTC/SCTP/SocketDeferredListener.hpp"
7+ #include " RTC/SCTP/SocketListener.hpp"
8+ #include " RTC/SCTP/SocketMetrics.hpp"
9+ #include " RTC/SCTP/SocketOptions.hpp"
10+ #include " RTC/SCTP/TransmissionControlBlock.hpp"
911#include " RTC/SCTP/packet/Chunk.hpp"
1012#include " RTC/SCTP/packet/Packet.hpp"
1113#include " RTC/SCTP/packet/chunks/AbortAssociationChunk.hpp"
@@ -34,16 +36,6 @@ namespace RTC
3436 */
3537 class Socket : public BackoffTimerHandle ::Listener
3638 {
37- public:
38- class Listener
39- {
40- public:
41- virtual ~Listener () = default ;
42-
43- public:
44- virtual void OnSocketSendSctpPacket (const Socket* socket, Packet* packet) const = 0;
45- };
46-
4739 public:
4840 /* *
4941 * SCTP association state.
@@ -77,10 +69,10 @@ namespace RTC
7769 };
7870
7971 public:
80- static constexpr std::string_view State2String (State state);
72+ static constexpr std::string_view StateToString (State state);
8173
8274 public:
83- explicit Socket (SocketOptions options, Listener * listener);
75+ explicit Socket (SocketOptions options, SocketListener * listener);
8476
8577 ~Socket ();
8678
@@ -93,7 +85,7 @@ namespace RTC
9385 * @remarks
9486 * The Socket must be in Closed state.
9587 */
96- void Associate ();
88+ void Connect ();
9789
9890 /* *
9991 * Receive a Packet received from the peer.
@@ -155,11 +147,11 @@ namespace RTC
155147 bool ProcessReceivedUnknownChunk (
156148 const Packet* receivedPacket, const UnknownChunk* receivedUnknownChunk);
157149
158- void OnT1InitTimer (uint64_t & baseTimeout , bool & stop);
150+ void OnT1InitTimer (uint64_t & baseTimeoutMs , bool & stop);
159151
160- void OnT1CookieTimer (uint64_t & baseTimeout , bool & stop);
152+ void OnT1CookieTimer (uint64_t & baseTimeoutMs , bool & stop);
161153
162- void OnT2ShutdownTimer (uint64_t & baseTimeout , bool & stop);
154+ void OnT2ShutdownTimer (uint64_t & baseTimeoutMs , bool & stop);
163155
164156 template <typename ... States>
165157 void AssertState (States... expectedStates) const ;
@@ -171,13 +163,14 @@ namespace RTC
171163
172164 /* Pure virtual methods inherited from BackoffTimerHandle::Listener. */
173165 public:
174- void OnTimer (BackoffTimerHandle* backoffTimer, uint64_t & baseTimeout , bool & stop) override ;
166+ void OnTimer (BackoffTimerHandle* backoffTimer, uint64_t & baseTimeoutMs , bool & stop) override ;
175167
176168 private:
177169 // Socket options given in th econstructor.
178170 const SocketOptions options;
179- // Listener.
180- const Listener* listener{ nullptr };
171+ // Listener. It's not a SocketListener but a SocketDeferredListener which
172+ // inherits from SocketListener.
173+ SocketDeferredListener listener;
181174 // SCTP association state.
182175 State state{ State::CLOSED };
183176 // Metrics.
0 commit comments