1<?xml version="1.0" encoding="UTF-8"?>
2
3<section id="dir-key"><title>Directory Access</title>
4
5<para>This module provides some directory access from lisp,
6 in package &ldap-pac;.</para>
7<simpara>When this module is present, &features-my;
8 contains the symbol <constant>:DIRKEY</constant>.</simpara>
9
10<para>3 types of directory keys may exist,
11 depending on the compilation environment.</para>
12
13<variablelist id="dir-key-type"><title>valid directory key types</title>
14 <varlistentry><term>:win32</term>
15  <listitem><simpara>&win32; registry access
16  </simpara></listitem></varlistentry>
17 <varlistentry><term>:gnome</term>
18  <listitem><simpara><ulink url="http://library.gnome.org/devel/libgnome/stable/libgnome-gnome-config.html">gnome-config</ulink> access
19  </simpara></listitem></varlistentry>
20 <varlistentry><term>:ldap</term>
21  <listitem><simpara>LDAP interface via
22   <ulink url="http://www.openldap.org">OpenLDAP</ulink> or compatible
23  </simpara></listitem></varlistentry>
24</variablelist>
25
26<para>The following functions and macros are exported (please note that
27these features are &experimental; and the API may be modified in the
28future).</para>
29
30<variablelist>
31 <varlistentry id="dir-key-open"><term><code>(&dkey-open;
32   &dkey-r; &path-r; &key-amp; (&direction-k; &input-k;)
33   &if-does-not-exist;)</code></term>
34  <listitem><simpara>Open the directory key under &dkey-r;, which should
35   be either an open directory key or a valid &dk-t;.
36   The meaning of the &direction-k; and &if-does-not-exist; keyword
37   arguments is the same as for &open;.</simpara></listitem></varlistentry>
38 <varlistentry id="dir-key-close"><term><code>(&dkey-close;
39    &dkey-r;)</code></term>
40  <listitem><simpara>Close the directory key.  The preferred way is to
41   use the &wdkey-open; macro.</simpara></listitem></varlistentry>
42 <varlistentry id="with-dir-key-open"><term><code>(&wdkey-open; (&var-r;
43    &dkey-r; &path-r; &rest-amp; {&option-r;}*) &body-amp;
44    &body-r;)</code></term>
45  <listitem><simpara>Open the directory key (by calling &dkey-open;
46   on &dkey-r;, &path-r; and &option-r;s), bind it to &var-r;,
47   execute &body-r;, then close it with &dkey-close;.
48 </simpara></listitem></varlistentry>
49 <varlistentry><term><code>(<function>LDAP:DIR-KEY-TYPE</function>
50    &dkey-r;)</code></term>
51  <listitem><simpara>Return the &dk-t; of the directory key
52  </simpara></listitem></varlistentry>
53 <varlistentry><term><code>(<function>LDAP:DIR-KEY-PATH</function>
54                &dkey-r;)</code></term>
55  <listitem><simpara>Return the path of this directory key, which is the
56   &path-r; argument of &dkey-open; if &dkey-r; was a &dk-t; or the
57   concatenation of the &path-r; argument and the
58   <function>ldap:dir-key-path</function> of &dkey-r;.
59   </simpara></listitem></varlistentry>
60 <varlistentry><term><code>(<function>LDAP:DIR-KEY-DIRECTION</function>
61    &dkey-r;)</code></term>
62  <listitem><simpara>One of &input-k;, &output-k; and &io-k;, indicating
63   the permitted operation on this key and its derivatives.
64   </simpara></listitem></varlistentry>
65 <varlistentry><term><code>(<function>LDAP:DIR-KEY-CLOSED-P</function>
66    &dkey-r;)</code></term>
67  <listitem><simpara>Check whether the key has been closed.
68   It is not an error to close a closed key.
69   </simpara></listitem></varlistentry>
70 <varlistentry><term><code>(<function>LDAP:DIR-KEY-SUBKEY-DELETE</function>
71     &dkey-r; <replaceable>subkey</replaceable>)</code>
72   <code>(<function>LDAP:DIR-KEY-VALUE-DELETE</function>
73     &dkey-r; <replaceable>attribute</replaceable>)</code></term>
74  <listitem><simpara>Delete the specified subkey or attribute.
75  </simpara></listitem></varlistentry>
76 <varlistentry><term><code>(<function>LDAP:DIR-KEY-SUBKEY</function>
77    &dkey-r;)</code>
78  <code>(<function>LDAP:DIR-KEY-ATTRIBUTES</function> &dkey-r;)</code></term>
79  <listitem><simpara>Return the list of the subkeys or attributes.
80  </simpara></listitem></varlistentry>
81 <varlistentry><term><code>(<function>LDAP:DIR-KEY-VALUE</function> &dkey-r;
82    <replaceable>attribute</replaceable> &optional-amp;
83    <replaceable>default</replaceable>)</code></term>
84  <listitem><simpara>Return the value of the specified attribute,
85   similar to &gethash; and &setf;able just like &gethash;.
86   </simpara></listitem></varlistentry>
87 <varlistentry><term><code>(<function>LDAP:DIR-KEY-INFO</function>
88    &dkey-r;)</code></term>
89  <listitem><simpara>Return some information about the directory key.
90   This is highly platform-dependent and will probably be removed or
91   replaced or modified in the future.</simpara></listitem></varlistentry>
92 <varlistentry id="with-dir-key-search"><term><code>(&wdkey-search;
93    (<replaceable>key-iter</replaceable>
94    <replaceable>atribute-iter</replaceable>
95    &dkey-r; &path-r; &key-amp; <constant>:scope</constant>)
96    &body-amp; &body-r;)</code></term>
97  <listitem><simpara>This is the main way to iterate over the subtree
98   under the key &dkey-r;+&path-r;.</simpara>
99   <simpara><replaceable>key-iter</replaceable> is a non-&nil; symbol
100    and is bound via &macrolet; to a macro, each call of which returns
101    the next subkey.</simpara>
102   <simpara><replaceable>atribute-iter</replaceable> is a symbol and is
103    bound, when non-&nil;, to a macro, each call of which returns two
104   values - the next attribute and its value.</simpara>
105   <para>The <constant>:scope</constant> keyword argument specifies the
106    scope of the search and can be
107   <variablelist>
108    <varlistentry><term><constant>:self</constant></term>
109     <listitem><simpara>iterate over the key itself
110     </simpara></listitem></varlistentry>
111    <varlistentry><term><constant>:level</constant></term>
112     <listitem><simpara>iterate over the children of the key
113     </simpara></listitem></varlistentry>
114    <varlistentry><term><constant>:tree</constant></term>
115     <listitem><simpara>iterate over the subtree
116     </simpara></listitem></varlistentry></variablelist></para>
117   <simpara>&wdkey-search; is used to implement
118    <function>LDAP:DIR-KEY-VALUES</function>,
119    <function>LDAP:DIR-KEY-CHILDREN</function> and
120    <function>LDAP:DIR-KEY-DUMP-TREE</function> in
121    <filename role="clisp-cvs">modules/dirkey/dirkey1.lisp</filename>.
122    </simpara></listitem></varlistentry>
123</variablelist>
124
125</section>
126