OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SOCKET_WEB_SOCKET_SERVER_SOCKET_H_ | 5 #ifndef NET_SOCKET_WEB_SOCKET_SERVER_SOCKET_H_ |
6 #define NET_SOCKET_WEB_SOCKET_SERVER_SOCKET_H_ | 6 #define NET_SOCKET_WEB_SOCKET_SERVER_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "net/base/net_api.h" | 11 #include "net/base/net_export.h" |
12 #include "net/socket/socket.h" | 12 #include "net/socket/socket.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 // WebSocketServerSocket takes an (already connected) underlying transport | 16 // WebSocketServerSocket takes an (already connected) underlying transport |
17 // socket and speaks server-side websocket protocol atop of it. | 17 // socket and speaks server-side websocket protocol atop of it. |
18 // This class implements Socket interface: notice that Read() returns (or calls | 18 // This class implements Socket interface: notice that Read() returns (or calls |
19 // back) as soon as some amount of data is available, even if message/frame is | 19 // back) as soon as some amount of data is available, even if message/frame is |
20 // incomplete. | 20 // incomplete. |
21 class WebSocketServerSocket : public Socket { | 21 class WebSocketServerSocket : public Socket { |
(...skipping 26 matching lines...) Expand all Loading... |
48 // must have already been connected/accepted. | 48 // must have already been connected/accepted. |
49 // | 49 // |
50 // Returns either ERR_IO_PENDING, in which case the given callback will be | 50 // Returns either ERR_IO_PENDING, in which case the given callback will be |
51 // called in the future with the real result, or it completes synchronously, | 51 // called in the future with the real result, or it completes synchronously, |
52 // returning the result immediately. | 52 // returning the result immediately. |
53 virtual int Accept(CompletionCallback* callback) = 0; | 53 virtual int Accept(CompletionCallback* callback) = 0; |
54 }; | 54 }; |
55 | 55 |
56 // Creates websocket server socket atop of already connected socket. This | 56 // Creates websocket server socket atop of already connected socket. This |
57 // created server socket will take ownership of |transport_socket|. | 57 // created server socket will take ownership of |transport_socket|. |
58 NET_API WebSocketServerSocket* CreateWebSocketServerSocket( | 58 NET_EXPORT WebSocketServerSocket* CreateWebSocketServerSocket( |
59 Socket* transport_socket, WebSocketServerSocket::Delegate* delegate); | 59 Socket* transport_socket, |
| 60 WebSocketServerSocket::Delegate* delegate); |
60 | 61 |
61 } // namespace net | 62 } // namespace net |
62 | 63 |
63 #endif // NET_SOCKET_WEB_SOCKET_SERVER_SOCKET_H_ | 64 #endif // NET_SOCKET_WEB_SOCKET_SERVER_SOCKET_H_ |
OLD | NEW |