Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

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

Issue 16667002: Introduce PPB_TCPSocket_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_TCPSocket_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_TCPSocket_Option_Dev {
18 // Disables coalescing of small writes to make TCP segments, and instead
19 // deliver data immediately. Value type is PP_VARTYPE_BOOL.
20 PP_TCPSOCKET_OPTION_NO_DELAY = 0,
21
22 // Specifies the socket send buffer in bytes. Value's type should be
23 // PP_VARTYPE_INT32.
24 // Note: This is only treated as a hint for the browser to set the buffer
25 // size. Even if SetOption() reports that this option has been successfully
26 // set, the browser doesn't guarantee to conform to it.
27 PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1,
28
29 // Specifies the socket receive buffer in bytes. Value's type should be
30 // PP_VARTYPE_INT32.
31 // Note: This is only treated as a hint for the browser to set the buffer
32 // size. Even if SetOption() reports that this option has been successfully
33 // set, the browser doesn't guarantee to conform to it.
34 PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2,
35
36 // Specifies the sending timeout. Value's type should be PP_VARTYPE_DOUBLE
37 // which is in seconds. 0 (the default value) means the operation will never
38 // timeout.
39 PP_TCPSOCKET_OPTION_SEND_TIMEOUT = 3,
40
41 // Specifies the receiving timeout. Value's type should be PP_VARTYPE_DOUBLE
42 // which is in seconds. 0 (the default value) means the operation will never
43 // timeout.
44 PP_TCPSOCKET_OPTION_RECV_TIMEOUT = 4
45 };
46
47 /**
48 * The <code>PPB_TCPSocket_Dev</code> interface provides TCP socket operations.
49 */
50 interface PPB_TCPSocket_Dev {
51 /**
52 * Allocates a TCP socket resource.
53 */
54 PP_Resource Create([in] PP_Instance instance);
55
56 /**
57 * Determines if a given resource is TCP socket.
58 */
59 PP_Bool IsTCPSocket([in] PP_Resource resource);
60
61 /**
62 * Connects to an address given by |addr|.
dmichael (off chromium) 2013/06/11 21:15:26 which is a PPB_NetAddress_Dev resource?
yzshen1 2013/06/12 05:20:54 Done.
63 */
64 int32_t Connect([in] PP_Resource tcp_socket,
65 [in] PP_Resource addr,
66 [in] PP_CompletionCallback callback);
67
68 /**
69 * Gets the local address of the socket, if it has been connected.
dmichael (off chromium) 2013/06/11 21:15:26 Probably ought to mention that it returns a PPB_Ne
yzshen1 2013/06/12 05:20:54 Done.
70 * Returns 0 on failure.
71 */
72 PP_Resource GetLocalAddress([in] PP_Resource tcp_socket);
73
74 /**
75 * Gets the remote address of the socket, if it has been connected.
76 * Returns 0 on failure.
77 */
78 PP_Resource GetRemoteAddress([in] PP_Resource tcp_socket);
79
80 /**
81 * Reads data from the socket. The size of |buffer| must be at least as large
82 * as |bytes_to_read|. May perform a partial read. Returns the number of bytes
83 * read or an error code. If the return value is 0, then it indicates that
84 * end-of-file was reached.
85 * Multiple outstanding read requests are not supported.
dmichael (off chromium) 2013/06/11 21:15:26 nit: I would put a blank comment line if this is a
yzshen1 2013/06/12 05:20:54 Done.
86 */
87 int32_t Read([in] PP_Resource tcp_socket,
88 [out] str_t buffer,
89 [in] int32_t bytes_to_read,
90 [in] PP_CompletionCallback callback);
91
92 /**
93 * Writes data to the socket. May perform a partial write. Returns the number
94 * of bytes written or an error code.
95 * Multiple outstanding write requests are not supported.
96 */
97 int32_t Write([in] PP_Resource tcp_socket,
98 [in] str_t buffer,
99 [in] int32_t bytes_to_write,
100 [in] PP_CompletionCallback callback);
101
102 /**
103 * Cancels any IO that may be pending, and disconnects the socket. Any pending
104 * callbacks will still run, reporting PP_ERROR_ABORTED if pending IO was
105 * interrupted. It is NOT valid to call Connect() again after a call to this
106 * method. Note: If the socket is destroyed when it is still connected, then
107 * it will be implicitly disconnected, so you are not required to call this
108 * method.
109 */
110 void Close([in] PP_Resource tcp_socket);
111
112 /**
113 * Sets an option on |tcp_socket|. Supported |name| and |value| parameters
114 * are as described for PP_TCPSocketOption_Dev. |callback| will be
115 * invoked with PP_OK if setting the option succeeds, or an error code
116 * otherwise. The socket must be connected before SetOption is called.
117 */
118 int32_t SetOption([in] PP_Resource tcp_socket,
119 [in] PP_TCPSocket_Option_Dev name,
120 [in] PP_Var value,
121 [in] PP_CompletionCallback callback);
122 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698