From d0f5ad34ae2cb88e921cf6f6d829d611b5ea2152 Mon Sep 17 00:00:00 2001 From: "Coren[m]" Date: Wed, 11 Sep 2013 16:57:26 +0200 Subject: cleanup TravisCI warnings (missing exports/extraneous args to printf) --- testing/Messenger_test.c | 2 +- toxcore/network.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 14d9ca20..fdcd3061 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) if ((argc != argvoffset + 2) && (argc != argvoffset + 4)) { printf("Usage: %s [--ipv4|--ipv6] ip port public_key (of the DHT bootstrap node)\n", argv[0]); printf("or\n"); - printf(" %s [--ipv4|--ipv6] Save.bak (to read Save.bak as state file)\n", argv[0], argv[0]); + printf(" %s [--ipv4|--ipv6] Save.bak (to read Save.bak as state file)\n", argv[0]); exit(0); } diff --git a/toxcore/network.h b/toxcore/network.h index e804379d..aa0c4661 100644 --- a/toxcore/network.h +++ b/toxcore/network.h @@ -136,6 +136,14 @@ typedef IP4_Port IP_Port; */ const char *ip_ntoa(IP *ip); +/* ip_equal + * compares two IPAny structures + * unset means unequal + * + * returns 0 when not equal or when uninitialized + */ +int ip_equal(IP *a, IP *b); + /* ipport_equal * compares two IPAny_Port structures * unset means unequal @@ -157,6 +165,24 @@ void ip_copy(IP *target, IP *source); /* copies an ip_port structure */ void ipport_copy(IP_Port *target, IP_Port *source); +/* + * addr_resolve(): + * uses getaddrinfo to resolve an address into an IP address + * uses the first IPv4/IPv6 addresses returned by getaddrinfo + * + * input + * address: a hostname (or something parseable to an IP address) + * ip: ip.family MUST be initialized, either set to a specific IP version + * (AF_INET/AF_INET6) or to the unspecified AF_UNSPEC (= 0), if both + * IP versions are acceptable + * + * returns in ip a valid IPAny (v4/v6), + * prefers v6 if ip.family was AF_UNSPEC and both available + * returns 0 on failure + */ + +int addr_resolve(const char *address, IP *to); + /* * addr_resolve_or_parse_ip * resolves string into an IP address -- cgit v1.2.3