summaryrefslogtreecommitdiff
path: root/toxcore/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/network.h')
-rw-r--r--toxcore/network.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/toxcore/network.h b/toxcore/network.h
index ccda7ae9..5f9af490 100644
--- a/toxcore/network.h
+++ b/toxcore/network.h
@@ -180,10 +180,30 @@ IP_Port;
180/* ip_ntoa 180/* ip_ntoa
181 * converts ip into a string 181 * converts ip into a string
182 * uses a static buffer, so mustn't used multiple times in the same output 182 * uses a static buffer, so mustn't used multiple times in the same output
183 *
184 * IPv6 addresses are enclosed into square brackets, i.e. "[IPv6]"
185 * writes error message into the buffer on error
183 */ 186 */
184const char *ip_ntoa(const IP *ip); 187const char *ip_ntoa(const IP *ip);
185 188
186/* 189/*
190 * ip_parse_addr
191 * parses IP structure into an address string
192 *
193 * input
194 * ip: ip of AF_INET or AF_INET6 families
195 * length: length of the address buffer
196 * Must be at least INET_ADDRSTRLEN for AF_INET
197 * and INET6_ADDRSTRLEN for AF_INET6
198 *
199 * output
200 * address: dotted notation (IPv4: quad, IPv6: 16) or colon notation (IPv6)
201 *
202 * returns 1 on success, 0 on failure
203 */
204int ip_parse_addr(const IP *ip, char *address, size_t length);
205
206/*
187 * addr_parse_ip 207 * addr_parse_ip
188 * directly parses the input into an IP structure 208 * directly parses the input into an IP structure
189 * tries IPv4 first, then IPv6 209 * tries IPv4 first, then IPv6