OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 PepperUDPSocketMessageFilter(BrowserPpapiHostImpl* host, | 49 PepperUDPSocketMessageFilter(BrowserPpapiHostImpl* host, |
50 PP_Instance instance, | 50 PP_Instance instance, |
51 bool private_api); | 51 bool private_api); |
52 | 52 |
53 static size_t GetNumInstances(); | 53 static size_t GetNumInstances(); |
54 | 54 |
55 protected: | 55 protected: |
56 ~PepperUDPSocketMessageFilter() override; | 56 ~PepperUDPSocketMessageFilter() override; |
57 | 57 |
58 private: | 58 private: |
| 59 enum SocketOption { |
| 60 SOCKET_OPTION_ADDRESS_REUSE = 1 << 0, |
| 61 SOCKET_OPTION_BROADCAST = 1 << 1, |
| 62 SOCKET_OPTION_RCVBUF_SIZE = 1 << 2, |
| 63 SOCKET_OPTION_SNDBUF_SIZE = 1 << 3 |
| 64 }; |
| 65 |
59 // ppapi::host::ResourceMessageFilter overrides. | 66 // ppapi::host::ResourceMessageFilter overrides. |
60 scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( | 67 scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( |
61 const IPC::Message& message) override; | 68 const IPC::Message& message) override; |
62 int32_t OnResourceMessageReceived( | 69 int32_t OnResourceMessageReceived( |
63 const IPC::Message& msg, | 70 const IPC::Message& msg, |
64 ppapi::host::HostMessageContext* context) override; | 71 ppapi::host::HostMessageContext* context) override; |
65 | 72 |
66 int32_t OnMsgSetOption(const ppapi::host::HostMessageContext* context, | 73 int32_t OnMsgSetOption(const ppapi::host::HostMessageContext* context, |
67 PP_UDPSocket_Option name, | 74 PP_UDPSocket_Option name, |
68 const ppapi::SocketOptionData& value); | 75 const ppapi::SocketOptionData& value); |
(...skipping 27 matching lines...) Expand all Loading... |
96 void SendSendToReply(const ppapi::host::ReplyMessageContext& context, | 103 void SendSendToReply(const ppapi::host::ReplyMessageContext& context, |
97 int32_t result, | 104 int32_t result, |
98 int32_t bytes_written); | 105 int32_t bytes_written); |
99 | 106 |
100 void SendBindError(const ppapi::host::ReplyMessageContext& context, | 107 void SendBindError(const ppapi::host::ReplyMessageContext& context, |
101 int32_t result); | 108 int32_t result); |
102 void SendRecvFromError(int32_t result); | 109 void SendRecvFromError(int32_t result); |
103 void SendSendToError(const ppapi::host::ReplyMessageContext& context, | 110 void SendSendToError(const ppapi::host::ReplyMessageContext& context, |
104 int32_t result); | 111 int32_t result); |
105 | 112 |
106 bool allow_address_reuse_; | 113 // Bitwise-or of SocketOption flags. This stores the state about whether |
107 bool allow_broadcast_; | 114 // each option is set before Bind() is called. |
| 115 int socket_options_; |
| 116 int32 rcvbuf_size_; |
| 117 int32 sndbuf_size_; |
108 | 118 |
109 scoped_ptr<net::UDPServerSocket> socket_; | 119 scoped_ptr<net::UDPServerSocket> socket_; |
110 bool closed_; | 120 bool closed_; |
111 | 121 |
112 scoped_refptr<net::IOBuffer> recvfrom_buffer_; | 122 scoped_refptr<net::IOBuffer> recvfrom_buffer_; |
113 scoped_refptr<net::IOBufferWithSize> sendto_buffer_; | 123 scoped_refptr<net::IOBufferWithSize> sendto_buffer_; |
114 | 124 |
115 net::IPEndPoint recvfrom_address_; | 125 net::IPEndPoint recvfrom_address_; |
116 | 126 |
117 size_t remaining_recv_slots_; | 127 size_t remaining_recv_slots_; |
118 | 128 |
119 bool external_plugin_; | 129 bool external_plugin_; |
120 bool private_api_; | 130 bool private_api_; |
121 | 131 |
122 int render_process_id_; | 132 int render_process_id_; |
123 int render_frame_id_; | 133 int render_frame_id_; |
124 | 134 |
125 DISALLOW_COPY_AND_ASSIGN(PepperUDPSocketMessageFilter); | 135 DISALLOW_COPY_AND_ASSIGN(PepperUDPSocketMessageFilter); |
126 }; | 136 }; |
127 | 137 |
128 } // namespace content | 138 } // namespace content |
129 | 139 |
130 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER
_H_ | 140 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER
_H_ |
OLD | NEW |