* Update to packages/alpine.spec to account for the new location of man
[alpine.git] / ldap / inckit / disptmpl.h
blobd6e0a35939d9e6132bc917115f5a32b5ff64d794
1 /*
2 * Copyright (c) 1993, 1994 Regents of the University of Michigan.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of Michigan at Ann Arbor. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
12 * disptmpl.h: display template library defines
13 * 7 March 1994 by Mark C Smith
16 #ifndef _DISPTMPL_H
17 #define _DISPTMPL_H
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
24 #define LDAP_TEMPLATE_VERSION 1
27 * general types of items (confined to most significant byte)
29 #define LDAP_SYN_TYPE_TEXT 0x01000000L
30 #define LDAP_SYN_TYPE_IMAGE 0x02000000L
31 #define LDAP_SYN_TYPE_BOOLEAN 0x04000000L
32 #define LDAP_SYN_TYPE_BUTTON 0x08000000L
33 #define LDAP_SYN_TYPE_ACTION 0x10000000L
37 * syntax options (confined to second most significant byte)
39 #define LDAP_SYN_OPT_DEFER 0x00010000L
42 /*
43 * display template item syntax ids (defined by common agreement)
44 * these are the valid values for the ti_syntaxid of the tmplitem
45 * struct (defined below). A general type is encoded in the
46 * most-significant 8 bits, and some options are encoded in the next
47 * 8 bits. The lower 16 bits are reserved for the distinct types.
49 #define LDAP_SYN_CASEIGNORESTR ( 1 | LDAP_SYN_TYPE_TEXT )
50 #define LDAP_SYN_MULTILINESTR ( 2 | LDAP_SYN_TYPE_TEXT )
51 #define LDAP_SYN_DN ( 3 | LDAP_SYN_TYPE_TEXT )
52 #define LDAP_SYN_BOOLEAN ( 4 | LDAP_SYN_TYPE_BOOLEAN )
53 #define LDAP_SYN_JPEGIMAGE ( 5 | LDAP_SYN_TYPE_IMAGE )
54 #define LDAP_SYN_JPEGBUTTON ( 6 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
55 #define LDAP_SYN_FAXIMAGE ( 7 | LDAP_SYN_TYPE_IMAGE )
56 #define LDAP_SYN_FAXBUTTON ( 8 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
57 #define LDAP_SYN_AUDIOBUTTON ( 9 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
58 #define LDAP_SYN_TIME ( 10 | LDAP_SYN_TYPE_TEXT )
59 #define LDAP_SYN_DATE ( 11 | LDAP_SYN_TYPE_TEXT )
60 #define LDAP_SYN_LABELEDURL ( 12 | LDAP_SYN_TYPE_TEXT )
61 #define LDAP_SYN_SEARCHACTION ( 13 | LDAP_SYN_TYPE_ACTION )
62 #define LDAP_SYN_LINKACTION ( 14 | LDAP_SYN_TYPE_ACTION )
63 #define LDAP_SYN_ADDDNACTION ( 15 | LDAP_SYN_TYPE_ACTION )
64 #define LDAP_SYN_VERIFYDNACTION ( 16 | LDAP_SYN_TYPE_ACTION )
65 #define LDAP_SYN_RFC822ADDR ( 17 | LDAP_SYN_TYPE_TEXT )
69 * handy macros
71 #define LDAP_GET_SYN_TYPE( syid ) ((syid) & 0xFF000000L )
72 #define LDAP_GET_SYN_OPTIONS( syid ) ((syid) & 0x00FF0000L )
76 * display options for output routines (used by entry2text and friends)
79 * use calculated label width (based on length of longest label in
80 * template) instead of contant width
82 #define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001L
83 #define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002L
86 * perform search actions (applies to ldap_entry2text_search only)
88 #define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002L
91 * include additional info. relevant to "non leaf" entries only
92 * used by ldap_entry2html and ldap_entry2html_search to include "Browse"
93 * and "Move Up" HREFs
95 #define LDAP_DISP_OPT_NONLEAF 0x00000004L
99 * display template item options (may not apply to all types)
100 * if this bit is set in ti_options, it applies.
102 #define LDAP_DITEM_OPT_READONLY 0x00000001L
103 #define LDAP_DITEM_OPT_SORTVALUES 0x00000002L
104 #define LDAP_DITEM_OPT_SINGLEVALUED 0x00000004L
105 #define LDAP_DITEM_OPT_HIDEIFEMPTY 0x00000008L
106 #define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010L
107 #define LDAP_DITEM_OPT_HIDEIFFALSE 0x00000020L /* booleans only */
112 * display template item structure
114 struct ldap_tmplitem {
115 unsigned long ti_syntaxid;
116 unsigned long ti_options;
117 char *ti_attrname;
118 char *ti_label;
119 char **ti_args;
120 struct ldap_tmplitem *ti_next_in_row;
121 struct ldap_tmplitem *ti_next_in_col;
122 void *ti_appdata;
126 #define NULLTMPLITEM ((struct ldap_tmplitem *)0)
128 #define LDAP_SET_TMPLITEM_APPDATA( ti, datap ) \
129 (ti)->ti_appdata = (void *)(datap)
131 #define LDAP_GET_TMPLITEM_APPDATA( ti, type ) \
132 (type)((ti)->ti_appdata)
134 #define LDAP_IS_TMPLITEM_OPTION_SET( ti, option ) \
135 (((ti)->ti_options & option ) != 0 )
139 * object class array structure
141 struct ldap_oclist {
142 char **oc_objclasses;
143 struct ldap_oclist *oc_next;
146 #define NULLOCLIST ((struct ldap_oclist *)0)
150 * add defaults list
152 struct ldap_adddeflist {
153 int ad_source;
154 #define LDAP_ADSRC_CONSTANTVALUE 1
155 #define LDAP_ADSRC_ADDERSDN 2
156 char *ad_attrname;
157 char *ad_value;
158 struct ldap_adddeflist *ad_next;
161 #define NULLADLIST ((struct ldap_adddeflist *)0)
165 * display template global options
166 * if this bit is set in dt_options, it applies.
169 * users should be allowed to try to add objects of these entries
171 #define LDAP_DTMPL_OPT_ADDABLE 0x00000001L
174 * users should be allowed to do "modify RDN" operation of these entries
176 #define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002L
179 * this template is an alternate view, not a primary view
181 #define LDAP_DTMPL_OPT_ALTVIEW 0x00000004L
185 * display template structure
187 struct ldap_disptmpl {
188 char *dt_name;
189 char *dt_pluralname;
190 char *dt_iconname;
191 unsigned long dt_options;
192 char *dt_authattrname;
193 char *dt_defrdnattrname;
194 char *dt_defaddlocation;
195 struct ldap_oclist *dt_oclist;
196 struct ldap_adddeflist *dt_adddeflist;
197 struct ldap_tmplitem *dt_items;
198 void *dt_appdata;
199 struct ldap_disptmpl *dt_next;
202 #define NULLDISPTMPL ((struct ldap_disptmpl *)0)
204 #define LDAP_SET_DISPTMPL_APPDATA( dt, datap ) \
205 (dt)->dt_appdata = (void *)(datap)
207 #define LDAP_GET_DISPTMPL_APPDATA( dt, type ) \
208 (type)((dt)->dt_appdata)
210 #define LDAP_IS_DISPTMPL_OPTION_SET( dt, option ) \
211 (((dt)->dt_options & option ) != 0 )
213 #define LDAP_TMPL_ERR_VERSION 1
214 #define LDAP_TMPL_ERR_MEM 2
215 #define LDAP_TMPL_ERR_SYNTAX 3
216 #define LDAP_TMPL_ERR_FILE 4
219 * buffer size needed for entry2text and vals2text
221 #define LDAP_DTMPL_BUFSIZ 8192
224 #ifndef NEEDPROTOS
226 typedef int (*writeptype)();
228 int ldap_init_templates();
229 int ldap_init_templates_buf();
230 void ldap_free_templates();
231 struct ldap_disptmpl *ldap_first_disptmpl();
232 struct ldap_disptmpl *ldap_next_disptmpl();
233 struct ldap_disptmpl *ldap_name2template();
234 struct ldap_disptmpl *ldap_oc2template();
235 char **ldap_tmplattrs();
236 struct ldap_tmplitem *ldap_first_tmplrow();
237 struct ldap_tmplitem *ldap_next_tmplrow();
238 struct ldap_tmplitem *ldap_first_tmplcol();
239 struct ldap_tmplitem *ldap_next_tmplcol();
240 int ldap_entry2text_search();
241 int ldap_entry2text();
242 int ldap_vals2text();
243 int ldap_entry2html_search();
244 int ldap_entry2html();
245 int ldap_vals2html();
247 #else /* !NEEDPROTOS */
249 typedef int (*writeptype)( void *writeparm, char *p, int len );
251 LDAPFUNCDECL int
252 ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp );
254 LDAPFUNCDECL int
255 ldap_init_templates_buf( char *buf, long buflen,
256 struct ldap_disptmpl **tmpllistp );
258 LDAPFUNCDECL void
259 ldap_free_templates( struct ldap_disptmpl *tmpllist );
261 LDAPFUNCDECL struct ldap_disptmpl *
262 ldap_first_disptmpl( struct ldap_disptmpl *tmpllist );
264 LDAPFUNCDECL struct ldap_disptmpl *
265 ldap_next_disptmpl( struct ldap_disptmpl *tmpllist,
266 struct ldap_disptmpl *tmpl );
268 LDAPFUNCDECL struct ldap_disptmpl *
269 ldap_name2template( char *name, struct ldap_disptmpl *tmpllist );
271 LDAPFUNCDECL struct ldap_disptmpl *
272 ldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist );
274 LDAPFUNCDECL char **
275 ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, int exclude,
276 unsigned long syntaxmask );
278 LDAPFUNCDECL struct ldap_tmplitem *
279 ldap_first_tmplrow( struct ldap_disptmpl *tmpl );
281 LDAPFUNCDECL struct ldap_tmplitem *
282 ldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row );
284 LDAPFUNCDECL struct ldap_tmplitem *
285 ldap_first_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row );
287 LDAPFUNCDECL struct ldap_tmplitem *
288 ldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row,
289 struct ldap_tmplitem *col );
291 LDAPFUNCDECL int
292 ldap_entry2text( LDAP *ld, char *buf, LDAPMessage *entry,
293 struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
294 writeptype writeproc, void *writeparm, char *eol, int rdncount,
295 unsigned long opts );
297 LDAPFUNCDECL int
298 ldap_vals2text( LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
299 unsigned long syntaxid, writeptype writeproc, void *writeparm,
300 char *eol, int rdncount );
302 LDAPFUNCDECL int
303 ldap_entry2text_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry,
304 struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
305 writeptype writeproc, void *writeparm, char *eol, int rdncount,
306 unsigned long opts );
308 LDAPFUNCDECL int
309 ldap_entry2html( LDAP *ld, char *buf, LDAPMessage *entry,
310 struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
311 writeptype writeproc, void *writeparm, char *eol, int rdncount,
312 unsigned long opts, char *urlprefix, char *base );
314 LDAPFUNCDECL int
315 ldap_vals2html( LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
316 unsigned long syntaxid, writeptype writeproc, void *writeparm,
317 char *eol, int rdncount, char *urlprefix );
319 LDAPFUNCDECL int
320 ldap_entry2html_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry,
321 struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
322 writeptype writeproc, void *writeparm, char *eol, int rdncount,
323 unsigned long opts, char *urlprefix );
324 #endif /* !NEEDPROTOS */
327 #ifdef __cplusplus
329 #endif
330 #endif /* _DISPTMPL_H */