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


4.15.3 Network protocols database

Structure Type: struct-protoent

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

p_name

Bytevector, the ASCII coding of the official protocol name.

p_aliases

Null or list of bytevectors, the ASCII codings of protocol name aliases.

p_proto

Fixnum, the protocol number.

Function: make-struct-protoent name aliases proto

Build and return an instance of struct-protoent.

Function: struct-protoent-p_name protoent
Function: struct-protoent-p_aliases protoent
Function: struct-protoent-p_proto protoent

Accessors for the fields of struct-protoent.

Function: getprotobyname name

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

(px.getprotobyname "udp")
⇒ #["struct-protoent"
        p_name="udp"
        p_aliases=(UDP)
        p_proto=17]
Function: getprotobynumber proto_num

Interface to the C function getprotobynumber(), (libc)getprotobynumber. Given a fixnum proto_num being the number of a network protocol, query the network protocols database and build an instance of struct-protoent mirroring the resulting struct protoent entry. If successful return the data structure, else raise an exception.

(px.getprotobynumber 17)
⇒ #["struct-protoent"
        p_name="udp"
        p_aliases=(UDP)
        p_proto=17]
Function: protocol-entries

Interface to the C functions setprotoent(), getprotoent() and endprotoent(), (libc)setprotoent. Scan the network protocol database and build a list of struct-protoent mirroring the resulting struct protoent entries. Return the list of structures.