Home | History | Annotate | Download | only in udp
      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 
     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 
     19 UDPServerSocket::~UDPServerSocket() {
     20 }
     21 
     22 int UDPServerSocket::Listen(const IPEndPoint& address) {
     23   return socket_.Bind(address);
     24 }
     25 
     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 
     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 
     40 bool UDPServerSocket::SetReceiveBufferSize(int32 size) {
     41   return socket_.SetReceiveBufferSize(size);
     42 }
     43 
     44 bool UDPServerSocket::SetSendBufferSize(int32 size) {
     45   return socket_.SetSendBufferSize(size);
     46 }
     47 
     48 void UDPServerSocket::Close() {
     49   socket_.Close();
     50 }
     51 
     52 int UDPServerSocket::GetPeerAddress(IPEndPoint* address) const {
     53   return socket_.GetPeerAddress(address);
     54 }
     55 
     56 int UDPServerSocket::GetLocalAddress(IPEndPoint* address) const {
     57   return socket_.GetLocalAddress(address);
     58 }
     59 
     60 const BoundNetLog& UDPServerSocket::NetLog() const {
     61   return socket_.NetLog();
     62 }
     63 
     64 void UDPServerSocket::AllowAddressReuse() {
     65   socket_.AllowAddressReuse();
     66 }
     67 
     68 void UDPServerSocket::AllowBroadcast() {
     69   socket_.AllowBroadcast();
     70 }
     71 
     72 int UDPServerSocket::JoinGroup(const IPAddressNumber& group_address) const {
     73   return socket_.JoinGroup(group_address);
     74 }
     75 
     76 int UDPServerSocket::LeaveGroup(const IPAddressNumber& group_address) const {
     77   return socket_.LeaveGroup(group_address);
     78 }
     79 
     80 int UDPServerSocket::SetMulticastInterface(uint32 interface_index) {
     81   return socket_.SetMulticastInterface(interface_index);
     82 }
     83 
     84 int UDPServerSocket::SetMulticastTimeToLive(int time_to_live) {
     85   return socket_.SetMulticastTimeToLive(time_to_live);
     86 }
     87 
     88 int UDPServerSocket::SetMulticastLoopbackMode(bool loopback) {
     89   return socket_.SetMulticastLoopbackMode(loopback);
     90 }
     91 
     92 int UDPServerSocket::SetDiffServCodePoint(DiffServCodePoint dscp) {
     93   return socket_.SetDiffServCodePoint(dscp);
     94 }
     95 
     96 }  // namespace net
     97