OLD | NEW |
1 /* Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /* From dev/ppb_net_address_dev.idl modified Wed Jun 19 22:41:57 2013. */ | 6 /* From ppb_net_address.idl modified Thu Jun 20 11:47:26 2013. */ |
7 | 7 |
8 #ifndef PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ | 8 #ifndef PPAPI_C_PPB_NET_ADDRESS_H_ |
9 #define PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ | 9 #define PPAPI_C_PPB_NET_ADDRESS_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
13 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
14 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
15 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
16 #include "ppapi/c/pp_var.h" | 16 #include "ppapi/c/pp_var.h" |
17 | 17 |
18 #define PPB_NETADDRESS_DEV_INTERFACE_0_1 "PPB_NetAddress(Dev);0.1" | 18 #define PPB_NETADDRESS_INTERFACE_0_1 "PPB_NetAddress;0.1" |
19 #define PPB_NETADDRESS_DEV_INTERFACE PPB_NETADDRESS_DEV_INTERFACE_0_1 | 19 #define PPB_NETADDRESS_INTERFACE PPB_NETADDRESS_INTERFACE_0_1 |
20 | 20 |
21 /** | 21 /** |
22 * @file | 22 * @file |
23 * This file defines the <code>PPB_NetAddress_Dev</code> interface. | 23 * This file defines the <code>PPB_NetAddress</code> interface. |
24 */ | 24 */ |
25 | 25 |
26 | 26 |
27 /** | 27 /** |
28 * @addtogroup Enums | 28 * @addtogroup Enums |
29 * @{ | 29 * @{ |
30 */ | 30 */ |
31 /** | 31 /** |
32 * Network address family types. | 32 * Network address family types. |
33 */ | 33 */ |
34 typedef enum { | 34 typedef enum { |
35 /** | 35 /** |
36 * The address family is unspecified. | 36 * The address family is unspecified. |
37 */ | 37 */ |
38 PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, | 38 PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, |
39 /** | 39 /** |
40 * The Internet Protocol version 4 (IPv4) address family. | 40 * The Internet Protocol version 4 (IPv4) address family. |
41 */ | 41 */ |
42 PP_NETADDRESS_FAMILY_IPV4 = 1, | 42 PP_NETADDRESS_FAMILY_IPV4 = 1, |
43 /** | 43 /** |
44 * The Internet Protocol version 6 (IPv6) address family. | 44 * The Internet Protocol version 6 (IPv6) address family. |
45 */ | 45 */ |
46 PP_NETADDRESS_FAMILY_IPV6 = 2 | 46 PP_NETADDRESS_FAMILY_IPV6 = 2 |
47 } PP_NetAddress_Family_Dev; | 47 } PP_NetAddress_Family; |
48 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddress_Family_Dev, 4); | 48 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddress_Family, 4); |
49 /** | 49 /** |
50 * @} | 50 * @} |
51 */ | 51 */ |
52 | 52 |
53 /** | 53 /** |
54 * @addtogroup Structs | 54 * @addtogroup Structs |
55 * @{ | 55 * @{ |
56 */ | 56 */ |
57 /** | 57 /** |
58 * All members are expressed in network byte order. | 58 * All members are expressed in network byte order. |
59 */ | 59 */ |
60 struct PP_NetAddress_IPv4_Dev { | 60 struct PP_NetAddress_IPv4 { |
61 /** | 61 /** |
62 * Port number. | 62 * Port number. |
63 */ | 63 */ |
64 uint16_t port; | 64 uint16_t port; |
65 /** | 65 /** |
66 * IPv4 address. | 66 * IPv4 address. |
67 */ | 67 */ |
68 uint8_t addr[4]; | 68 uint8_t addr[4]; |
69 }; | 69 }; |
70 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv4_Dev, 6); | 70 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv4, 6); |
71 | 71 |
72 /** | 72 /** |
73 * All members are expressed in network byte order. | 73 * All members are expressed in network byte order. |
74 */ | 74 */ |
75 struct PP_NetAddress_IPv6_Dev { | 75 struct PP_NetAddress_IPv6 { |
76 /** | 76 /** |
77 * Port number. | 77 * Port number. |
78 */ | 78 */ |
79 uint16_t port; | 79 uint16_t port; |
80 /** | 80 /** |
81 * IPv6 address. | 81 * IPv6 address. |
82 */ | 82 */ |
83 uint8_t addr[16]; | 83 uint8_t addr[16]; |
84 }; | 84 }; |
85 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv6_Dev, 18); | 85 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv6, 18); |
86 /** | 86 /** |
87 * @} | 87 * @} |
88 */ | 88 */ |
89 | 89 |
90 /** | 90 /** |
91 * @addtogroup Interfaces | 91 * @addtogroup Interfaces |
92 * @{ | 92 * @{ |
93 */ | 93 */ |
94 /** | 94 /** |
95 * The <code>PPB_NetAddress_Dev</code> interface provides operations on | 95 * The <code>PPB_NetAddress</code> interface provides operations on network |
96 * network addresses. | 96 * addresses. |
97 */ | 97 */ |
98 struct PPB_NetAddress_Dev_0_1 { | 98 struct PPB_NetAddress_0_1 { |
99 /** | 99 /** |
100 * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv4 | 100 * Creates a <code>PPB_NetAddress</code> resource with the specified IPv4 |
101 * address. | 101 * address. |
102 * | 102 * |
103 * @param[in] instance A <code>PP_Instance</code> identifying one instance of | 103 * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
104 * a module. | 104 * a module. |
105 * @param[in] ipv4_addr An IPv4 address. | 105 * @param[in] ipv4_addr An IPv4 address. |
106 * | 106 * |
107 * @return A <code>PP_Resource</code> representing the same address as | 107 * @return A <code>PP_Resource</code> representing the same address as |
108 * <code>ipv4_addr</code> or 0 on failure. | 108 * <code>ipv4_addr</code> or 0 on failure. |
109 */ | 109 */ |
110 PP_Resource (*CreateFromIPv4Address)( | 110 PP_Resource (*CreateFromIPv4Address)( |
111 PP_Instance instance, | 111 PP_Instance instance, |
112 const struct PP_NetAddress_IPv4_Dev* ipv4_addr); | 112 const struct PP_NetAddress_IPv4* ipv4_addr); |
113 /** | 113 /** |
114 * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv6 | 114 * Creates a <code>PPB_NetAddress</code> resource with the specified IPv6 |
115 * address. | 115 * address. |
116 * | 116 * |
117 * @param[in] instance A <code>PP_Instance</code> identifying one instance of | 117 * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
118 * a module. | 118 * a module. |
119 * @param[in] ipv6_addr An IPv6 address. | 119 * @param[in] ipv6_addr An IPv6 address. |
120 * | 120 * |
121 * @return A <code>PP_Resource</code> representing the same address as | 121 * @return A <code>PP_Resource</code> representing the same address as |
122 * <code>ipv6_addr</code> or 0 on failure. | 122 * <code>ipv6_addr</code> or 0 on failure. |
123 */ | 123 */ |
124 PP_Resource (*CreateFromIPv6Address)( | 124 PP_Resource (*CreateFromIPv6Address)( |
125 PP_Instance instance, | 125 PP_Instance instance, |
126 const struct PP_NetAddress_IPv6_Dev* ipv6_addr); | 126 const struct PP_NetAddress_IPv6* ipv6_addr); |
127 /** | 127 /** |
128 * Determines if a given resource is a network address. | 128 * Determines if a given resource is a network address. |
129 * | 129 * |
130 * @param[in] addr A <code>PP_Resource</code> to check. | 130 * @param[in] resource A <code>PP_Resource</code> to check. |
131 * | 131 * |
132 * @return <code>PP_TRUE</code> if the input is a | 132 * @return <code>PP_TRUE</code> if the input is a |
133 * <code>PPB_NetAddress_Dev</code> resource; <code>PP_FALSE</code> otherwise. | 133 * <code>PPB_NetAddress</code> resource; <code>PP_FALSE</code> otherwise. |
134 */ | 134 */ |
135 PP_Bool (*IsNetAddress)(PP_Resource addr); | 135 PP_Bool (*IsNetAddress)(PP_Resource resource); |
136 /** | 136 /** |
137 * Gets the address family. | 137 * Gets the address family. |
138 * | 138 * |
139 * @param[in] addr A <code>PP_Resource</code> corresponding to a network | 139 * @param[in] addr A <code>PP_Resource</code> corresponding to a network |
140 * address. | 140 * address. |
141 * | 141 * |
142 * @return The address family on success; | 142 * @return The address family on success; |
143 * <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. | 143 * <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. |
144 */ | 144 */ |
145 PP_NetAddress_Family_Dev (*GetFamily)(PP_Resource addr); | 145 PP_NetAddress_Family (*GetFamily)(PP_Resource addr); |
146 /** | 146 /** |
147 * Returns a human-readable description of the network address. The | 147 * Returns a human-readable description of the network address. The |
148 * description is in the form of host [ ":" port ] and conforms to | 148 * description is in the form of host [ ":" port ] and conforms to |
149 * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses | 149 * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses |
150 * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). | 150 * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). |
151 * | 151 * |
152 * @param[in] addr A <code>PP_Resource</code> corresponding to a network | 152 * @param[in] addr A <code>PP_Resource</code> corresponding to a network |
153 * address. | 153 * address. |
154 * @param[in] include_port Whether to include the port number in the | 154 * @param[in] include_port Whether to include the port number in the |
155 * description. | 155 * description. |
156 * | 156 * |
157 * @return A string <code>PP_Var</code> on success; an undefined | 157 * @return A string <code>PP_Var</code> on success; an undefined |
158 * <code>PP_Var</code> on failure. | 158 * <code>PP_Var</code> on failure. |
159 */ | 159 */ |
160 struct PP_Var (*DescribeAsString)(PP_Resource addr, PP_Bool include_port); | 160 struct PP_Var (*DescribeAsString)(PP_Resource addr, PP_Bool include_port); |
161 /** | 161 /** |
162 * Fills a <code>PP_NetAddress_IPv4_Dev</code> structure if the network | 162 * Fills a <code>PP_NetAddress_IPv4</code> structure if the network address is |
163 * address is of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. | 163 * of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. |
164 * Note that passing a network address of | 164 * Note that passing a network address of |
165 * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the | 165 * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the |
166 * address is an IPv4-mapped IPv6 address. | 166 * address is an IPv4-mapped IPv6 address. |
167 * | 167 * |
168 * @param[in] addr A <code>PP_Resource</code> corresponding to a network | 168 * @param[in] addr A <code>PP_Resource</code> corresponding to a network |
169 * address. | 169 * address. |
170 * @param[out] ipv4_addr A <code>PP_NetAddress_IPv4_Dev</code> structure to | 170 * @param[out] ipv4_addr A <code>PP_NetAddress_IPv4</code> structure to |
171 * store the result. | 171 * store the result. |
172 * | 172 * |
173 * @return A <code>PP_Bool</code> value indicating whether the operation is | 173 * @return A <code>PP_Bool</code> value indicating whether the operation is |
174 * successful or not. | 174 * successful or not. |
175 */ | 175 */ |
176 PP_Bool (*DescribeAsIPv4Address)(PP_Resource addr, | 176 PP_Bool (*DescribeAsIPv4Address)(PP_Resource addr, |
177 struct PP_NetAddress_IPv4_Dev* ipv4_addr); | 177 struct PP_NetAddress_IPv4* ipv4_addr); |
178 /** | 178 /** |
179 * Fills a <code>PP_NetAddress_IPv6_Dev</code> structure if the network | 179 * Fills a <code>PP_NetAddress_IPv6</code> structure if the network address is |
180 * address is of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. | 180 * of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. |
181 * Note that passing a network address of | 181 * Note that passing a network address of |
182 * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this | 182 * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this |
183 * method doesn't map it to an IPv6 address. | 183 * method doesn't map it to an IPv6 address. |
184 * | 184 * |
185 * @param[in] addr A <code>PP_Resource</code> corresponding to a network | 185 * @param[in] addr A <code>PP_Resource</code> corresponding to a network |
186 * address. | 186 * address. |
187 * @param[out] ipv6_addr A <code>PP_NetAddress_IPv6_Dev</code> structure to | 187 * @param[out] ipv6_addr A <code>PP_NetAddress_IPv6</code> structure to |
188 * store the result. | 188 * store the result. |
189 * | 189 * |
190 * @return A <code>PP_Bool</code> value indicating whether the operation is | 190 * @return A <code>PP_Bool</code> value indicating whether the operation is |
191 * successful or not. | 191 * successful or not. |
192 */ | 192 */ |
193 PP_Bool (*DescribeAsIPv6Address)(PP_Resource addr, | 193 PP_Bool (*DescribeAsIPv6Address)(PP_Resource addr, |
194 struct PP_NetAddress_IPv6_Dev* ipv6_addr); | 194 struct PP_NetAddress_IPv6* ipv6_addr); |
195 }; | 195 }; |
196 | 196 |
197 typedef struct PPB_NetAddress_Dev_0_1 PPB_NetAddress_Dev; | 197 typedef struct PPB_NetAddress_0_1 PPB_NetAddress; |
198 /** | 198 /** |
199 * @} | 199 * @} |
200 */ | 200 */ |
201 | 201 |
202 #endif /* PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ */ | 202 #endif /* PPAPI_C_PPB_NET_ADDRESS_H_ */ |
203 | 203 |
OLD | NEW |