Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: ppapi/c/private/ppb_udp_socket_private.h

Issue 9212047: Add GetBoundAddress to PPB_UDPSocket_Private (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: add a few more unit tests, updates from review Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 5
6 /* From private/ppb_udp_socket_private.idl modified Wed Nov 16 15:27:20 2011. */ 6 /* From private/ppb_udp_socket_private.idl modified Wed Feb 8 14:07:18 2012. */
7 7
8 #ifndef PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ 8 #ifndef PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_
9 #define PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ 9 #define PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_
10 10
11 #include "ppapi/c/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h" 14 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_stdint.h" 16 #include "ppapi/c/pp_stdint.h"
17 #include "ppapi/c/private/ppb_net_address_private.h" 17 #include "ppapi/c/private/ppb_net_address_private.h"
18 18
19 #define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2 "PPB_UDPSocket_Private;0.2" 19 #define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2 "PPB_UDPSocket_Private;0.2"
20 #define PPB_UDPSOCKET_PRIVATE_INTERFACE PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2 20 #define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_UDPSocket_Private;0.3"
21 #define PPB_UDPSOCKET_PRIVATE_INTERFACE PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3
21 22
22 /** 23 /**
23 * @file 24 * @file
24 * This file defines the <code>PPB_UDPSocket_Private</code> interface. 25 * This file defines the <code>PPB_UDPSocket_Private</code> interface.
25 */ 26 */
26 27
27 28
28 /** 29 /**
29 * @addtogroup Interfaces 30 * @addtogroup Interfaces
30 * @{ 31 * @{
31 */ 32 */
32 struct PPB_UDPSocket_Private_0_2 { 33 struct PPB_UDPSocket_Private_0_3 {
33 /** 34 /**
34 * Creates a UDP socket resource. 35 * Creates a UDP socket resource.
35 */ 36 */
36 PP_Resource (*Create)(PP_Instance instance_id); 37 PP_Resource (*Create)(PP_Instance instance_id);
37 /** 38 /**
38 * Determines if a given resource is a UDP socket. 39 * Determines if a given resource is a UDP socket.
39 */ 40 */
40 PP_Bool (*IsUDPSocket)(PP_Resource resource_id); 41 PP_Bool (*IsUDPSocket)(PP_Resource resource_id);
41 /* Creates a socket and binds to the address given by |addr|. */ 42 /* Creates a socket and binds to the address given by |addr|. */
42 int32_t (*Bind)(PP_Resource udp_socket, 43 int32_t (*Bind)(PP_Resource udp_socket,
43 const struct PP_NetAddress_Private* addr, 44 const struct PP_NetAddress_Private* addr,
44 struct PP_CompletionCallback callback); 45 struct PP_CompletionCallback callback);
46 /* Returns the address that the socket has bound to. A successful
47 * call to Bind must be called first. Returns false if Bind fails,
dmichael (off chromium) 2012/02/08 16:05:20 nit: false->PP_FALSE
mtilburg1 2012/02/09 11:08:06 Done.
48 * or if Close has been called.
49 */
50 PP_Bool (*GetBoundAddress)(PP_Resource udp_socket,
51 struct PP_NetAddress_Private* addr);
45 /* Performs a non-blocking recvfrom call on socket. 52 /* Performs a non-blocking recvfrom call on socket.
46 * Bind must be called first. |callback| is invoked when recvfrom 53 * Bind must be called first. |callback| is invoked when recvfrom
47 * reads data. You must call GetRecvFromAddress to recover the 54 * reads data. You must call GetRecvFromAddress to recover the
48 * address the data was retrieved from. 55 * address the data was retrieved from.
49 */ 56 */
50 int32_t (*RecvFrom)(PP_Resource udp_socket, 57 int32_t (*RecvFrom)(PP_Resource udp_socket,
51 char* buffer, 58 char* buffer,
52 int32_t num_bytes, 59 int32_t num_bytes,
53 struct PP_CompletionCallback callback); 60 struct PP_CompletionCallback callback);
54 /* Upon successful completion of RecvFrom, the address that the data 61 /* Upon successful completion of RecvFrom, the address that the data
55 * was received from is stored in |addr|. 62 * was received from is stored in |addr|.
56 */ 63 */
57 PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, 64 PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket,
58 struct PP_NetAddress_Private* addr); 65 struct PP_NetAddress_Private* addr);
59 /* Performs a non-blocking sendto call on the socket created and 66 /* Performs a non-blocking sendto call on the socket created and
60 * bound(has already called Bind). The callback |callback| is 67 * bound(has already called Bind). The callback |callback| is
61 * invoked when sendto completes. 68 * invoked when sendto completes.
62 */ 69 */
63 int32_t (*SendTo)(PP_Resource udp_socket, 70 int32_t (*SendTo)(PP_Resource udp_socket,
64 const char* buffer, 71 const char* buffer,
65 int32_t num_bytes, 72 int32_t num_bytes,
66 const struct PP_NetAddress_Private* addr, 73 const struct PP_NetAddress_Private* addr,
67 struct PP_CompletionCallback callback); 74 struct PP_CompletionCallback callback);
68 /* Cancels all pending reads and writes, and closes the socket. */ 75 /* Cancels all pending reads and writes, and closes the socket. */
69 void (*Close)(PP_Resource udp_socket); 76 void (*Close)(PP_Resource udp_socket);
70 }; 77 };
71 78
72 typedef struct PPB_UDPSocket_Private_0_2 PPB_UDPSocket_Private; 79 typedef struct PPB_UDPSocket_Private_0_3 PPB_UDPSocket_Private;
80
81 struct PPB_UDPSocket_Private_0_2 {
82 PP_Resource (*Create)(PP_Instance instance_id);
83 PP_Bool (*IsUDPSocket)(PP_Resource resource_id);
84 int32_t (*Bind)(PP_Resource udp_socket,
85 const struct PP_NetAddress_Private* addr,
86 struct PP_CompletionCallback callback);
87 int32_t (*RecvFrom)(PP_Resource udp_socket,
88 char* buffer,
89 int32_t num_bytes,
90 struct PP_CompletionCallback callback);
91 PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket,
92 struct PP_NetAddress_Private* addr);
93 int32_t (*SendTo)(PP_Resource udp_socket,
94 const char* buffer,
95 int32_t num_bytes,
96 const struct PP_NetAddress_Private* addr,
97 struct PP_CompletionCallback callback);
98 void (*Close)(PP_Resource udp_socket);
99 };
73 /** 100 /**
74 * @} 101 * @}
75 */ 102 */
76 103
77 #endif /* PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ */ 104 #endif /* PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ */
78 105
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698