1ldap_entry2text(3LDAP)      LDAP Library Functions      ldap_entry2text(3LDAP)
2
3
4

NAME

6       ldap_entry2text,        ldap_entry2text_search,        ldap_entry2html,
7       ldap_entry2html_search, ldap_vals2html,  ldap_vals2text  -  LDAP  entry
8       display functions
9

SYNOPSIS

11       cc[ flag... ] file... -lldap[ library... ]
12       #include <lber.h>
13       #include <ldap.h>
14
15       int ldap_entry2text(LDAP *ld, char *buf, LDAPMessage *entry,
16            struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
17            int (*writeproc)(), void *writeparm, char *eol, int rdncount,
18            unsigned long opts);
19
20
21       int ldap_entry2text_search(LDAP *ld, char *dn, char *base,
22            LDAPMessage *entry, struct ldap_disptmpl *tmpllist,
23            char **defattrs, char ***defvals, int (*writeproc)(),
24            void *writeparm, char *eol,int rdncount,
25            unsigned long opts);
26
27
28       int ldap_vals2text(LDAP *ld, char *buf, char **vals, char *label,
29            int labelwidth, unsigned longsyntaxid, int (*writeproc)(),
30            void *writeparm, char *eol, int rdncount);
31
32
33       int ldap_entry2html(LDAP *ld, char *buf, LDAPMessage *entry,
34            struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
35            int (*writeproc)(),void *writeparm, char *eol, int rdncount,
36            unsigned long opts, char *urlprefix, char *base);
37
38
39       int ldap_entry2html_search(LDAP *ld, char *dn, LDAPMessage *entry,
40            struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
41            int (*writeproc)(), void *writeparm, char *eol, int rdncount,
42            unsigned long opts, char *urlprefix);
43
44
45       int ldap_vals2html(LDAP *ld, char *buf, char **vals,
46            char *label, int labelwidth, unsigned long syntaxid,
47            int (*writeproc)(), void *writeparm, char *eol, int rdncount,
48            char *urlprefix);
49
50
51       #define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001
52
53
54       #define LDAP_DISP_OPT_HTMLBODYONLY      0x00000002
55
56
57       #define LDAP_DTMPL_BUFSIZ  2048
58
59

DESCRIPTION

61       These   functions   use   the  LDAP  display  template  functions  (see
62       ldap_disptmpl(3LDAP) and  ldap_templates.conf(4)) to  produce  a  plain
63       text  or  an  HyperText Markup Language (HTML) display of an entry or a
64       set of values.  Typical plain text output produced for an  entry  might
65       look like:
66
67             "Barbara J Jensen, Information Technology Division"
68              Also Known As:
69              Babs Jensen
70              Barbara Jensen
71              Barbara J Jensen
72              E-Mail Address:
73              bjensen@terminator.rs.itd.umich.edu
74              Work Address:
75              535 W. William
76              Ann Arbor, MI 48103
77              Title:
78              Mythical Manager, Research Systems
79              ...
80
81
82
83       The  exact output produced will depend on the display template configu‐
84       ration. HTML output is similar to  the  plain  text  output,  but  more
85       richly formatted.
86
87
88       ldap_entry2text()  produces  a  text representation of entry and writes
89       the text by calling the writeproc function.  All of the attributes val‐
90       ues  to  be displayed must be present in entry; no interaction with the
91       LDAP server will be performed within ldap_entry2text. ld  is  the  LDAP
92       pointer  obtained  by a previous call to ldap_open. writeproc should be
93       declared as:
94
95         int writeproc( writeparm, p, len )
96          void  *writeparm;
97          char  *p;
98          int  len;
99
100
101
102       where p is a pointer to text to be written and len is the length of the
103       text.  p is guaranteed to be zero-terminated.  Lines of text are termi‐
104       nated with the string eol. buf  is  a  pointer  to  a  buffer  of  size
105       LDAP_DTMPL_BUFSIZ or larger.  If buf is NULL then a buffer is allocated
106       and freed internally. tmpl is a pointer to the display template  to  be
107       used  (usually  obtained by calling ldap_oc2template). If tmpl is NULL,
108       no template is used and a generic display is produced.  defattrs  is  a
109       NULL-terminated array of LDAP attribute names which you wish to provide
110       default values for (only used if  entry  contains  no  values  for  the
111       attribute).   An array of NULL-terminated arrays of default values cor‐
112       responding to the attributes should be passed in defvals. The  rdncount
113       parameter is used to limit the number of Distinguished Name (DN) compo‐
114       nents that are actually displayed for DN attributes.   If  rdncount  is
115       zero, all components are shown. opts is used to specify output options.
116       The  only  values  currently  allowed  are   zero   (default   output),
117       LDAP_DISP_OPT_AUTOLABELWIDTH  which  causes  the width for labels to be
118       determined based on the longest label in tmpl, and  LDAP_DISP_OPT_HTML‐
119       BODYONLY.  The  LDAP_DISP_OPT_HTMLBODYONLY option instructs the library
120       not to include <HTML>, <HEAD>, <TITLE>,  and  <BODY>  tags.   In  other
121       words, an HTML fragment is generated, and the caller is responsible for
122       prepending and appending the appropriate HTML tags to construct a  cor‐
123       rect HTML document.
124
125
126       ldap_entry2text_search()  is similar to ldap_entry2text, and all of the
127       like-named parameters have the same meaning except as noted below.   If
128       base  is  not  NULL, it is the search base to use when executing search
129       actions.  If it is NULL, search action template items are ignored.   If
130       entry  is  not NULL, it should contain the objectClass attribute values
131       for the entry to be displayed.  If entry is NULL, dn must not be  NULL,
132       and   ldap_entry2text_search  will  retrieve  the   objectClass  values
133       itself by calling ldap_search_s. ldap_entry2text_search will  determine
134       the  appropriate  display  template to use by calling ldap_oc2template,
135       and will call ldap_search_s to retrieve any attribute values to be dis‐
136       played.  The tmpllist parameter is a pointer to the entire list of tem‐
137       plates available (usually obtained by  calling  ldap_init_templates  or
138       ldap_init_templates_buf).  If  tmpllist is NULL, ldap_entry2text_search
139       will attempt to read a load templates from the default template config‐
140       uration file ETCDIR/ldaptemplates.conf
141
142
143       ldap_vals2text  produces  a text representation of a single set of LDAP
144       attribute values.  The ld, buf, writeproc, writeparm, eol, and rdncount
145       parameters   are   the   same   as   the   like-named   parameters  for
146       ldap_entry2text. vals is a  NULL-terminated  list  of  values,  usually
147       obtained  by a call to ldap_get_values. label is a string shown next to
148       the values (usually a friendly form of an LDAP attribute name).  label‐
149       width  specifies  the label margin, which is the number of blank spaces
150       displayed to the left of the values. If zero is passed, a default label
151       width  is used. syntaxid is a display template attribute syntax identi‐
152       fier  (see   ldap_disptmpl(3LDAP)  for  a  list  of   the   pre-defined
153       LDAP_SYN_... values).
154
155
156       ldap_entry2html  produces  an  HTML representation of entry. It behaves
157       exactly like ldap_entry2text(3LDAP), except for  the  formatted  output
158       and  the  addition of two parameters. urlprefix is the starting text to
159       use when constructing an LDAP URL.  The default is the string  ldap:///
160       The second additional parameter, base, the search base to use when exe‐
161       cuting search actions.  If it is  NULL, search  action  template  items
162       are ignored.
163
164
165       ldap_entry2html_search           behaves          exactly          like
166       ldap_entry2text_search(3LDAP), except HTML output is produced  and  one
167       additional parameter is required. urlprefix is the starting text to use
168       when constructing an LDAP URL.  The default is the string ldap:///
169
170
171       ldap_vals2html behaves exactly like   ldap_vals2text,exceptHTMLoutputis
172       and  one  additional  parameter  is required. urlprefix is the starting
173       text to use when constructing an LDAP URL. The default  is  the  string
174       ldap:///
175

ERRORS

177       These functions all return an LDAP error code. LDAP_SUCCESS is returned
178       if no error occurs. See ldap_error(3LDAP)  for  details.  The  ld_errno
179       field of the ld parameter is also set to indicate the error.
180

FILES

182       ETCDIR/ldaptemplates.conf
183

ATTRIBUTES

185       See attributes(5) for a description of the following attributes:
186
187
188
189
190       ┌─────────────────────────────┬─────────────────────────────┐
191       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
192       │Availability                 │SUNWcsl (32-bit)             │
193       │                             │SUNWcslx (64-bit)            │
194       │Interface Stability          │Evolving                     │
195       └─────────────────────────────┴─────────────────────────────┘
196

SEE ALSO

198       ldap(3LDAP),      ldap_disptmpl(3LDAP),     ldaptemplates.conf(4)     ,
199       attributes(5)
200
201
202
203SunOS 5.11                        27 Jan 2002           ldap_entry2text(3LDAP)
Impressum