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 #include "net/udp/udp_server_socket.h"
7 #include "net/base/rand_callback.h"
11 UDPServerSocket::UDPServerSocket(net::NetLog
* net_log
,
12 const net::NetLog::Source
& source
)
13 : socket_(DatagramSocket::DEFAULT_BIND
,
19 UDPServerSocket::~UDPServerSocket() {
22 int UDPServerSocket::Listen(const IPEndPoint
& address
) {
23 return socket_
.Bind(address
);
26 int UDPServerSocket::RecvFrom(IOBuffer
* buf
,
29 const CompletionCallback
& callback
) {
30 return socket_
.RecvFrom(buf
, buf_len
, address
, callback
);
33 int UDPServerSocket::SendTo(IOBuffer
* buf
,
35 const IPEndPoint
& address
,
36 const CompletionCallback
& callback
) {
37 return socket_
.SendTo(buf
, buf_len
, address
, callback
);
40 int UDPServerSocket::SetReceiveBufferSize(int32 size
) {
41 return socket_
.SetReceiveBufferSize(size
);
44 int UDPServerSocket::SetSendBufferSize(int32 size
) {
45 return socket_
.SetSendBufferSize(size
);
48 void UDPServerSocket::Close() {
52 int UDPServerSocket::GetPeerAddress(IPEndPoint
* address
) const {
53 return socket_
.GetPeerAddress(address
);
56 int UDPServerSocket::GetLocalAddress(IPEndPoint
* address
) const {
57 return socket_
.GetLocalAddress(address
);
60 const BoundNetLog
& UDPServerSocket::NetLog() const {
61 return socket_
.NetLog();
64 void UDPServerSocket::AllowAddressReuse() {
65 socket_
.AllowAddressReuse();
68 void UDPServerSocket::AllowBroadcast() {
69 socket_
.AllowBroadcast();
72 int UDPServerSocket::JoinGroup(const IPAddressNumber
& group_address
) const {
73 return socket_
.JoinGroup(group_address
);
76 int UDPServerSocket::LeaveGroup(const IPAddressNumber
& group_address
) const {
77 return socket_
.LeaveGroup(group_address
);
80 int UDPServerSocket::SetMulticastInterface(uint32 interface_index
) {
81 return socket_
.SetMulticastInterface(interface_index
);
84 int UDPServerSocket::SetMulticastTimeToLive(int time_to_live
) {
85 return socket_
.SetMulticastTimeToLive(time_to_live
);
88 int UDPServerSocket::SetMulticastLoopbackMode(bool loopback
) {
89 return socket_
.SetMulticastLoopbackMode(loopback
);
92 int UDPServerSocket::SetDiffServCodePoint(DiffServCodePoint dscp
) {
93 return socket_
.SetDiffServCodePoint(dscp
);
96 void UDPServerSocket::DetachFromThread() {
97 socket_
.DetachFromThread();