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

Unified Diff: net/udp/udp_socket_libevent.h

Issue 12684008: Multicast socket API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
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..d55470723174c20bb3a6315f36aea009db80d7f3 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 timeToLive);
mmenke 2013/04/12 21:07:41 time_to_live, per google naming rules.
Bei Zhang 2013/04/15 22:30:26 Done.
+
+ // 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_;

Powered by Google App Engine
This is Rietveld 408576698