Add signalSyncPoint to the WebGraphicsContext3D command buffer impls.
[chromium-blink-merge.git] / net / udp / datagram_server_socket.h
bloba1aa38bdefff72a8a24f7c2e263ade0b3b55af73
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
3 // found in the LICENSE file.
5 #ifndef NET_UDP_DATAGRAM_SERVER_SOCKET_H_
6 #define NET_UDP_DATAGRAM_SERVER_SOCKET_H_
8 #include "net/base/completion_callback.h"
9 #include "net/udp/datagram_socket.h"
11 namespace net {
13 class IPEndPoint;
14 class IOBuffer;
16 // A UDP Socket.
17 class NET_EXPORT DatagramServerSocket : public DatagramSocket {
18 public:
19 virtual ~DatagramServerSocket() {}
21 // Initialize this socket as a server socket listening at |address|.
22 // Returns a network error code.
23 virtual int Listen(const IPEndPoint& address) = 0;
25 // Read from a socket and receive sender address information.
26 // |buf| is the buffer to read data into.
27 // |buf_len| is the maximum amount of data to read.
28 // |address| is a buffer provided by the caller for receiving the sender
29 // address information about the received data. This buffer must be kept
30 // alive by the caller until the callback is placed.
31 // |address_length| is a ptr to the length of the |address| buffer. This
32 // is an input parameter containing the maximum size |address| can hold
33 // and also an output parameter for the size of |address| upon completion.
34 // |callback| the callback on completion of the Recv.
35 // Returns a net error code, or ERR_IO_PENDING if the IO is in progress.
36 // If ERR_IO_PENDING is returned, the caller must keep |buf|, |address|,
37 // and |address_length| alive until the callback is called.
38 virtual int RecvFrom(IOBuffer* buf,
39 int buf_len,
40 IPEndPoint* address,
41 const CompletionCallback& callback) = 0;
43 // Send to a socket with a particular destination.
44 // |buf| is the buffer to send
45 // |buf_len| is the number of bytes to send
46 // |address| is the recipient address.
47 // |address_length| is the size of the recipient address
48 // |callback| is the user callback function to call on complete.
49 // Returns a net error code, or ERR_IO_PENDING if the IO is in progress.
50 // If ERR_IO_PENDING is returned, the caller must keep |buf| and |address|
51 // alive until the callback is called.
52 virtual int SendTo(IOBuffer* buf,
53 int buf_len,
54 const IPEndPoint& address,
55 const CompletionCallback& callback) = 0;
57 // Set the receive buffer size (in bytes) for the socket.
58 virtual bool SetReceiveBufferSize(int32 size) = 0;
60 // Set the send buffer size (in bytes) for the socket.
61 virtual bool SetSendBufferSize(int32 size) = 0;
63 // Allow the socket to share the local address to which the socket will
64 // be bound with other processes. Should be called before Listen().
65 virtual void AllowAddressReuse() = 0;
67 // Allow sending and receiving packets to and from broadcast addresses.
68 // Should be called before Listen().
69 virtual void AllowBroadcast() = 0;
72 } // namespace net
74 #endif // NET_UDP_DATAGRAM_SERVER_SOCKET_H_