Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: ppapi/c/private/ppb_net_address_private.h

Issue 9722008: Add CreateFromIPv[46]Address() in PPB_NetAddress_Private. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/api/private/ppb_net_address_private.idl ('k') | ppapi/cpp/private/net_address_private.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /* From private/ppb_net_address_private.idl, 6 /* From private/ppb_net_address_private.idl,
7 * modified Tue Feb 14 17:56:23 2012. 7 * modified Wed Mar 21 11:10:47 2012.
8 */ 8 */
9 9
10 #ifndef PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ 10 #ifndef PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ 11 #define PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_
12 12
13 #include "ppapi/c/pp_bool.h" 13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_macros.h" 14 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_module.h" 15 #include "ppapi/c/pp_module.h"
16 #include "ppapi/c/pp_stdint.h" 16 #include "ppapi/c/pp_stdint.h"
17 #include "ppapi/c/pp_var.h" 17 #include "ppapi/c/pp_var.h"
18 18
19 #define PPB_NETADDRESS_PRIVATE_INTERFACE_0_1 "PPB_NetAddress_Private;0.1" 19 #define PPB_NETADDRESS_PRIVATE_INTERFACE_0_1 "PPB_NetAddress_Private;0.1"
20 #define PPB_NETADDRESS_PRIVATE_INTERFACE_1_0 "PPB_NetAddress_Private;1.0" 20 #define PPB_NETADDRESS_PRIVATE_INTERFACE_1_0 "PPB_NetAddress_Private;1.0"
21 #define PPB_NETADDRESS_PRIVATE_INTERFACE PPB_NETADDRESS_PRIVATE_INTERFACE_1_0 21 #define PPB_NETADDRESS_PRIVATE_INTERFACE_1_1 "PPB_NetAddress_Private;1.1"
22 #define PPB_NETADDRESS_PRIVATE_INTERFACE PPB_NETADDRESS_PRIVATE_INTERFACE_1_1
22 23
23 /** 24 /**
24 * @file 25 * @file
25 * This file defines the <code>PPB_NetAddress_Private</code> interface. 26 * This file defines the <code>PPB_NetAddress_Private</code> interface.
26 */ 27 */
27 28
28 29
29 /** 30 /**
30 * @addtogroup Enums 31 * @addtogroup Enums
31 * @{ 32 * @{
(...skipping 15 matching lines...) Expand all
47 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddressFamily_Private, 4); 48 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddressFamily_Private, 4);
48 /** 49 /**
49 * @} 50 * @}
50 */ 51 */
51 52
52 /** 53 /**
53 * @addtogroup Structs 54 * @addtogroup Structs
54 * @{ 55 * @{
55 */ 56 */
56 /** 57 /**
57 * This is an opaque type holding a network address. 58 * This is an opaque type holding a network address. Plugins must
59 * never access members of this struct directly.
58 */ 60 */
59 struct PP_NetAddress_Private { 61 struct PP_NetAddress_Private {
60 uint32_t size; 62 uint32_t size;
61 char data[128]; 63 char data[128];
62 }; 64 };
63 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_Private, 132); 65 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_Private, 132);
64 /** 66 /**
65 * @} 67 * @}
66 */ 68 */
67 69
68 /** 70 /**
69 * @addtogroup Interfaces 71 * @addtogroup Interfaces
70 * @{ 72 * @{
71 */ 73 */
72 /** 74 /**
73 * The <code>PPB_NetAddress_Private</code> interface provides operations on 75 * The <code>PPB_NetAddress_Private</code> interface provides operations on
74 * network addresses. 76 * network addresses.
75 */ 77 */
76 struct PPB_NetAddress_Private_1_0 { 78 struct PPB_NetAddress_Private_1_1 {
77 /** 79 /**
78 * Returns PP_TRUE if the two addresses are equal (host and port). 80 * Returns PP_TRUE if the two addresses are equal (host and port).
79 */ 81 */
80 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, 82 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1,
81 const struct PP_NetAddress_Private* addr2); 83 const struct PP_NetAddress_Private* addr2);
82 /** 84 /**
83 * Returns PP_TRUE if the two addresses refer to the same host. 85 * Returns PP_TRUE if the two addresses refer to the same host.
84 */ 86 */
85 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, 87 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1,
86 const struct PP_NetAddress_Private* addr2); 88 const struct PP_NetAddress_Private* addr2);
87 /** 89 /**
88 * Returns a human-readable description of the network address, optionally 90 * Returns a human-readable description of the network address, optionally
89 * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"), 91 * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"),
90 * or an undefined var on failure. 92 * or an undefined var on failure.
91 */ 93 */
92 struct PP_Var (*Describe)(PP_Module module, 94 struct PP_Var (*Describe)(PP_Module module,
93 const struct PP_NetAddress_Private* addr, 95 const struct PP_NetAddress_Private* addr,
94 PP_Bool include_port); 96 PP_Bool include_port);
95 /** 97 /**
96 * Replaces the port in the given source address. Returns PP_TRUE on success. 98 * Replaces the port in the given source address. Returns PP_TRUE on success.
97 */ 99 */
98 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, 100 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr,
99 uint16_t port, 101 uint16_t port,
100 struct PP_NetAddress_Private* dest_addr); 102 struct PP_NetAddress_Private* addr_out);
101 /** 103 /**
102 * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind. 104 * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind.
103 */ 105 */
104 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); 106 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr);
105 /** 107 /**
106 * Gets the address family. 108 * Gets the address family.
107 */ 109 */
108 PP_NetAddressFamily_Private (*GetFamily)( 110 PP_NetAddressFamily_Private (*GetFamily)(
109 const struct PP_NetAddress_Private* addr); 111 const struct PP_NetAddress_Private* addr);
110 /** 112 /**
111 * Gets the port. The port is returned in host byte order. 113 * Gets the port. The port is returned in host byte order.
112 */ 114 */
113 uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr); 115 uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr);
114 /** 116 /**
115 * Gets the address. The output, address, must be large enough for the 117 * Gets the address. The output, address, must be large enough for the
116 * current socket family. The output will be the binary representation of an 118 * current socket family. The output will be the binary representation of an
117 * address for the current socket family. For IPv4 and IPv6 the address is in 119 * address for the current socket family. For IPv4 and IPv6 the address is in
118 * network byte order. PP_TRUE is returned if the address was successfully 120 * network byte order. PP_TRUE is returned if the address was successfully
119 * retrieved. 121 * retrieved.
120 */ 122 */
121 PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr, 123 PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr,
122 void* address, 124 void* address,
123 uint16_t address_size); 125 uint16_t address_size);
126 /**
127 * Returns ScopeID for IPv6 addresses or 0 for IPv4.
128 */
129 uint32_t (*GetScopeID)(const struct PP_NetAddress_Private* addr);
130 /**
131 * Creates NetAddress with the specified IPv4 address and port
132 * number.
133 */
134 void (*CreateFromIPv4Address)(const uint8_t ip[4],
135 uint16_t port,
136 struct PP_NetAddress_Private* addr_out);
137 /**
138 * Creates NetAddress with the specified IPv6 address, scope_id and
139 * port number.
140 */
141 void (*CreateFromIPv6Address)(const uint8_t ip[16],
142 uint32_t scope_id,
143 uint16_t port,
144 struct PP_NetAddress_Private* addr_out);
124 }; 145 };
125 146
126 typedef struct PPB_NetAddress_Private_1_0 PPB_NetAddress_Private; 147 typedef struct PPB_NetAddress_Private_1_1 PPB_NetAddress_Private;
127 148
128 struct PPB_NetAddress_Private_0_1 { 149 struct PPB_NetAddress_Private_0_1 {
129 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, 150 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1,
130 const struct PP_NetAddress_Private* addr2); 151 const struct PP_NetAddress_Private* addr2);
131 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, 152 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1,
132 const struct PP_NetAddress_Private* addr2); 153 const struct PP_NetAddress_Private* addr2);
133 struct PP_Var (*Describe)(PP_Module module, 154 struct PP_Var (*Describe)(PP_Module module,
134 const struct PP_NetAddress_Private* addr, 155 const struct PP_NetAddress_Private* addr,
135 PP_Bool include_port); 156 PP_Bool include_port);
136 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, 157 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr,
137 uint16_t port, 158 uint16_t port,
138 struct PP_NetAddress_Private* dest_addr); 159 struct PP_NetAddress_Private* addr_out);
139 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); 160 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr);
140 }; 161 };
162
163 struct PPB_NetAddress_Private_1_0 {
164 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1,
165 const struct PP_NetAddress_Private* addr2);
166 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1,
167 const struct PP_NetAddress_Private* addr2);
168 struct PP_Var (*Describe)(PP_Module module,
169 const struct PP_NetAddress_Private* addr,
170 PP_Bool include_port);
171 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr,
172 uint16_t port,
173 struct PP_NetAddress_Private* addr_out);
174 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr);
175 PP_NetAddressFamily_Private (*GetFamily)(
176 const struct PP_NetAddress_Private* addr);
177 uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr);
178 PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr,
179 void* address,
180 uint16_t address_size);
181 };
141 /** 182 /**
142 * @} 183 * @}
143 */ 184 */
144 185
145 #endif /* PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ */ 186 #endif /* PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ */
146 187
OLDNEW
« no previous file with comments | « ppapi/api/private/ppb_net_address_private.idl ('k') | ppapi/cpp/private/net_address_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698