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

Side by Side Diff: ppapi/api/dev/ppb_udp_socket_dev.idl

Issue 16282005: Introduce PPB_UDPSocket_Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
(Empty)
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
3 * found in the LICENSE file.
4 */
5
6 /**
7 * This file defines the <code>PPB_UDPSocket_Dev</code> interface.
8 */
9
10 [generate_thunk]
11
12 label Chrome {
13 M29 = 0.1
14 };
15
16 [assert_size(4)]
17 enum PP_UDPSocket_Option_Dev {
18 // Allows the socket to share the local address to which socket will
bbudge 2013/06/10 12:59:56 s/to which socket/to which it/
yzshen1 2013/06/10 22:10:35 Done.
19 // be bound with other processes. Value's type should be PP_VARTYPE_BOOL.
20 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0,
21
22 // Allows sending and receiving packets sent to and from broadcast addresses.
bbudge 2013/06/10 12:59:56 s/sent//
yzshen1 2013/06/10 22:10:35 Done.
23 // Value's type should be PP_VARTYPE_BOOL.
24 PP_UDPSOCKET_OPTION_BROADCAST = 1,
25
26 // Specifies the total per-socket buffer space reserved for sends. Value's
27 // type should be PP_VARTYPE_INT32.
28 // Note: This is only treated as a hint for the browser to set the buffer
29 // size. Even if SetOption() reports that this option has been successfully
30 // set, the browser doesn't guarantee to conform to it.
31 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2,
32
33 // Specifies the total per-socket buffer space reserved for receives. Value's
34 // type should be PP_VARTYPE_INT32.
35 // Note: This is only treated as a hint for the browser to set the buffer
36 // size. Even if SetOption() reports that this option has been successfully
37 // set, the browser doesn't guarantee to conform to it.
38 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3,
39
40 // Specifies the receiving timeout. Value's type should be PP_VARTYPE_DOUBLE
41 // which is in seconds. 0 (the default value) means the operation will never
42 // timeout.
43 PP_UDPSOCKET_OPTION_RECV_TIMEOUT = 4
44 };
45
46 interface PPB_UDPSocket_Dev {
47 /**
48 * Creates a UDP socket resource.
49 */
50 PP_Resource Create([in] PP_Instance instance);
51
52 /**
53 * Determines if a given resource is a UDP socket.
54 */
55 PP_Bool IsUDPSocket([in] PP_Resource resource);
56
57 /**
58 * Binds to the address given by |addr|.
bbudge 2013/06/10 12:59:56 'addr' is a NetAddress?
yzshen1 2013/06/10 22:10:35 Done.
59 */
60 int32_t Bind([in] PP_Resource udp_socket,
61 [in] PP_Resource addr,
62 [in] PP_CompletionCallback callback);
63
64 /**
65 * Returns the address that the socket has bound to. A successful call to
66 * Bind must be called first. Returns 0 if Bind fails, or if Close has
67 * been called.
bbudge 2013/06/10 12:59:56 'addr' is a NetAddress? Here and below. Perhaps a
yzshen1 2013/06/10 22:10:35 Done. I will also tidy up the document to use tags
68 */
69 PP_Resource GetBoundAddress([in] PP_Resource udp_socket);
70
71 /**
72 * Performs a non-blocking recvfrom call on socket.
73 * Bind must be called first. |callback| is invoked when recvfrom reads data.
74 */
75 int32_t RecvFrom([in] PP_Resource udp_socket,
76 [out] str_t buffer,
77 [in] int32_t num_bytes,
78 [out] PP_Resource addr,
79 [in] PP_CompletionCallback callback);
80
81 /**
82 * Performs a non-blocking sendto call on the socket created and bound (has
83 * already called Bind). The callback |callback| is invoked when sendto
84 * completes.
85 */
86 int32_t SendTo([in] PP_Resource udp_socket,
87 [in] str_t buffer,
88 [in] int32_t num_bytes,
89 [in] PP_Resource addr,
90 [in] PP_CompletionCallback callback);
91
92 /**
93 * Cancels all pending reads and writes, and closes the socket.
94 */
95 void Close([in] PP_Resource udp_socket);
96
97 /**
98 * Sets a socket option to |udp_socket|. Should be called before Bind().
99 * Possible values for |name|, |value| and |value|'s type are described in
100 * PP_UDPSocketOption_Dev description. If no error occurs, returns PP_OK.
101 * Otherwise, returns PP_ERROR_BADRESOURCE (if bad |udp_socket| provided),
102 * PP_ERROR_BADARGUMENT (if bad name/value/value's type provided) or
103 * PP_ERROR_FAILED in the case of internal errors.
104 */
105 int32_t SetOption([in] PP_Resource udp_socket,
106 [in] PP_UDPSocket_Option_Dev name,
107 [in] PP_Var value,
108 [in] PP_CompletionCallback callback);
109 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698