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

Side by Side Diff: net/udp/udp_socket_win.h

Issue 10783029: Fix comment nits. This is a follow-up to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months 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
OLDNEW
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_UDP_UDP_SOCKET_WIN_H_ 5 #ifndef NET_UDP_UDP_SOCKET_WIN_H_
6 #define NET_UDP_UDP_SOCKET_WIN_H_ 6 #define NET_UDP_UDP_SOCKET_WIN_H_
7 7
8 #include <winsock2.h> 8 #include <winsock2.h>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 // Set the send buffer size (in bytes) for the socket. 100 // Set the send buffer size (in bytes) for the socket.
101 bool SetSendBufferSize(int32 size); 101 bool SetSendBufferSize(int32 size);
102 102
103 // Returns true if the socket is already connected or bound. 103 // Returns true if the socket is already connected or bound.
104 bool is_connected() const { return socket_ != INVALID_SOCKET; } 104 bool is_connected() const { return socket_ != INVALID_SOCKET; }
105 105
106 const BoundNetLog& NetLog() const { return net_log_; } 106 const BoundNetLog& NetLog() const { return net_log_; }
107 107
108 // Sets corresponding flags in |socket_options_| to allow the socket 108 // Sets corresponding flags in |socket_options_| to allow the socket
109 // to share the local address to which socket will be bound with 109 // to share the local address to which the socket will be bound with
110 // other processes. Should be called before Bind(). 110 // other processes. Should be called before Bind().
111 void AllowAddressReuse(); 111 void AllowAddressReuse();
112 112
113 // Sets corresponding flags in |socket_options_| to allow sending 113 // Sets corresponding flags in |socket_options_| to allow sending
114 // and receiving packets sent to and from broadcast 114 // and receiving packets to and from broadcast addresses. Should be
115 // addresses. Should be called before Bind(). 115 // called before Bind().
116 void AllowBroadcast(); 116 void AllowBroadcast();
117 117
118 private: 118 private:
119 enum SocketOptions { 119 enum SocketOptions {
120 SOCKET_OPTION_REUSE_ADDRESS = 1 << 0, 120 SOCKET_OPTION_REUSE_ADDRESS = 1 << 0,
121 SOCKET_OPTION_BROADCAST = 1 << 1 121 SOCKET_OPTION_BROADCAST = 1 << 1
122 }; 122 };
123 123
124 class ReadDelegate : public base::win::ObjectWatcher::Delegate { 124 class ReadDelegate : public base::win::ObjectWatcher::Delegate {
125 public: 125 public:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 int SetSocketOptions(); 176 int SetSocketOptions();
177 int DoBind(const IPEndPoint& address); 177 int DoBind(const IPEndPoint& address);
178 int RandomBind(const IPEndPoint& address); 178 int RandomBind(const IPEndPoint& address);
179 179
180 // Attempts to convert the data in |recv_addr_storage_| and |recv_addr_len_| 180 // Attempts to convert the data in |recv_addr_storage_| and |recv_addr_len_|
181 // to an IPEndPoint and writes it to |address|. Returns true on success. 181 // to an IPEndPoint and writes it to |address|. Returns true on success.
182 bool ReceiveAddressToIPEndpoint(IPEndPoint* address) const; 182 bool ReceiveAddressToIPEndpoint(IPEndPoint* address) const;
183 183
184 SOCKET socket_; 184 SOCKET socket_;
185 185
186 // Bitwise-or'd combination of SocketOptions. Specifies set of 186 // Bitwise-or'd combination of SocketOptions. Specifies the set of
187 // options that should be applied to |socket_| before bind. 187 // options that should be applied to |socket_| before Bind().
188 int socket_options_; 188 int socket_options_;
189 189
190 // How to do source port binding, used only when UDPSocket is part of 190 // How to do source port binding, used only when UDPSocket is part of
191 // UDPClientSocket, since UDPServerSocket provides Bind. 191 // UDPClientSocket, since UDPServerSocket provides Bind.
192 DatagramSocket::BindType bind_type_; 192 DatagramSocket::BindType bind_type_;
193 193
194 // PRNG function for generating port numbers. 194 // PRNG function for generating port numbers.
195 RandIntCallback rand_int_cb_; 195 RandIntCallback rand_int_cb_;
196 196
197 // These are mutable since they're just cached copies to make 197 // These are mutable since they're just cached copies to make
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 CompletionCallback write_callback_; 231 CompletionCallback write_callback_;
232 232
233 BoundNetLog net_log_; 233 BoundNetLog net_log_;
234 234
235 DISALLOW_COPY_AND_ASSIGN(UDPSocketWin); 235 DISALLOW_COPY_AND_ASSIGN(UDPSocketWin);
236 }; 236 };
237 237
238 } // namespace net 238 } // namespace net
239 239
240 #endif // NET_UDP_UDP_SOCKET_WIN_H_ 240 #endif // NET_UDP_UDP_SOCKET_WIN_H_
OLDNEW
« net/udp/datagram_server_socket.h ('K') | « net/udp/udp_socket_libevent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698