Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / udp / udp_server_socket.cc
blob796c04da503bcda479c1822d68ce9e53173ee617
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"
9 namespace net {
11 UDPServerSocket::UDPServerSocket(net::NetLog* net_log,
12 const net::NetLog::Source& source)
13 : socket_(DatagramSocket::DEFAULT_BIND,
14 RandIntCallback(),
15 net_log,
16 source) {
19 UDPServerSocket::~UDPServerSocket() {
22 int UDPServerSocket::Listen(const IPEndPoint& address) {
23 return socket_.Bind(address);
26 int UDPServerSocket::RecvFrom(IOBuffer* buf,
27 int buf_len,
28 IPEndPoint* address,
29 const CompletionCallback& callback) {
30 return socket_.RecvFrom(buf, buf_len, address, callback);
33 int UDPServerSocket::SendTo(IOBuffer* buf,
34 int buf_len,
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() {
49 socket_.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();
100 } // namespace net