Next: , Previous: , Up: glibc   [Index]


5.6 Network sockets

The following bindings are exported by the (vicare glibc) library.

Function: if-nametoindex name

Interface to the C function if_nametoindex(), (libc)if_nametoindex. Convert the string name representing a network interface to the corresponding internal index. Return a fixnum representing the index or false if name is invalid.

(import (vicare)
  (prefix (vicare glibc) glibc.))

(glibc.if-indextoname 0)      ⇒ #f
(glibc.if-indextoname 1)      ⇒ "lo"
(glibc.if-indextoname 2)      ⇒ "eth0"
Function: ikptr if-indextoname index

Interface to the C function if_indextoname(), (libc)if_indextoname. Convert the fixnum index associated to an interface to the corresponding string name. Return a string holding the name or false if index is invalid.

(import (vicare)
  (prefix (vicare glibc) glibc.))

(glibc.if-nametoindex "lo")   ⇒ 1
(glibc.if-nametoindex "eth0") ⇒ 2
Function: if-nameindex

Interface to the C function if_nameindex(), (libc)if_nameindex. Build and return an association list having fixnums as keys and strings as values; the fixnums are the interface indexes, the strings are the corresponding interface names.

(import (vicare)
  (prefix (vicare glibc) glibc.))

(glibc.if-nameindex)
⇒ ((4 . "wlan0")
    (2 . "eth0")
    (1 . "lo"))
Function: gethostbyname2 hostname addrtype

Interface to the C function gethostbyname2(), (libc)gethostbyname2. Like gethostbyname but allows the selection of the address type with the parameter addrtype which must be AF_INET or AF_INET6.