Chromium Code Reviews| 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 /** | 6 /** |
| 7 * This file defines the <code>PPB_NetAddress_Dev</code> interface. | 7 * This file defines the <code>PPB_NetAddress</code> interface. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 label Chrome { | 10 label Chrome { |
| 11 M29 = 0.1 | 11 M29 = 0.1 |
|
bbudge
2013/06/20 19:25:02
Version 1.0 Whee!
yzshen1
2013/06/20 20:54:12
Done. Shame on me!
| |
| 12 }; | 12 }; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Network address family types. | 15 * Network address family types. |
| 16 */ | 16 */ |
| 17 [assert_size(4)] | 17 [assert_size(4)] |
| 18 enum PP_NetAddress_Family_Dev { | 18 enum PP_NetAddress_Family { |
| 19 /** | 19 /** |
| 20 * The address family is unspecified. | 20 * The address family is unspecified. |
| 21 */ | 21 */ |
| 22 PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, | 22 PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, |
| 23 /** | 23 /** |
| 24 * The Internet Protocol version 4 (IPv4) address family. | 24 * The Internet Protocol version 4 (IPv4) address family. |
| 25 */ | 25 */ |
| 26 PP_NETADDRESS_FAMILY_IPV4 = 1, | 26 PP_NETADDRESS_FAMILY_IPV4 = 1, |
| 27 /** | 27 /** |
| 28 * The Internet Protocol version 6 (IPv6) address family. | 28 * The Internet Protocol version 6 (IPv6) address family. |
| 29 */ | 29 */ |
| 30 PP_NETADDRESS_FAMILY_IPV6 = 2 | 30 PP_NETADDRESS_FAMILY_IPV6 = 2 |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * All members are expressed in network byte order. | 34 * All members are expressed in network byte order. |
| 35 */ | 35 */ |
| 36 [assert_size(6)] | 36 [assert_size(6)] |
| 37 struct PP_NetAddress_IPv4_Dev { | 37 struct PP_NetAddress_IPv4 { |
| 38 /** | 38 /** |
| 39 * Port number. | 39 * Port number. |
| 40 */ | 40 */ |
| 41 uint16_t port; | 41 uint16_t port; |
| 42 /** | 42 /** |
| 43 * IPv4 address. | 43 * IPv4 address. |
| 44 */ | 44 */ |
| 45 uint8_t[4] addr; | 45 uint8_t[4] addr; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * All members are expressed in network byte order. | 49 * All members are expressed in network byte order. |
| 50 */ | 50 */ |
| 51 [assert_size(18)] | 51 [assert_size(18)] |
| 52 struct PP_NetAddress_IPv6_Dev { | 52 struct PP_NetAddress_IPv6 { |
| 53 /** | 53 /** |
| 54 * Port number. | 54 * Port number. |
| 55 */ | 55 */ |
| 56 uint16_t port; | 56 uint16_t port; |
| 57 /** | 57 /** |
| 58 * IPv6 address. | 58 * IPv6 address. |
| 59 */ | 59 */ |
| 60 uint8_t[16] addr; | 60 uint8_t[16] addr; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * The <code>PPB_NetAddress_Dev</code> interface provides operations on | 64 * The <code>PPB_NetAddress</code> interface provides operations on network |
| 65 * network addresses. | 65 * addresses. |
| 66 */ | 66 */ |
| 67 interface PPB_NetAddress_Dev { | 67 interface PPB_NetAddress { |
| 68 /** | 68 /** |
| 69 * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv4 | 69 * Creates a <code>PPB_NetAddress</code> resource with the specified IPv4 |
| 70 * address. | 70 * address. |
| 71 * | 71 * |
| 72 * @param[in] instance A <code>PP_Instance</code> identifying one instance of | 72 * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
| 73 * a module. | 73 * a module. |
| 74 * @param[in] ipv4_addr An IPv4 address. | 74 * @param[in] ipv4_addr An IPv4 address. |
| 75 * | 75 * |
| 76 * @return A <code>PP_Resource</code> representing the same address as | 76 * @return A <code>PP_Resource</code> representing the same address as |
| 77 * <code>ipv4_addr</code> or 0 on failure. | 77 * <code>ipv4_addr</code> or 0 on failure. |
| 78 */ | 78 */ |
| 79 PP_Resource CreateFromIPv4Address([in] PP_Instance instance, | 79 PP_Resource CreateFromIPv4Address([in] PP_Instance instance, |
| 80 [in] PP_NetAddress_IPv4_Dev ipv4_addr); | 80 [in] PP_NetAddress_IPv4 ipv4_addr); |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv6 | 83 * Creates a <code>PPB_NetAddress</code> resource with the specified IPv6 |
| 84 * address. | 84 * address. |
| 85 * | 85 * |
| 86 * @param[in] instance A <code>PP_Instance</code> identifying one instance of | 86 * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
| 87 * a module. | 87 * a module. |
| 88 * @param[in] ipv6_addr An IPv6 address. | 88 * @param[in] ipv6_addr An IPv6 address. |
| 89 * | 89 * |
| 90 * @return A <code>PP_Resource</code> representing the same address as | 90 * @return A <code>PP_Resource</code> representing the same address as |
| 91 * <code>ipv6_addr</code> or 0 on failure. | 91 * <code>ipv6_addr</code> or 0 on failure. |
| 92 */ | 92 */ |
| 93 PP_Resource CreateFromIPv6Address([in] PP_Instance instance, | 93 PP_Resource CreateFromIPv6Address([in] PP_Instance instance, |
| 94 [in] PP_NetAddress_IPv6_Dev ipv6_addr); | 94 [in] PP_NetAddress_IPv6 ipv6_addr); |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * Determines if a given resource is a network address. | 97 * Determines if a given resource is a network address. |
| 98 * | 98 * |
| 99 * @param[in] addr A <code>PP_Resource</code> to check. | 99 * @param[in] resource A <code>PP_Resource</code> to check. |
| 100 * | 100 * |
| 101 * @return <code>PP_TRUE</code> if the input is a | 101 * @return <code>PP_TRUE</code> if the input is a |
| 102 * <code>PPB_NetAddress_Dev</code> resource; <code>PP_FALSE</code> otherwise. | 102 * <code>PPB_NetAddress</code> resource; <code>PP_FALSE</code> otherwise. |
| 103 */ | 103 */ |
| 104 PP_Bool IsNetAddress([in] PP_Resource addr); | 104 PP_Bool IsNetAddress([in] PP_Resource resource); |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * Gets the address family. | 107 * Gets the address family. |
| 108 * | 108 * |
| 109 * @param[in] addr A <code>PP_Resource</code> corresponding to a network | 109 * @param[in] addr A <code>PP_Resource</code> corresponding to a network |
| 110 * address. | 110 * address. |
| 111 * | 111 * |
| 112 * @return The address family on success; | 112 * @return The address family on success; |
| 113 * <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. | 113 * <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. |
| 114 */ | 114 */ |
| 115 PP_NetAddress_Family_Dev GetFamily([in] PP_Resource addr); | 115 PP_NetAddress_Family GetFamily([in] PP_Resource addr); |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * Returns a human-readable description of the network address. The | 118 * Returns a human-readable description of the network address. The |
| 119 * description is in the form of host [ ":" port ] and conforms to | 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 | 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"). | 121 * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). |
| 122 * | 122 * |
| 123 * @param[in] addr A <code>PP_Resource</code> corresponding to a network | 123 * @param[in] addr A <code>PP_Resource</code> corresponding to a network |
| 124 * address. | 124 * address. |
| 125 * @param[in] include_port Whether to include the port number in the | 125 * @param[in] include_port Whether to include the port number in the |
| 126 * description. | 126 * description. |
| 127 * | 127 * |
| 128 * @return A string <code>PP_Var</code> on success; an undefined | 128 * @return A string <code>PP_Var</code> on success; an undefined |
| 129 * <code>PP_Var</code> on failure. | 129 * <code>PP_Var</code> on failure. |
| 130 */ | 130 */ |
| 131 PP_Var DescribeAsString([in] PP_Resource addr, | 131 PP_Var DescribeAsString([in] PP_Resource addr, |
| 132 [in] PP_Bool include_port); | 132 [in] PP_Bool include_port); |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * Fills a <code>PP_NetAddress_IPv4_Dev</code> structure if the network | 135 * Fills a <code>PP_NetAddress_IPv4</code> structure if the network address is |
| 136 * address is of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. | 136 * of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. |
| 137 * Note that passing a network address of | 137 * Note that passing a network address of |
| 138 * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the | 138 * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the |
| 139 * address is an IPv4-mapped IPv6 address. | 139 * address is an IPv4-mapped IPv6 address. |
| 140 * | 140 * |
| 141 * @param[in] addr A <code>PP_Resource</code> corresponding to a network | 141 * @param[in] addr A <code>PP_Resource</code> corresponding to a network |
| 142 * address. | 142 * address. |
| 143 * @param[out] ipv4_addr A <code>PP_NetAddress_IPv4_Dev</code> structure to | 143 * @param[out] ipv4_addr A <code>PP_NetAddress_IPv4</code> structure to |
| 144 * store the result. | 144 * store the result. |
| 145 * | 145 * |
| 146 * @return A <code>PP_Bool</code> value indicating whether the operation is | 146 * @return A <code>PP_Bool</code> value indicating whether the operation is |
| 147 * successful or not. | 147 * successful or not. |
| 148 */ | 148 */ |
| 149 PP_Bool DescribeAsIPv4Address([in] PP_Resource addr, | 149 PP_Bool DescribeAsIPv4Address([in] PP_Resource addr, |
| 150 [out] PP_NetAddress_IPv4_Dev ipv4_addr); | 150 [out] PP_NetAddress_IPv4 ipv4_addr); |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * Fills a <code>PP_NetAddress_IPv6_Dev</code> structure if the network | 153 * Fills a <code>PP_NetAddress_IPv6</code> structure if the network address is |
| 154 * address is of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. | 154 * of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. |
| 155 * Note that passing a network address of | 155 * Note that passing a network address of |
| 156 * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this | 156 * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this |
| 157 * method doesn't map it to an IPv6 address. | 157 * method doesn't map it to an IPv6 address. |
| 158 * | 158 * |
| 159 * @param[in] addr A <code>PP_Resource</code> corresponding to a network | 159 * @param[in] addr A <code>PP_Resource</code> corresponding to a network |
| 160 * address. | 160 * address. |
| 161 * @param[out] ipv6_addr A <code>PP_NetAddress_IPv6_Dev</code> structure to | 161 * @param[out] ipv6_addr A <code>PP_NetAddress_IPv6</code> structure to |
| 162 * store the result. | 162 * store the result. |
| 163 * | 163 * |
| 164 * @return A <code>PP_Bool</code> value indicating whether the operation is | 164 * @return A <code>PP_Bool</code> value indicating whether the operation is |
| 165 * successful or not. | 165 * successful or not. |
| 166 */ | 166 */ |
| 167 PP_Bool DescribeAsIPv6Address([in] PP_Resource addr, | 167 PP_Bool DescribeAsIPv6Address([in] PP_Resource addr, |
| 168 [out] PP_NetAddress_IPv6_Dev ipv6_addr); | 168 [out] PP_NetAddress_IPv6 ipv6_addr); |
| 169 }; | 169 }; |
| OLD | NEW |