OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 PPAPI_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_ | 5 #ifndef PPAPI_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_ |
6 #define PPAPI_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_ | 6 #define PPAPI_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ~ReadInfo_Dev(); | 89 ~ReadInfo_Dev(); |
90 | 90 |
91 bool Populate(const PP_Ext_Socket_ReadInfo_Dev& value); | 91 bool Populate(const PP_Ext_Socket_ReadInfo_Dev& value); |
92 | 92 |
93 Var CreateVar() const; | 93 Var CreateVar() const; |
94 | 94 |
95 static const char* const kResultCode; | 95 static const char* const kResultCode; |
96 static const char* const kData; | 96 static const char* const kData; |
97 | 97 |
98 DictField<int32_t> result_code; | 98 DictField<int32_t> result_code; |
99 // TODO(yzshen): It is more natural to use VarArrayBuffer, but it doesn't have | 99 DictField<VarArrayBuffer> data; |
100 // a default constructor currently. | |
101 DictField<Var> data; | |
102 }; | 100 }; |
103 | 101 |
104 class WriteInfo_Dev : public internal::OutputObjectBase { | 102 class WriteInfo_Dev : public internal::OutputObjectBase { |
105 public: | 103 public: |
106 WriteInfo_Dev(); | 104 WriteInfo_Dev(); |
107 ~WriteInfo_Dev(); | 105 ~WriteInfo_Dev(); |
108 | 106 |
109 bool Populate(const PP_Ext_Socket_WriteInfo_Dev& value); | 107 bool Populate(const PP_Ext_Socket_WriteInfo_Dev& value); |
110 | 108 |
111 Var CreateVar() const; | 109 Var CreateVar() const; |
(...skipping 11 matching lines...) Expand all Loading... |
123 bool Populate(const PP_Ext_Socket_RecvFromInfo_Dev& value); | 121 bool Populate(const PP_Ext_Socket_RecvFromInfo_Dev& value); |
124 | 122 |
125 Var CreateVar() const; | 123 Var CreateVar() const; |
126 | 124 |
127 static const char* const kResultCode; | 125 static const char* const kResultCode; |
128 static const char* const kData; | 126 static const char* const kData; |
129 static const char* const kAddress; | 127 static const char* const kAddress; |
130 static const char* const kPort; | 128 static const char* const kPort; |
131 | 129 |
132 DictField<int32_t> result_code; | 130 DictField<int32_t> result_code; |
133 DictField<Var> data; | 131 DictField<VarArrayBuffer> data; |
134 DictField<std::string> address; | 132 DictField<std::string> address; |
135 DictField<int32_t> port; | 133 DictField<int32_t> port; |
136 }; | 134 }; |
137 | 135 |
138 class SocketInfo_Dev : public internal::OutputObjectBase { | 136 class SocketInfo_Dev : public internal::OutputObjectBase { |
139 public: | 137 public: |
140 SocketInfo_Dev(); | 138 SocketInfo_Dev(); |
141 ~SocketInfo_Dev(); | 139 ~SocketInfo_Dev(); |
142 | 140 |
143 bool Populate(const PP_Ext_Socket_SocketInfo_Dev& value); | 141 bool Populate(const PP_Ext_Socket_SocketInfo_Dev& value); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // const CompletionCallbackWithOutput<int32_t>& callback); | 190 // const CompletionCallbackWithOutput<int32_t>& callback); |
193 //int32_t Bind(int32_t socket_id, | 191 //int32_t Bind(int32_t socket_id, |
194 // const std::string& address, | 192 // const std::string& address, |
195 // int32_t port, | 193 // int32_t port, |
196 // const CompletionCallbackWithOutput<int32_t>& callback); | 194 // const CompletionCallbackWithOutput<int32_t>& callback); |
197 void Disconnect(int32_t socket_id); | 195 void Disconnect(int32_t socket_id); |
198 int32_t Read(int32_t socket_id, | 196 int32_t Read(int32_t socket_id, |
199 const Optional<int32_t>& buffer_size, | 197 const Optional<int32_t>& buffer_size, |
200 const CompletionCallbackWithOutput<ReadInfo_Dev>& callback); | 198 const CompletionCallbackWithOutput<ReadInfo_Dev>& callback); |
201 int32_t Write(int32_t socket_id, | 199 int32_t Write(int32_t socket_id, |
202 const Var& data, | 200 const VarArrayBuffer& data, |
203 const CompletionCallbackWithOutput<WriteInfo_Dev>& callback); | 201 const CompletionCallbackWithOutput<WriteInfo_Dev>& callback); |
204 int32_t RecvFrom( | 202 int32_t RecvFrom( |
205 int32_t socket_id, | 203 int32_t socket_id, |
206 const Optional<int32_t>& buffer_size, | 204 const Optional<int32_t>& buffer_size, |
207 const CompletionCallbackWithOutput<RecvFromInfo_Dev>& callback); | 205 const CompletionCallbackWithOutput<RecvFromInfo_Dev>& callback); |
208 int32_t SendTo(int32_t socket_id, | 206 int32_t SendTo(int32_t socket_id, |
209 const Var& data, | 207 const VarArrayBuffer& data, |
210 const std::string& address, | 208 const std::string& address, |
211 int32_t port, | 209 int32_t port, |
212 const CompletionCallbackWithOutput<WriteInfo_Dev>& callback); | 210 const CompletionCallbackWithOutput<WriteInfo_Dev>& callback); |
213 // TODO(yzshen): Support more powerful traits. | 211 // TODO(yzshen): Support more powerful traits. |
214 //int32_t Listen(int32_t socket_id, | 212 //int32_t Listen(int32_t socket_id, |
215 // const std::string& address, | 213 // const std::string& address, |
216 // int32_t port, | 214 // int32_t port, |
217 // const Optional<int32_t>& backlog, | 215 // const Optional<int32_t>& backlog, |
218 // const CompletionCallbackWithOutput<int32_t>& callback); | 216 // const CompletionCallbackWithOutput<int32_t>& callback); |
219 int32_t Accept(int32_t socket_id, | 217 int32_t Accept(int32_t socket_id, |
(...skipping 14 matching lines...) Expand all Loading... |
234 | 232 |
235 private: | 233 private: |
236 InstanceHandle instance_; | 234 InstanceHandle instance_; |
237 }; | 235 }; |
238 | 236 |
239 } // namespace socket | 237 } // namespace socket |
240 } // namespace ext | 238 } // namespace ext |
241 } // namespace pp | 239 } // namespace pp |
242 | 240 |
243 #endif // PPAPI_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_ | 241 #endif // PPAPI_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_ |
OLD | NEW |