summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testing/Messenger_test.c2
-rw-r--r--toxcore/network.h26
2 files changed, 27 insertions, 1 deletions
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[])
105 if ((argc != argvoffset + 2) && (argc != argvoffset + 4)) { 105 if ((argc != argvoffset + 2) && (argc != argvoffset + 4)) {
106 printf("Usage: %s [--ipv4|--ipv6] ip port public_key (of the DHT bootstrap node)\n", argv[0]); 106 printf("Usage: %s [--ipv4|--ipv6] ip port public_key (of the DHT bootstrap node)\n", argv[0]);
107 printf("or\n"); 107 printf("or\n");
108 printf(" %s [--ipv4|--ipv6] Save.bak (to read Save.bak as state file)\n", argv[0], argv[0]); 108 printf(" %s [--ipv4|--ipv6] Save.bak (to read Save.bak as state file)\n", argv[0]);
109 exit(0); 109 exit(0);
110 } 110 }
111 111
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;
136 */ 136 */
137const char *ip_ntoa(IP *ip); 137const char *ip_ntoa(IP *ip);
138 138
139/* ip_equal
140 * compares two IPAny structures
141 * unset means unequal
142 *
143 * returns 0 when not equal or when uninitialized
144 */
145int ip_equal(IP *a, IP *b);
146
139/* ipport_equal 147/* ipport_equal
140 * compares two IPAny_Port structures 148 * compares two IPAny_Port structures
141 * unset means unequal 149 * unset means unequal
@@ -158,6 +166,24 @@ void ip_copy(IP *target, IP *source);
158void ipport_copy(IP_Port *target, IP_Port *source); 166void ipport_copy(IP_Port *target, IP_Port *source);
159 167
160/* 168/*
169 * addr_resolve():
170 * uses getaddrinfo to resolve an address into an IP address
171 * uses the first IPv4/IPv6 addresses returned by getaddrinfo
172 *
173 * input
174 * address: a hostname (or something parseable to an IP address)
175 * ip: ip.family MUST be initialized, either set to a specific IP version
176 * (AF_INET/AF_INET6) or to the unspecified AF_UNSPEC (= 0), if both
177 * IP versions are acceptable
178 *
179 * returns in ip a valid IPAny (v4/v6),
180 * prefers v6 if ip.family was AF_UNSPEC and both available
181 * returns 0 on failure
182 */
183
184int addr_resolve(const char *address, IP *to);
185
186/*
161 * addr_resolve_or_parse_ip 187 * addr_resolve_or_parse_ip
162 * resolves string into an IP address 188 * resolves string into an IP address
163 * 189 *