1scan_ip6(3) Library Functions Manual scan_ip6(3)
2
3
4
6 scan_ip6 - parse an IPv6 number in ASCII representation
7
9 #include <ip6.h>
10
11 int scan_ip6(const char *src,char ip[16]);
12
14 scan_ip6 parses an IPv6 number in RFC1884 ASCII representation from src
15 and writes the result into ip. It returns the number of bytes read from
16 src or 0 if the parsing failed.
17
18 scan_ip6 accepts upper and lower case hex letters, it understands "::"
19 compression and partial IPv4 addresses as in "::FFFF:129.144.52.38".
20
21 To allow transparent usage of IPv4 in IPv6 applications, scan_ip6 also
22 understands IPv4 addresses in dotted-decimal notation and will return
23 an IPv4-mapped IPv6 address (i.e. "127.0.0.1" will be parsed as
24 "::FFFF:127.0.0.1".
25
26 Unlike many other IP parsing routines, scan_ip6 does not recognize
27 octal (like 0177.0.0.1) or hexadecimal numbers (like 0x7f000001) in the
28 IPv4 part.
29
31 #include <str.h>
32 #include <ip6.h>
33
34 char buf[]="::1";
35 char ip[16];
36 if (scan_ip6(buf,ip) != str_len(buf))
37 parse_error();
38
39
41 fmt_ip6(3), scan_ip4(3), inet_pton(3)
42
43
44
45 scan_ip6(3)