| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 int Close() override; | 44 int Close() override; |
| 45 | 45 |
| 46 State GetState() const override; | 46 State GetState() const override; |
| 47 int GetOption(Socket::Option opt, int* value) override; | 47 int GetOption(Socket::Option opt, int* value) override; |
| 48 int SetOption(Socket::Option opt, int value) override; | 48 int SetOption(Socket::Option opt, int value) override; |
| 49 int GetError() const override; | 49 int GetError() const override; |
| 50 void SetError(int error) override; | 50 void SetError(int error) override; |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 // Binds and connects |socket| and creates AsyncTCPSocket for | 53 // Binds and connects |socket| and creates AsyncTCPSocket for |
| 54 // it. Takes ownership of |socket|. Returns NULL if bind() or | 54 // it. Takes ownership of |socket|. Returns null if bind() or |
| 55 // connect() fail (|socket| is destroyed in that case). | 55 // connect() fail (|socket| is destroyed in that case). |
| 56 static AsyncSocket* ConnectSocket(AsyncSocket* socket, | 56 static AsyncSocket* ConnectSocket(AsyncSocket* socket, |
| 57 const SocketAddress& bind_address, | 57 const SocketAddress& bind_address, |
| 58 const SocketAddress& remote_address); | 58 const SocketAddress& remote_address); |
| 59 virtual int SendRaw(const void* pv, size_t cb); | 59 virtual int SendRaw(const void* pv, size_t cb); |
| 60 int FlushOutBuffer(); | 60 int FlushOutBuffer(); |
| 61 // Add data to |outbuf_|. | 61 // Add data to |outbuf_|. |
| 62 void AppendToOutBuffer(const void* pv, size_t cb); | 62 void AppendToOutBuffer(const void* pv, size_t cb); |
| 63 | 63 |
| 64 // Helper methods for |outpos_|. | 64 // Helper methods for |outpos_|. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 78 Buffer outbuf_; | 78 Buffer outbuf_; |
| 79 size_t max_insize_; | 79 size_t max_insize_; |
| 80 size_t max_outsize_; | 80 size_t max_outsize_; |
| 81 | 81 |
| 82 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocketBase); | 82 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocketBase); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class AsyncTCPSocket : public AsyncTCPSocketBase { | 85 class AsyncTCPSocket : public AsyncTCPSocketBase { |
| 86 public: | 86 public: |
| 87 // Binds and connects |socket| and creates AsyncTCPSocket for | 87 // Binds and connects |socket| and creates AsyncTCPSocket for |
| 88 // it. Takes ownership of |socket|. Returns NULL if bind() or | 88 // it. Takes ownership of |socket|. Returns null if bind() or |
| 89 // connect() fail (|socket| is destroyed in that case). | 89 // connect() fail (|socket| is destroyed in that case). |
| 90 static AsyncTCPSocket* Create(AsyncSocket* socket, | 90 static AsyncTCPSocket* Create(AsyncSocket* socket, |
| 91 const SocketAddress& bind_address, | 91 const SocketAddress& bind_address, |
| 92 const SocketAddress& remote_address); | 92 const SocketAddress& remote_address); |
| 93 AsyncTCPSocket(AsyncSocket* socket, bool listen); | 93 AsyncTCPSocket(AsyncSocket* socket, bool listen); |
| 94 ~AsyncTCPSocket() override {} | 94 ~AsyncTCPSocket() override {} |
| 95 | 95 |
| 96 int Send(const void* pv, | 96 int Send(const void* pv, |
| 97 size_t cb, | 97 size_t cb, |
| 98 const rtc::PacketOptions& options) override; | 98 const rtc::PacketOptions& options) override; |
| 99 void ProcessInput(char* data, size_t* len) override; | 99 void ProcessInput(char* data, size_t* len) override; |
| 100 void HandleIncomingConnection(AsyncSocket* socket) override; | 100 void HandleIncomingConnection(AsyncSocket* socket) override; |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocket); | 103 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocket); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace rtc | 106 } // namespace rtc |
| 107 | 107 |
| 108 #endif // WEBRTC_BASE_ASYNCTCPSOCKET_H_ | 108 #endif // WEBRTC_BASE_ASYNCTCPSOCKET_H_ |
| OLD | NEW |