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_DATAGRAM_SERVER_SOCKET_H_ | 5 #ifndef NET_UDP_DATAGRAM_SERVER_SOCKET_H_ |
6 #define NET_UDP_DATAGRAM_SERVER_SOCKET_H_ | 6 #define NET_UDP_DATAGRAM_SERVER_SOCKET_H_ |
7 | 7 |
8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
| 9 #include "net/base/net_util.h" |
9 #include "net/udp/datagram_socket.h" | 10 #include "net/udp/datagram_socket.h" |
10 | 11 |
11 namespace net { | 12 namespace net { |
12 | 13 |
13 class IPEndPoint; | 14 class IPEndPoint; |
14 class IOBuffer; | 15 class IOBuffer; |
15 | 16 |
16 // A UDP Socket. | 17 // A UDP Socket. |
17 class NET_EXPORT DatagramServerSocket : public DatagramSocket { | 18 class NET_EXPORT DatagramServerSocket : public DatagramSocket { |
18 public: | 19 public: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Set the send buffer size (in bytes) for the socket. | 61 // Set the send buffer size (in bytes) for the socket. |
61 virtual bool SetSendBufferSize(int32 size) = 0; | 62 virtual bool SetSendBufferSize(int32 size) = 0; |
62 | 63 |
63 // Allow the socket to share the local address to which the socket will | 64 // 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 // be bound with other processes. Should be called before Listen(). |
65 virtual void AllowAddressReuse() = 0; | 66 virtual void AllowAddressReuse() = 0; |
66 | 67 |
67 // Allow sending and receiving packets to and from broadcast addresses. | 68 // Allow sending and receiving packets to and from broadcast addresses. |
68 // Should be called before Listen(). | 69 // Should be called before Listen(). |
69 virtual void AllowBroadcast() = 0; | 70 virtual void AllowBroadcast() = 0; |
| 71 |
| 72 // Join the multicast group with address |group_address|. |
| 73 // Returns a network error code. |
| 74 virtual int JoinGroup(const IPAddressNumber& group_address) const = 0; |
| 75 |
| 76 // Leave the multicast group with address |group_address|. |
| 77 // If the socket hasn't joined the group, it will be ignored. |
| 78 // It's optional to leave the multicast group before destroying |
| 79 // the socket. It will be done by the OS. |
| 80 // Returns a network error code. |
| 81 virtual int LeaveGroup(const IPAddressNumber& group_address) const = 0; |
| 82 |
| 83 // Set the time-to-live option for UDP packets sent to the multicast |
| 84 // group address. The default value of this option is 1. |
| 85 // Cannot be negative or more than 255. |
| 86 // Should be called before Bind(). |
| 87 // Returns a network error code. |
| 88 virtual int SetMulticastTimeToLive(int time_to_live) = 0; |
| 89 |
| 90 // Set the loopback flag for UDP socket. If this flag is true, the host |
| 91 // will receive packets sent to the joined group from itself. |
| 92 // The default value of this option is true. |
| 93 // Should be called before Bind(). |
| 94 // Returns a network error code. |
| 95 virtual int SetMulticastLoopbackMode(bool loopback) = 0; |
70 }; | 96 }; |
71 | 97 |
72 } // namespace net | 98 } // namespace net |
73 | 99 |
74 #endif // NET_UDP_DATAGRAM_SERVER_SOCKET_H_ | 100 #endif // NET_UDP_DATAGRAM_SERVER_SOCKET_H_ |
OLD | NEW |