summaryrefslogtreecommitdiff
path: root/toxcore/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/network.h')
-rw-r--r--toxcore/network.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/toxcore/network.h b/toxcore/network.h
index 5bc04632..6cdf300d 100644
--- a/toxcore/network.h
+++ b/toxcore/network.h
@@ -175,25 +175,34 @@ void ipport_copy(IP_Port *target, IP_Port *source);
175 * 175 *
176 * input 176 * input
177 * address: a hostname (or something parseable to an IP address) 177 * address: a hostname (or something parseable to an IP address)
178 * ip: ip.family MUST be initialized, either set to a specific IP version 178 * to: to.family MUST be initialized, either set to a specific IP version
179 * (AF_INET/AF_INET6) or to the unspecified AF_UNSPEC (= 0), if both 179 * (AF_INET/AF_INET6) or to the unspecified AF_UNSPEC (= 0), if both
180 * IP versions are acceptable 180 * IP versions are acceptable
181 * extra can be NULL and is only set in special circumstances, see returns
181 * 182 *
182 * returns in ip a valid IPAny (v4/v6), 183 * returns in *to a valid IPAny (v4/v6),
183 * prefers v6 if ip.family was AF_UNSPEC and both available 184 * prefers v6 if ip.family was AF_UNSPEC and both available
185 * returns in *extra an IPv4 address, if family was AF_UNSPEC and *to is AF_INET6
184 * returns 0 on failure 186 * returns 0 on failure
185 */ 187 */
186 188int addr_resolve(const char *address, IP *to, IP *extra);
187int addr_resolve(const char *address, IP *to);
188 189
189/* 190/*
190 * addr_resolve_or_parse_ip 191 * addr_resolve_or_parse_ip
191 * resolves string into an IP address 192 * resolves string into an IP address
192 * 193 *
193 * to->family MUST be set (AF_UNSPEC, AF_INET, AF_INET6) 194 * address: a hostname (or something parseable to an IP address)
194 * returns 1 on success, 0 on failure 195 * to: to.family MUST be initialized, either set to a specific IP version
196 * (AF_INET/AF_INET6) or to the unspecified AF_UNSPEC (= 0), if both
197 * IP versions are acceptable
198 * extra can be NULL and is only set in special circumstances, see returns
199 *
200 * returns in *tro a matching address (IPv6 or IPv4)
201 * returns in *extra, if not NULL, an IPv4 address, if to->family was AF_UNSPEC
202 * returns 1 on success
203 * returns 0 on failure
195 */ 204 */
196int addr_resolve_or_parse_ip(const char *address, IP *to); 205int addr_resolve_or_parse_ip(const char *address, IP *to, IP *extra);
197 206
198/* Function to receive data, ip and port of sender is put into ip_port. 207/* Function to receive data, ip and port of sender is put into ip_port.
199 * Packet data is put into data. 208 * Packet data is put into data.