Next: posix socket addresses info, Previous: posix socket addresses in6, Up: posix socket addresses [Index]
Dotted quad address representations can be handled as follows:
(import (vicare) (prefix (vicare posix) px.)) (px.inet-aton "127.0.0.1") ⇒ #vu8(127 0 0 1) (px.inet-aton "ciao") error→ invalid argument (px.inet-ntoa/string '#vu8(127 0 0 1)) ⇒ "127.0.0.1"
care must be taken when handling such raw values.
ASCII to number. Given the bytevector dotted-quad holding the
ASCII dotted quad representation of a host address, build and return
a bytevector holding the corresponding struct in_addr
. If
dotted-quad is invalid: an exception is raised.
Number to ASCII. Given the bytevector host-address holding a
struct in_addr
: inet-ntoa
builds and returns a bytevector
holding the corresponding ASCII dotted quad representation,
inet-ntoa/string
builds and returns a string holding the
corresponding ASCII dotted quad representation.
Addresses in presentation format can be handled as follows:
#!vicare (import (vicare) (prefix (vicare posix) px.) (vicare platform constants)) (px.inet-pton AF_INET "127.0.0.1") ⇒ #vu8(127 0 0 1) (px.inet-pton AF_INET "ciao") error→ invalid arguments (px.inet-pton AF_INET6 "1:2:3:4:5:6:7:8") ⇒ #vu16b(1 2 3 4 5 6 7 8) (px.inet-ntop/string AF_INET '#vu8(127 0 0 1)) ⇒ "127.0.0.1" (px.inet-ntop/string AF_INET6 '#vu16b(1 2 3 4 5 6 7 8)) ⇒ "1:2:3:4:5:6:7:8"
care must be taken when handling such raw values.
Given the fixnum af, being AF_INET
or AF_INET6
, and
the string or bytevector presentation holding the ASCII
presentation of an Internet address, build and return a bytevector
holding the corresponding struct in_addr
or struct
in6_addr
. If either af or presentation is invalid: raise
an exception.
Given the fixnum af, being AF_INET
or AF_INET6
, and
the bytevector host-address holding a struct in_addr
or
struct in6_addr
: inet-ntop
builds and returns a bytevector
holding the corresponding ASCII presentation of the Internet address,
inet-ntop/string
builds and returns a string holding the
corresponding ASCII presentation of the Internet address. If the
arguments are invalid: an exception is raised.
Next: posix socket addresses info, Previous: posix socket addresses in6, Up: posix socket addresses [Index]