| OLD | NEW |
| 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_LIBEVENT_H_ | 5 #ifndef NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
| 6 #define NET_UDP_UDP_SOCKET_LIBEVENT_H_ | 6 #define NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 // Leave the multicast group. | 123 // Leave the multicast group. |
| 124 // |group_address| is the group address to leave, could be either | 124 // |group_address| is the group address to leave, could be either |
| 125 // an IPv4 or IPv6 address. If the socket hasn't joined the group, | 125 // an IPv4 or IPv6 address. If the socket hasn't joined the group, |
| 126 // it will be ignored. | 126 // it will be ignored. |
| 127 // It's optional to leave the multicast group before destroying | 127 // It's optional to leave the multicast group before destroying |
| 128 // the socket. It will be done by the OS. | 128 // the socket. It will be done by the OS. |
| 129 // Return a network error code. | 129 // Return a network error code. |
| 130 int LeaveGroup(const IPAddressNumber& group_address) const; | 130 int LeaveGroup(const IPAddressNumber& group_address) const; |
| 131 | 131 |
| 132 // Set interface to use for multicast. If |interface_index| set to 0, default |
| 133 // interface is used. |
| 134 // Should be called before Bind(). |
| 135 // Returns a network error code. |
| 136 int SetMulticastInterface(uint32 interface_index); |
| 137 |
| 132 // Set the time-to-live option for UDP packets sent to the multicast | 138 // Set the time-to-live option for UDP packets sent to the multicast |
| 133 // group address. The default value of this option is 1. | 139 // group address. The default value of this option is 1. |
| 134 // Cannot be negative or more than 255. | 140 // Cannot be negative or more than 255. |
| 135 // Should be called before Bind(). | 141 // Should be called before Bind(). |
| 136 // Return a network error code. | 142 // Return a network error code. |
| 137 int SetMulticastTimeToLive(int time_to_live); | 143 int SetMulticastTimeToLive(int time_to_live); |
| 138 | 144 |
| 139 // Set the loopback flag for UDP socket. If this flag is true, the host | 145 // 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. | 146 // will receive packets sent to the joined group from itself. |
| 141 // The default value of this option is true. | 147 // The default value of this option is true. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 int DoBind(const IPEndPoint& address); | 236 int DoBind(const IPEndPoint& address); |
| 231 int RandomBind(const IPEndPoint& address); | 237 int RandomBind(const IPEndPoint& address); |
| 232 | 238 |
| 233 int socket_; | 239 int socket_; |
| 234 int addr_family_; | 240 int addr_family_; |
| 235 | 241 |
| 236 // Bitwise-or'd combination of SocketOptions. Specifies the set of | 242 // Bitwise-or'd combination of SocketOptions. Specifies the set of |
| 237 // options that should be applied to |socket_| before Bind(). | 243 // options that should be applied to |socket_| before Bind(). |
| 238 int socket_options_; | 244 int socket_options_; |
| 239 | 245 |
| 246 // Multicast interface. |
| 247 uint32 multicast_interface_; |
| 248 |
| 240 // Multicast socket options cached for SetSocketOption. | 249 // Multicast socket options cached for SetSocketOption. |
| 241 // Cannot be used after Bind(). | 250 // Cannot be used after Bind(). |
| 242 int multicast_time_to_live_; | 251 int multicast_time_to_live_; |
| 243 | 252 |
| 244 // How to do source port binding, used only when UDPSocket is part of | 253 // How to do source port binding, used only when UDPSocket is part of |
| 245 // UDPClientSocket, since UDPServerSocket provides Bind. | 254 // UDPClientSocket, since UDPServerSocket provides Bind. |
| 246 DatagramSocket::BindType bind_type_; | 255 DatagramSocket::BindType bind_type_; |
| 247 | 256 |
| 248 // PRNG function for generating port numbers. | 257 // PRNG function for generating port numbers. |
| 249 RandIntCallback rand_int_cb_; | 258 RandIntCallback rand_int_cb_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 278 CompletionCallback write_callback_; | 287 CompletionCallback write_callback_; |
| 279 | 288 |
| 280 BoundNetLog net_log_; | 289 BoundNetLog net_log_; |
| 281 | 290 |
| 282 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); | 291 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); |
| 283 }; | 292 }; |
| 284 | 293 |
| 285 } // namespace net | 294 } // namespace net |
| 286 | 295 |
| 287 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ | 296 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
| OLD | NEW |