Index: net/udp/udp_socket_libevent.h |
diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h |
index ce8a0f2269ad4c39dbe6f8b7e997216ecebde42a..f94c55beae647198db9b2912ff2d009ccfaa8277 100644 |
--- a/net/udp/udp_socket_libevent.h |
+++ b/net/udp/udp_socket_libevent.h |
@@ -5,6 +5,7 @@ |
#ifndef NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
#define NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
+#include "base/hash_tables.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/message_loop.h" |
@@ -113,6 +114,29 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { |
// called before Bind(). |
void AllowBroadcast(); |
+ // Join the multicast group. |
+ // |group_address| is the group address to join, could be either |
+ // IPv4 or IPv6 address. |
+ int JoinGroup(const net::IPAddressNumber& group_address) const; |
+ |
+ // Leave the multicast group. |
+ // |group_address| is the group address to leave, could be either |
+ // IPv4 or IPv6 address. If the socket hasn't joined the group, |
+ // it will be ignored. |
+ // It's optional to leave the multicast group before destroying |
+ // the socket. It will be done by the OS. |
+ int LeaveGroup(const net::IPAddressNumber& group_address) const; |
+ |
+ // Set the time-to-live option for udp packets sent to the multicast |
+ // group address. Initially this value is 1. Cannot be negative or |
+ // more than 255. |
+ int SetMulticastTimeToLive(int time_to_live); |
mmenke
2013/04/16 18:09:49
Think it's worth mentioned that this is safe to ca
Bei Zhang
2013/04/17 17:53:03
Please see comments in udp_socket_libevent.cc
On 2
|
+ |
+ // Set the loopback flag for udp socket. If this flag is true, the host |
+ // will receive package sent to the joined group from itself. |
+ // Initially this value is true. |
+ int SetMulticastLoopbackMode(bool loopback); |
+ |
private: |
static const int kInvalidSocket = -1; |
@@ -188,11 +212,17 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { |
int RandomBind(const IPEndPoint& address); |
int socket_; |
+ int sock_addr_family_; |
// Bitwise-or'd combination of SocketOptions. Specifies the set of |
// options that should be applied to |socket_| before Bind(). |
int socket_options_; |
+ // Multicast socket options cached for SetSocketOption. |
+ // Cannot be used after Bind(). |
+ int multicast_time_to_live_; |
+ bool multicast_loopback_mode_; |
+ |
// How to do source port binding, used only when UDPSocket is part of |
// UDPClientSocket, since UDPServerSocket provides Bind. |
DatagramSocket::BindType bind_type_; |