Next: , Previous: , Up: Common API   [Contents][Index]

2.1.2 Constants

Guile-netlink defines constants used by the Netlink protocols in the (netlink constant) module. The constants are the ones present in the kernel and are too numerous to list here. Please see the source for the complete list.

The module also defines the following macro:

Scheme Macro: define-enum integer->symbol name-spec ...

This macros defines an enumeration. integer->symbol is the name of a procedure that is publicly defined, that takes an integer and returns the associated symbol in the enumeration.

The macro also publicly defines variables whose names are in name-spec to an integer.

A name-spec is either a single name, and the associated value is 0 for the first name-spec, or one more than the previous name-spec. It can also be a pair of a name and an integer, in which case the associated value is that integer. For instance:

(define-enum get-foo FOO0 FOO1 (FOO10 10) FOO11 FOO12)
(get-foo 9) -> #<unspecified>
(get-foo 0) -> FOO0
FOO11 -> 11