MAN page from Mandrake Other ldap-devel-3.3-3.i386.rpm
LDAP_ENTRY2TEXT
Section: C Library Functions (3)
Updated: 13 November 1994
Index NAME
ldap_entry2text, ldap_entry2text_search, ldap_vals2text - LDAP entry display routines
SYNOPSIS
#include <lber.h>#include <ldap.h>#include <disptmpl.h>int ldap_entry2text( ld, buf, entry, tmpl, defattrs, defvals, writeproc, writeparm, eol, rdncount, opts ) LDAP *ld; char *buf; LDAPMessage *entry; struct ldap_disptmpl *tmpl; char **defattrs; char ***defvals; int (*writeproc)(); void *writeparm; char *eol; int rdncount; unsigned long opts;int ldap_entry2text_search( ld, entry, tmpllist, defattrs, defvals, writeproc, writeparm, eol, rdncount, opts ) LDAP *ld; char *dn; char *base; LDAPMessage *entry; struct ldap_disptmpl *tmpllist; char **defattrs; char ***defvals; int (*writeproc)(); void *writeparm; char *eol; int rdncount; unsigned long opts;int ldap_vals2text( ld, buf, vals, label, labelwidth, syntaxid, writeproc, writeparm, eol, rdncount ) LDAP *ld; char *buf; char **vals; char *label; int labelwidth; unsigned long syntaxid; int (*writeproc)(); void *writeparm; char *eol; int rdncount;int ldap_entry2html( ld, buf, entry, tmpl, defattrs, defvals, writeproc, writeparm, eol, rdncount, opts ) LDAP *ld; char *buf; LDAPMessage *entry; struct ldap_disptmpl *tmpl; char **defattrs; char ***defvals; int (*writeproc)(); void *writeparm; char *eol; int rdncount; unsigned long opts; char *urlprefix; char *base;int ldap_entry2html_search( ld, entry, tmpllist, defattrs, defvals, writeproc, writeparm, eol, rdncount, opts ) LDAP *ld; char *dn; LDAPMessage *entry; struct ldap_disptmpl *tmpllist; char **defattrs; char ***defvals; int (*writeproc)(); void *writeparm; char *eol; int rdncount; unsigned long opts; char *urlprefix;int ldap_vals2html( ld, buf, vals, label, labelwidth, syntaxid, writeproc, writeparm, eol, rdncount ) LDAP *ld; char *buf; char **vals; char *label; int labelwidth; unsigned long syntaxid; int (*writeproc)(); void *writeparm; char *eol; int rdncount; char *urlprefix;#define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001#define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002#define LDAP_DTMPL_BUFSIZ 2048
DESCRIPTION
These functions use the LDAP display template routines (see
ldap_disptmpl(3) and
ldap_templates.conf(5)) to produce a plain textor an HyperText Markup Language (HTML) display of an entry or a set ofvalues. Typical plain text output produced for an entry might look like:
"Barbara J Jensen, Information Technology Division" Also Known As: Babs Jensen Barbara Jensen Barbara J Jensen E-Mail Address: bjensenAATTterminator.rs.itd.umich.edu Work Address: 535 W. William Ann Arbor, MI 48103 Title: Mythical Manager, Research Systems ...
The exact output produced will depend on the display template configuration.HTML output is similar to the plain text output, but more richly formatted.
ldap_entry2text()produces a text representation ofentryand writes the text by calling thewriteprocfunction. All of the attributes values to be displayed must be presentinentry;no interaction with the LDAP server will be performed withinldap_entry2text.ld is the LDAP pointer obtained by a previous call toldap_open.writeprocshould be declared as:
int writeproc( writeparm, p, len ) void *writeparm; char *p; int len;
wherepis a pointer to text to be written andlenis the length of the text.pis guaranteed to be zero-terminated. Lines of text are terminatedwith the stringeol.bufis a pointer to a buffer of sizeLDAP_DTMPL_BUFSIZor larger. Ifbuf isNULLthen a buffer is allocated and freed internally.tmplis a pointer to the display template to be used (usually obtained by callingldap_oc2template).Iftmplis NULL,no template is used and a generic display is produced.defattrsis a NULL-terminated array of LDAP attribute names which you wish toprovide default values for (only used ifentrycontains no values for the attribute). An array of NULL-terminated arrays ofdefault values corresponding to the attributes should be passed indefvals. Therdncountparameter is used to limit the number of Distinguished Name (DN) componentsthat are actually displayed for DN attributes. Ifrdncountis zero, all components are shown.optsis used to specify output options. The only values currently allowedare zero (default output),LDAP_DISP_OPT_AUTOLABELWIDTHwhich causes the width for labels to be determined based on the longestlabel intmpl, andLDAP_DISP_OPT_HTMLBODYONLY.The LDAP_DISP_OPT_HTMLBODYONLYoption instructs the library not to include <HTML>, <HEAD>, <TITLE>, and<BODY> tags. In other words, an HTML fragment is generated, and thecaller is responsible for prepending and appending the appropriate HTMLtags to construct a correct HTML document.
ldap_entry2text_search()is similar toldap_entry2text,and all of the like-named parameters have the same meaning except as notedbelow. Ifbaseis not NULL, it is the search base to use when executing search actions. Ifit is NULL, search action template items are ignored. Ifentryis not NULL, it should contain theobjectClassattribute values for the entry to be displayed. Ifentryis NULL,dnmust not be NULL, and ldap_entry2text_searchwill retrieve the objectClass values itself by callingldap_search_s.ldap_entry2text_searchwill determine the appropriate display template to use by callingldap_oc2template,and will callldap_search_sto retrieve any attribute values to be displayed. Thetmpllistparameter is a pointer to the entire list of templates available (usuallyobtained by callingldap_init_templatesorldap_init_templates_buf).Iftmpllistis NULL,ldap_entry2text_searchwill attempt to read a load templates from the default template configurationfile /etc/ldaptemplates.conf.
ldap_vals2textproduces a text representation of a single set of LDAP attribute values. Theld,buf,writeproc,writeparm,eol,andrdncountparameters are the same as the like-named parameters forldap_entry2text.valsis a NULL-terminated list of values, usually obtained by a call toldap_get_values.labelis a string shown next to the values (usually a friendly form of anLDAP attribute name).labelwidthspecifies the label margin, which is the number of blank spaces displayedto the left of the values. If zero is passed, a default label width isused.syntaxidis a display template attribute syntax identifier (see ldap_disptmpl(3)for a list of the pre-defined LDAP_SYN_...values).
ldap_entry2htmlproduces an HTML representation of entry.It behaves exactly like ldap_entry2text(3), except for the formatted outputand the addition of two parameters.urlprefixis the starting text to use when constructing an LDAP URL. The default isthe stringldap:///The second additional parameter,base,the search base to use when executing search actions. If it is NULL, searchaction template items are ignored.
ldap_entry2html_searchbehaves exactly like ldap_entry2text_search(3), except HTML output is producedand one additional parameter is required.urlprefixis the starting text to use when constructing an LDAP URL. The default isthe stringldap:///
ldap_vals2htmlbehaves exactly like ldap_vals2text, except HTML output is producedand one additional parameter is required.urlprefixis the starting text to use when constructing an LDAP URL. The default isthe stringldap:///
ERRORS
These routines all return an LDAP error code (LDAP_SUCCESS is returnedif no error occurs). See
ldap_error(3) for details. The
ld_errnofield of the
ldparameter is also set to indicate the error.
FILES
/etc/ldaptemplates.conf
SEE ALSO
ldap(3),
ldap_disptmpl(3),
ldaptemplates.conf(5)
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- ERRORS
- FILES
- SEE ALSO
This document was created byman2html,using the manual pages.