summaryrefslogtreecommitdiffstats
path: root/ppapi/api/private/ppb_host_resolver_private.idl
blob: f7b0e4a5c29766255a7f9c35f5a407adeb9ff824 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/**
 * This file defines the <code>PPB_HostResolver_Private</code> interface.
 */

label Chrome {
  M19 = 0.1
};

/**
 * The <code>PP_HostResolver_Flags</code> is an enumeration of the
 * different types of flags, that can be OR-ed and passed to host
 * resolver.
 */
[assert_size(4)]
enum PP_HostResolver_Private_Flags {
  /**
   * AI_CANONNAME
   */
  PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME = 1 << 0,
  /**
   * Hint to the resolver that only loopback addresses are configured.
   */
  PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY = 1 << 1
};

[assert_size(8)]
struct PP_HostResolver_Private_Hint {
  PP_NetAddressFamily_Private family;
  int32_t flags;
};

interface PPB_HostResolver_Private {
  /**
   * Allocates a Host Resolver resource.
   */
  PP_Resource Create([in] PP_Instance instance);

  /**
   * Determines if a given resource is a Host Resolver.
   */
  PP_Bool IsHostResolver([in] PP_Resource resource);

  /**
   * Creates a new request to Host Resolver. |callback| is invoked
   * when request is processed and a list of network addresses is
   * obtained. These addresses can be be used in Connect, Bind or
   * Listen calls to connect to a given |host| and |port|.
   */
  int32_t Resolve([in] PP_Resource host_resolver,
                  [in] str_t host,
                  [in] uint16_t port,
                  [in] PP_HostResolver_Private_Hint hint,
                  [in] PP_CompletionCallback callback);

  /**
   * Returns canonical name of host.
   */
  PP_Var GetCanonicalName([in] PP_Resource host_resolver);

  /**
   * Returns number of network addresses obtained after Resolve call.
   */
  uint32_t GetSize([in] PP_Resource host_resolver);

  /**
   * Stores in the |addr| |index|-th network address. |addr| can't be
   * NULL. Returns PP_TRUE if success or PP_FALSE if the given
   * resource is not a Host Resolver or |index| exceeds number of
   * available addresses.
  */
  PP_Bool GetNetAddress([in] PP_Resource host_resolver,
                        [in] uint32_t index,
                        [out] PP_NetAddress_Private addr);
};