summaryrefslogtreecommitdiff
path: root/toxcore/network.h
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-09-12 18:39:21 +0200
committerCoren[m] <Break@Ocean>2013-09-12 18:39:21 +0200
commit591d6c70c635406830486deb561343e4dc06af2a (patch)
treee427dc378ad3f2c0744249896d3e165063aae7be /toxcore/network.h
parent0cfbe004ef30e5a601f965e625ab42a490e13e15 (diff)
network.*:
- addr_resolv(_or_parse_ip)(): added an optional parameter to return both an IPv6 and an IPv4 address if requested address family was AF_UNSPEC - logging of unhandled packets DHT.c: - bootstrap_from_address(): use the additional return from addr_resolv_or_parse_ip() to bootstrap in both network types at once Lossless_UDP_testclient.c: - main(): adapt to signature change of addr_resolve() Messenger.c. LAN_discovery.h: - lost a htons(), readded - moved LAN_DISCOVERY_INTERVAL #define into LAN_discovery.h LAN_discovery.c: - added IPv4-in-IPv6 local address test
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.