1N/A/*
1N/A * Copyright (c) 2001 by Sun Microsystems, Inc.
1N/A * All rights reserved.
1N/A */
1N/A
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A/*
1N/A * The contents of this file are subject to the Netscape Public
1N/A * License Version 1.1 (the "License"); you may not use this file
1N/A * except in compliance with the License. You may obtain a copy of
1N/A * the License at http://www.mozilla.org/NPL/
1N/A *
1N/A * Software distributed under the License is distributed on an "AS
1N/A * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1N/A * implied. See the License for the specific language governing
1N/A * rights and limitations under the License.
1N/A *
1N/A * The Original Code is Mozilla Communicator client code, released
1N/A * March 31, 1998.
1N/A *
1N/A * The Initial Developer of the Original Code is Netscape
1N/A * Communications Corporation. Portions created by Netscape are
1N/A * Copyright (C) 1998-1999 Netscape Communications Corporation. All
1N/A * Rights Reserved.
1N/A *
1N/A * Contributor(s):
1N/A */
1N/A
1N/A/*
1N/A * Copyright (c) 1993, 1994 Regents of the University of Michigan.
1N/A * All rights reserved.
1N/A *
1N/A * Redistribution and use in source and binary forms are permitted
1N/A * provided that this notice is preserved and that due credit is given
1N/A * to the University of Michigan at Ann Arbor. The name of the University
1N/A * may not be used to endorse or promote products derived from this
1N/A * software without specific prior written permission. This software
1N/A * is provided ``as is'' without express or implied warranty.
1N/A *
1N/A * disptmpl.h: display template library defines
1N/A */
1N/A
1N/A#ifndef _DISPTMPL_H
1N/A#define _DISPTMPL_H
1N/A
1N/A#ifdef __cplusplus
1N/Aextern "C" {
1N/A#endif
1N/A
1N/A/* calling conventions used by library */
1N/A#ifndef LDAP_CALL
1N/A#if defined( _WINDOWS ) || defined( _WIN32 )
1N/A#define LDAP_C __cdecl
1N/A#ifndef _WIN32
1N/A#define __stdcall _far _pascal
1N/A#define LDAP_CALLBACK _loadds
1N/A#else
1N/A#define LDAP_CALLBACK
1N/A#endif /* _WIN32 */
1N/A#define LDAP_PASCAL __stdcall
1N/A#define LDAP_CALL LDAP_PASCAL
1N/A#else /* _WINDOWS */
1N/A#define LDAP_C
1N/A#define LDAP_CALLBACK
1N/A#define LDAP_PASCAL
1N/A#define LDAP_CALL
1N/A#endif /* _WINDOWS */
1N/A#endif /* LDAP_CALL */
1N/A
1N/A#ifndef _SOLARIS_SDK
1N/A
1N/A#define LDAP_TEMPLATE_VERSION 1
1N/A
1N/A/*
1N/A * general types of items (confined to most significant byte)
1N/A */
1N/A#define LDAP_SYN_TYPE_TEXT 0x01000000L
1N/A#define LDAP_SYN_TYPE_IMAGE 0x02000000L
1N/A#define LDAP_SYN_TYPE_BOOLEAN 0x04000000L
1N/A#define LDAP_SYN_TYPE_BUTTON 0x08000000L
1N/A#define LDAP_SYN_TYPE_ACTION 0x10000000L
1N/A
1N/A
1N/A/*
1N/A * syntax options (confined to second most significant byte)
1N/A */
1N/A#define LDAP_SYN_OPT_DEFER 0x00010000L
1N/A
1N/A
1N/A/*
1N/A * display template item syntax ids (defined by common agreement)
1N/A * these are the valid values for the ti_syntaxid of the tmplitem
1N/A * struct (defined below). A general type is encoded in the
1N/A * most-significant 8 bits, and some options are encoded in the next
1N/A * 8 bits. The lower 16 bits are reserved for the distinct types.
1N/A */
1N/A#define LDAP_SYN_CASEIGNORESTR ( 1 | LDAP_SYN_TYPE_TEXT )
1N/A#define LDAP_SYN_MULTILINESTR ( 2 | LDAP_SYN_TYPE_TEXT )
1N/A#define LDAP_SYN_DN ( 3 | LDAP_SYN_TYPE_TEXT )
1N/A#define LDAP_SYN_BOOLEAN ( 4 | LDAP_SYN_TYPE_BOOLEAN )
1N/A#define LDAP_SYN_JPEGIMAGE ( 5 | LDAP_SYN_TYPE_IMAGE )
1N/A#define LDAP_SYN_JPEGBUTTON ( 6 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
1N/A#define LDAP_SYN_FAXIMAGE ( 7 | LDAP_SYN_TYPE_IMAGE )
1N/A#define LDAP_SYN_FAXBUTTON ( 8 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
1N/A#define LDAP_SYN_AUDIOBUTTON ( 9 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
1N/A#define LDAP_SYN_TIME ( 10 | LDAP_SYN_TYPE_TEXT )
1N/A#define LDAP_SYN_DATE ( 11 | LDAP_SYN_TYPE_TEXT )
1N/A#define LDAP_SYN_LABELEDURL ( 12 | LDAP_SYN_TYPE_TEXT )
1N/A#define LDAP_SYN_SEARCHACTION ( 13 | LDAP_SYN_TYPE_ACTION )
1N/A#define LDAP_SYN_LINKACTION ( 14 | LDAP_SYN_TYPE_ACTION )
1N/A#define LDAP_SYN_ADDDNACTION ( 15 | LDAP_SYN_TYPE_ACTION )
1N/A#define LDAP_SYN_VERIFYDNACTION ( 16 | LDAP_SYN_TYPE_ACTION )
1N/A#define LDAP_SYN_RFC822ADDR ( 17 | LDAP_SYN_TYPE_TEXT )
1N/A
1N/A
1N/A/*
1N/A * handy macros
1N/A */
1N/A#define LDAP_GET_SYN_TYPE( syid ) ((syid) & 0xFF000000UL )
1N/A#define LDAP_GET_SYN_OPTIONS( syid ) ((syid) & 0x00FF0000UL )
1N/A
1N/A
1N/A/*
1N/A * display options for output routines (used by entry2text and friends)
1N/A */
1N/A/*
1N/A * use calculated label width (based on length of longest label in
1N/A * template) instead of contant width
1N/A */
1N/A#define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001L
1N/A#define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002L
1N/A
1N/A/*
1N/A * perform search actions (applies to ldap_entry2text_search only)
1N/A */
1N/A#define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002L
1N/A
1N/A/*
1N/A * include additional info. relevant to "non leaf" entries only
1N/A * used by ldap_entry2html and ldap_entry2html_search to include "Browse"
1N/A * and "Move Up" HREFs
1N/A */
1N/A#define LDAP_DISP_OPT_NONLEAF 0x00000004L
1N/A
1N/A#endif /* ifndef _SOLARIS_SDK */
1N/A
1N/A/*
1N/A * display template item options (may not apply to all types)
1N/A * if this bit is set in ti_options, it applies.
1N/A */
1N/A#define LDAP_DITEM_OPT_READONLY 0x00000001L
1N/A#define LDAP_DITEM_OPT_SORTVALUES 0x00000002L
1N/A#define LDAP_DITEM_OPT_SINGLEVALUED 0x00000004L
1N/A#define LDAP_DITEM_OPT_HIDEIFEMPTY 0x00000008L
1N/A#define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010L
1N/A#define LDAP_DITEM_OPT_HIDEIFFALSE 0x00000020L /* booleans only */
1N/A
1N/A
1N/A#ifndef _SOLARIS_SDK
1N/A
1N/A/*
1N/A * display template item structure
1N/A */
1N/Astruct ldap_tmplitem {
1N/A unsigned long ti_syntaxid;
1N/A unsigned long ti_options;
1N/A char *ti_attrname;
1N/A char *ti_label;
1N/A char **ti_args;
1N/A struct ldap_tmplitem *ti_next_in_row;
1N/A struct ldap_tmplitem *ti_next_in_col;
1N/A void *ti_appdata;
1N/A};
1N/A
1N/A#define NULLTMPLITEM ((struct ldap_tmplitem *)0)
1N/A
1N/A#define LDAP_SET_TMPLITEM_APPDATA( ti, datap ) \
1N/A (ti)->ti_appdata = (void *)(datap)
1N/A
1N/A#define LDAP_GET_TMPLITEM_APPDATA( ti, type ) \
1N/A (type)((ti)->ti_appdata)
1N/A
1N/A#define LDAP_IS_TMPLITEM_OPTION_SET( ti, option ) \
1N/A (((ti)->ti_options & option ) != 0 )
1N/A
1N/A
1N/A/*
1N/A * object class array structure
1N/A */
1N/Astruct ldap_oclist {
1N/A char **oc_objclasses;
1N/A struct ldap_oclist *oc_next;
1N/A};
1N/A
1N/A#define NULLOCLIST ((struct ldap_oclist *)0)
1N/A
1N/A
1N/A/*
1N/A * add defaults list
1N/A */
1N/Astruct ldap_adddeflist {
1N/A int ad_source;
1N/A#define LDAP_ADSRC_CONSTANTVALUE 1
1N/A#define LDAP_ADSRC_ADDERSDN 2
1N/A char *ad_attrname;
1N/A char *ad_value;
1N/A struct ldap_adddeflist *ad_next;
1N/A};
1N/A
1N/A#define NULLADLIST ((struct ldap_adddeflist *)0)
1N/A
1N/A
1N/A/*
1N/A * display template global options
1N/A * if this bit is set in dt_options, it applies.
1N/A */
1N/A/*
1N/A * users should be allowed to try to add objects of these entries
1N/A */
1N/A#define LDAP_DTMPL_OPT_ADDABLE 0x00000001L
1N/A
1N/A/*
1N/A * users should be allowed to do "modify RDN" operation of these entries
1N/A */
1N/A#define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002L
1N/A
1N/A/*
1N/A * this template is an alternate view, not a primary view
1N/A */
1N/A#define LDAP_DTMPL_OPT_ALTVIEW 0x00000004L
1N/A
1N/A
1N/A/*
1N/A * display template structure
1N/A */
1N/Astruct ldap_disptmpl {
1N/A char *dt_name;
1N/A char *dt_pluralname;
1N/A char *dt_iconname;
1N/A unsigned long dt_options;
1N/A char *dt_authattrname;
1N/A char *dt_defrdnattrname;
1N/A char *dt_defaddlocation;
1N/A struct ldap_oclist *dt_oclist;
1N/A struct ldap_adddeflist *dt_adddeflist;
1N/A struct ldap_tmplitem *dt_items;
1N/A void *dt_appdata;
1N/A struct ldap_disptmpl *dt_next;
1N/A};
1N/A
1N/A#define NULLDISPTMPL ((struct ldap_disptmpl *)0)
1N/A
1N/A#define LDAP_SET_DISPTMPL_APPDATA( dt, datap ) \
1N/A (dt)->dt_appdata = (void *)(datap)
1N/A
1N/A#define LDAP_GET_DISPTMPL_APPDATA( dt, type ) \
1N/A (type)((dt)->dt_appdata)
1N/A
1N/A#define LDAP_IS_DISPTMPL_OPTION_SET( dt, option ) \
1N/A (((dt)->dt_options & option ) != 0 )
1N/A
1N/A#define LDAP_TMPL_ERR_VERSION 1
1N/A#define LDAP_TMPL_ERR_MEM 2
1N/A#define LDAP_TMPL_ERR_SYNTAX 3
1N/A#define LDAP_TMPL_ERR_FILE 4
1N/A
1N/A/*
1N/A * buffer size needed for entry2text and vals2text
1N/A */
1N/A#define LDAP_DTMPL_BUFSIZ 8192
1N/A
1N/Atypedef int (*writeptype)( void *writeparm, char *p, int len );
1N/A
1N/ALDAP_API(int)
1N/ALDAP_CALL
1N/Aldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp );
1N/A
1N/ALDAP_API(int)
1N/ALDAP_CALL
1N/Aldap_init_templates_buf( char *buf, long buflen,
1N/A struct ldap_disptmpl **tmpllistp );
1N/A
1N/ALDAP_API(void)
1N/ALDAP_CALL
1N/Aldap_free_templates( struct ldap_disptmpl *tmpllist );
1N/A
1N/ALDAP_API(struct ldap_disptmpl *)
1N/ALDAP_CALL
1N/Aldap_first_disptmpl( struct ldap_disptmpl *tmpllist );
1N/A
1N/ALDAP_API(struct ldap_disptmpl *)
1N/ALDAP_CALL
1N/Aldap_next_disptmpl( struct ldap_disptmpl *tmpllist,
1N/A struct ldap_disptmpl *tmpl );
1N/A
1N/ALDAP_API(struct ldap_disptmpl *)
1N/ALDAP_CALL
1N/Aldap_name2template( char *name, struct ldap_disptmpl *tmpllist );
1N/A
1N/ALDAP_API(struct ldap_disptmpl *)
1N/ALDAP_CALL
1N/Aldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist );
1N/A
1N/ALDAP_API(char **)
1N/ALDAP_CALL
1N/Aldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, int exclude,
1N/A unsigned long syntaxmask );
1N/A
1N/ALDAP_API(struct ldap_tmplitem *)
1N/ALDAP_CALL
1N/Aldap_first_tmplrow( struct ldap_disptmpl *tmpl );
1N/A
1N/ALDAP_API(struct ldap_tmplitem *)
1N/ALDAP_CALL
1N/Aldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row );
1N/A
1N/ALDAP_API(struct ldap_tmplitem *)
1N/ALDAP_CALL
1N/Aldap_first_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row );
1N/A
1N/ALDAP_API(struct ldap_tmplitem *)
1N/ALDAP_CALL
1N/Aldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row,
1N/A struct ldap_tmplitem *col );
1N/A
1N/ALDAP_API(int)
1N/ALDAP_CALL
1N/Aldap_entry2text( LDAP *ld, char *buf, LDAPMessage *entry,
1N/A struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
1N/A writeptype writeproc, void *writeparm, char *eol, int rdncount,
1N/A unsigned long opts );
1N/A
1N/ALDAP_API(int)
1N/ALDAP_CALL
1N/Aldap_vals2text( LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
1N/A unsigned long syntaxid, writeptype writeproc, void *writeparm,
1N/A char *eol, int rdncount );
1N/A
1N/ALDAP_API(int)
1N/ALDAP_CALL
1N/Aldap_entry2text_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry,
1N/A struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
1N/A writeptype writeproc, void *writeparm, char *eol, int rdncount,
1N/A unsigned long opts );
1N/A
1N/ALDAP_API(int)
1N/ALDAP_CALL
1N/Aldap_entry2html( LDAP *ld, char *buf, LDAPMessage *entry,
1N/A struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
1N/A writeptype writeproc, void *writeparm, char *eol, int rdncount,
1N/A unsigned long opts, char *urlprefix, char *base );
1N/A
1N/ALDAP_API(int)
1N/ALDAP_CALL
1N/Aldap_vals2html( LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
1N/A unsigned long syntaxid, writeptype writeproc, void *writeparm,
1N/A char *eol, int rdncount, char *urlprefix );
1N/A
1N/ALDAP_API(int)
1N/ALDAP_CALL
1N/Aldap_entry2html_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry,
1N/A struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
1N/A writeptype writeproc, void *writeparm, char *eol, int rdncount,
1N/A unsigned long opts, char *urlprefix );
1N/A
1N/A#endif /* ifndef _SOLARIS_SDK */
1N/A
1N/ALDAP_API(char *)
1N/ALDAP_CALL
1N/Aldap_tmplerr2string( int err );
1N/A
1N/A#ifdef __cplusplus
1N/A}
1N/A#endif
1N/A#endif /* _DISPTMPL_H */