Index: net/udp/udp_socket_libevent.h |
diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h |
index 2ac564debc533752d038b81a9b76312ecf0cc920..3e9cc4720cbacf389e6e903ac9e80264e551dfb3 100644 |
--- a/net/udp/udp_socket_libevent.h |
+++ b/net/udp/udp_socket_libevent.h |
@@ -94,9 +94,11 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { |
const CompletionCallback& callback); |
// Set the receive buffer size (in bytes) for the socket. |
+ // Returns a net error code. |
int SetReceiveBufferSize(int32 size); |
// Set the send buffer size (in bytes) for the socket. |
+ // Returns a net error code. |
int SetSendBufferSize(int32 size); |
// Returns true if the socket is already connected or bound. |
@@ -104,15 +106,23 @@ 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 the socket will be bound with |
- // other processes. Should be called before Bind(). |
- void AllowAddressReuse(); |
+ // Allows the socket to share the local address to which the socket will be |
+ // bound with other processes. |
+ // Returns a net error code. |
+ int AllowAddressReuse(); |
+ |
+ // Disallows the socket to share the local address to which the socket will |
+ // be bound with other processes. |
+ // Returns a net error code. |
+ int DisallowAddressReuse(); |
+ |
+ // Allows sending and receiving packets to and from broadcast addresses. |
+ // Returns a net error code. |
+ int AllowBroadcast(); |
- // Sets corresponding flags in |socket_options_| to allow sending |
- // and receiving packets to and from broadcast addresses. Should be |
- // called before Bind(). |
- void AllowBroadcast(); |
+ // Disallows sending and receiving packets to and from broadcast addresses. |
+ // Returns a net error code. |
+ int DisallowBroadcast(); |
// Join the multicast group. |
// |group_address| is the group address to join, could be either |
@@ -170,7 +180,9 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { |
enum SocketOptions { |
SOCKET_OPTION_REUSE_ADDRESS = 1 << 0, |
SOCKET_OPTION_BROADCAST = 1 << 1, |
- SOCKET_OPTION_MULTICAST_LOOP = 1 << 2 |
+ SOCKET_OPTION_MULTICAST_LOOP = 1 << 2, |
+ SOCKET_OPTION_RCVBUF_SIZE = 1 << 3, |
+ SOCKET_OPTION_SNDBUF_SIZE = 1 << 4 |
}; |
class ReadWatcher : public base::MessageLoopForIO::Watcher { |
@@ -234,8 +246,13 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { |
int InternalSendTo(IOBuffer* buf, int buf_len, const IPEndPoint* address); |
// Applies |socket_options_| to |socket_|. Should be called before |
- // Bind(). |
+ // DoBind(). |
int SetSocketOptions(); |
+ int SetAddressReuseInternal(bool address_reuse); |
+ int SetBroadcastInternal(bool broadcast); |
+ int SetReceiveBufferSizeInternal(int32 size); |
+ int SetSendBufferSizeInternal(int32 size); |
+ |
int DoBind(const IPEndPoint& address); |
// Binds to a random port on |address|. |
int RandomBind(const IPAddressNumber& address); |
@@ -247,6 +264,11 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { |
// options that should be applied to |socket_| before Bind(). |
int socket_options_; |
+ // Locally cached value of buffere size. These are automatically applied |
+ // when SetSocketOptions() is called. |
+ int32 rcvbuf_size_; |
+ int32 sndbuf_size_; |
+ |
// Multicast interface. |
uint32 multicast_interface_; |