blob: eb9cfc1d3ce6a8f907e9574013f52cbecec49db2 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef RTC_BASE_VIRTUAL_SOCKET_SERVER_H_
12#define RTC_BASE_VIRTUAL_SOCKET_SERVER_H_
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000013
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020014#include <deque>
15#include <map>
Steve Antonf4172382020-01-27 15:45:02 -080016#include <vector>
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000017
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "rtc_base/checks.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "rtc_base/event.h"
Steve Anton10542f22019-01-11 09:11:00 -080020#include "rtc_base/fake_clock.h"
Sebastian Jansson4db28b52020-01-08 14:07:15 +010021#include "rtc_base/message_handler.h"
Steve Anton10542f22019-01-11 09:11:00 -080022#include "rtc_base/socket_server.h"
Niels Möllerc413c552021-06-22 10:03:14 +020023#include "rtc_base/synchronization/mutex.h"
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020024
25namespace rtc {
26
27class Packet;
Niels Möllerea423a52021-08-19 10:13:31 +020028class VirtualSocketServer;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020029class SocketAddressPair;
30
Niels Möllerea423a52021-08-19 10:13:31 +020031// Implements the socket interface using the virtual network. Packets are
32// passed as messages using the message queue of the socket server.
33class VirtualSocket : public Socket,
34 public MessageHandler,
35 public sigslot::has_slots<> {
36 public:
37 VirtualSocket(VirtualSocketServer* server, int family, int type);
38 ~VirtualSocket() override;
39
40 SocketAddress GetLocalAddress() const override;
41 SocketAddress GetRemoteAddress() const override;
42
43 int Bind(const SocketAddress& addr) override;
44 int Connect(const SocketAddress& addr) override;
45 int Close() override;
46 int Send(const void* pv, size_t cb) override;
47 int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override;
48 int Recv(void* pv, size_t cb, int64_t* timestamp) override;
49 int RecvFrom(void* pv,
50 size_t cb,
51 SocketAddress* paddr,
52 int64_t* timestamp) override;
53 int Listen(int backlog) override;
54 VirtualSocket* Accept(SocketAddress* paddr) override;
55
56 int GetError() const override;
57 void SetError(int error) override;
58 ConnState GetState() const override;
59 int GetOption(Option opt, int* value) override;
60 int SetOption(Option opt, int value) override;
61 void OnMessage(Message* pmsg) override;
62
63 size_t recv_buffer_size() const { return recv_buffer_size_; }
64 size_t send_buffer_size() const { return send_buffer_.size(); }
65 const char* send_buffer_data() const { return send_buffer_.data(); }
66
67 // Used by server sockets to set the local address without binding.
68 void SetLocalAddress(const SocketAddress& addr);
69
70 bool was_any() { return was_any_; }
71 void set_was_any(bool was_any) { was_any_ = was_any; }
72
73 void SetToBlocked();
74
75 void UpdateRecv(size_t data_size);
76 void UpdateSend(size_t data_size);
77
78 void MaybeSignalWriteEvent(size_t capacity);
79
80 // Adds a packet to be sent. Returns delay, based on network_size_.
81 uint32_t AddPacket(int64_t cur_time, size_t packet_size);
82
83 int64_t UpdateOrderedDelivery(int64_t ts);
84
85 // Removes stale packets from the network. Returns current size.
86 size_t PurgeNetworkPackets(int64_t cur_time);
87
88 private:
89 struct NetworkEntry {
90 size_t size;
91 int64_t done_time;
92 };
93
94 typedef std::deque<SocketAddress> ListenQueue;
95 typedef std::deque<NetworkEntry> NetworkQueue;
96 typedef std::vector<char> SendBuffer;
97 typedef std::list<Packet*> RecvBuffer;
98 typedef std::map<Option, int> OptionsMap;
99
100 int InitiateConnect(const SocketAddress& addr, bool use_delay);
101 void CompleteConnect(const SocketAddress& addr);
102 int SendUdp(const void* pv, size_t cb, const SocketAddress& addr);
103 int SendTcp(const void* pv, size_t cb);
104
105 void OnSocketServerReadyToSend();
106
107 VirtualSocketServer* const server_;
108 const int type_;
109 ConnState state_;
110 int error_;
111 SocketAddress local_addr_;
112 SocketAddress remote_addr_;
113
114 // Pending sockets which can be Accepted
115 std::unique_ptr<ListenQueue> listen_queue_ RTC_GUARDED_BY(mutex_)
116 RTC_PT_GUARDED_BY(mutex_);
117
118 // Data which tcp has buffered for sending
119 SendBuffer send_buffer_;
120 // Set to false if the last attempt to send resulted in EWOULDBLOCK.
121 // Set back to true when the socket can send again.
122 bool ready_to_send_ = true;
123
124 // Mutex to protect the recv_buffer and listen_queue_
125 webrtc::Mutex mutex_;
126
127 // Network model that enforces bandwidth and capacity constraints
128 NetworkQueue network_;
129 size_t network_size_;
130 // The scheduled delivery time of the last packet sent on this socket.
131 // It is used to ensure ordered delivery of packets sent on this socket.
132 int64_t last_delivery_time_ = 0;
133
134 // Data which has been received from the network
135 RecvBuffer recv_buffer_ RTC_GUARDED_BY(mutex_);
136 // The amount of data which is in flight or in recv_buffer_
137 size_t recv_buffer_size_;
138
139 // Is this socket bound?
140 bool bound_;
141
142 // When we bind a socket to Any, VSS's Bind gives it another address. For
143 // dual-stack sockets, we want to distinguish between sockets that were
144 // explicitly given a particular address and sockets that had one picked
145 // for them by VSS.
146 bool was_any_;
147
148 // Store the options that are set
149 OptionsMap options_map_;
150};
151
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200152// Simulates a network in the same manner as a loopback interface. The
153// interface can create as many addresses as you want. All of the sockets
154// created by this network will be able to communicate with one another, unless
155// they are bound to addresses from incompatible families.
Niels Möller9bd24572021-04-19 12:18:27 +0200156class VirtualSocketServer : public SocketServer {
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200157 public:
158 VirtualSocketServer();
159 // This constructor needs to be used if the test uses a fake clock and
160 // ProcessMessagesUntilIdle, since ProcessMessagesUntilIdle needs a way of
161 // advancing time.
Sebastian Janssond624c392019-04-17 10:36:03 +0200162 explicit VirtualSocketServer(ThreadProcessingFakeClock* fake_clock);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200163 ~VirtualSocketServer() override;
164
Byoungchan Lee14af7622022-01-12 05:24:58 +0900165 VirtualSocketServer(const VirtualSocketServer&) = delete;
166 VirtualSocketServer& operator=(const VirtualSocketServer&) = delete;
167
Niels Möller84d15952021-09-01 10:50:34 +0200168 // The default source address specifies which local address to use when a
169 // socket is bound to the 'any' address, e.g. 0.0.0.0. (If not set, the 'any'
170 // address is used as the source address on outgoing virtual packets, exposed
171 // to recipient's RecvFrom).
172 IPAddress GetDefaultSourceAddress(int family);
173 void SetDefaultSourceAddress(const IPAddress& from_addr);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200174
175 // Limits the network bandwidth (maximum bytes per second). Zero means that
176 // all sends occur instantly. Defaults to 0.
Florent Castellif94c0532021-11-16 13:29:53 +0100177 void set_bandwidth(uint32_t bandwidth) RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200178
179 // Limits the amount of data which can be in flight on the network without
180 // packet loss (on a per sender basis). Defaults to 64 KB.
Florent Castellif94c0532021-11-16 13:29:53 +0100181 void set_network_capacity(uint32_t capacity) RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200182
183 // The amount of data which can be buffered by tcp on the sender's side
Florent Castellif94c0532021-11-16 13:29:53 +0100184 uint32_t send_buffer_capacity() const RTC_LOCKS_EXCLUDED(mutex_);
185 void set_send_buffer_capacity(uint32_t capacity) RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200186
187 // The amount of data which can be buffered by tcp on the receiver's side
Florent Castellif94c0532021-11-16 13:29:53 +0100188 uint32_t recv_buffer_capacity() const RTC_LOCKS_EXCLUDED(mutex_);
189 void set_recv_buffer_capacity(uint32_t capacity) RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200190
191 // Controls the (transit) delay for packets sent in the network. This does
192 // not inclue the time required to sit in the send queue. Both of these
193 // values are measured in milliseconds. Defaults to no delay.
Florent Castellif94c0532021-11-16 13:29:53 +0100194 void set_delay_mean(uint32_t delay_mean) RTC_LOCKS_EXCLUDED(mutex_);
195 void set_delay_stddev(uint32_t delay_stddev) RTC_LOCKS_EXCLUDED(mutex_);
196 void set_delay_samples(uint32_t delay_samples) RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200197
198 // If the (transit) delay parameters are modified, this method should be
199 // called to recompute the new distribution.
Florent Castellif94c0532021-11-16 13:29:53 +0100200 void UpdateDelayDistribution() RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200201
202 // Controls the (uniform) probability that any sent packet is dropped. This
203 // is separate from calculations to drop based on queue size.
Florent Castellif94c0532021-11-16 13:29:53 +0100204 void set_drop_probability(double drop_prob) RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200205
Harald Alvestrand3d792e92021-03-10 07:29:28 +0000206 // Controls the maximum UDP payload for the networks simulated
207 // by this server. Any UDP payload sent that is larger than this will
208 // be dropped.
Florent Castellif94c0532021-11-16 13:29:53 +0100209 void set_max_udp_payload(size_t payload_size) RTC_LOCKS_EXCLUDED(mutex_);
Harald Alvestrand3d792e92021-03-10 07:29:28 +0000210
Artem Titov96e3b992021-07-26 16:03:14 +0200211 // If `blocked` is true, subsequent attempts to send will result in -1 being
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200212 // returned, with the socket error set to EWOULDBLOCK.
213 //
Artem Titov96e3b992021-07-26 16:03:14 +0200214 // If this method is later called with `blocked` set to false, any sockets
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200215 // that previously failed to send with EWOULDBLOCK will emit SignalWriteEvent.
216 //
217 // This can be used to simulate the send buffer on a network interface being
218 // full, and test functionality related to EWOULDBLOCK/SignalWriteEvent.
Florent Castellif94c0532021-11-16 13:29:53 +0100219 void SetSendingBlocked(bool blocked) RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200220
221 // SocketFactory:
Niels Möllerea423a52021-08-19 10:13:31 +0200222 VirtualSocket* CreateSocket(int family, int type) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200223
224 // SocketServer:
Sebastian Jansson290de822020-01-09 14:20:23 +0100225 void SetMessageQueue(Thread* queue) override;
Markus Handell9a21c492022-08-25 11:40:13 +0000226 bool Wait(webrtc::TimeDelta max_wait_duration, bool process_io) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200227 void WakeUp() override;
228
229 void SetDelayOnAddress(const rtc::SocketAddress& address, int delay_ms) {
230 delay_by_ip_[address.ipaddr()] = delay_ms;
231 }
232
deadbeef5c3c1042017-08-04 15:01:57 -0700233 // Used by TurnPortTest and TcpPortTest (for example), to mimic a case where
234 // a proxy returns the local host address instead of the original one the
235 // port was bound against. Please see WebRTC issue 3927 for more detail.
236 //
237 // If SetAlternativeLocalAddress(A, B) is called, then when something
238 // attempts to bind a socket to address A, it will get a socket bound to
239 // address B instead.
240 void SetAlternativeLocalAddress(const rtc::IPAddress& address,
241 const rtc::IPAddress& alternative);
242
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200243 typedef std::pair<double, double> Point;
244 typedef std::vector<Point> Function;
245
Niels Möller983627c2021-02-09 15:12:28 +0100246 static std::unique_ptr<Function> CreateDistribution(uint32_t mean,
247 uint32_t stddev,
248 uint32_t samples);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200249
250 // Similar to Thread::ProcessMessages, but it only processes messages until
251 // there are no immediate messages or pending network traffic. Returns false
252 // if Thread::Stop() was called.
253 bool ProcessMessagesUntilIdle();
254
255 // Sets the next port number to use for testing.
256 void SetNextPortForTesting(uint16_t port);
257
258 // Close a pair of Tcp connections by addresses. Both connections will have
259 // its own OnClose invoked.
260 bool CloseTcpConnections(const SocketAddress& addr_local,
261 const SocketAddress& addr_remote);
262
Taylor Brandstetter389a97c2018-01-03 16:26:06 -0800263 // Number of packets that clients have attempted to send through this virtual
264 // socket server. Intended to be used for test assertions.
Florent Castellif94c0532021-11-16 13:29:53 +0100265 uint32_t sent_packets() const RTC_LOCKS_EXCLUDED(mutex_);
Taylor Brandstetter389a97c2018-01-03 16:26:06 -0800266
Niels Möllerc2d8f1e2021-08-24 15:49:34 +0200267 // Assign IP and Port if application's address is unspecified. Also apply
268 // `alternative_address_mapping_`.
269 SocketAddress AssignBindAddress(const SocketAddress& app_addr);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200270
271 // Binds the given socket to the given (fully-defined) address.
272 int Bind(VirtualSocket* socket, const SocketAddress& addr);
273
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200274 int Unbind(const SocketAddress& addr, VirtualSocket* socket);
275
276 // Adds a mapping between this socket pair and the socket.
277 void AddConnection(const SocketAddress& client,
278 const SocketAddress& server,
279 VirtualSocket* socket);
280
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200281 // Connects the given socket to the socket at the given address
Yves Gerey665174f2018-06-19 15:03:05 +0200282 int Connect(VirtualSocket* socket,
283 const SocketAddress& remote_addr,
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200284 bool use_delay);
285
286 // Sends a disconnect message to the socket at the given address
287 bool Disconnect(VirtualSocket* socket);
288
Niels Möllerc79bd432021-02-16 09:25:52 +0100289 // Lookup address, and disconnect corresponding socket.
290 bool Disconnect(const SocketAddress& addr);
291
292 // Lookup connection, close corresponding socket.
293 bool Disconnect(const SocketAddress& local_addr,
294 const SocketAddress& remote_addr);
295
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200296 // Sends the given packet to the socket at the given address (if one exists).
Yves Gerey665174f2018-06-19 15:03:05 +0200297 int SendUdp(VirtualSocket* socket,
298 const char* data,
299 size_t data_size,
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200300 const SocketAddress& remote_addr);
301
302 // Moves as much data as possible from the sender's buffer to the network
Florent Castellif94c0532021-11-16 13:29:53 +0100303 void SendTcp(VirtualSocket* socket) RTC_LOCKS_EXCLUDED(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200304
Niels Möllerc79bd432021-02-16 09:25:52 +0100305 // Like above, but lookup sender by address.
Florent Castellif94c0532021-11-16 13:29:53 +0100306 void SendTcp(const SocketAddress& addr) RTC_LOCKS_EXCLUDED(mutex_);
Niels Möllerc79bd432021-02-16 09:25:52 +0100307
308 // Computes the number of milliseconds required to send a packet of this size.
Florent Castellif94c0532021-11-16 13:29:53 +0100309 uint32_t SendDelay(uint32_t size) RTC_LOCKS_EXCLUDED(mutex_);
Niels Möllerc79bd432021-02-16 09:25:52 +0100310
311 // Cancel attempts to connect to a socket that is being closed.
312 void CancelConnects(VirtualSocket* socket);
313
314 // Clear incoming messages for a socket that is being closed.
315 void Clear(VirtualSocket* socket);
316
Niels Möllerc79bd432021-02-16 09:25:52 +0100317 void PostSignalReadEvent(VirtualSocket* socket);
318
319 // Sending was previously blocked, but now isn't.
320 sigslot::signal0<> SignalReadyToSend;
321
322 protected:
323 // Returns a new IP not used before in this network.
324 IPAddress GetNextIP(int family);
325
326 // Find the socket bound to the given address
327 VirtualSocket* LookupBinding(const SocketAddress& addr);
328
329 private:
330 uint16_t GetNextPort();
331
Niels Möllerc79bd432021-02-16 09:25:52 +0100332 // Find the socket pair corresponding to this server address.
333 VirtualSocket* LookupConnection(const SocketAddress& client,
334 const SocketAddress& server);
335
336 void RemoveConnection(const SocketAddress& client,
337 const SocketAddress& server);
338
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200339 // Places a packet on the network.
340 void AddPacketToNetwork(VirtualSocket* socket,
341 VirtualSocket* recipient,
342 int64_t cur_time,
343 const char* data,
344 size_t data_size,
345 size_t header_size,
346 bool ordered);
347
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200348 // If the delay has been set for the address of the socket, returns the set
349 // delay. Otherwise, returns a random transit delay chosen from the
350 // appropriate distribution.
351 uint32_t GetTransitDelay(Socket* socket);
352
Niels Möller983627c2021-02-09 15:12:28 +0100353 // Basic operations on functions.
354 static std::unique_ptr<Function> Accumulate(std::unique_ptr<Function> f);
355 static std::unique_ptr<Function> Invert(std::unique_ptr<Function> f);
356 static std::unique_ptr<Function> Resample(std::unique_ptr<Function> f,
357 double x1,
358 double x2,
359 uint32_t samples);
360 static double Evaluate(const Function* f, double x);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200361
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200362 // Determine if two sockets should be able to communicate.
363 // We don't (currently) specify an address family for sockets; instead,
364 // the currently bound address is used to infer the address family.
365 // Any socket that is not explicitly bound to an IPv4 address is assumed to be
366 // dual-stack capable.
367 // This function tests if two addresses can communicate, as well as the
368 // sockets to which they may be bound (the addresses may or may not yet be
369 // bound to the sockets).
370 // First the addresses are tested (after normalization):
371 // If both have the same family, then communication is OK.
372 // If only one is IPv4 then false, unless the other is bound to ::.
373 // This applies even if the IPv4 address is 0.0.0.0.
374 // The socket arguments are optional; the sockets are checked to see if they
375 // were explicitly bound to IPv6-any ('::'), and if so communication is
376 // permitted.
377 // NB: This scheme doesn't permit non-dualstack IPv6 sockets.
378 static bool CanInteractWith(VirtualSocket* local, VirtualSocket* remote);
379
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200380 typedef std::map<SocketAddress, VirtualSocket*> AddressMap;
381 typedef std::map<SocketAddressPair, VirtualSocket*> ConnectionMap;
382
383 // May be null if the test doesn't use a fake clock, or it does but doesn't
384 // use ProcessMessagesUntilIdle.
Sebastian Janssond624c392019-04-17 10:36:03 +0200385 ThreadProcessingFakeClock* fake_clock_ = nullptr;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200386
387 // Used to implement Wait/WakeUp.
388 Event wakeup_;
Sebastian Jansson290de822020-01-09 14:20:23 +0100389 Thread* msg_queue_;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200390 bool stop_on_idle_;
391 in_addr next_ipv4_;
392 in6_addr next_ipv6_;
393 uint16_t next_port_;
394 AddressMap* bindings_;
395 ConnectionMap* connections_;
396
Niels Möller84d15952021-09-01 10:50:34 +0200397 IPAddress default_source_address_v4_;
398 IPAddress default_source_address_v6_;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200399
Florent Castellif94c0532021-11-16 13:29:53 +0100400 mutable webrtc::Mutex mutex_;
401
402 uint32_t bandwidth_ RTC_GUARDED_BY(mutex_);
403 uint32_t network_capacity_ RTC_GUARDED_BY(mutex_);
404 uint32_t send_buffer_capacity_ RTC_GUARDED_BY(mutex_);
405 uint32_t recv_buffer_capacity_ RTC_GUARDED_BY(mutex_);
406 uint32_t delay_mean_ RTC_GUARDED_BY(mutex_);
407 uint32_t delay_stddev_ RTC_GUARDED_BY(mutex_);
408 uint32_t delay_samples_ RTC_GUARDED_BY(mutex_);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200409
Taylor Brandstetter389a97c2018-01-03 16:26:06 -0800410 // Used for testing.
Florent Castellif94c0532021-11-16 13:29:53 +0100411 uint32_t sent_packets_ RTC_GUARDED_BY(mutex_) = 0;
Taylor Brandstetter389a97c2018-01-03 16:26:06 -0800412
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200413 std::map<rtc::IPAddress, int> delay_by_ip_;
deadbeef5c3c1042017-08-04 15:01:57 -0700414 std::map<rtc::IPAddress, rtc::IPAddress> alternative_address_mapping_;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200415 std::unique_ptr<Function> delay_dist_;
416
Florent Castellif94c0532021-11-16 13:29:53 +0100417 double drop_prob_ RTC_GUARDED_BY(mutex_);
Harald Alvestrand3d792e92021-03-10 07:29:28 +0000418 // The largest UDP payload permitted on this virtual socket server.
419 // The default is the max size of IPv4 fragmented UDP packet payload:
420 // 65535 bytes - 8 bytes UDP header - 20 bytes IP header.
Florent Castellif94c0532021-11-16 13:29:53 +0100421 size_t max_udp_payload_ RTC_GUARDED_BY(mutex_) = 65507;
Harald Alvestrand3d792e92021-03-10 07:29:28 +0000422
Florent Castellif94c0532021-11-16 13:29:53 +0100423 bool sending_blocked_ RTC_GUARDED_BY(mutex_) = false;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200424};
425
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +0200426} // namespace rtc
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000427
Steve Anton10542f22019-01-11 09:11:00 -0800428#endif // RTC_BASE_VIRTUAL_SOCKET_SERVER_H_