Chromium Code Reviews| Index: ppapi/c/private/ppb_flash_udp_socket.h |
| diff --git a/ppapi/c/private/ppb_flash_udp_socket.h b/ppapi/c/private/ppb_flash_udp_socket.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..862df29368ed16ecef5513da18fafcb6f58a0d76 |
| --- /dev/null |
| +++ b/ppapi/c/private/ppb_flash_udp_socket.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_UDP_SOCKET_H_ |
| +#define PPAPI_C_PRIVATE_PPB_FLASH_UDP_SOCKET_H_ |
| + |
| +#include "ppapi/c/pp_bool.h" |
| +#include "ppapi/c/pp_completion_callback.h" |
| +#include "ppapi/c/pp_instance.h" |
| +#include "ppapi/c/pp_resource.h" |
| +#include "ppapi/c/pp_stdint.h" |
| +#include "ppapi/c/private/ppb_flash_tcp_socket.h" // for PP_Flash_NetAddress |
| + |
| +#define PPB_FLASH_UDPSOCKET_INTERFACE "PPB_Flash_UDPSocket;0.1" |
| + |
| +struct PPB_Flash_UDPSocket { |
| + PP_Resource (*Create)(PP_Instance instance, |
| + int32_t family); |
|
yzshen1
2011/09/07 18:00:36
Style: the parameters could fit in one line.
mtilburg
2011/09/15 23:13:32
Done.
|
| + |
|
yzshen1
2011/09/07 18:00:36
I think you probably need such a function
PP_Bool
mtilburg
2011/09/15 23:13:32
Done.
|
| + // creates a socket and binds to the address given by |addr|. |
|
yzshen1
2011/09/07 18:00:36
Please use sentence, starting with a capital lette
mtilburg
2011/09/15 23:13:32
Done.
|
| + int32_t (*Bind)(PP_Resource udp_socket, |
| + const struct PP_Flash_NetAddress* addr, |
|
yzshen1
2011/09/07 18:00:36
Have you considered using host + port?
Currently P
mtilburg
2011/09/15 23:13:32
I started a conversation with Trung about this...
|
| + struct PP_CompletionCallback callback); |
| + |
| + // non-blocking recvfrom call on socket. must call Bind first, |callback| is |
| + // invoked with recvfrom reads data |
| + int32_t (*RecvFrom)(PP_Resource udp_socket, |
| + char* buffer, |
| + int32_t num_bytes, |
| + const struct PP_Flash_NetAddress* addr, |
| + struct PP_CompletionCallback callback); |
| + |
| + // upon successful completion of RecvFrom, the address that the data |
| + // was received from is stored in |addr| |
| + PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, |
|
yzshen1
2011/09/07 18:00:36
What is the relationship between this |addr| and t
mtilburg
2011/09/15 23:13:32
I removed the one from RecvFrom, which was actuall
|
| + struct PP_Flash_NetAddress* addr); |
| + |
| + // non-blocking sendto call on socket. must call Bind first, |callback| is |
| + // invoked when sendto completes |
| + int32_t (*SendTo)(PP_Resource udp_socket, |
| + const char* buffer, |
| + int32_t num_bytes, |
| + const struct PP_Flash_NetAddress* addr, |
| + struct PP_CompletionCallback callback); |
| + |
| + // Cancels all pending reads and writes, and closes the socket. |
| + void (*Disconnect)(PP_Resource udp_socket); |
| +}; |
| + |
| +#endif // PPAPI_C_PRIVATE_PPB_FLASH_UDP_SOCKET_H_ |