Next: , Previous: , Up: posix socket   [Index]


4.15.5 Networks database

Structure Type: struct-netent

Scheme level representation of struct netent. It has the following fields:

n_name

Bytevector, ASCII coding of the official network name.

n_aliases

List of bytevectors, alias names for the network.

n_addrtype

Fixnum, the network type.

n_net

32-bit bytevector, the network number in network byte order.

Function: make-struct-netent name aliases addrtype net

Build and return a new instance of struct-netent.

Function: struct-netent-n_name netent
Function: struct-netent-n_aliases netent
Function: struct-netent-n_addrtype netent
Function: struct-netent-n_net netent

Accessors for the fields of struct-netent.

Function: struct-netent? obj

Return #t if obj is an instance of struct-netent.

Function: getnetbyname name

Interface to the C function getnetbyname(), (libc)getnetbyname. Given the bytevector name holding the ASCII coding of a network name, query the networks database and build an instance of struct-netent mirroring the resulting struct netent entry. If successful return the data structure, else raise an exception.

(px.getnetbyname "loopback")
⇒ #["struct-netent"
        n_name="loopback"
        n_aliases=()
        n_addrtype=AF_INET
        n_net=#vu8(127 0 0 0)]
Function: getnetbyaddr net type

Interface to the C function getnetbyaddr(), (libc)getnetbyaddr. Given an exact integer or bytevector net representing a network number and the fixnum type representing a network type, query the networks database and build an instance of struct-netent mirroring the resulting struct netent entry. If successful return the data structure, else raise an exception.

(px.getnetbyaddr '#vu8(127 0 0 0) AF_INET)
⇒ #["struct-netent"
        n_name="loopback"
        n_aliases=()
        n_addrtype=AF_INET
        n_net=#vu8(127 0 0 0)]
Function: network-entries

Interface to the C functions setnetent(), getnetent() and endnetent(), (libc)setnetent. Scan the networks database and build a list of struct-netent mirroring the resulting struct netent entries. Return the list of structures.


Next: , Previous: , Up: posix socket   [Index]