OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 PhysicalSocketServer(); | 61 PhysicalSocketServer(); |
62 ~PhysicalSocketServer() override; | 62 ~PhysicalSocketServer() override; |
63 | 63 |
64 // SocketFactory: | 64 // SocketFactory: |
65 Socket* CreateSocket(int type) override; | 65 Socket* CreateSocket(int type) override; |
66 Socket* CreateSocket(int family, int type) override; | 66 Socket* CreateSocket(int family, int type) override; |
67 | 67 |
68 AsyncSocket* CreateAsyncSocket(int type) override; | 68 AsyncSocket* CreateAsyncSocket(int type) override; |
69 AsyncSocket* CreateAsyncSocket(int family, int type) override; | 69 AsyncSocket* CreateAsyncSocket(int family, int type) override; |
70 | 70 |
71 // Internal Factory for Accept | 71 // Internal Factory for Accept (virtual so it can be overwritten in tests). |
72 AsyncSocket* WrapSocket(SOCKET s); | 72 virtual AsyncSocket* WrapSocket(SOCKET s); |
73 | 73 |
74 // SocketServer: | 74 // SocketServer: |
75 bool Wait(int cms, bool process_io) override; | 75 bool Wait(int cms, bool process_io) override; |
76 void WakeUp() override; | 76 void WakeUp() override; |
77 | 77 |
78 void Add(Dispatcher* dispatcher); | 78 void Add(Dispatcher* dispatcher); |
79 void Remove(Dispatcher* dispatcher); | 79 void Remove(Dispatcher* dispatcher); |
80 | 80 |
81 #if defined(WEBRTC_POSIX) | 81 #if defined(WEBRTC_POSIX) |
82 AsyncFile* CreateFile(int fd); | 82 AsyncFile* CreateFile(int fd); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 int EstimateMTU(uint16_t* mtu) override; | 154 int EstimateMTU(uint16_t* mtu) override; |
155 | 155 |
156 SocketServer* socketserver() { return ss_; } | 156 SocketServer* socketserver() { return ss_; } |
157 | 157 |
158 protected: | 158 protected: |
159 int DoConnect(const SocketAddress& connect_addr); | 159 int DoConnect(const SocketAddress& connect_addr); |
160 | 160 |
161 // Make virtual so ::accept can be overwritten in tests. | 161 // Make virtual so ::accept can be overwritten in tests. |
162 virtual SOCKET DoAccept(SOCKET socket, sockaddr* addr, socklen_t* addrlen); | 162 virtual SOCKET DoAccept(SOCKET socket, sockaddr* addr, socklen_t* addrlen); |
163 | 163 |
| 164 // Make virtual so ::send can be overwritten in tests. |
| 165 virtual int DoSend(SOCKET socket, const char* buf, int len, int flags); |
| 166 |
| 167 // Make virtual so ::sendto can be overwritten in tests. |
| 168 virtual int DoSendTo(SOCKET socket, const char* buf, int len, int flags, |
| 169 const struct sockaddr* dest_addr, socklen_t addrlen); |
| 170 |
164 void OnResolveResult(AsyncResolverInterface* resolver); | 171 void OnResolveResult(AsyncResolverInterface* resolver); |
165 | 172 |
166 void UpdateLastError(); | 173 void UpdateLastError(); |
167 void MaybeRemapSendError(); | 174 void MaybeRemapSendError(); |
168 | 175 |
169 static int TranslateOption(Option opt, int* slevel, int* sopt); | 176 static int TranslateOption(Option opt, int* slevel, int* sopt); |
170 | 177 |
171 PhysicalSocketServer* ss_; | 178 PhysicalSocketServer* ss_; |
172 SOCKET s_; | 179 SOCKET s_; |
173 uint8_t enabled_events_; | 180 uint8_t enabled_events_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 static int next_id_; | 220 static int next_id_; |
214 int id_; | 221 int id_; |
215 bool signal_close_; | 222 bool signal_close_; |
216 int signal_err_; | 223 int signal_err_; |
217 #endif // WEBRTC_WIN | 224 #endif // WEBRTC_WIN |
218 }; | 225 }; |
219 | 226 |
220 } // namespace rtc | 227 } // namespace rtc |
221 | 228 |
222 #endif // WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ | 229 #endif // WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ |
OLD | NEW |