Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

  1. .TH scan_ip6if 3
  2. .SH NAME
  3. scan_ip6 \- parse an IPv6 number and interface in ASCII representation
  5. .B #include <ip6.h>
  6. int \fBscan_ip6if\fP(const char *\fIsrc\fR,char \fIip\fR[16],uint32* scope_id);
  8. scan_ip6if parses an IPv6 number in RFC1884 ASCII representation
  9. from \fIsrc\fR and writes the result into \fIip\fR. If the IPv6 number
  10. is followed by the percent sign, scan_ip6if takes the word following
  11. that, tries to parse it as network interface and writes the result to
  12. \fIscope_id\fR.
  13. It returns the number of bytes read from \fIsrc\fR or 0 if the parsing
  14. failed.
  15. scan_ip6if accepts upper and lower case hex letters, it understands "::"
  16. compression and partial IPv4 addresses as in "::FFFF:".
  17. To allow transparent usage of IPv4 in IPv6 applications, scan_ip6if also
  18. understands IPv4 addresses in dotted-decimal notation and will return
  19. an IPv4-mapped IPv6 address (i.e. "" will be parsed as
  20. "::FFFF:".
  21. Unlike many other IP parsing routines, scan_ip6if does not recognize octal
  22. (like \fB0177.0.0.1\fR) or hexadecimal numbers (like \fB0x7f000001\fR)
  23. in the IPv4 part.
  25. #include <str.h>
  26. .br
  27. #include <ip6.h>
  28. char buf[]="::1%lo";
  29. char ip[16];
  30. uint32 scope_id;
  31. if (scan_ip6if(buf,ip,&scope_id) != str_len(buf))
  32. parse_error();
  33. .SH "SEE ALSO"
  34. fmt_ip6(3), scan_ip4(3), fmt_ip6if(3)