| OLD | NEW |
| 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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_Private</code> interface. | 7 * This file defines the <code>PPB_NetAddress_Private</code> interface. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 label Chrome { | 10 label Chrome { |
| 11 M17 = 0.1, | 11 M17 = 0.1, |
| 12 M19 = 1.0 | 12 M19_0 = 1.0, |
| 13 M19_1 = 1.1 |
| 13 }; | 14 }; |
| 14 | 15 |
| 15 [assert_size(4)] | 16 [assert_size(4)] |
| 16 enum PP_NetAddressFamily_Private { | 17 enum PP_NetAddressFamily_Private { |
| 17 /** | 18 /** |
| 18 * The address family is unspecified. | 19 * The address family is unspecified. |
| 19 */ | 20 */ |
| 20 PP_NETADDRESSFAMILY_UNSPECIFIED = 0, | 21 PP_NETADDRESSFAMILY_UNSPECIFIED = 0, |
| 21 /** | 22 /** |
| 22 * The Internet Protocol version 4 (IPv4) address family. | 23 * The Internet Protocol version 4 (IPv4) address family. |
| 23 */ | 24 */ |
| 24 PP_NETADDRESSFAMILY_IPV4 = 1, | 25 PP_NETADDRESSFAMILY_IPV4 = 1, |
| 25 /** | 26 /** |
| 26 * The Internet Protocol version 6 (IPv6) address family. | 27 * The Internet Protocol version 6 (IPv6) address family. |
| 27 */ | 28 */ |
| 28 PP_NETADDRESSFAMILY_IPV6 = 2 | 29 PP_NETADDRESSFAMILY_IPV6 = 2 |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 /** | 32 /** |
| 32 * This is an opaque type holding a network address. | 33 * This is an opaque type holding a network address. Plugins must |
| 34 * never access members of this struct directly. |
| 33 */ | 35 */ |
| 34 [assert_size(132)] | 36 [assert_size(132)] |
| 35 struct PP_NetAddress_Private { | 37 struct PP_NetAddress_Private { |
| 36 uint32_t size; | 38 uint32_t size; |
| 37 char[128] data; | 39 char[128] data; |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 /** | 42 /** |
| 41 * The <code>PPB_NetAddress_Private</code> interface provides operations on | 43 * The <code>PPB_NetAddress_Private</code> interface provides operations on |
| 42 * network addresses. | 44 * network addresses. |
| 43 */ | 45 */ |
| 44 interface PPB_NetAddress_Private { | 46 interface PPB_NetAddress_Private { |
| 45 /** | 47 /** |
| 46 * Returns PP_TRUE if the two addresses are equal (host and port). | 48 * Returns PP_TRUE if the two addresses are equal (host and port). |
| 47 */ | 49 */ |
| 48 PP_Bool AreEqual([in] PP_NetAddress_Private addr1, | 50 PP_Bool AreEqual([in] PP_NetAddress_Private addr1, |
| 49 [in] PP_NetAddress_Private addr2); | 51 [in] PP_NetAddress_Private addr2); |
| 50 | 52 |
| 51 /** | 53 /** |
| 52 * Returns PP_TRUE if the two addresses refer to the same host. | 54 * Returns PP_TRUE if the two addresses refer to the same host. |
| 53 */ | 55 */ |
| 54 PP_Bool AreHostsEqual([in] PP_NetAddress_Private addr1, | 56 PP_Bool AreHostsEqual([in] PP_NetAddress_Private addr1, |
| 55 [in] PP_NetAddress_Private addr2); | 57 [in] PP_NetAddress_Private addr2); |
| 56 | 58 |
| 57 /** | 59 /** |
| 58 * Returns a human-readable description of the network address, optionally | 60 * Returns a human-readable description of the network address, optionally |
| 59 * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"), | 61 * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"), |
| 60 * or an undefined var on failure. | 62 * or an undefined var on failure. |
| 61 */ | 63 */ |
| 62 PP_Var Describe([in] PP_Module module, | 64 PP_Var Describe([in] PP_Module module, |
| 63 [in] PP_NetAddress_Private addr, | 65 [in] PP_NetAddress_Private addr, |
| 64 [in] PP_Bool include_port); | 66 [in] PP_Bool include_port); |
| 65 | 67 |
| 66 /** | 68 /** |
| 67 * Replaces the port in the given source address. Returns PP_TRUE on success. | 69 * Replaces the port in the given source address. Returns PP_TRUE on success. |
| 68 */ | 70 */ |
| 69 PP_Bool ReplacePort([in] PP_NetAddress_Private src_addr, | 71 PP_Bool ReplacePort([in] PP_NetAddress_Private src_addr, |
| 70 [in] uint16_t port, | 72 [in] uint16_t port, |
| 71 [out] PP_NetAddress_Private dest_addr); | 73 [out] PP_NetAddress_Private addr_out); |
| 72 | 74 |
| 73 /** | 75 /** |
| 74 * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind. | 76 * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind. |
| 75 */ | 77 */ |
| 76 void GetAnyAddress([in] PP_Bool is_ipv6, | 78 void GetAnyAddress([in] PP_Bool is_ipv6, |
| 77 [out] PP_NetAddress_Private addr); | 79 [out] PP_NetAddress_Private addr); |
| 78 | 80 |
| 79 /** | 81 /** |
| 80 * Gets the address family. | 82 * Gets the address family. |
| 81 */ | 83 */ |
| 82 [version=1.0] | 84 [version=1.0] |
| 83 PP_NetAddressFamily_Private GetFamily([in] PP_NetAddress_Private addr); | 85 PP_NetAddressFamily_Private GetFamily([in] PP_NetAddress_Private addr); |
| 84 | 86 |
| 85 /** | 87 /** |
| 86 * Gets the port. The port is returned in host byte order. | 88 * Gets the port. The port is returned in host byte order. |
| 87 */ | 89 */ |
| 88 [version=1.0] | 90 [version=1.0] |
| 89 uint16_t GetPort([in] PP_NetAddress_Private addr); | 91 uint16_t GetPort([in] PP_NetAddress_Private addr); |
| 90 | 92 |
| 91 /** | 93 /** |
| 92 * Gets the address. The output, address, must be large enough for the | 94 * Gets the address. The output, address, must be large enough for the |
| 93 * current socket family. The output will be the binary representation of an | 95 * current socket family. The output will be the binary representation of an |
| 94 * address for the current socket family. For IPv4 and IPv6 the address is in | 96 * address for the current socket family. For IPv4 and IPv6 the address is in |
| 95 * network byte order. PP_TRUE is returned if the address was successfully | 97 * network byte order. PP_TRUE is returned if the address was successfully |
| 96 * retrieved. | 98 * retrieved. |
| 97 */ | 99 */ |
| 98 [version=1.0] | 100 [version=1.0] |
| 99 PP_Bool GetAddress([in] PP_NetAddress_Private addr, | 101 PP_Bool GetAddress([in] PP_NetAddress_Private addr, |
| 100 [out] mem_t address, | 102 [out] mem_t address, |
| 101 [in] uint16_t address_size); | 103 [in] uint16_t address_size); |
| 104 |
| 105 /** |
| 106 * Returns ScopeID for IPv6 addresses or 0 for IPv4. |
| 107 */ |
| 108 [version=1.1] |
| 109 uint32_t GetScopeID([in] PP_NetAddress_Private addr); |
| 110 |
| 111 /** |
| 112 * Creates NetAddress with the specified IPv4 address and port |
| 113 * number. |
| 114 */ |
| 115 [version=1.1] |
| 116 void CreateFromIPv4Address([in] uint8_t[4] ip, |
| 117 [in] uint16_t port, |
| 118 [out] PP_NetAddress_Private addr_out); |
| 119 /** |
| 120 * Creates NetAddress with the specified IPv6 address, scope_id and |
| 121 * port number. |
| 122 */ |
| 123 [version=1.1] |
| 124 void CreateFromIPv6Address([in] uint8_t[16] ip, |
| 125 [in] uint32_t scope_id, |
| 126 [in] uint16_t port, |
| 127 [out] PP_NetAddress_Private addr_out); |
| 102 }; | 128 }; |
| OLD | NEW |