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_CURVECP_SERVER_PACKETIZER_H_ | 5 #ifndef NET_CURVECP_SERVER_PACKETIZER_H_ |
6 #define NET_CURVECP_SERVER_PACKETIZER_H_ | 6 #define NET_CURVECP_SERVER_PACKETIZER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 int Listen(const IPEndPoint& endpoint, Packetizer::Listener* listener); | 31 int Listen(const IPEndPoint& endpoint, Packetizer::Listener* listener); |
32 | 32 |
33 // Register a listener for a connection. | 33 // Register a listener for a connection. |
34 // To revoke the registration, call Close(). | 34 // To revoke the registration, call Close(). |
35 bool Open(ConnectionKey key, Packetizer::Listener* listener); | 35 bool Open(ConnectionKey key, Packetizer::Listener* listener); |
36 | 36 |
37 // Packetizer methods | 37 // Packetizer methods |
38 virtual int SendMessage(ConnectionKey key, | 38 virtual int SendMessage(ConnectionKey key, |
39 const char* data, | 39 const char* data, |
40 size_t length, | 40 size_t length, |
41 OldCompletionCallback* callback) OVERRIDE; | 41 const CompletionCallback& callback) OVERRIDE; |
42 virtual void Close(ConnectionKey key) OVERRIDE; | 42 virtual void Close(ConnectionKey key) OVERRIDE; |
43 virtual int GetPeerAddress(IPEndPoint* endpoint) const OVERRIDE; | 43 virtual int GetPeerAddress(IPEndPoint* endpoint) const OVERRIDE; |
44 virtual int max_message_payload() const OVERRIDE; | 44 virtual int max_message_payload() const OVERRIDE; |
45 | 45 |
46 private: | 46 private: |
47 enum State { | 47 enum State { |
48 NONE, // The initial state, before listen. | 48 NONE, // The initial state, before listen. |
49 LISTENING, // Listening for packets. | 49 LISTENING, // Listening for packets. |
50 }; | 50 }; |
51 | 51 |
(...skipping 28 matching lines...) Expand all Loading... |
80 | 80 |
81 scoped_refptr<IOBuffer> read_buffer_; | 81 scoped_refptr<IOBuffer> read_buffer_; |
82 IPEndPoint recv_address_; | 82 IPEndPoint recv_address_; |
83 | 83 |
84 // The connection map tracks active client addresses which are known | 84 // The connection map tracks active client addresses which are known |
85 // to this server. | 85 // to this server. |
86 ConnectionMap connection_map_; | 86 ConnectionMap connection_map_; |
87 // The listener map tracks active message listeners known to the packetizer. | 87 // The listener map tracks active message listeners known to the packetizer. |
88 ListenerMap listener_map_; | 88 ListenerMap listener_map_; |
89 | 89 |
90 OldCompletionCallbackImpl<ServerPacketizer> read_callback_; | |
91 OldCompletionCallbackImpl<ServerPacketizer> write_callback_; | |
92 | |
93 DISALLOW_COPY_AND_ASSIGN(ServerPacketizer); | 90 DISALLOW_COPY_AND_ASSIGN(ServerPacketizer); |
94 }; | 91 }; |
95 | 92 |
96 } // namespace net | 93 } // namespace net |
97 | 94 |
98 #endif // NET_CURVECP_SERVER_PACKETIZER_H_ | 95 #endif // NET_CURVECP_SERVER_PACKETIZER_H_ |
OLD | NEW |