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 |
11 #ifndef WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ | 11 #ifndef WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ |
12 #define WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ | 12 #define WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/asyncfile.h" | |
18 #include "webrtc/base/nethelpers.h" | 17 #include "webrtc/base/nethelpers.h" |
19 #include "webrtc/base/socketserver.h" | 18 #include "webrtc/base/socketserver.h" |
20 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
21 | 20 |
22 #if defined(WEBRTC_POSIX) | 21 #if defined(WEBRTC_POSIX) |
23 typedef int SOCKET; | 22 typedef int SOCKET; |
24 #endif // WEBRTC_POSIX | 23 #endif // WEBRTC_POSIX |
25 | 24 |
26 namespace rtc { | 25 namespace rtc { |
27 | 26 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 virtual AsyncSocket* WrapSocket(SOCKET s); | 71 virtual AsyncSocket* WrapSocket(SOCKET s); |
73 | 72 |
74 // SocketServer: | 73 // SocketServer: |
75 bool Wait(int cms, bool process_io) override; | 74 bool Wait(int cms, bool process_io) override; |
76 void WakeUp() override; | 75 void WakeUp() override; |
77 | 76 |
78 void Add(Dispatcher* dispatcher); | 77 void Add(Dispatcher* dispatcher); |
79 void Remove(Dispatcher* dispatcher); | 78 void Remove(Dispatcher* dispatcher); |
80 | 79 |
81 #if defined(WEBRTC_POSIX) | 80 #if defined(WEBRTC_POSIX) |
82 AsyncFile* CreateFile(int fd); | |
83 | |
84 // Sets the function to be executed in response to the specified POSIX signal. | 81 // Sets the function to be executed in response to the specified POSIX signal. |
85 // The function is executed from inside Wait() using the "self-pipe trick"-- | 82 // The function is executed from inside Wait() using the "self-pipe trick"-- |
86 // regardless of which thread receives the signal--and hence can safely | 83 // regardless of which thread receives the signal--and hence can safely |
87 // manipulate user-level data structures. | 84 // manipulate user-level data structures. |
88 // "handler" may be SIG_IGN, SIG_DFL, or a user-specified function, just like | 85 // "handler" may be SIG_IGN, SIG_DFL, or a user-specified function, just like |
89 // with signal(2). | 86 // with signal(2). |
90 // Only one PhysicalSocketServer should have user-level signal handlers. | 87 // Only one PhysicalSocketServer should have user-level signal handlers. |
91 // Dispatching signals on multiple PhysicalSocketServers is not reliable. | 88 // Dispatching signals on multiple PhysicalSocketServers is not reliable. |
92 // The signal mask is not modified. It is the caller's responsibily to | 89 // The signal mask is not modified. It is the caller's responsibily to |
93 // maintain it as desired. | 90 // maintain it as desired. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 static int next_id_; | 220 static int next_id_; |
224 int id_; | 221 int id_; |
225 bool signal_close_; | 222 bool signal_close_; |
226 int signal_err_; | 223 int signal_err_; |
227 #endif // WEBRTC_WIN | 224 #endif // WEBRTC_WIN |
228 }; | 225 }; |
229 | 226 |
230 } // namespace rtc | 227 } // namespace rtc |
231 | 228 |
232 #endif // WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ | 229 #endif // WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ |
OLD | NEW |