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/base/net_util.h" |
10 #include "net/udp/datagram_socket.h" | 10 #include "net/udp/datagram_socket.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 virtual bool SetSendBufferSize(int32 size) = 0; | 62 virtual bool SetSendBufferSize(int32 size) = 0; |
63 | 63 |
64 // 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 |
65 // be bound with other processes. Should be called before Listen(). | 65 // be bound with other processes. Should be called before Listen(). |
66 virtual void AllowAddressReuse() = 0; | 66 virtual void AllowAddressReuse() = 0; |
67 | 67 |
68 // Allow sending and receiving packets to and from broadcast addresses. | 68 // Allow sending and receiving packets to and from broadcast addresses. |
69 // Should be called before Listen(). | 69 // Should be called before Listen(). |
70 virtual void AllowBroadcast() = 0; | 70 virtual void AllowBroadcast() = 0; |
71 | 71 |
72 // Join the multicast group. | 72 // Join the multicast group with address |group_address|. |
73 // |group_address| is the group address to join, could be either | 73 // Returns a network error code. |
74 // an IPv4 or IPv6 address. | |
75 // Return a network error code. | |
76 virtual int JoinGroup(const IPAddressNumber& group_address) const = 0; | 74 virtual int JoinGroup(const IPAddressNumber& group_address) const = 0; |
77 | 75 |
78 // Leave the multicast group. | 76 // Leave the multicast group with address |group_address|. |
79 // |group_address| is the group address to leave, could be either | 77 // If the socket hasn't joined the group, it will be ignored. |
80 // an IPv4 or IPv6 address. If the socket hasn't joined the group, | |
81 // it will be ignored. | |
82 // It's optional to leave the multicast group before destroying | 78 // It's optional to leave the multicast group before destroying |
83 // the socket. It will be done by the OS. | 79 // the socket. It will be done by the OS. |
84 // Return a network error code. | 80 // Returns a network error code. |
85 virtual int LeaveGroup(const IPAddressNumber& group_address) const = 0; | 81 virtual int LeaveGroup(const IPAddressNumber& group_address) const = 0; |
86 | 82 |
87 // Set the time-to-live option for UDP packets sent to the multicast | 83 // Set the time-to-live option for UDP packets sent to the multicast |
88 // group address. The default value of this option is 1. | 84 // group address. The default value of this option is 1. |
89 // Cannot be negative or more than 255. | 85 // Cannot be negative or more than 255. |
90 // Should be called before Bind(). | 86 // Should be called before Bind(). |
91 // Return a network error code. | 87 // Returns a network error code. |
92 virtual int SetMulticastTimeToLive(int time_to_live) = 0; | 88 virtual int SetMulticastTimeToLive(int time_to_live) = 0; |
93 | 89 |
94 // Set the loopback flag for UDP socket. If this flag is true, the host | 90 // Set the loopback flag for UDP socket. If this flag is true, the host |
95 // will receive packets sent to the joined group from itself. | 91 // will receive packets sent to the joined group from itself. |
96 // The default value of this option is true. | 92 // The default value of this option is true. |
97 // Should be called before Bind(). | 93 // Should be called before Bind(). |
98 // Return a network error code. | 94 // Returns a network error code. |
99 virtual int SetMulticastLoopbackMode(bool loopback) = 0; | 95 virtual int SetMulticastLoopbackMode(bool loopback) = 0; |
100 }; | 96 }; |
101 | 97 |
102 } // namespace net | 98 } // namespace net |
103 | 99 |
104 #endif // NET_UDP_DATAGRAM_SERVER_SOCKET_H_ | 100 #endif // NET_UDP_DATAGRAM_SERVER_SOCKET_H_ |
OLD | NEW |