| 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 <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 static size_t GetNumInstances(); | 54 static size_t GetNumInstances(); |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 ~PepperUDPSocketMessageFilter() override; | 57 ~PepperUDPSocketMessageFilter() override; |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 enum SocketOption { | 60 enum SocketOption { |
| 61 SOCKET_OPTION_ADDRESS_REUSE = 1 << 0, | 61 SOCKET_OPTION_ADDRESS_REUSE = 1 << 0, |
| 62 SOCKET_OPTION_BROADCAST = 1 << 1, | 62 SOCKET_OPTION_BROADCAST = 1 << 1, |
| 63 SOCKET_OPTION_RCVBUF_SIZE = 1 << 2, | 63 SOCKET_OPTION_RCVBUF_SIZE = 1 << 2, |
| 64 SOCKET_OPTION_SNDBUF_SIZE = 1 << 3 | 64 SOCKET_OPTION_SNDBUF_SIZE = 1 << 3, |
| 65 SOCKET_OPTION_MULTICAST_LOOP = 1 << 4, |
| 66 SOCKET_OPTION_MULTICAST_TTL = 1 << 5 |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 struct PendingSend { | 69 struct PendingSend { |
| 68 PendingSend(const net::IPAddressNumber& address, | 70 PendingSend(const net::IPAddressNumber& address, |
| 69 int port, | 71 int port, |
| 70 const scoped_refptr<net::IOBufferWithSize>& buffer, | 72 const scoped_refptr<net::IOBufferWithSize>& buffer, |
| 71 const ppapi::host::ReplyMessageContext& context); | 73 const ppapi::host::ReplyMessageContext& context); |
| 72 ~PendingSend(); | 74 ~PendingSend(); |
| 73 | 75 |
| 74 net::IPAddressNumber address; | 76 net::IPAddressNumber address; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 88 PP_UDPSocket_Option name, | 90 PP_UDPSocket_Option name, |
| 89 const ppapi::SocketOptionData& value); | 91 const ppapi::SocketOptionData& value); |
| 90 int32_t OnMsgBind(const ppapi::host::HostMessageContext* context, | 92 int32_t OnMsgBind(const ppapi::host::HostMessageContext* context, |
| 91 const PP_NetAddress_Private& addr); | 93 const PP_NetAddress_Private& addr); |
| 92 int32_t OnMsgSendTo(const ppapi::host::HostMessageContext* context, | 94 int32_t OnMsgSendTo(const ppapi::host::HostMessageContext* context, |
| 93 const std::string& data, | 95 const std::string& data, |
| 94 const PP_NetAddress_Private& addr); | 96 const PP_NetAddress_Private& addr); |
| 95 int32_t OnMsgClose(const ppapi::host::HostMessageContext* context); | 97 int32_t OnMsgClose(const ppapi::host::HostMessageContext* context); |
| 96 int32_t OnMsgRecvSlotAvailable( | 98 int32_t OnMsgRecvSlotAvailable( |
| 97 const ppapi::host::HostMessageContext* context); | 99 const ppapi::host::HostMessageContext* context); |
| 100 int32_t OnMsgJoinGroup(const ppapi::host::HostMessageContext* context, |
| 101 const PP_NetAddress_Private& addr); |
| 102 int32_t OnMsgLeaveGroup(const ppapi::host::HostMessageContext* context, |
| 103 const PP_NetAddress_Private& addr); |
| 98 | 104 |
| 99 void DoBind(const ppapi::host::ReplyMessageContext& context, | 105 void DoBind(const ppapi::host::ReplyMessageContext& context, |
| 100 const PP_NetAddress_Private& addr); | 106 const PP_NetAddress_Private& addr); |
| 101 void DoRecvFrom(); | 107 void DoRecvFrom(); |
| 102 void DoSendTo(const ppapi::host::ReplyMessageContext& context, | 108 void DoSendTo(const ppapi::host::ReplyMessageContext& context, |
| 103 const std::string& data, | 109 const std::string& data, |
| 104 const PP_NetAddress_Private& addr); | 110 const PP_NetAddress_Private& addr); |
| 105 int StartPendingSend(); | 111 int StartPendingSend(); |
| 106 void Close(); | 112 void Close(); |
| 107 | 113 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 118 void SendSendToReply(const ppapi::host::ReplyMessageContext& context, | 124 void SendSendToReply(const ppapi::host::ReplyMessageContext& context, |
| 119 int32_t result, | 125 int32_t result, |
| 120 int32_t bytes_written); | 126 int32_t bytes_written); |
| 121 | 127 |
| 122 void SendBindError(const ppapi::host::ReplyMessageContext& context, | 128 void SendBindError(const ppapi::host::ReplyMessageContext& context, |
| 123 int32_t result); | 129 int32_t result); |
| 124 void SendRecvFromError(int32_t result); | 130 void SendRecvFromError(int32_t result); |
| 125 void SendSendToError(const ppapi::host::ReplyMessageContext& context, | 131 void SendSendToError(const ppapi::host::ReplyMessageContext& context, |
| 126 int32_t result); | 132 int32_t result); |
| 127 | 133 |
| 134 int32_t CanUseMulticastAPI(const PP_NetAddress_Private& addr); |
| 135 |
| 128 // Bitwise-or of SocketOption flags. This stores the state about whether | 136 // Bitwise-or of SocketOption flags. This stores the state about whether |
| 129 // each option is set before Bind() is called. | 137 // each option is set before Bind() is called. |
| 130 int socket_options_; | 138 int socket_options_; |
| 131 | 139 |
| 132 // Locally cached value of buffer size. | 140 // Locally cached value of buffer size. |
| 133 int32_t rcvbuf_size_; | 141 int32_t rcvbuf_size_; |
| 134 int32_t sndbuf_size_; | 142 int32_t sndbuf_size_; |
| 135 | 143 |
| 144 // Multicast options, if socket hasn't been bound |
| 145 int multicast_ttl_; |
| 146 int32_t can_use_multicast_; |
| 147 |
| 136 scoped_ptr<net::UDPSocket> socket_; | 148 scoped_ptr<net::UDPSocket> socket_; |
| 137 bool closed_; | 149 bool closed_; |
| 138 | 150 |
| 139 scoped_refptr<net::IOBuffer> recvfrom_buffer_; | 151 scoped_refptr<net::IOBuffer> recvfrom_buffer_; |
| 140 | 152 |
| 141 std::queue<PendingSend> pending_sends_; | 153 std::queue<PendingSend> pending_sends_; |
| 142 | 154 |
| 143 net::IPEndPoint recvfrom_address_; | 155 net::IPEndPoint recvfrom_address_; |
| 144 | 156 |
| 145 size_t remaining_recv_slots_; | 157 size_t remaining_recv_slots_; |
| 146 | 158 |
| 147 bool external_plugin_; | 159 bool external_plugin_; |
| 148 bool private_api_; | 160 bool private_api_; |
| 149 | 161 |
| 150 int render_process_id_; | 162 int render_process_id_; |
| 151 int render_frame_id_; | 163 int render_frame_id_; |
| 152 | 164 |
| 153 DISALLOW_COPY_AND_ASSIGN(PepperUDPSocketMessageFilter); | 165 DISALLOW_COPY_AND_ASSIGN(PepperUDPSocketMessageFilter); |
| 154 }; | 166 }; |
| 155 | 167 |
| 156 } // namespace content | 168 } // namespace content |
| 157 | 169 |
| 158 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER
_H_ | 170 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER
_H_ |
| OLD | NEW |