Move render_view_context_menu.* and related files out of tab_contents.
[chromium-blink-merge.git] / ppapi / api / ppb_host_resolver.idl
blob20ff906a37f2822b491b5dced5f9d494579b3290
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
3 * found in the LICENSE file.
4 */
6 /**
7 * This file defines the <code>PPB_HostResolver</code> interface.
8 */
10 [generate_thunk]
12 label Chrome {
13 M29 = 1.0
16 /**
17 * <code>PP_HostResolver_Flag</code> is an enumeration of flags which can be
18 * OR-ed and passed to the host resolver. Currently there is only one flag
19 * defined.
21 [assert_size(4)]
22 enum PP_HostResolver_Flag {
23 /**
24 * Hint to request the canonical name of the host, which can be retrieved by
25 * <code>GetCanonicalName()</code>.
27 PP_HOSTRESOLVER_FLAG_CANONNAME = 1 << 0
30 /**
31 * <code>PP_HostResolver_Hint</code> represents hints for host resolution.
33 [assert_size(8)]
34 struct PP_HostResolver_Hint {
35 /**
36 * Network address family.
38 PP_NetAddress_Family family;
39 /**
40 * Combination of flags from <code>PP_HostResolver_Flag</code>.
42 int32_t flags;
45 /**
46 * The <code>PPB_HostResolver</code> interface supports host name
47 * resolution.
49 * Permissions: In order to run <code>Resolve()</code>, apps permission
50 * <code>socket</code> with subrule <code>resolve-host</code> is required.
51 * For more details about network communication permissions, please see:
52 * http://developer.chrome.com/apps/app_network.html
54 interface PPB_HostResolver {
55 /**
56 * Creates a host resolver resource.
58 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
59 * a module.
61 * @return A <code>PP_Resource</code> corresponding to a host reslover or 0
62 * on failure.
64 PP_Resource Create([in] PP_Instance instance);
66 /**
67 * Determines if a given resource is a host resolver.
69 * @param[in] resource A <code>PP_Resource</code> to check.
71 * @return <code>PP_TRUE</code> if the input is a
72 * <code>PPB_HostResolver</code> resource; <code>PP_FALSE</code> otherwise.
74 PP_Bool IsHostResolver([in] PP_Resource resource);
76 /**
77 * Requests resolution of a host name. If the call completes successfully, the
78 * results can be retrieved by <code>GetCanonicalName()</code>,
79 * <code>GetNetAddressCount()</code> and <code>GetNetAddress()</code>.
81 * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host
82 * resolver.
83 * @param[in] host The host name (or IP address literal) to resolve.
84 * @param[in] port The port number to be set in the resulting network
85 * addresses.
86 * @param[in] hint A <code>PP_HostResolver_Hint</code> structure providing
87 * hints for host resolution.
88 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
89 * completion.
91 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
92 * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have
93 * required permissions. <code>PP_ERROR_NAME_NOT_RESOLVED</code> will be
94 * returned if the host name couldn't be resolved.
96 int32_t Resolve([in] PP_Resource host_resolver,
97 [in] str_t host,
98 [in] uint16_t port,
99 [in] PP_HostResolver_Hint hint,
100 [in] PP_CompletionCallback callback);
103 * Gets the canonical name of the host.
105 * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host
106 * resolver.
108 * @return A string <code>PP_Var</code> on success, which is an empty string
109 * if <code>PP_HOSTRESOLVER_FLAG_CANONNAME</code> is not set in the hint flags
110 * when calling <code>Resolve()</code>; an undefined <code>PP_Var</code> if
111 * there is a pending <code>Resolve()</code> call or the previous
112 * <code>Resolve()</code> call failed.
114 PP_Var GetCanonicalName([in] PP_Resource host_resolver);
117 * Gets the number of network addresses.
119 * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host
120 * resolver.
122 * @return The number of available network addresses on success; 0 if there is
123 * a pending <code>Resolve()</code> call or the previous
124 * <code>Resolve()</code> call failed.
126 uint32_t GetNetAddressCount([in] PP_Resource host_resolver);
129 * Gets a network address.
131 * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host
132 * resolver.
133 * @param[in] index An index indicating which address to return.
135 * @return A <code>PPB_NetAddress</code> resource on success; 0 if there is a
136 * pending <code>Resolve()</code> call or the previous <code>Resolve()</code>
137 * call failed, or the specified index is out of range.
139 PP_Resource GetNetAddress([in] PP_Resource host_resolver,
140 [in] uint32_t index);