(guile.info.gz) Network Address Conversion
Info Catalog
(guile.info.gz) Networking
(guile.info.gz) Network Databases
38.11.1 Network Address Conversion
----------------------------------
This section describes procedures which convert internet addresses
between numeric and string formats.
38.11.1.1 IPv4 Address Conversion
.................................
-- Scheme Procedure: inet-aton address
-- C Function: scm_inet_aton (address)
Convert an IPv4 Internet address from printable string (dotted
decimal notation) to an integer. E.g.,
(inet-aton "127.0.0.1") => 2130706433
-- Scheme Procedure: inet-ntoa inetid
-- C Function: scm_inet_ntoa (inetid)
Convert an IPv4 Internet address to a printable (dotted decimal
notation) string. E.g.,
(inet-ntoa 2130706433) => "127.0.0.1"
-- Scheme Procedure: inet-netof address
-- C Function: scm_inet_netof (address)
Return the network number part of the given IPv4 Internet address.
E.g.,
(inet-netof 2130706433) => 127
-- Scheme Procedure: inet-lnaof address
-- C Function: scm_lnaof (address)
Return the local-address-with-network part of the given IPv4
Internet address, using the obsolete class A/B/C system. E.g.,
(inet-lnaof 2130706433) => 1
-- Scheme Procedure: inet-makeaddr net lna
-- C Function: scm_inet_makeaddr (net, lna)
Make an IPv4 Internet address by combining the network number NET
with the local-address-within-network number LNA. E.g.,
(inet-makeaddr 127 1) => 2130706433
38.11.1.2 IPv6 Address Conversion
.................................
-- Scheme Procedure: inet-ntop family address
-- C Function: scm_inet_ntop (family, address)
Convert a network address into a printable string. Note that
unlike the C version of this function, the input is an integer
with normal host byte ordering. FAMILY can be `AF_INET' or
`AF_INET6'. E.g.,
(inet-ntop AF_INET 2130706433) => "127.0.0.1"
(inet-ntop AF_INET6 (- (expt 2 128) 1)) =>
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
-- Scheme Procedure: inet-pton family address
-- C Function: scm_inet_pton (family, address)
Convert a string containing a printable network address to an
integer address. Note that unlike the C version of this function,
the result is an integer with normal host byte ordering. FAMILY
can be `AF_INET' or `AF_INET6'. E.g.,
(inet-pton AF_INET "127.0.0.1") => 2130706433
(inet-pton AF_INET6 "::1") => 1
Info Catalog
(guile.info.gz) Networking
(guile.info.gz) Network Databases
automatically generated byinfo2html