Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / api / private / ppb_net_address_private.idl
blob9feb503050e0140c1920cb8e9b73cbdc87222a41
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 */
6 /**
7 * This file defines the <code>PPB_NetAddress_Private</code> interface.
8 */
10 label Chrome {
11 M13 = 0.0,
12 M17 = 0.1,
13 M19_0 = 1.0,
14 M19_1 = 1.1
17 [assert_size(4)]
18 enum PP_NetAddressFamily_Private {
19 /**
20 * The address family is unspecified.
22 PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED = 0,
23 /**
24 * The Internet Protocol version 4 (IPv4) address family.
26 PP_NETADDRESSFAMILY_PRIVATE_IPV4 = 1,
27 /**
28 * The Internet Protocol version 6 (IPv6) address family.
30 PP_NETADDRESSFAMILY_PRIVATE_IPV6 = 2
33 /**
34 * This is an opaque type holding a network address. Plugins must
35 * never access members of this struct directly.
37 [assert_size(132)]
38 struct PP_NetAddress_Private {
39 uint32_t size;
40 char[128] data;
43 /**
44 * The <code>PPB_NetAddress_Private</code> interface provides operations on
45 * network addresses.
47 [version=0.1] interface PPB_NetAddress_Private {
48 /**
49 * Returns PP_TRUE if the two addresses are equal (host and port).
51 PP_Bool AreEqual([in] PP_NetAddress_Private addr1,
52 [in] PP_NetAddress_Private addr2);
54 /**
55 * Returns PP_TRUE if the two addresses refer to the same host.
57 PP_Bool AreHostsEqual([in] PP_NetAddress_Private addr1,
58 [in] PP_NetAddress_Private addr2);
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.
65 PP_Var Describe([in] PP_Module module,
66 [in] PP_NetAddress_Private addr,
67 [in] PP_Bool include_port);
69 /**
70 * Replaces the port in the given source address. Returns PP_TRUE on success.
72 PP_Bool ReplacePort([in] PP_NetAddress_Private src_addr,
73 [in] uint16_t port,
74 [out] PP_NetAddress_Private addr_out);
76 /**
77 * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind.
79 void GetAnyAddress([in] PP_Bool is_ipv6,
80 [out] PP_NetAddress_Private addr);
82 /**
83 * Gets the address family.
85 [version=1.0]
86 PP_NetAddressFamily_Private GetFamily([in] PP_NetAddress_Private addr);
88 /**
89 * Gets the port. The port is returned in host byte order.
91 [version=1.0]
92 uint16_t GetPort([in] PP_NetAddress_Private addr);
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.
101 [version=1.0]
102 PP_Bool GetAddress([in] PP_NetAddress_Private addr,
103 [out] mem_t address,
104 [in] uint16_t address_size);
107 * Returns ScopeID for IPv6 addresses or 0 for IPv4.
109 [version=1.1]
110 uint32_t GetScopeID([in] PP_NetAddress_Private addr);
113 * Creates NetAddress with the specified IPv4 address and port
114 * number.
116 [version=1.1]
117 void CreateFromIPv4Address([in] uint8_t[4] ip,
118 [in] uint16_t port,
119 [out] PP_NetAddress_Private addr_out);
121 * Creates NetAddress with the specified IPv6 address, scope_id and
122 * port number.
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);