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

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
« no previous file with comments | « native_client_sdk/src/build_tools/sdk_files.list ('k') | ppapi/c/dev/ppb_tcp_socket_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
37 /**
38 * The <code>PPB_TCPSocket_Dev</code> interface provides TCP socket operations.
39 */
40 interface PPB_TCPSocket_Dev {
41 /**
42 * Allocates a TCP socket resource.
43 */
44 PP_Resource Create([in] PP_Instance instance);
45
46 /**
47 * Determines if a given resource is TCP socket.
48 */
49 PP_Bool IsTCPSocket([in] PP_Resource resource);
50
51 /**
52 * Connects to an address given by |addr|, which is a PPB_NetAddress_Dev
53 * resource.
54 */
55 int32_t Connect([in] PP_Resource tcp_socket,
56 [in] PP_Resource addr,
57 [in] PP_CompletionCallback callback);
58
59 /**
60 * Gets the local address of the socket, if it has been connected.
61 * Returns a PPB_NetAddress_Dev resource on success; returns 0 on failure.
62 */
63 PP_Resource GetLocalAddress([in] PP_Resource tcp_socket);
64
65 /**
66 * Gets the remote address of the socket, if it has been connected.
67 * Returns a PPB_NetAddress_Dev resource on success; returns 0 on failure.
68 */
69 PP_Resource GetRemoteAddress([in] PP_Resource tcp_socket);
70
71 /**
72 * Reads data from the socket. The size of |buffer| must be at least as large
73 * as |bytes_to_read|. May perform a partial read. Returns the number of bytes
74 * read or an error code. If the return value is 0, then it indicates that
75 * end-of-file was reached.
76 *
77 * Multiple outstanding read requests are not supported.
78 */
79 int32_t Read([in] PP_Resource tcp_socket,
80 [out] str_t buffer,
81 [in] int32_t bytes_to_read,
82 [in] PP_CompletionCallback callback);
83
84 /**
85 * Writes data to the socket. May perform a partial write. Returns the number
86 * of bytes written or an error code.
87 *
88 * Multiple outstanding write requests are not supported.
89 */
90 int32_t Write([in] PP_Resource tcp_socket,
91 [in] str_t buffer,
92 [in] int32_t bytes_to_write,
93 [in] PP_CompletionCallback callback);
94
95 /**
96 * Cancels any IO that may be pending, and disconnects the socket. Any pending
97 * callbacks will still run, reporting PP_ERROR_ABORTED if pending IO was
98 * interrupted. It is NOT valid to call Connect() again after a call to this
99 * method. Note: If the socket is destroyed when it is still connected, then
100 * it will be implicitly disconnected, so you are not required to call this
101 * method.
102 */
103 void Close([in] PP_Resource tcp_socket);
104
105 /**
106 * Sets an option on |tcp_socket|. Supported |name| and |value| parameters
107 * are as described for PP_TCPSocketOption_Dev. |callback| will be
108 * invoked with PP_OK if setting the option succeeds, or an error code
109 * otherwise. The socket must be connected before SetOption is called.
110 */
111 int32_t SetOption([in] PP_Resource tcp_socket,
112 [in] PP_TCPSocket_Option_Dev name,
113 [in] PP_Var value,
114 [in] PP_CompletionCallback callback);
115 };
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/sdk_files.list ('k') | ppapi/c/dev/ppb_tcp_socket_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698