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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 // Make virtual so ::sendto can be overwritten in tests. | 165 // Make virtual so ::sendto can be overwritten in tests. |
166 virtual int DoSendTo(SOCKET socket, const char* buf, int len, int flags, | 166 virtual int DoSendTo(SOCKET socket, const char* buf, int len, int flags, |
167 const struct sockaddr* dest_addr, socklen_t addrlen); | 167 const struct sockaddr* dest_addr, socklen_t addrlen); |
168 | 168 |
169 void OnResolveResult(AsyncResolverInterface* resolver); | 169 void OnResolveResult(AsyncResolverInterface* resolver); |
170 | 170 |
171 void UpdateLastError(); | 171 void UpdateLastError(); |
172 void MaybeRemapSendError(); | 172 void MaybeRemapSendError(); |
173 | 173 |
| 174 uint8_t enabled_events() const { return enabled_events_; } |
| 175 void SetEnabledEvents(uint8_t events); |
| 176 void EnableEvents(uint8_t events); |
| 177 void DisableEvents(uint8_t events); |
| 178 |
174 static int TranslateOption(Option opt, int* slevel, int* sopt); | 179 static int TranslateOption(Option opt, int* slevel, int* sopt); |
175 | 180 |
176 PhysicalSocketServer* ss_; | 181 PhysicalSocketServer* ss_; |
177 SOCKET s_; | 182 SOCKET s_; |
178 uint8_t enabled_events_; | |
179 bool udp_; | 183 bool udp_; |
180 CriticalSection crit_; | 184 CriticalSection crit_; |
181 int error_ GUARDED_BY(crit_); | 185 int error_ GUARDED_BY(crit_); |
182 ConnState state_; | 186 ConnState state_; |
183 AsyncResolver* resolver_; | 187 AsyncResolver* resolver_; |
184 | 188 |
185 #if !defined(NDEBUG) | 189 #if !defined(NDEBUG) |
186 std::string dbg_addr_; | 190 std::string dbg_addr_; |
187 #endif | 191 #endif |
| 192 |
| 193 private: |
| 194 uint8_t enabled_events_ = 0; |
188 }; | 195 }; |
189 | 196 |
190 class SocketDispatcher : public Dispatcher, public PhysicalSocket { | 197 class SocketDispatcher : public Dispatcher, public PhysicalSocket { |
191 public: | 198 public: |
192 explicit SocketDispatcher(PhysicalSocketServer *ss); | 199 explicit SocketDispatcher(PhysicalSocketServer *ss); |
193 SocketDispatcher(SOCKET s, PhysicalSocketServer *ss); | 200 SocketDispatcher(SOCKET s, PhysicalSocketServer *ss); |
194 ~SocketDispatcher() override; | 201 ~SocketDispatcher() override; |
195 | 202 |
196 bool Initialize(); | 203 bool Initialize(); |
197 | 204 |
(...skipping 20 matching lines...) Expand all Loading... |
218 static int next_id_; | 225 static int next_id_; |
219 int id_; | 226 int id_; |
220 bool signal_close_; | 227 bool signal_close_; |
221 int signal_err_; | 228 int signal_err_; |
222 #endif // WEBRTC_WIN | 229 #endif // WEBRTC_WIN |
223 }; | 230 }; |
224 | 231 |
225 } // namespace rtc | 232 } // namespace rtc |
226 | 233 |
227 #endif // WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ | 234 #endif // WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ |
OLD | NEW |