33.8. Directory Access

This module provides some directory access from lisp, in package LDAP.

When this module is present, *FEATURES* contains the symbol :DIRKEY.

3 types of directory keys may exist, depending on the compilation environment.

valid directory key types

:win32
Win32 registry access
:gnome
gnome-config access
:ldap
LDAP interface via OpenLDAP or compatible

The following functions and macros are exported (please note that these features are experimental and the API may be modified in the future).

(LDAP:DIR-KEY-OPEN dkey pathname &KEY (:DIRECTION :INPUT) :IF-DOES-NOT-EXIST)
Open the directory key under dkey, which should be either an open directory key or a valid directory key type. The meaning of the :DIRECTION and :IF-DOES-NOT-EXIST keyword arguments is the same as for OPEN.
(LDAP:DIR-KEY-CLOSE dkey)
Close the directory key. The preferred way is to use the LDAP:WITH-DIR-KEY-OPEN macro.
(LDAP:WITH-DIR-KEY-OPEN (variable dkey pathname &REST {option}*) &BODY body)
Open the directory key (by calling LDAP:DIR-KEY-OPEN on dkey, pathname and options), bind it to variable, execute body, then close it with LDAP:DIR-KEY-CLOSE.
(LDAP:DIR-KEY-TYPE dkey)
Return the directory key type of the directory key
(LDAP:DIR-KEY-PATH dkey)
Return the path of this directory key, which is the pathname argument of LDAP:DIR-KEY-OPEN if dkey was a directory key type or the concatenation of the pathname argument and the ldap:dir-key-path of dkey.
(LDAP:DIR-KEY-DIRECTION dkey)
One of :INPUT, :OUTPUT and :IO, indicating the permitted operation on this key and its derivatives.
(LDAP:DIR-KEY-CLOSED-P dkey)
Check whether the key has been closed. It is not an error to close a closed key.
(LDAP:DIR-KEY-SUBKEY-DELETE dkey subkey) (LDAP:DIR-KEY-VALUE-DELETE dkey attribute)
Delete the specified subkey or attribute.
(LDAP:DIR-KEY-SUBKEY dkey) (LDAP:DIR-KEY-ATTRIBUTES dkey)
Return the list of the subkeys or attributes.
(LDAP:DIR-KEY-VALUE dkey attribute &OPTIONAL default)
Return the value of the specified attribute, similar to GETHASH and SETFable just like GETHASH.
(LDAP:DIR-KEY-INFO dkey)
Return some information about the directory key. This is highly platform-dependent and will probably be removed or replaced or modified in the future.
(LDAP:WITH-DIR-KEY-SEARCH (key-iter atribute-iter dkey pathname &KEY :scope) &BODY body)

This is the main way to iterate over the subtree under the key dkey+pathname.

key-iter is a non-NIL symbol and is bound via MACROLET to a macro, each call of which returns the next subkey.

atribute-iter is a symbol and is bound, when non-NIL, to a macro, each call of which returns two values - the next attribute and its value.

The :scope keyword argument specifies the scope of the search and can be

:self
iterate over the key itself
:level
iterate over the children of the key
:tree
iterate over the subtree

LDAP:WITH-DIR-KEY-SEARCH is used to implement LDAP:DIR-KEY-VALUES, LDAP:DIR-KEY-CHILDREN and LDAP:DIR-KEY-DUMP-TREE in modules/dirkey/dirkey1.lisp.


These notes document CLISP version 2.49.93+Last modified: 2018-02-19