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
3 * found in the LICENSE file.
7 * This file defines the <code>PPB_NetAddress_Private</code> interface.
18 enum PP_NetAddressFamily_Private
{
20 * The address family is unspecified.
22 PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED
= 0,
24 * The Internet Protocol version 4 (IPv4) address family.
26 PP_NETADDRESSFAMILY_PRIVATE_IPV4
= 1,
28 * The Internet Protocol version 6 (IPv6) address family.
30 PP_NETADDRESSFAMILY_PRIVATE_IPV6
= 2
34 * This is an opaque type holding a network address. Plugins must
35 * never access members of this struct directly.
38 struct PP_NetAddress_Private
{
44 * The <code>PPB_NetAddress_Private</code> interface provides operations on
47 [version=0.1] interface PPB_NetAddress_Private
{
49 * Returns PP_TRUE if the two addresses are equal (host and port).
51 PP_Bool AreEqual
([in] PP_NetAddress_Private addr1
,
52 [in] PP_NetAddress_Private addr2
);
55 * Returns PP_TRUE if the two addresses refer to the same host.
57 PP_Bool AreHostsEqual
([in] PP_NetAddress_Private addr1
,
58 [in] PP_NetAddress_Private addr2
);
61 * Returns a human-readable description of the network address, optionally
62 * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"),
63 * or an undefined var on failure.
65 PP_Var Describe
([in] PP_Module
module,
66 [in] PP_NetAddress_Private addr
,
67 [in] PP_Bool include_port
);
70 * Replaces the port in the given source address. Returns PP_TRUE on success.
72 PP_Bool ReplacePort
([in] PP_NetAddress_Private src_addr
,
74 [out] PP_NetAddress_Private addr_out
);
77 * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind.
79 void GetAnyAddress
([in] PP_Bool is_ipv6
,
80 [out] PP_NetAddress_Private addr
);
83 * Gets the address family.
86 PP_NetAddressFamily_Private GetFamily
([in] PP_NetAddress_Private addr
);
89 * Gets the port. The port is returned in host byte order.
92 uint16_t GetPort
([in] PP_NetAddress_Private addr
);
95 * Gets the address. The output, address, must be large enough for the
96 * current socket family. The output will be the binary representation of an
97 * address for the current socket family. For IPv4 and IPv6 the address is in
98 * network byte order. PP_TRUE is returned if the address was successfully
102 PP_Bool GetAddress
([in] PP_NetAddress_Private addr
,
104 [in] uint16_t address_size
);
107 * Returns ScopeID for IPv6 addresses or 0 for IPv4.
110 uint32_t GetScopeID
([in] PP_NetAddress_Private addr
);
113 * Creates NetAddress with the specified IPv4 address and port
117 void CreateFromIPv4Address
([in] uint8_t
[4] ip
,
119 [out] PP_NetAddress_Private addr_out
);
121 * Creates NetAddress with the specified IPv6 address, scope_id and
125 void CreateFromIPv6Address
([in] uint8_t
[16] ip
,
126 [in] uint32_t scope_id
,
128 [out] PP_NetAddress_Private addr_out
);