OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 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 */ |
| 5 |
| 6 /** |
| 7 * This file defines the <code>PPB_NetAddress_Dev</code> interface. |
| 8 */ |
| 9 |
| 10 label Chrome { |
| 11 M29 = 0.1 |
| 12 }; |
| 13 |
| 14 [assert_size(4)] |
| 15 enum PP_NetAddress_Family_Dev { |
| 16 /** |
| 17 * The address family is unspecified. |
| 18 */ |
| 19 PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, |
| 20 /** |
| 21 * The Internet Protocol version 4 (IPv4) address family. |
| 22 */ |
| 23 PP_NETADDRESS_FAMILY_IPV4 = 1, |
| 24 /** |
| 25 * The Internet Protocol version 6 (IPv6) address family. |
| 26 */ |
| 27 PP_NETADDRESS_FAMILY_IPV6 = 2 |
| 28 }; |
| 29 |
| 30 /** |
| 31 * All members are expressed in network byte order. |
| 32 */ |
| 33 [assert_size(8)] |
| 34 struct PP_NetAddress_IPv4_Dev { |
| 35 /** |
| 36 * Port number. |
| 37 */ |
| 38 uint16_t port; |
| 39 /** |
| 40 * Padding that makes the structure size consistent across compilers. |
| 41 */ |
| 42 uint16_t unused_padding; |
| 43 /** |
| 44 * IPv4 address. |
| 45 */ |
| 46 uint8_t[4] addr; |
| 47 }; |
| 48 |
| 49 /** |
| 50 * All members are expressed in network byte order. |
| 51 */ |
| 52 [assert_size(20)] |
| 53 struct PP_NetAddress_IPv6_Dev { |
| 54 /** |
| 55 * Port number. |
| 56 */ |
| 57 uint16_t port; |
| 58 /** |
| 59 * Padding that makes the structure size consistent across compilers. |
| 60 */ |
| 61 uint16_t unused_padding; |
| 62 /** |
| 63 * IPv6 address. |
| 64 */ |
| 65 uint8_t[16] addr; |
| 66 }; |
| 67 |
| 68 /** |
| 69 * The <code>PPB_NetAddress_Dev</code> interface provides operations on |
| 70 * network addresses. |
| 71 */ |
| 72 interface PPB_NetAddress_Dev { |
| 73 /** |
| 74 * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv4 |
| 75 * address. |
| 76 */ |
| 77 PP_Resource CreateFromIPv4Address([in] PP_Instance instance, |
| 78 [in] PP_NetAddress_IPv4_Dev ipv4_addr); |
| 79 |
| 80 /** |
| 81 * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv6 |
| 82 * address. |
| 83 */ |
| 84 PP_Resource CreateFromIPv6Address([in] PP_Instance instance, |
| 85 [in] PP_NetAddress_IPv6_Dev ipv6_addr); |
| 86 |
| 87 /** |
| 88 * Determines if a given resource is a network address. |
| 89 */ |
| 90 PP_Bool IsNetAddress([in] PP_Resource addr); |
| 91 |
| 92 /** |
| 93 * Gets the address family. |
| 94 */ |
| 95 PP_NetAddress_Family_Dev GetFamily([in] PP_Resource addr); |
| 96 |
| 97 /** |
| 98 * Returns a human-readable description of the network address. The |
| 99 * description is in the form of host [ ":" port ] and conforms to |
| 100 * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses |
| 101 * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). |
| 102 * Returns an undefined var on failure. |
| 103 */ |
| 104 PP_Var DescribeAsString([in] PP_Resource addr, |
| 105 [in] PP_Bool include_port); |
| 106 |
| 107 /** |
| 108 * Fills a <code>PP_NetAddress_IPv4_Dev</code> structure if the network |
| 109 * address is of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. |
| 110 * Returns PP_FALSE on failure. Note that passing a network address of |
| 111 * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the |
| 112 * address is an IPv4-mapped IPv6 address. |
| 113 */ |
| 114 PP_Bool DescribeAsIPv4Address([in] PP_Resource addr, |
| 115 [out] PP_NetAddress_IPv4_Dev ipv4_addr); |
| 116 |
| 117 /** |
| 118 * Fills a <code>PP_NetAddress_IPv6_Dev</code> structure if the network |
| 119 * address is of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. |
| 120 * Returns PP_FALSE on failure. Note that passing a network address of |
| 121 * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this |
| 122 * method doesn't map it to an IPv6 address. |
| 123 */ |
| 124 PP_Bool DescribeAsIPv6Address([in] PP_Resource addr, |
| 125 [out] PP_NetAddress_IPv6_Dev ipv6_addr); |
| 126 }; |
OLD | NEW |