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 // Set interface to use for multicast. If |interface_index| set to 0, default |
| 73 // interface is used. Must be called before |JoinGroup| or |LeaveGroup|. |
| 74 virtual int SetMulticastInterface(uint32 interface_index) = 0; |
| 75 |
72 // Join the multicast group with address |group_address|. | 76 // Join the multicast group with address |group_address|. |
73 // Returns a network error code. | 77 // Returns a network error code. |
74 virtual int JoinGroup(const IPAddressNumber& group_address) const = 0; | 78 virtual int JoinGroup(const IPAddressNumber& group_address) = 0; |
75 | 79 |
76 // Leave the multicast group with address |group_address|. | 80 // Leave the multicast group with address |group_address|. |
77 // If the socket hasn't joined the group, it will be ignored. | 81 // If the socket hasn't joined the group, it will be ignored. |
78 // It's optional to leave the multicast group before destroying | 82 // It's optional to leave the multicast group before destroying |
79 // the socket. It will be done by the OS. | 83 // the socket. It will be done by the OS. |
80 // Returns a network error code. | 84 // Returns a network error code. |
81 virtual int LeaveGroup(const IPAddressNumber& group_address) const = 0; | 85 virtual int LeaveGroup(const IPAddressNumber& group_address) = 0; |
82 | 86 |
83 // Set the time-to-live option for UDP packets sent to the multicast | 87 // Set the time-to-live option for UDP packets sent to the multicast |
84 // group address. The default value of this option is 1. | 88 // group address. The default value of this option is 1. |
85 // Cannot be negative or more than 255. | 89 // Cannot be negative or more than 255. |
86 // Should be called before Bind(). | 90 // Should be called before Bind(). |
87 // Returns a network error code. | 91 // Returns a network error code. |
88 virtual int SetMulticastTimeToLive(int time_to_live) = 0; | 92 virtual int SetMulticastTimeToLive(int time_to_live) = 0; |
89 | 93 |
90 // Set the loopback flag for UDP socket. If this flag is true, the host | 94 // 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. | 95 // will receive packets sent to the joined group from itself. |
92 // The default value of this option is true. | 96 // The default value of this option is true. |
93 // Should be called before Bind(). | 97 // Should be called before Bind(). |
94 // Returns a network error code. | 98 // Returns a network error code. |
95 virtual int SetMulticastLoopbackMode(bool loopback) = 0; | 99 virtual int SetMulticastLoopbackMode(bool loopback) = 0; |
96 | 100 |
97 // Set the Differentiated Services Code Point. May do nothing on | 101 // Set the Differentiated Services Code Point. May do nothing on |
98 // some platforms. Returns a network error code. | 102 // some platforms. Returns a network error code. |
99 virtual int SetDiffServCodePoint(DiffServCodePoint dscp) = 0; | 103 virtual int SetDiffServCodePoint(DiffServCodePoint dscp) = 0; |
100 }; | 104 }; |
101 | 105 |
102 } // namespace net | 106 } // namespace net |
103 | 107 |
104 #endif // NET_UDP_DATAGRAM_SERVER_SOCKET_H_ | 108 #endif // NET_UDP_DATAGRAM_SERVER_SOCKET_H_ |
OLD | NEW |