OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "net/udp/udp_server_socket.h" | 5 #include "net/udp/udp_server_socket.h" |
6 | 6 |
7 #include "net/base/rand_callback.h" | 7 #include "net/base/rand_callback.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 UDPServerSocket::UDPServerSocket(net::NetLog* net_log, | 11 UDPServerSocket::UDPServerSocket(net::NetLog* net_log, |
12 const net::NetLog::Source& source) | 12 const net::NetLog::Source& source) |
13 : socket_(DatagramSocket::DEFAULT_BIND, | 13 : socket_(DatagramSocket::DEFAULT_BIND, |
14 RandIntCallback(), | 14 RandIntCallback(), |
15 net_log, | 15 net_log, |
16 source) { | 16 source) { |
17 } | 17 } |
18 | 18 |
19 UDPServerSocket::~UDPServerSocket() { | 19 UDPServerSocket::~UDPServerSocket() { |
20 } | 20 } |
21 | 21 |
22 int UDPServerSocket::Listen(const IPEndPoint& address) { | 22 int UDPServerSocket::Listen(const IPEndPoint& address) { |
23 return socket_.Bind(address); | 23 return socket_.Bind(address); |
24 } | 24 } |
25 | 25 |
26 int UDPServerSocket::RecvFrom(IOBuffer* buf, | 26 int UDPServerSocket::RecvFrom(IOBuffer* buf, |
27 int buf_len, | 27 int buf_len, |
28 IPEndPoint* address, | 28 IPEndPoint* address, |
29 OldCompletionCallback* callback) { | 29 const CompletionCallback& callback) { |
30 return socket_.RecvFrom(buf, buf_len, address, callback); | 30 return socket_.RecvFrom(buf, buf_len, address, callback); |
31 } | 31 } |
32 | 32 |
33 int UDPServerSocket::SendTo(IOBuffer* buf, | 33 int UDPServerSocket::SendTo(IOBuffer* buf, |
34 int buf_len, | 34 int buf_len, |
35 const IPEndPoint& address, | 35 const IPEndPoint& address, |
36 OldCompletionCallback* callback) { | 36 const CompletionCallback& callback) { |
37 return socket_.SendTo(buf, buf_len, address, callback); | 37 return socket_.SendTo(buf, buf_len, address, callback); |
38 } | 38 } |
39 | 39 |
40 bool UDPServerSocket::SetReceiveBufferSize(int32 size) { | 40 bool UDPServerSocket::SetReceiveBufferSize(int32 size) { |
41 return socket_.SetReceiveBufferSize(size); | 41 return socket_.SetReceiveBufferSize(size); |
42 } | 42 } |
43 | 43 |
44 bool UDPServerSocket::SetSendBufferSize(int32 size) { | 44 bool UDPServerSocket::SetSendBufferSize(int32 size) { |
45 return socket_.SetSendBufferSize(size); | 45 return socket_.SetSendBufferSize(size); |
46 } | 46 } |
47 | 47 |
48 void UDPServerSocket::Close() { | 48 void UDPServerSocket::Close() { |
49 socket_.Close(); | 49 socket_.Close(); |
50 } | 50 } |
51 | 51 |
52 int UDPServerSocket::GetPeerAddress(IPEndPoint* address) const { | 52 int UDPServerSocket::GetPeerAddress(IPEndPoint* address) const { |
53 return socket_.GetPeerAddress(address); | 53 return socket_.GetPeerAddress(address); |
54 } | 54 } |
55 | 55 |
56 int UDPServerSocket::GetLocalAddress(IPEndPoint* address) const { | 56 int UDPServerSocket::GetLocalAddress(IPEndPoint* address) const { |
57 return socket_.GetLocalAddress(address); | 57 return socket_.GetLocalAddress(address); |
58 } | 58 } |
59 | 59 |
60 const BoundNetLog& UDPServerSocket::NetLog() const { | 60 const BoundNetLog& UDPServerSocket::NetLog() const { |
61 return socket_.NetLog(); | 61 return socket_.NetLog(); |
62 } | 62 } |
63 | 63 |
64 } // namespace net | 64 } // namespace net |
OLD | NEW |