• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "net/udp/udp_server_socket.h"
6 
7 #include "net/base/rand_callback.h"
8 
9 namespace net {
10 
UDPServerSocket(net::NetLog * net_log,const net::NetLog::Source & source)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) {
17 }
18 
~UDPServerSocket()19 UDPServerSocket::~UDPServerSocket() {
20 }
21 
Listen(const IPEndPoint & address)22 int UDPServerSocket::Listen(const IPEndPoint& address) {
23   return socket_.Bind(address);
24 }
25 
RecvFrom(IOBuffer * buf,int buf_len,IPEndPoint * address,const CompletionCallback & callback)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);
31 }
32 
SendTo(IOBuffer * buf,int buf_len,const IPEndPoint & address,const CompletionCallback & 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);
38 }
39 
SetReceiveBufferSize(int32 size)40 int UDPServerSocket::SetReceiveBufferSize(int32 size) {
41   return socket_.SetReceiveBufferSize(size);
42 }
43 
SetSendBufferSize(int32 size)44 int UDPServerSocket::SetSendBufferSize(int32 size) {
45   return socket_.SetSendBufferSize(size);
46 }
47 
Close()48 void UDPServerSocket::Close() {
49   socket_.Close();
50 }
51 
GetPeerAddress(IPEndPoint * address) const52 int UDPServerSocket::GetPeerAddress(IPEndPoint* address) const {
53   return socket_.GetPeerAddress(address);
54 }
55 
GetLocalAddress(IPEndPoint * address) const56 int UDPServerSocket::GetLocalAddress(IPEndPoint* address) const {
57   return socket_.GetLocalAddress(address);
58 }
59 
NetLog() const60 const BoundNetLog& UDPServerSocket::NetLog() const {
61   return socket_.NetLog();
62 }
63 
AllowAddressReuse()64 void UDPServerSocket::AllowAddressReuse() {
65   socket_.AllowAddressReuse();
66 }
67 
AllowBroadcast()68 void UDPServerSocket::AllowBroadcast() {
69   socket_.AllowBroadcast();
70 }
71 
JoinGroup(const IPAddressNumber & group_address) const72 int UDPServerSocket::JoinGroup(const IPAddressNumber& group_address) const {
73   return socket_.JoinGroup(group_address);
74 }
75 
LeaveGroup(const IPAddressNumber & group_address) const76 int UDPServerSocket::LeaveGroup(const IPAddressNumber& group_address) const {
77   return socket_.LeaveGroup(group_address);
78 }
79 
SetMulticastInterface(uint32 interface_index)80 int UDPServerSocket::SetMulticastInterface(uint32 interface_index) {
81   return socket_.SetMulticastInterface(interface_index);
82 }
83 
SetMulticastTimeToLive(int time_to_live)84 int UDPServerSocket::SetMulticastTimeToLive(int time_to_live) {
85   return socket_.SetMulticastTimeToLive(time_to_live);
86 }
87 
SetMulticastLoopbackMode(bool loopback)88 int UDPServerSocket::SetMulticastLoopbackMode(bool loopback) {
89   return socket_.SetMulticastLoopbackMode(loopback);
90 }
91 
SetDiffServCodePoint(DiffServCodePoint dscp)92 int UDPServerSocket::SetDiffServCodePoint(DiffServCodePoint dscp) {
93   return socket_.SetDiffServCodePoint(dscp);
94 }
95 
DetachFromThread()96 void UDPServerSocket::DetachFromThread() {
97   socket_.DetachFromThread();
98 }
99 
100 }  // namespace net
101