OLD | NEW |
1 /* Copyright 2013 The Chromium Authors. All rights reserved. | 1 /* Copyright 2013 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 /** | 6 /** |
7 * This file defines the <code>PPB_UDPSocket_Dev</code> interface. | 7 * This file defines the <code>PPB_UDPSocket_Dev</code> interface. |
8 */ | 8 */ |
9 | 9 |
10 [generate_thunk] | 10 [generate_thunk] |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 * <code>PPB_UDPSocket_Dev</code> resource; <code>PP_FALSE</code> | 85 * <code>PPB_UDPSocket_Dev</code> resource; <code>PP_FALSE</code> |
86 * otherwise. | 86 * otherwise. |
87 */ | 87 */ |
88 PP_Bool IsUDPSocket([in] PP_Resource resource); | 88 PP_Bool IsUDPSocket([in] PP_Resource resource); |
89 | 89 |
90 /** | 90 /** |
91 * Binds to the given address. | 91 * Binds to the given address. |
92 * | 92 * |
93 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP | 93 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
94 * socket. | 94 * socket. |
95 * @param[in] addr A <code>PPB_NetAddress_Dev</code> resource. | 95 * @param[in] addr A <code>PPB_NetAddress</code> resource. |
96 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 96 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
97 * completion. | 97 * completion. |
98 * | 98 * |
99 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 99 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
100 * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have | 100 * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have |
101 * required permissions. <code>PP_ERROR_ADDRESS_IN_USE</code> will be returned | 101 * required permissions. <code>PP_ERROR_ADDRESS_IN_USE</code> will be returned |
102 * if the address is already in use. | 102 * if the address is already in use. |
103 */ | 103 */ |
104 int32_t Bind([in] PP_Resource udp_socket, | 104 int32_t Bind([in] PP_Resource udp_socket, |
105 [in] PP_Resource addr, | 105 [in] PP_Resource addr, |
106 [in] PP_CompletionCallback callback); | 106 [in] PP_CompletionCallback callback); |
107 | 107 |
108 /** | 108 /** |
109 * Get the address that the socket has bound to. It can only be called after | 109 * Get the address that the socket has bound to. It can only be called after |
110 * a successful <code>Bind()</code> call. | 110 * a successful <code>Bind()</code> call. |
111 * | 111 * |
112 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP | 112 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
113 * socket. | 113 * socket. |
114 * | 114 * |
115 * @return A <code>PPB_NetAddress_Dev</code> resource on success or 0 on | 115 * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. |
116 * failure. | |
117 */ | 116 */ |
118 PP_Resource GetBoundAddress([in] PP_Resource udp_socket); | 117 PP_Resource GetBoundAddress([in] PP_Resource udp_socket); |
119 | 118 |
120 /** | 119 /** |
121 * Receives data from the socket and stores the source address. It can only be | 120 * Receives data from the socket and stores the source address. It can only be |
122 * called after a successful <code>Bind()</code> call. | 121 * called after a successful <code>Bind()</code> call. |
123 * | 122 * |
124 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP | 123 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
125 * socket. | 124 * socket. |
126 * @param[out] buffer The buffer to store the received data on success. It | 125 * @param[out] buffer The buffer to store the received data on success. It |
127 * must be at least as large as <code>num_bytes</code>. | 126 * must be at least as large as <code>num_bytes</code>. |
128 * @param[in] num_bytes The number of bytes to read. | 127 * @param[in] num_bytes The number of bytes to read. |
129 * @param[out] addr A <code>PPB_NetAddress_Dev</code> resource to store the | 128 * @param[out] addr A <code>PPB_NetAddress</code> resource to store the source |
130 * source address on success. | 129 * address on success. |
131 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 130 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
132 * completion. | 131 * completion. |
133 * | 132 * |
134 * @return A non-negative number on success to indicate how many bytes have | 133 * @return A non-negative number on success to indicate how many bytes have |
135 * been received; otherwise, an error code from <code>pp_errors.h</code>. | 134 * been received; otherwise, an error code from <code>pp_errors.h</code>. |
136 */ | 135 */ |
137 int32_t RecvFrom([in] PP_Resource udp_socket, | 136 int32_t RecvFrom([in] PP_Resource udp_socket, |
138 [out] str_t buffer, | 137 [out] str_t buffer, |
139 [in] int32_t num_bytes, | 138 [in] int32_t num_bytes, |
140 [out] PP_Resource addr, | 139 [out] PP_Resource addr, |
141 [in] PP_CompletionCallback callback); | 140 [in] PP_CompletionCallback callback); |
142 | 141 |
143 /** | 142 /** |
144 * Sends data to a specific destination. It can only be called after a | 143 * Sends data to a specific destination. It can only be called after a |
145 * successful <code>Bind()</code> call. | 144 * successful <code>Bind()</code> call. |
146 * | 145 * |
147 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP | 146 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
148 * socket. | 147 * socket. |
149 * @param[in] buffer The buffer containing the data to send. | 148 * @param[in] buffer The buffer containing the data to send. |
150 * @param[in] num_bytes The number of bytes to send. | 149 * @param[in] num_bytes The number of bytes to send. |
151 * @param[in] addr A <code>PPB_NetAddress_Dev</code> resource holding the | 150 * @param[in] addr A <code>PPB_NetAddress</code> resource holding the target |
152 * target address. | 151 * address. |
153 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 152 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
154 * completion. | 153 * completion. |
155 * | 154 * |
156 * @return A non-negative number on success to indicate how many bytes have | 155 * @return A non-negative number on success to indicate how many bytes have |
157 * been sent; otherwise, an error code from <code>pp_errors.h</code>. | 156 * been sent; otherwise, an error code from <code>pp_errors.h</code>. |
158 * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have | 157 * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have |
159 * required permissions. | 158 * required permissions. |
160 */ | 159 */ |
161 int32_t SendTo([in] PP_Resource udp_socket, | 160 int32_t SendTo([in] PP_Resource udp_socket, |
162 [in] str_t buffer, | 161 [in] str_t buffer, |
(...skipping 28 matching lines...) Expand all Loading... |
191 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 190 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
192 * completion. | 191 * completion. |
193 * | 192 * |
194 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 193 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
195 */ | 194 */ |
196 int32_t SetOption([in] PP_Resource udp_socket, | 195 int32_t SetOption([in] PP_Resource udp_socket, |
197 [in] PP_UDPSocket_Option_Dev name, | 196 [in] PP_UDPSocket_Option_Dev name, |
198 [in] PP_Var value, | 197 [in] PP_Var value, |
199 [in] PP_CompletionCallback callback); | 198 [in] PP_CompletionCallback callback); |
200 }; | 199 }; |
OLD | NEW |