• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 */
5
6/**
7 * This file defines the <code>PPB_NetAddress_Private</code> interface.
8 */
9
10label Chrome {
11    M13 = 0.0,
12    M17 = 0.1,
13    M19_0 = 1.0,
14    M19_1 = 1.1
15};
16
17[assert_size(4)]
18enum PP_NetAddressFamily_Private {
19  /**
20   * The address family is unspecified.
21   */
22  PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED = 0,
23  /**
24   * The Internet Protocol version 4 (IPv4) address family.
25   */
26  PP_NETADDRESSFAMILY_PRIVATE_IPV4 = 1,
27  /**
28   * The Internet Protocol version 6 (IPv6) address family.
29   */
30  PP_NETADDRESSFAMILY_PRIVATE_IPV6 = 2
31};
32
33/**
34 * This is an opaque type holding a network address. Plugins must
35 * never access members of this struct directly.
36 */
37[assert_size(132)]
38struct PP_NetAddress_Private {
39  uint32_t size;
40  char[128] data;
41};
42
43/**
44 * The <code>PPB_NetAddress_Private</code> interface provides operations on
45 * network addresses.
46 */
47[version=0.1] interface PPB_NetAddress_Private {
48  /**
49   * Returns PP_TRUE if the two addresses are equal (host and port).
50   */
51  PP_Bool AreEqual([in] PP_NetAddress_Private addr1,
52                   [in] PP_NetAddress_Private addr2);
53
54  /**
55   * Returns PP_TRUE if the two addresses refer to the same host.
56   */
57  PP_Bool AreHostsEqual([in] PP_NetAddress_Private addr1,
58                        [in] PP_NetAddress_Private addr2);
59
60  /**
61   * Returns a human-readable description of the network address, optionally
62   * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"),
63   * or an undefined var on failure.
64   */
65  PP_Var Describe([in] PP_Module module,
66                  [in] PP_NetAddress_Private addr,
67                  [in] PP_Bool include_port);
68
69  /**
70   * Replaces the port in the given source address. Returns PP_TRUE on success.
71   */
72  PP_Bool ReplacePort([in] PP_NetAddress_Private src_addr,
73                      [in] uint16_t port,
74                      [out] PP_NetAddress_Private addr_out);
75
76  /**
77   * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind.
78   */
79  void GetAnyAddress([in] PP_Bool is_ipv6,
80                     [out] PP_NetAddress_Private addr);
81
82  /**
83   * Gets the address family.
84   */
85  [version=1.0]
86  PP_NetAddressFamily_Private GetFamily([in] PP_NetAddress_Private addr);
87
88  /**
89   * Gets the port. The port is returned in host byte order.
90   */
91  [version=1.0]
92  uint16_t GetPort([in] PP_NetAddress_Private addr);
93
94  /**
95   * Gets the address. The output, address, must be large enough for the
96   * current socket family. The output will be the binary representation of an
97   * address for the current socket family. For IPv4 and IPv6 the address is in
98   * network byte order. PP_TRUE is returned if the address was successfully
99   * retrieved.
100   */
101  [version=1.0]
102  PP_Bool GetAddress([in] PP_NetAddress_Private addr,
103                     [out] mem_t address,
104                     [in] uint16_t address_size);
105
106  /**
107   * Returns ScopeID for IPv6 addresses or 0 for IPv4.
108   */
109  [version=1.1]
110  uint32_t GetScopeID([in] PP_NetAddress_Private addr);
111
112  /**
113   * Creates NetAddress with the specified IPv4 address and port
114   * number.
115   */
116  [version=1.1]
117  void CreateFromIPv4Address([in] uint8_t[4] ip,
118                             [in] uint16_t port,
119                             [out] PP_NetAddress_Private addr_out);
120  /**
121   * Creates NetAddress with the specified IPv6 address, scope_id and
122   * port number.
123   */
124  [version=1.1]
125  void CreateFromIPv6Address([in] uint8_t[16] ip,
126                             [in] uint32_t scope_id,
127                             [in] uint16_t port,
128                             [out] PP_NetAddress_Private addr_out);
129};
130