| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_SERVER_WEB_SOCKET_H_ | 5 #ifndef NET_SERVER_WEB_SOCKET_H_ |
| 6 #define NET_SERVER_WEB_SOCKET_H_ | 6 #define NET_SERVER_WEB_SOCKET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 FRAME_INCOMPLETE, | 23 FRAME_INCOMPLETE, |
| 24 FRAME_CLOSE, | 24 FRAME_CLOSE, |
| 25 FRAME_ERROR | 25 FRAME_ERROR |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 static WebSocket* CreateWebSocket(HttpServer* server, | 28 static WebSocket* CreateWebSocket(HttpServer* server, |
| 29 HttpConnection* connection, | 29 HttpConnection* connection, |
| 30 const HttpServerRequestInfo& request, | 30 const HttpServerRequestInfo& request, |
| 31 size_t* pos); | 31 size_t* pos); |
| 32 | 32 |
| 33 static ParseResult DecodeFrameHybi17(const base::StringPiece& frame, | |
| 34 bool client_frame, | |
| 35 int* bytes_consumed, | |
| 36 std::string* output); | |
| 37 | |
| 38 static std::string EncodeFrameHybi17(const std::string& data, | |
| 39 int masking_key); | |
| 40 | |
| 41 virtual void Accept(const HttpServerRequestInfo& request) = 0; | 33 virtual void Accept(const HttpServerRequestInfo& request) = 0; |
| 42 virtual ParseResult Read(std::string* message) = 0; | 34 virtual ParseResult Read(std::string* message) = 0; |
| 43 virtual void Send(const std::string& message) = 0; | 35 virtual void Send(const std::string& message) = 0; |
| 44 virtual ~WebSocket() {} | 36 virtual ~WebSocket(); |
| 45 | 37 |
| 46 protected: | 38 protected: |
| 47 WebSocket(HttpServer* server, HttpConnection* connection); | 39 WebSocket(HttpServer* server, HttpConnection* connection); |
| 48 | 40 |
| 49 HttpServer* const server_; | 41 HttpServer* const server_; |
| 50 HttpConnection* const connection_; | 42 HttpConnection* const connection_; |
| 51 | 43 |
| 52 private: | 44 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(WebSocket); | 45 DISALLOW_COPY_AND_ASSIGN(WebSocket); |
| 54 }; | 46 }; |
| 55 | 47 |
| 56 } // namespace net | 48 } // namespace net |
| 57 | 49 |
| 58 #endif // NET_SERVER_WEB_SOCKET_H_ | 50 #endif // NET_SERVER_WEB_SOCKET_H_ |
| OLD | NEW |