| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 bool expect_close_; | 135 bool expect_close_; |
| 136 enum ProxyState { | 136 enum ProxyState { |
| 137 PS_INIT, PS_LEADER, PS_AUTHENTICATE, PS_SKIP_HEADERS, PS_ERROR_HEADERS, | 137 PS_INIT, PS_LEADER, PS_AUTHENTICATE, PS_SKIP_HEADERS, PS_ERROR_HEADERS, |
| 138 PS_TUNNEL_HEADERS, PS_SKIP_BODY, PS_TUNNEL, PS_WAIT_CLOSE, PS_ERROR | 138 PS_TUNNEL_HEADERS, PS_SKIP_BODY, PS_TUNNEL, PS_WAIT_CLOSE, PS_ERROR |
| 139 } state_; | 139 } state_; |
| 140 HttpAuthContext * context_; | 140 HttpAuthContext * context_; |
| 141 std::string unknown_mechanisms_; | 141 std::string unknown_mechanisms_; |
| 142 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncHttpsProxySocket); | 142 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncHttpsProxySocket); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 /* TODO: Implement this. | |
| 146 class AsyncHttpsProxyServerSocket : public AsyncProxyServerSocket { | |
| 147 public: | |
| 148 explicit AsyncHttpsProxyServerSocket(AsyncSocket* socket); | |
| 149 | |
| 150 private: | |
| 151 virtual void ProcessInput(char * data, size_t& len); | |
| 152 void Error(int error); | |
| 153 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncHttpsProxyServerSocket); | |
| 154 }; | |
| 155 */ | |
| 156 | |
| 157 /////////////////////////////////////////////////////////////////////////////// | 145 /////////////////////////////////////////////////////////////////////////////// |
| 158 | 146 |
| 159 // Implements a socket adapter that speaks the SOCKS proxy protocol. | 147 // Implements a socket adapter that speaks the SOCKS proxy protocol. |
| 160 class AsyncSocksProxySocket : public BufferedReadAdapter { | 148 class AsyncSocksProxySocket : public BufferedReadAdapter { |
| 161 public: | 149 public: |
| 162 AsyncSocksProxySocket(AsyncSocket* socket, const SocketAddress& proxy, | 150 AsyncSocksProxySocket(AsyncSocket* socket, const SocketAddress& proxy, |
| 163 const std::string& username, const CryptString& password); | 151 const std::string& username, const CryptString& password); |
| 164 ~AsyncSocksProxySocket() override; | 152 ~AsyncSocksProxySocket() override; |
| 165 | 153 |
| 166 int Connect(const SocketAddress& addr) override; | 154 int Connect(const SocketAddress& addr) override; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 void Error(int error); | 195 void Error(int error); |
| 208 | 196 |
| 209 static const int kBufferSize = 1024; | 197 static const int kBufferSize = 1024; |
| 210 enum State { | 198 enum State { |
| 211 SS_HELLO, SS_AUTH, SS_CONNECT, SS_CONNECT_PENDING, SS_TUNNEL, SS_ERROR | 199 SS_HELLO, SS_AUTH, SS_CONNECT, SS_CONNECT_PENDING, SS_TUNNEL, SS_ERROR |
| 212 }; | 200 }; |
| 213 State state_; | 201 State state_; |
| 214 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSocksProxyServerSocket); | 202 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSocksProxyServerSocket); |
| 215 }; | 203 }; |
| 216 | 204 |
| 217 /////////////////////////////////////////////////////////////////////////////// | |
| 218 | |
| 219 // Implements a socket adapter that logs everything that it sends and receives. | |
| 220 class LoggingSocketAdapter : public AsyncSocketAdapter { | |
| 221 public: | |
| 222 LoggingSocketAdapter(AsyncSocket* socket, LoggingSeverity level, | |
| 223 const char * label, bool hex_mode = false); | |
| 224 | |
| 225 int Send(const void* pv, size_t cb) override; | |
| 226 int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override; | |
| 227 int Recv(void* pv, size_t cb, int64_t* timestamp) override; | |
| 228 int RecvFrom(void* pv, | |
| 229 size_t cb, | |
| 230 SocketAddress* paddr, | |
| 231 int64_t* timestamp) override; | |
| 232 int Close() override; | |
| 233 | |
| 234 protected: | |
| 235 void OnConnectEvent(AsyncSocket* socket) override; | |
| 236 void OnCloseEvent(AsyncSocket* socket, int err) override; | |
| 237 | |
| 238 private: | |
| 239 LoggingSeverity level_; | |
| 240 std::string label_; | |
| 241 bool hex_mode_; | |
| 242 LogMultilineState lms_; | |
| 243 RTC_DISALLOW_COPY_AND_ASSIGN(LoggingSocketAdapter); | |
| 244 }; | |
| 245 | |
| 246 /////////////////////////////////////////////////////////////////////////////// | |
| 247 | |
| 248 } // namespace rtc | 205 } // namespace rtc |
| 249 | 206 |
| 250 #endif // WEBRTC_BASE_SOCKETADAPTERS_H_ | 207 #endif // WEBRTC_BASE_SOCKETADAPTERS_H_ |
| OLD | NEW |