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

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

Issue 99923004: Add support of IP_MULTICAST_IF in UDP sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // to share the local address to which the 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 to and from broadcast addresses. Should be 114 // and receiving packets to and from broadcast addresses. Should be
115 // called before Bind(). 115 // called before Bind().
116 void AllowBroadcast(); 116 void AllowBroadcast();
117 117
118 // Join the multicast group. 118 // Join the multicast group.
119 // |group_address| is the group address to join, could be either 119 // |group_address| is the group address to join, could be either an IPv4 or
120 // an IPv4 or IPv6 address. 120 // IPv6 address.
121 // Return a network error code. 121 // Return a network error code.
122 int JoinGroup(const IPAddressNumber& group_address) const; 122 int JoinGroup(const IPAddressNumber& group_address);
123 123
124 // Leave the multicast group. 124 // Leave the multicast group.
125 // |group_address| is the group address to leave, could be either 125 // |group_address| is the group address to leave, could be either
126 // an IPv4 or IPv6 address. If the socket hasn't joined the group, 126 // an IPv4 or IPv6 address. If the socket hasn't joined the group,
127 // it will be ignored. 127 // it will be ignored.
128 // It's optional to leave the multicast group before destroying 128 // It's optional to leave the multicast group before destroying
129 // the socket. It will be done by the OS. 129 // the socket. It will be done by the OS.
130 // Return a network error code. 130 // Return a network error code.
131 int LeaveGroup(const IPAddressNumber& group_address) const; 131 int LeaveGroup(const IPAddressNumber& group_address);
132
133 // Set interface to listen and send multicast. If |interface_index| set to 0,
134 // default interface is used.
135 int SetMulticastInterface(uint32 interface_index);
132 136
133 // Set the time-to-live option for UDP packets sent to the multicast 137 // Set the time-to-live option for UDP packets sent to the multicast
134 // group address. The default value of this option is 1. 138 // group address. The default value of this option is 1.
135 // Cannot be negative or more than 255. 139 // Cannot be negative or more than 255.
136 // Should be called before Bind(). 140 // Should be called before Bind().
137 int SetMulticastTimeToLive(int time_to_live); 141 int SetMulticastTimeToLive(int time_to_live);
138 142
139 // Set the loopback flag for UDP socket. If this flag is true, the host 143 // Set the loopback flag for UDP socket. If this flag is true, the host
140 // will receive packets sent to the joined group from itself. 144 // will receive packets sent to the joined group from itself.
141 // The default value of this option is true. 145 // The default value of this option is true.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // to an IPEndPoint and writes it to |address|. Returns true on success. 204 // to an IPEndPoint and writes it to |address|. Returns true on success.
201 bool ReceiveAddressToIPEndpoint(IPEndPoint* address) const; 205 bool ReceiveAddressToIPEndpoint(IPEndPoint* address) const;
202 206
203 SOCKET socket_; 207 SOCKET socket_;
204 int addr_family_; 208 int addr_family_;
205 209
206 // Bitwise-or'd combination of SocketOptions. Specifies the set of 210 // Bitwise-or'd combination of SocketOptions. Specifies the set of
207 // options that should be applied to |socket_| before Bind(). 211 // options that should be applied to |socket_| before Bind().
208 int socket_options_; 212 int socket_options_;
209 213
214 // Multicast interface.
215 uint32 multicast_interface_;
216
210 // Multicast socket options cached for SetSocketOption. 217 // Multicast socket options cached for SetSocketOption.
211 // Cannot be used after Bind(). 218 // Cannot be used after Bind().
212 int multicast_time_to_live_; 219 int multicast_time_to_live_;
213 220
214 // How to do source port binding, used only when UDPSocket is part of 221 // How to do source port binding, used only when UDPSocket is part of
215 // UDPClientSocket, since UDPServerSocket provides Bind. 222 // UDPClientSocket, since UDPServerSocket provides Bind.
216 DatagramSocket::BindType bind_type_; 223 DatagramSocket::BindType bind_type_;
217 224
218 // PRNG function for generating port numbers. 225 // PRNG function for generating port numbers.
219 RandIntCallback rand_int_cb_; 226 RandIntCallback rand_int_cb_;
(...skipping 21 matching lines...) Expand all
241 CompletionCallback write_callback_; 248 CompletionCallback write_callback_;
242 249
243 BoundNetLog net_log_; 250 BoundNetLog net_log_;
244 251
245 DISALLOW_COPY_AND_ASSIGN(UDPSocketWin); 252 DISALLOW_COPY_AND_ASSIGN(UDPSocketWin);
246 }; 253 };
247 254
248 } // namespace net 255 } // namespace net
249 256
250 #endif // NET_UDP_UDP_SOCKET_WIN_H_ 257 #endif // NET_UDP_UDP_SOCKET_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698