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 /* From dev/ppb_net_address_dev.idl modified Tue Jun 04 17:32:47 2013. */ |
| 7 |
| 8 #ifndef PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ |
| 9 #define PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ |
| 10 |
| 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_instance.h" |
| 13 #include "ppapi/c/pp_macros.h" |
| 14 #include "ppapi/c/pp_resource.h" |
| 15 #include "ppapi/c/pp_stdint.h" |
| 16 #include "ppapi/c/pp_var.h" |
| 17 |
| 18 #define PPB_NETADDRESS_DEV_INTERFACE_0_1 "PPB_NetAddress(Dev);0.1" |
| 19 #define PPB_NETADDRESS_DEV_INTERFACE PPB_NETADDRESS_DEV_INTERFACE_0_1 |
| 20 |
| 21 /** |
| 22 * @file |
| 23 * This file defines the <code>PPB_NetAddress_Dev</code> interface. |
| 24 */ |
| 25 |
| 26 |
| 27 /** |
| 28 * @addtogroup Enums |
| 29 * @{ |
| 30 */ |
| 31 typedef enum { |
| 32 /** |
| 33 * The address family is unspecified. |
| 34 */ |
| 35 PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, |
| 36 /** |
| 37 * The Internet Protocol version 4 (IPv4) address family. |
| 38 */ |
| 39 PP_NETADDRESS_FAMILY_IPV4 = 1, |
| 40 /** |
| 41 * The Internet Protocol version 6 (IPv6) address family. |
| 42 */ |
| 43 PP_NETADDRESS_FAMILY_IPV6 = 2 |
| 44 } PP_NetAddress_Family_Dev; |
| 45 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddress_Family_Dev, 4); |
| 46 /** |
| 47 * @} |
| 48 */ |
| 49 |
| 50 /** |
| 51 * @addtogroup Structs |
| 52 * @{ |
| 53 */ |
| 54 /** |
| 55 * The contents are expressed in network byte order. |
| 56 */ |
| 57 struct PP_NetAddress_IPv4_Dev { |
| 58 /** |
| 59 * Port number. |
| 60 */ |
| 61 uint16_t port; |
| 62 /** |
| 63 * Padding that makes the structure size consistent across compilers. |
| 64 */ |
| 65 uint16_t unused_padding; |
| 66 /** |
| 67 * IP address. |
| 68 */ |
| 69 uint8_t addr[4]; |
| 70 }; |
| 71 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv4_Dev, 8); |
| 72 |
| 73 /** |
| 74 * The contents are expressed in network byte order. |
| 75 */ |
| 76 struct PP_NetAddress_IPv6_Dev { |
| 77 /** |
| 78 * Port number. |
| 79 */ |
| 80 uint16_t port; |
| 81 /** |
| 82 * Padding that makes the structure size consistent across compilers. |
| 83 */ |
| 84 uint16_t unused_padding; |
| 85 /** |
| 86 * IPv6 address. |
| 87 */ |
| 88 uint8_t addr[16]; |
| 89 }; |
| 90 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv6_Dev, 20); |
| 91 /** |
| 92 * @} |
| 93 */ |
| 94 |
| 95 /** |
| 96 * @addtogroup Interfaces |
| 97 * @{ |
| 98 */ |
| 99 /** |
| 100 * The <code>PPB_NetAddress_Dev</code> interface provides operations on |
| 101 * network addresses. |
| 102 */ |
| 103 struct PPB_NetAddress_Dev_0_1 { |
| 104 /** |
| 105 * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv4 |
| 106 * address. |
| 107 */ |
| 108 PP_Resource (*CreateFromIPv4Address)( |
| 109 PP_Instance instance, |
| 110 const struct PP_NetAddress_IPv4_Dev* ipv4_addr); |
| 111 /** |
| 112 * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv6 |
| 113 * address. |
| 114 */ |
| 115 PP_Resource (*CreateFromIPv6Address)( |
| 116 PP_Instance instance, |
| 117 const struct PP_NetAddress_IPv6_Dev* ipv6_addr); |
| 118 /** |
| 119 * Determines if a given resource is a network address. |
| 120 */ |
| 121 PP_Bool (*IsNetAddress)(PP_Resource addr); |
| 122 /** |
| 123 * Gets the address family. |
| 124 */ |
| 125 PP_NetAddress_Family_Dev (*GetFamily)(PP_Resource addr); |
| 126 /** |
| 127 * Returns a human-readable description of the network address. The |
| 128 * description is in the form of host [ ":" port ] and conforms to |
| 129 * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses |
| 130 * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). |
| 131 * Returns an undefined var on failure. |
| 132 */ |
| 133 struct PP_Var (*DescribeAsString)(PP_Resource addr, PP_Bool include_port); |
| 134 /** |
| 135 * Fills a <code>PP_NetAddress_IPv4_Dev</code> structure if the network |
| 136 * address is of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. |
| 137 */ |
| 138 PP_Bool (*DescribeAsIPv4Address)(PP_Resource addr, |
| 139 struct PP_NetAddress_IPv4_Dev* ipv4_addr); |
| 140 /** |
| 141 * Fills a <code>PP_NetAddress_IPv6_Dev</code> structure if the network |
| 142 * address is of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. |
| 143 * Returns PP_FALSE if the network address is of |
| 144 * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. This method doesn't |
| 145 * map it to an IPv6 address. |
| 146 */ |
| 147 PP_Bool (*DescribeAsIPv6Address)(PP_Resource addr, |
| 148 struct PP_NetAddress_IPv6_Dev* ipv6_addr); |
| 149 }; |
| 150 |
| 151 typedef struct PPB_NetAddress_Dev_0_1 PPB_NetAddress_Dev; |
| 152 /** |
| 153 * @} |
| 154 */ |
| 155 |
| 156 #endif /* PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ */ |
| 157 |
OLD | NEW |