| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // |callback| is the user callback function to call on complete. | 87 // |callback| is the user callback function to call on complete. |
| 88 // Returns a net error code, or ERR_IO_PENDING if the IO is in progress. | 88 // Returns a net error code, or ERR_IO_PENDING if the IO is in progress. |
| 89 // If ERR_IO_PENDING is returned, the caller must keep |buf| and |address| | 89 // If ERR_IO_PENDING is returned, the caller must keep |buf| and |address| |
| 90 // alive until the callback is called. | 90 // alive until the callback is called. |
| 91 int SendTo(IOBuffer* buf, | 91 int SendTo(IOBuffer* buf, |
| 92 int buf_len, | 92 int buf_len, |
| 93 const IPEndPoint& address, | 93 const IPEndPoint& address, |
| 94 const CompletionCallback& callback); | 94 const CompletionCallback& callback); |
| 95 | 95 |
| 96 // Set the receive buffer size (in bytes) for the socket. | 96 // Set the receive buffer size (in bytes) for the socket. |
| 97 bool SetReceiveBufferSize(int32 size); | 97 int SetReceiveBufferSize(int32 size); |
| 98 | 98 |
| 99 // Set the send buffer size (in bytes) for the socket. | 99 // Set the send buffer size (in bytes) for the socket. |
| 100 bool SetSendBufferSize(int32 size); | 100 int SetSendBufferSize(int32 size); |
| 101 | 101 |
| 102 // Returns true if the socket is already connected or bound. | 102 // Returns true if the socket is already connected or bound. |
| 103 bool is_connected() const { return socket_ != kInvalidSocket; } | 103 bool is_connected() const { return socket_ != kInvalidSocket; } |
| 104 | 104 |
| 105 const BoundNetLog& NetLog() const { return net_log_; } | 105 const BoundNetLog& NetLog() const { return net_log_; } |
| 106 | 106 |
| 107 // Sets corresponding flags in |socket_options_| to allow the socket | 107 // Sets corresponding flags in |socket_options_| to allow the socket |
| 108 // to share the local address to which the socket will be bound with | 108 // to share the local address to which the socket will be bound with |
| 109 // other processes. Should be called before Bind(). | 109 // other processes. Should be called before Bind(). |
| 110 void AllowAddressReuse(); | 110 void AllowAddressReuse(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 CompletionCallback write_callback_; | 291 CompletionCallback write_callback_; |
| 292 | 292 |
| 293 BoundNetLog net_log_; | 293 BoundNetLog net_log_; |
| 294 | 294 |
| 295 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); | 295 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 } // namespace net | 298 } // namespace net |
| 299 | 299 |
| 300 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ | 300 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
| OLD | NEW |