Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: net/curvecp/client_packetizer.h

Issue 8824006: Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/net_log.h ('k') | net/curvecp/client_packetizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CLIENT_PACKETIZER_H_ 5 #ifndef NET_CURVECP_CLIENT_PACKETIZER_H_
6 #define NET_CURVECP_CLIENT_PACKETIZER_H_ 6 #define NET_CURVECP_CLIENT_PACKETIZER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 11 matching lines...) Expand all
22 class IPEndPoint; 22 class IPEndPoint;
23 class UDPClientSocket; 23 class UDPClientSocket;
24 24
25 class ClientPacketizer : public Packetizer { 25 class ClientPacketizer : public Packetizer {
26 public: 26 public:
27 ClientPacketizer(); 27 ClientPacketizer();
28 virtual ~ClientPacketizer(); 28 virtual ~ClientPacketizer();
29 29
30 int Connect(const AddressList& server, 30 int Connect(const AddressList& server,
31 Packetizer::Listener* listener, 31 Packetizer::Listener* listener,
32 OldCompletionCallback* callback);
33 int Connect(const AddressList& server,
34 Packetizer::Listener* listener,
35 const CompletionCallback& callback); 32 const CompletionCallback& callback);
36 33
37 // Packetizer implementation. 34 // Packetizer implementation.
38 virtual int SendMessage(ConnectionKey key, 35 virtual int SendMessage(ConnectionKey key,
39 const char* data, 36 const char* data,
40 size_t length, 37 size_t length,
41 OldCompletionCallback* callback) OVERRIDE; 38 const CompletionCallback& callback) OVERRIDE;
42 virtual void Close(ConnectionKey key) OVERRIDE; 39 virtual void Close(ConnectionKey key) OVERRIDE;
43 virtual int GetPeerAddress(IPEndPoint* endpoint) const OVERRIDE; 40 virtual int GetPeerAddress(IPEndPoint* endpoint) const OVERRIDE;
44 virtual int max_message_payload() const OVERRIDE; 41 virtual int max_message_payload() const OVERRIDE;
45 42
46 private: 43 private:
47 enum StateType { 44 enum StateType {
48 NONE, // The initial state, before connect. 45 NONE, // The initial state, before connect.
49 LOOKUP_COOKIE, // Looking up a cookie in the disk cache. 46 LOOKUP_COOKIE, // Looking up a cookie in the disk cache.
50 LOOKUP_COOKIE_COMPLETE, // The disk cache lookup is complete. 47 LOOKUP_COOKIE_COMPLETE, // The disk cache lookup is complete.
51 SENDING_HELLO, // Sending a Hello packet. 48 SENDING_HELLO, // Sending a Hello packet.
(...skipping 27 matching lines...) Expand all
79 76
80 // Read packets until an error occurs. 77 // Read packets until an error occurs.
81 int ReadPackets(); 78 int ReadPackets();
82 79
83 // Callback when an internal IO is completed. 80 // Callback when an internal IO is completed.
84 void OnIOComplete(int result); 81 void OnIOComplete(int result);
85 82
86 StateType next_state_; 83 StateType next_state_;
87 scoped_ptr<UDPClientSocket> socket_; 84 scoped_ptr<UDPClientSocket> socket_;
88 Packetizer::Listener* listener_; 85 Packetizer::Listener* listener_;
89 OldCompletionCallback* old_user_callback_;
90 CompletionCallback user_callback_; 86 CompletionCallback user_callback_;
91 AddressList addresses_; 87 AddressList addresses_;
92 const struct addrinfo* current_address_; 88 const struct addrinfo* current_address_;
93 int hello_attempts_; // Number of attempts to send a Hello Packet. 89 int hello_attempts_; // Number of attempts to send a Hello Packet.
94 bool initiate_sent_; // Indicates whether the Initiate Packet was sent. 90 bool initiate_sent_; // Indicates whether the Initiate Packet was sent.
95 91
96 scoped_refptr<IOBuffer> read_buffer_; // Buffer for internal reads. 92 scoped_refptr<IOBuffer> read_buffer_; // Buffer for internal reads.
97 93
98 uchar shortterm_public_key_[32]; 94 uchar shortterm_public_key_[32];
99 95
100 OldCompletionCallbackImpl<ClientPacketizer> io_callback_; 96 CompletionCallback io_callback_;
101 base::WeakPtrFactory<ClientPacketizer> weak_factory_; 97 base::WeakPtrFactory<ClientPacketizer> weak_factory_;
102 98
103 DISALLOW_COPY_AND_ASSIGN(ClientPacketizer); 99 DISALLOW_COPY_AND_ASSIGN(ClientPacketizer);
104 }; 100 };
105 101
106 } // namespace net 102 } // namespace net
107 103
108 #endif // NET_CURVECP_CLIENT_PACKETIZER_H_ 104 #endif // NET_CURVECP_CLIENT_PACKETIZER_H_
OLDNEW
« no previous file with comments | « net/base/net_log.h ('k') | net/curvecp/client_packetizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698