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

Side by Side Diff: ppapi/c/dev/ppb_host_resolver_dev.h

Issue 16938011: Update comments of the Pepper networking APIs. (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 | « ppapi/api/dev/ppb_udp_socket_dev.idl ('k') | ppapi/c/dev/ppb_net_address_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
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 /* From dev/ppb_host_resolver_dev.idl modified Wed Jun 19 11:37:25 2013. */ 6 /* From dev/ppb_host_resolver_dev.idl modified Thu Jun 20 12:08:29 2013. */
7 7
8 #ifndef PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_ 8 #ifndef PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_
9 #define PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_ 9 #define PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_
10 10
11 #include "ppapi/c/dev/ppb_net_address_dev.h" 11 #include "ppapi/c/dev/ppb_net_address_dev.h"
12 #include "ppapi/c/pp_bool.h" 12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_completion_callback.h" 13 #include "ppapi/c/pp_completion_callback.h"
14 #include "ppapi/c/pp_instance.h" 14 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/c/pp_macros.h" 15 #include "ppapi/c/pp_macros.h"
16 #include "ppapi/c/pp_resource.h" 16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/pp_stdint.h" 17 #include "ppapi/c/pp_stdint.h"
18 #include "ppapi/c/pp_var.h" 18 #include "ppapi/c/pp_var.h"
19 19
20 #define PPB_HOSTRESOLVER_DEV_INTERFACE_0_1 "PPB_HostResolver(Dev);0.1" 20 #define PPB_HOSTRESOLVER_DEV_INTERFACE_0_1 "PPB_HostResolver(Dev);0.1"
21 #define PPB_HOSTRESOLVER_DEV_INTERFACE PPB_HOSTRESOLVER_DEV_INTERFACE_0_1 21 #define PPB_HOSTRESOLVER_DEV_INTERFACE PPB_HOSTRESOLVER_DEV_INTERFACE_0_1
22 22
23 /** 23 /**
24 * @file 24 * @file
25 * This file defines the <code>PPB_HostResolver_Dev</code> interface. 25 * This file defines the <code>PPB_HostResolver_Dev</code> interface.
26 * TODO(yzshen): Tidy up the document.
27 */ 26 */
28 27
29 28
30 /** 29 /**
31 * @addtogroup Enums 30 * @addtogroup Enums
32 * @{ 31 * @{
33 */ 32 */
34 /** 33 /**
35 * The <code>PP_HostResolver_Flags_Dev</code> is an enumeration of the 34 * <code>PP_HostResolver_Flags_Dev</code> is an enumeration of flags which can
36 * different types of flags, that can be OR-ed and passed to host 35 * be OR-ed and passed to the host resolver. Currently there is only one flag
37 * resolver. Currently there is only one flag defined. 36 * defined.
38 */ 37 */
39 typedef enum { 38 typedef enum {
40 /** 39 /**
41 * AI_CANONNAME 40 * Hint to request the canonical name of the host, which can be retrieved by
41 * <code>GetCanonicalName()</code>.
42 */ 42 */
43 PP_HOSTRESOLVER_FLAGS_CANONNAME = 1 << 0 43 PP_HOSTRESOLVER_FLAGS_CANONNAME = 1 << 0
44 } PP_HostResolver_Flags_Dev; 44 } PP_HostResolver_Flags_Dev;
45 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Flags_Dev, 4); 45 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Flags_Dev, 4);
46 /** 46 /**
47 * @} 47 * @}
48 */ 48 */
49 49
50 /** 50 /**
51 * @addtogroup Structs 51 * @addtogroup Structs
52 * @{ 52 * @{
53 */ 53 */
54 /**
55 * <code>PP_HostResolver_Hint_Dev</code> represents hints for host resolution.
56 */
54 struct PP_HostResolver_Hint_Dev { 57 struct PP_HostResolver_Hint_Dev {
58 /**
59 * Network address family.
60 */
55 PP_NetAddress_Family_Dev family; 61 PP_NetAddress_Family_Dev family;
62 /**
63 * Combination of flags from <code>PP_HostResolver_Flags_Dev</code>.
64 */
56 int32_t flags; 65 int32_t flags;
57 }; 66 };
58 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Hint_Dev, 8); 67 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Hint_Dev, 8);
59 /** 68 /**
60 * @} 69 * @}
61 */ 70 */
62 71
63 /** 72 /**
64 * @addtogroup Interfaces 73 * @addtogroup Interfaces
65 * @{ 74 * @{
66 */ 75 */
76 /**
77 * The <code>PPB_HostResolver_Dev</code> interface supports host name
78 * resolution.
79 *
80 * Permissions: In order to run <code>Resolve()</code>, apps permission
81 * <code>socket</code> with subrule <code>resolve-host</code> is required.
82 * For more details about network communication permissions, please see:
83 * http://developer.chrome.com/apps/app_network.html
84 */
67 struct PPB_HostResolver_Dev_0_1 { 85 struct PPB_HostResolver_Dev_0_1 {
68 /** 86 /**
69 * Allocates a Host Resolver resource. 87 * Creates a host resolver resource.
88 *
89 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
90 * a module.
91 *
92 * @return A <code>PP_Resource</code> corresponding to a host reslover or 0
93 * on failure.
70 */ 94 */
71 PP_Resource (*Create)(PP_Instance instance); 95 PP_Resource (*Create)(PP_Instance instance);
72 /** 96 /**
73 * Determines if a given resource is a Host Resolver. 97 * Determines if a given resource is a host resolver.
98 *
99 * @param[in] resource A <code>PP_Resource</code> to check.
100 *
101 * @return <code>PP_TRUE</code> if the input is a
102 * <code>PPB_HostResolver_Dev</code> resource; <code>PP_FALSE</code>
103 * otherwise.
74 */ 104 */
75 PP_Bool (*IsHostResolver)(PP_Resource resource); 105 PP_Bool (*IsHostResolver)(PP_Resource resource);
76 /** 106 /**
77 * Creates a new request to Host Resolver. |callback| is invoked when request 107 * Requests resolution of a host name. If the call completes successfully, the
78 * is processed and a list of network addresses is obtained. These addresses 108 * results can be retrieved by <code>GetCanonicalName()</code>,
79 * can be used in Connect, Bind or Listen calls to connect to a given |host| 109 * <code>GetNetAddressCount()</code> and <code>GetNetAddress()</code>.
80 * and |port|. 110 *
111 * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host
112 * resolver.
113 * @param[in] host The host name (or IP address literal) to resolve.
114 * @param[in] port The port number to be set in the resulting network
115 * addresses.
116 * @param[in] hint A <code>PP_HostResolver_Hint_Dev</code> structure providing
117 * hints for host resolution.
118 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
119 * completion.
120 *
121 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
122 * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have
123 * required permissions. <code>PP_ERROR_NAME_NOT_RESOLVED</code> will be
124 * returned if the host name couldn't be resolved.
81 */ 125 */
82 int32_t (*Resolve)(PP_Resource host_resolver, 126 int32_t (*Resolve)(PP_Resource host_resolver,
83 const char* host, 127 const char* host,
84 uint16_t port, 128 uint16_t port,
85 const struct PP_HostResolver_Hint_Dev* hint, 129 const struct PP_HostResolver_Hint_Dev* hint,
86 struct PP_CompletionCallback callback); 130 struct PP_CompletionCallback callback);
87 /** 131 /**
88 * Gets canonical name of host. Returns an undefined var if there is a pending 132 * Gets the canonical name of the host.
89 * Resolve call or the previous Resolve call failed. 133 *
134 * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host
135 * resolver.
136 *
137 * @return A string <code>PP_Var</code> on success, which is an empty string
138 * if <code>PP_HOSTRESOLVER_FLAGS_CANONNAME</code> is not set in the hint
139 * flags when calling <code>Resolve()</code>; an undefined <code>PP_Var</code>
140 * if there is a pending <code>Resolve()</code> call or the previous
141 * <code>Resolve()</code> call failed.
90 */ 142 */
91 struct PP_Var (*GetCanonicalName)(PP_Resource host_resolver); 143 struct PP_Var (*GetCanonicalName)(PP_Resource host_resolver);
92 /** 144 /**
93 * Gets number of network addresses obtained after Resolve call. Returns 0 if 145 * Gets the number of network addresses.
94 * there is a pending Resolve call or the previous Resolve call failed. 146 *
147 * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host
148 * resolver.
149 *
150 * @return The number of available network addresses on success; 0 if there is
151 * a pending <code>Resolve()</code> call or the previous
152 * <code>Resolve()</code> call failed.
95 */ 153 */
96 uint32_t (*GetNetAddressCount)(PP_Resource host_resolver); 154 uint32_t (*GetNetAddressCount)(PP_Resource host_resolver);
97 /** 155 /**
98 * Gets the |index|-th network address. 156 * Gets a network address.
99 * Returns 0 if there is a pending Resolve call or the previous Resolve call 157 *
100 * failed, or |index| is not less than the number of available addresses. 158 * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host
159 * resolver.
160 * @param[in] index An index indicating which address to return.
161 *
162 * @return A <code>PPB_NetAddress_Dev</code> resource on success; 0 if there
163 * is a pending <code>Resolve()</code> call or the previous
164 * <code>Resolve()</code> call failed, or the specified index is out of range.
101 */ 165 */
102 PP_Resource (*GetNetAddress)(PP_Resource host_resolver, uint32_t index); 166 PP_Resource (*GetNetAddress)(PP_Resource host_resolver, uint32_t index);
103 }; 167 };
104 168
105 typedef struct PPB_HostResolver_Dev_0_1 PPB_HostResolver_Dev; 169 typedef struct PPB_HostResolver_Dev_0_1 PPB_HostResolver_Dev;
106 /** 170 /**
107 * @} 171 * @}
108 */ 172 */
109 173
110 #endif /* PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_ */ 174 #endif /* PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_ */
111 175
OLDNEW
« no previous file with comments | « ppapi/api/dev/ppb_udp_socket_dev.idl ('k') | ppapi/c/dev/ppb_net_address_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698