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

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
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 Fri Mar 16 15:29: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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 */ 67 */
67 68
68 /** 69 /**
69 * @addtogroup Interfaces 70 * @addtogroup Interfaces
70 * @{ 71 * @{
71 */ 72 */
72 /** 73 /**
73 * The <code>PPB_NetAddress_Private</code> interface provides operations on 74 * The <code>PPB_NetAddress_Private</code> interface provides operations on
74 * network addresses. 75 * network addresses.
75 */ 76 */
76 struct PPB_NetAddress_Private_1_0 { 77 struct PPB_NetAddress_Private_1_1 {
77 /** 78 /**
78 * Returns PP_TRUE if the two addresses are equal (host and port). 79 * Returns PP_TRUE if the two addresses are equal (host and port).
79 */ 80 */
80 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, 81 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1,
81 const struct PP_NetAddress_Private* addr2); 82 const struct PP_NetAddress_Private* addr2);
82 /** 83 /**
83 * Returns PP_TRUE if the two addresses refer to the same host. 84 * Returns PP_TRUE if the two addresses refer to the same host.
84 */ 85 */
85 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, 86 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1,
86 const struct PP_NetAddress_Private* addr2); 87 const struct PP_NetAddress_Private* addr2);
87 /** 88 /**
88 * Returns a human-readable description of the network address, optionally 89 * 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"), 90 * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"),
90 * or an undefined var on failure. 91 * or an undefined var on failure.
91 */ 92 */
92 struct PP_Var (*Describe)(PP_Module module, 93 struct PP_Var (*Describe)(PP_Module module,
93 const struct PP_NetAddress_Private* addr, 94 const struct PP_NetAddress_Private* addr,
94 PP_Bool include_port); 95 PP_Bool include_port);
95 /** 96 /**
96 * Replaces the port in the given source address. Returns PP_TRUE on success. 97 * Replaces the port in the given source address. Returns PP_TRUE on success.
97 */ 98 */
98 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, 99 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr,
99 uint16_t port, 100 uint16_t port,
100 struct PP_NetAddress_Private* dest_addr); 101 struct PP_NetAddress_Private* addr_out);
101 /** 102 /**
102 * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind. 103 * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind.
103 */ 104 */
104 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); 105 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr);
105 /** 106 /**
106 * Gets the address family. 107 * Gets the address family.
107 */ 108 */
108 PP_NetAddressFamily_Private (*GetFamily)( 109 PP_NetAddressFamily_Private (*GetFamily)(
109 const struct PP_NetAddress_Private* addr); 110 const struct PP_NetAddress_Private* addr);
110 /** 111 /**
111 * Gets the port. The port is returned in host byte order. 112 * Gets the port. The port is returned in host byte order.
112 */ 113 */
113 uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr); 114 uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr);
114 /** 115 /**
115 * Gets the address. The output, address, must be large enough for the 116 * 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 117 * 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 118 * 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 119 * network byte order. PP_TRUE is returned if the address was successfully
119 * retrieved. 120 * retrieved.
120 */ 121 */
121 PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr, 122 PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr,
122 void* address, 123 void* address,
123 uint16_t address_size); 124 uint16_t address_size);
125 /**
126 * Creates NetAddress with the specified IPv4 address and port
127 * number.
128 */
129 void (*CreateFromIPv4Address)(const uint8_t ip[4],
130 uint16_t port,
131 struct PP_NetAddress_Private* addr_out);
132 /**
133 * Creates NetAddress with the specified IPv6 address, scope_id and
134 * port number.
135 */
136 void (*CreateFromIPv6Address)(const uint8_t ip[16],
137 uint32_t scope_id,
138 uint16_t port,
139 struct PP_NetAddress_Private* addr_out);
124 }; 140 };
125 141
126 typedef struct PPB_NetAddress_Private_1_0 PPB_NetAddress_Private; 142 typedef struct PPB_NetAddress_Private_1_1 PPB_NetAddress_Private;
127 143
128 struct PPB_NetAddress_Private_0_1 { 144 struct PPB_NetAddress_Private_0_1 {
129 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, 145 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1,
130 const struct PP_NetAddress_Private* addr2); 146 const struct PP_NetAddress_Private* addr2);
131 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, 147 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1,
132 const struct PP_NetAddress_Private* addr2); 148 const struct PP_NetAddress_Private* addr2);
133 struct PP_Var (*Describe)(PP_Module module, 149 struct PP_Var (*Describe)(PP_Module module,
134 const struct PP_NetAddress_Private* addr, 150 const struct PP_NetAddress_Private* addr,
135 PP_Bool include_port); 151 PP_Bool include_port);
136 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, 152 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr,
137 uint16_t port, 153 uint16_t port,
138 struct PP_NetAddress_Private* dest_addr); 154 struct PP_NetAddress_Private* addr_out);
139 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); 155 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr);
140 }; 156 };
157
158 struct PPB_NetAddress_Private_1_0 {
159 PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1,
160 const struct PP_NetAddress_Private* addr2);
161 PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1,
162 const struct PP_NetAddress_Private* addr2);
163 struct PP_Var (*Describe)(PP_Module module,
164 const struct PP_NetAddress_Private* addr,
165 PP_Bool include_port);
166 PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr,
167 uint16_t port,
168 struct PP_NetAddress_Private* addr_out);
169 void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr);
170 PP_NetAddressFamily_Private (*GetFamily)(
171 const struct PP_NetAddress_Private* addr);
172 uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr);
173 PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr,
174 void* address,
175 uint16_t address_size);
176 };
141 /** 177 /**
142 * @} 178 * @}
143 */ 179 */
144 180
145 #endif /* PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ */ 181 #endif /* PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ */
146 182
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698