1fmt_ip6if(3) Library Functions Manual fmt_ip6if(3)
2
3
4
6 fmt_ip6if - write a formatted ASCII representation of an IPv6 number
7
9 #include <ip6.h>
10
11 unsigned int fmt_ip6if(char *dest,const char ip[16],uint32 scope_id);
12
14 fmt_ip6if formats an IPv6 number in ASCII representation from ip and
15 writes the result into dest. It returns the number of bytes written.
16
17 fmt_ip6if will apply "::" compression to the output.
18
19 If ip is an IPv4-mapped IPv6 address, fmt_ip6if will output the last 4
20 bytes as IPv4 number in dotted-decimal notation.
21
22 If dest equals FMT_LEN (i.e. is zero), fmt_ip6if returns the number of
23 bytes it would have written.
24
25 fmt_ip6 does not append \0.
26
27 ip6.h defines the integer IP6_FMT to be big enough to contain every
28 possible fmt_ip6 output plus \0. However, for fmt_ip6if you need to
29 add 1 for the '%' and IF_NAMESIZE from <net/if.h> for the interface
30 name.
31
33 #include <ip6.h>
34
35 char buf[IP6_FMT];
36 char ip[16];
37 scope_id sid;
38 buf[fmt_ip6if(buf,ip,sid)]=0;
39
41 scan_ip6(3), fmt_ip4(3)
42
43
44
45 fmt_ip6if(3)