1 /* Copyright (c) 2012 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.
6 /* From private/ppb_host_resolver_private.idl,
7 * modified Mon Jun 24 09:49:40 2013.
10 #ifndef PPAPI_C_PRIVATE_PPB_HOST_RESOLVER_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_HOST_RESOLVER_PRIVATE_H_
13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_macros.h"
17 #include "ppapi/c/pp_resource.h"
18 #include "ppapi/c/pp_stdint.h"
19 #include "ppapi/c/pp_var.h"
20 #include "ppapi/c/private/ppb_net_address_private.h"
22 #define PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1 "PPB_HostResolver_Private;0.1"
23 #define PPB_HOSTRESOLVER_PRIVATE_INTERFACE \
24 PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1
28 * This file defines the <code>PPB_HostResolver_Private</code> interface.
37 * The <code>PP_HostResolver_Flags</code> is an enumeration of the
38 * different types of flags, that can be OR-ed and passed to host
45 PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME
= 1 << 0,
47 * Hint to the resolver that only loopback addresses are configured.
49 PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY
= 1 << 1
50 } PP_HostResolver_Private_Flags
;
51 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Private_Flags
, 4);
60 struct PP_HostResolver_Private_Hint
{
61 PP_NetAddressFamily_Private family
;
64 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Private_Hint
, 8);
70 * @addtogroup Interfaces
73 struct PPB_HostResolver_Private_0_1
{
75 * Allocates a Host Resolver resource.
77 PP_Resource (*Create
)(PP_Instance instance
);
79 * Determines if a given resource is a Host Resolver.
81 PP_Bool (*IsHostResolver
)(PP_Resource resource
);
83 * Creates a new request to Host Resolver. |callback| is invoked
84 * when request is processed and a list of network addresses is
85 * obtained. These addresses can be be used in Connect, Bind or
86 * Listen calls to connect to a given |host| and |port|.
88 int32_t (*Resolve
)(PP_Resource host_resolver
,
91 const struct PP_HostResolver_Private_Hint
* hint
,
92 struct PP_CompletionCallback callback
);
94 * Returns canonical name of host.
96 struct PP_Var (*GetCanonicalName
)(PP_Resource host_resolver
);
98 * Returns number of network addresses obtained after Resolve call.
100 uint32_t (*GetSize
)(PP_Resource host_resolver
);
102 * Stores in the |addr| |index|-th network address. |addr| can't be
103 * NULL. Returns PP_TRUE if success or PP_FALSE if the given
104 * resource is not a Host Resolver or |index| exceeds number of
105 * available addresses.
107 PP_Bool (*GetNetAddress
)(PP_Resource host_resolver
,
109 struct PP_NetAddress_Private
* addr
);
112 typedef struct PPB_HostResolver_Private_0_1 PPB_HostResolver_Private
;
117 #endif /* PPAPI_C_PRIVATE_PPB_HOST_RESOLVER_PRIVATE_H_ */