| Index: net/udp/udp_socket_libevent.h
|
| diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h
|
| index 3242e18f12cc112048e5db89b2fcec1fee389669..2c19841549ae1ea79bee572228231e5380d61cfa 100644
|
| --- a/net/udp/udp_socket_libevent.h
|
| +++ b/net/udp/udp_socket_libevent.h
|
| @@ -103,9 +103,24 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe {
|
|
|
| const BoundNetLog& NetLog() const { return net_log_; }
|
|
|
| + // Sets corresponding flags in |socket_options_| to allow the socket
|
| + // to share the local address to which socket will be bound with
|
| + // other processes. Should be called before Bind().
|
| + void AllowAddressReuse();
|
| +
|
| + // Sets corresponding flags in |socket_options_| to allow sending
|
| + // and receiving packets sent to and from broadcast
|
| + // addresses. Should be called before Bind().
|
| + void AllowBroadcast();
|
| +
|
| private:
|
| static const int kInvalidSocket = -1;
|
|
|
| + enum SocketOptions {
|
| + SOCKET_OPTION_REUSE_ADDRESS = 1 << 0,
|
| + SOCKET_OPTION_BROADCAST = 1 << 1
|
| + };
|
| +
|
| class ReadWatcher : public MessageLoopForIO::Watcher {
|
| public:
|
| explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {}
|
| @@ -172,11 +187,18 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe {
|
| int InternalRecvFrom(IOBuffer* buf, int buf_len, IPEndPoint* address);
|
| int InternalSendTo(IOBuffer* buf, int buf_len, const IPEndPoint* address);
|
|
|
| + // Applies |socket_options_| to |socket_|. Should be called before
|
| + // Bind().
|
| + int SetSocketOptions();
|
| int DoBind(const IPEndPoint& address);
|
| int RandomBind(const IPEndPoint& address);
|
|
|
| int socket_;
|
|
|
| + // Bitwise-or'd combination of SocketOptions. Specifies set of
|
| + // options that should be applied to |socket_| before bind.
|
| + int socket_options_;
|
| +
|
| // How to do source port binding, used only when UDPSocket is part of
|
| // UDPClientSocket, since UDPServerSocket provides Bind.
|
| DatagramSocket::BindType bind_type_;
|
|
|