OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ |
6 #define EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "extensions/browser/api/socket/socket.h" | 11 #include "extensions/browser/api/socket/socket.h" |
12 #include "net/udp/udp_socket.h" | 12 #include "net/udp/udp_socket.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 class UDPSocket : public Socket { | 16 class UDPSocket : public Socket { |
17 public: | 17 public: |
18 explicit UDPSocket(const std::string& owner_extension_id); | 18 explicit UDPSocket(const std::string& owner_extension_id); |
19 ~UDPSocket() override; | 19 ~UDPSocket() override; |
20 | 20 |
21 void Connect(const std::string& address, | 21 void Connect(const std::string& address, |
22 int port, | 22 uint16 port, |
23 const CompletionCallback& callback) override; | 23 const CompletionCallback& callback) override; |
24 void Disconnect() override; | 24 void Disconnect() override; |
25 int Bind(const std::string& address, int port) override; | 25 int Bind(const std::string& address, uint16 port) override; |
26 void Read(int count, const ReadCompletionCallback& callback) override; | 26 void Read(int count, const ReadCompletionCallback& callback) override; |
27 void RecvFrom(int count, const RecvFromCompletionCallback& callback) override; | 27 void RecvFrom(int count, const RecvFromCompletionCallback& callback) override; |
28 void SendTo(scoped_refptr<net::IOBuffer> io_buffer, | 28 void SendTo(scoped_refptr<net::IOBuffer> io_buffer, |
29 int byte_count, | 29 int byte_count, |
30 const std::string& address, | 30 const std::string& address, |
31 int port, | 31 uint16 port, |
32 const CompletionCallback& callback) override; | 32 const CompletionCallback& callback) override; |
33 | 33 |
34 bool IsConnected() override; | 34 bool IsConnected() override; |
35 | 35 |
36 bool GetPeerAddress(net::IPEndPoint* address) override; | 36 bool GetPeerAddress(net::IPEndPoint* address) override; |
37 bool GetLocalAddress(net::IPEndPoint* address) override; | 37 bool GetLocalAddress(net::IPEndPoint* address) override; |
38 Socket::SocketType GetSocketType() const override; | 38 Socket::SocketType GetSocketType() const override; |
39 | 39 |
40 bool IsBound(); | 40 bool IsBound(); |
41 | 41 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // The size of the buffer used to receive data - see sockets_udp.idl. | 107 // The size of the buffer used to receive data - see sockets_udp.idl. |
108 int buffer_size_; | 108 int buffer_size_; |
109 // Flag indicating whether a connected socket blocks its peer from sending | 109 // Flag indicating whether a connected socket blocks its peer from sending |
110 // more data - see sockets_udp.idl. | 110 // more data - see sockets_udp.idl. |
111 bool paused_; | 111 bool paused_; |
112 }; | 112 }; |
113 | 113 |
114 } // namespace extensions | 114 } // namespace extensions |
115 | 115 |
116 #endif // EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ | 116 #endif // EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ |
OLD | NEW |