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 CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "content/common/p2p_socket_type.h" | 11 #include "content/common/p2p_socket_type.h" |
12 #include "net/base/ip_endpoint.h" | 12 #include "net/base/ip_endpoint.h" |
13 | 13 |
14 namespace talk_base { | 14 namespace rtc { |
15 struct PacketOptions; | 15 struct PacketOptions; |
16 }; | 16 }; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class P2PSocketClientDelegate; | 20 class P2PSocketClientDelegate; |
21 | 21 |
22 // P2P socket that routes all calls over IPC. | 22 // P2P socket that routes all calls over IPC. |
23 // Note that while ref-counting is thread-safe, all methods must be | 23 // Note that while ref-counting is thread-safe, all methods must be |
24 // called on the same thread. | 24 // called on the same thread. |
(...skipping 12 matching lines...) Expand all Loading... |
37 P2PSocketClient() {} | 37 P2PSocketClient() {} |
38 | 38 |
39 // Send the |data| to the |address|. | 39 // Send the |data| to the |address|. |
40 virtual void Send(const net::IPEndPoint& address, | 40 virtual void Send(const net::IPEndPoint& address, |
41 const std::vector<char>& data) = 0; | 41 const std::vector<char>& data) = 0; |
42 | 42 |
43 // Send the |data| to the |address| using Differentiated Services Code Point | 43 // Send the |data| to the |address| using Differentiated Services Code Point |
44 // |dscp|. | 44 // |dscp|. |
45 virtual void SendWithDscp(const net::IPEndPoint& address, | 45 virtual void SendWithDscp(const net::IPEndPoint& address, |
46 const std::vector<char>& data, | 46 const std::vector<char>& data, |
47 const talk_base::PacketOptions& options) = 0; | 47 const rtc::PacketOptions& options) = 0; |
48 | 48 |
49 virtual void SetOption(P2PSocketOption option, int value) = 0; | 49 virtual void SetOption(P2PSocketOption option, int value) = 0; |
50 | 50 |
51 // Must be called before the socket is destroyed. | 51 // Must be called before the socket is destroyed. |
52 virtual void Close() = 0; | 52 virtual void Close() = 0; |
53 | 53 |
54 virtual int GetSocketID() const = 0; | 54 virtual int GetSocketID() const = 0; |
55 virtual void SetDelegate(P2PSocketClientDelegate* delegate) = 0; | 55 virtual void SetDelegate(P2PSocketClientDelegate* delegate) = 0; |
56 | 56 |
57 protected: | 57 protected: |
58 virtual ~P2PSocketClient() {} | 58 virtual ~P2PSocketClient() {} |
59 | 59 |
60 private: | 60 private: |
61 // Calls destructor. | 61 // Calls destructor. |
62 friend class base::RefCountedThreadSafe<P2PSocketClient>; | 62 friend class base::RefCountedThreadSafe<P2PSocketClient>; |
63 }; | 63 }; |
64 } // namespace content | 64 } // namespace content |
65 | 65 |
66 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 66 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
OLD | NEW |