[Chromoting] Only raise the CONNECTED event when capabilities are negotiated.
[chromium-blink-merge.git] / ppapi / api / ppb_net_address.idl
blobddd69b57e0e0ec9ecab3ec32b99bc497692f6f62
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_NetAddress</code> interface.
8 */
10 label Chrome {
11 M29 = 1.0
14 /**
15 * Network address family types.
17 [assert_size(4)]
18 enum PP_NetAddress_Family {
19 /**
20 * The address family is unspecified.
22 PP_NETADDRESS_FAMILY_UNSPECIFIED = 0,
23 /**
24 * The Internet Protocol version 4 (IPv4) address family.
26 PP_NETADDRESS_FAMILY_IPV4 = 1,
27 /**
28 * The Internet Protocol version 6 (IPv6) address family.
30 PP_NETADDRESS_FAMILY_IPV6 = 2
33 /**
34 * All members are expressed in network byte order.
36 [assert_size(6)]
37 struct PP_NetAddress_IPv4 {
38 /**
39 * Port number.
41 uint16_t port;
42 /**
43 * IPv4 address.
45 uint8_t[4] addr;
48 /**
49 * All members are expressed in network byte order.
51 [assert_size(18)]
52 struct PP_NetAddress_IPv6 {
53 /**
54 * Port number.
56 uint16_t port;
57 /**
58 * IPv6 address.
60 uint8_t[16] addr;
63 /**
64 * The <code>PPB_NetAddress</code> interface provides operations on network
65 * addresses.
67 interface PPB_NetAddress {
68 /**
69 * Creates a <code>PPB_NetAddress</code> resource with the specified IPv4
70 * address.
72 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
73 * a module.
74 * @param[in] ipv4_addr An IPv4 address.
76 * @return A <code>PP_Resource</code> representing the same address as
77 * <code>ipv4_addr</code> or 0 on failure.
79 PP_Resource CreateFromIPv4Address([in] PP_Instance instance,
80 [in] PP_NetAddress_IPv4 ipv4_addr);
82 /**
83 * Creates a <code>PPB_NetAddress</code> resource with the specified IPv6
84 * address.
86 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
87 * a module.
88 * @param[in] ipv6_addr An IPv6 address.
90 * @return A <code>PP_Resource</code> representing the same address as
91 * <code>ipv6_addr</code> or 0 on failure.
93 PP_Resource CreateFromIPv6Address([in] PP_Instance instance,
94 [in] PP_NetAddress_IPv6 ipv6_addr);
96 /**
97 * Determines if a given resource is a network address.
99 * @param[in] resource A <code>PP_Resource</code> to check.
101 * @return <code>PP_TRUE</code> if the input is a <code>PPB_NetAddress</code>
102 * resource; <code>PP_FALSE</code> otherwise.
104 PP_Bool IsNetAddress([in] PP_Resource resource);
107 * Gets the address family.
109 * @param[in] addr A <code>PP_Resource</code> corresponding to a network
110 * address.
112 * @return The address family on success;
113 * <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure.
115 PP_NetAddress_Family GetFamily([in] PP_Resource addr);
118 * Returns a human-readable description of the network address. The
119 * description is in the form of host [ ":" port ] and conforms to
120 * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses
121 * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80").
123 * @param[in] addr A <code>PP_Resource</code> corresponding to a network
124 * address.
125 * @param[in] include_port Whether to include the port number in the
126 * description.
128 * @return A string <code>PP_Var</code> on success; an undefined
129 * <code>PP_Var</code> on failure.
131 PP_Var DescribeAsString([in] PP_Resource addr,
132 [in] PP_Bool include_port);
135 * Fills a <code>PP_NetAddress_IPv4</code> structure if the network address is
136 * of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family.
137 * Note that passing a network address of
138 * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the
139 * address is an IPv4-mapped IPv6 address.
141 * @param[in] addr A <code>PP_Resource</code> corresponding to a network
142 * address.
143 * @param[out] ipv4_addr A <code>PP_NetAddress_IPv4</code> structure to store
144 * the result.
146 * @return A <code>PP_Bool</code> value indicating whether the operation
147 * succeeded.
149 PP_Bool DescribeAsIPv4Address([in] PP_Resource addr,
150 [out] PP_NetAddress_IPv4 ipv4_addr);
153 * Fills a <code>PP_NetAddress_IPv6</code> structure if the network address is
154 * of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family.
155 * Note that passing a network address of
156 * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this
157 * method doesn't map it to an IPv6 address.
159 * @param[in] addr A <code>PP_Resource</code> corresponding to a network
160 * address.
161 * @param[out] ipv6_addr A <code>PP_NetAddress_IPv6</code> structure to store
162 * the result.
164 * @return A <code>PP_Bool</code> value indicating whether the operation
165 * succeeded.
167 PP_Bool DescribeAsIPv6Address([in] PP_Resource addr,
168 [out] PP_NetAddress_IPv6 ipv6_addr);