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 24 matching lines...) Expand all Loading... |
35 sigslot::multi_threaded_local> SignalReadEvent; | 35 sigslot::multi_threaded_local> SignalReadEvent; |
36 // ready to write | 36 // ready to write |
37 sigslot::signal1<AsyncSocket*, | 37 sigslot::signal1<AsyncSocket*, |
38 sigslot::multi_threaded_local> SignalWriteEvent; | 38 sigslot::multi_threaded_local> SignalWriteEvent; |
39 sigslot::signal1<AsyncSocket*> SignalConnectEvent; // connected | 39 sigslot::signal1<AsyncSocket*> SignalConnectEvent; // connected |
40 sigslot::signal2<AsyncSocket*, int> SignalCloseEvent; // closed | 40 sigslot::signal2<AsyncSocket*, int> SignalCloseEvent; // closed |
41 }; | 41 }; |
42 | 42 |
43 class AsyncSocketAdapter : public AsyncSocket, public sigslot::has_slots<> { | 43 class AsyncSocketAdapter : public AsyncSocket, public sigslot::has_slots<> { |
44 public: | 44 public: |
45 // The adapted socket may explicitly be NULL, and later assigned using Attach. | 45 // The adapted socket may explicitly be null, and later assigned using Attach. |
46 // However, subclasses which support detached mode must override any methods | 46 // However, subclasses which support detached mode must override any methods |
47 // that will be called during the detached period (usually GetState()), to | 47 // that will be called during the detached period (usually GetState()), to |
48 // avoid dereferencing a null pointer. | 48 // avoid dereferencing a null pointer. |
49 explicit AsyncSocketAdapter(AsyncSocket* socket); | 49 explicit AsyncSocketAdapter(AsyncSocket* socket); |
50 ~AsyncSocketAdapter() override; | 50 ~AsyncSocketAdapter() override; |
51 void Attach(AsyncSocket* socket); | 51 void Attach(AsyncSocket* socket); |
52 SocketAddress GetLocalAddress() const override; | 52 SocketAddress GetLocalAddress() const override; |
53 SocketAddress GetRemoteAddress() const override; | 53 SocketAddress GetRemoteAddress() const override; |
54 int Bind(const SocketAddress& addr) override; | 54 int Bind(const SocketAddress& addr) override; |
55 int Connect(const SocketAddress& addr) override; | 55 int Connect(const SocketAddress& addr) override; |
(...skipping 19 matching lines...) Expand all Loading... |
75 virtual void OnReadEvent(AsyncSocket* socket); | 75 virtual void OnReadEvent(AsyncSocket* socket); |
76 virtual void OnWriteEvent(AsyncSocket* socket); | 76 virtual void OnWriteEvent(AsyncSocket* socket); |
77 virtual void OnCloseEvent(AsyncSocket* socket, int err); | 77 virtual void OnCloseEvent(AsyncSocket* socket, int err); |
78 | 78 |
79 AsyncSocket* socket_; | 79 AsyncSocket* socket_; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace rtc | 82 } // namespace rtc |
83 | 83 |
84 #endif // WEBRTC_BASE_ASYNCSOCKET_H_ | 84 #endif // WEBRTC_BASE_ASYNCSOCKET_H_ |
OLD | NEW |