/*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of Michigan at Ann Arbor. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
#ifndef _LDAP_H
#define _LDAP_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LDAP_SSL
#endif /* LDAP_SSL */
#include <pthread.h>
#ifdef LDAP_SSL
#endif
#if !defined(NEEDPROTOS) && defined(__STDC__)
#endif
/* OPTIONS to use with ldap_set_option and ldap_get_option */
/* int, control how aliases are handled during search */
/* Deref values */
/* int, protocol version, default 2 */
/* List of ldap controls to be sent with each request */
/* List of ldap controls that affect the session */
/* The hostname of the default ldap server */
/* The code of the most recent ldap error that occured for this session */
/* The message returned with the most recent ldap error */
/* The Matching DN in case of a naming error */
/* The timeout while trying to connect to a server */
#define LDAP_X_IO_TIMEOUT_NO_WAIT 0
/* The Filter List Desc used by UFN functions */
/* #define LDAP_OPT_FILTERDESC 0x80 */
#define LDAP_OPT_OFF ((void *)0)
/* Used for NO limitation is TIMELIMIT or SIZELIMIT */
#define LDAP_NO_LIMIT 0
/* Begin LDAP Display Template Definitions */
/*
* general types of items (confined to most significant byte)
*/
/*
* syntax options (confined to second most significant byte)
*/
/*
* display template item syntax ids (defined by common agreement)
* these are the valid values for the ti_syntaxid of the tmplitem
* struct (defined below). A general type is encoded in the
* most-significant 8 bits, and some options are encoded in the next
* 8 bits. The lower 16 bits are reserved for the distinct types.
*/
#ifdef SUN
#endif
/*
* handy macros
*/
/*
* display options for output routines (used by entry2text and friends)
*/
/*
* use calculated label width (based on length of longest label in
* template) instead of contant width
*/
/*
* perform search actions (applies to ldap_entry2text_search only)
*/
/*
* include additional info. relevant to "non leaf" entries only
* used by ldap_entry2html and ldap_entry2html_search to include "Browse"
* and "Move Up" HREFs
*/
/*
* display template item options (may not apply to all types)
* if this bit is set in ti_options, it applies.
*/
/*
* LDAP API Information structure
*/
typedef struct ldapapiinfo {
} LDAPAPIInfo;
/*
* LDAP API Feature Information
*/
typedef struct ldap_apifeature_info {
/*
* display template item structure
*/
struct ldap_tmplitem {
unsigned int ti_syntaxid;
unsigned int ti_options;
char *ti_attrname;
char *ti_label;
char **ti_args;
void *ti_appdata;
};
/*
* object class array structure
*/
struct ldap_oclist {
char **oc_objclasses;
};
/*
* add defaults list
*/
struct ldap_adddeflist {
int ad_source;
char *ad_attrname;
char *ad_value;
};
/*
* display template global options
* if this bit is set in dt_options, it applies.
*/
/*
* users should be allowed to try to add objects of these entries
*/
/*
* users should be allowed to do "modify RDN" operation of these entries
*/
/*
* this template is an alternate view, not a primary view
*/
/*
* display template structure
*/
struct ldap_disptmpl {
char *dt_name;
char *dt_pluralname;
char *dt_iconname;
unsigned int dt_options;
char *dt_authattrname;
char *dt_defrdnattrname;
char *dt_defaddlocation;
void *dt_appdata;
};
/*
* buffer size needed for entry2text and vals2text
*/
/* END Display Template Definitions */
/* BEGIN Search Prefrences Definitions */
struct ldap_searchattr {
char *sa_attrlabel;
char *sa_attr;
/* max 32 matchtypes for now */
unsigned int sa_matchtypebitmap;
char *sa_selectattr;
char *sa_selecttext;
};
struct ldap_searchmatch {
char *sm_matchprompt;
char *sm_filter;
};
struct ldap_searchobj {
char *so_objtypeprompt;
unsigned int so_options;
char *so_prompt;
short so_defaultscope;
char *so_filterprefix;
char *so_filtertag;
char *so_defaultselectattr;
char *so_defaultselecttext;
};
/*
* global search object options
*/
#define LDAP_SEARCHPREF_VERSION_ZERO 0
/* END Search Prefrences Definitions */
/*
* Structure for LDAP modifications
*/
typedef struct ldapmod {
int mod_op;
char *mod_type;
union {
char **modv_strvals;
} mod_vals;
/*
* The following field is commented out since no functions use it in
* the library and also not part of c-api draft.
*/
/* struct ldapmod *mod_next */
} LDAPMod;
/* Call back to get info needed for re-bind */
/*
* structures for ldap getfilter routines
*/
typedef struct ldap_filt_info {
char *lfi_filter;
char *lfi_desc;
} LDAPFiltInfo;
/*
* Simple Page control OID
*/
/*
* Server Sort Control
*/
/*
* structure for a sort-key
*/
typedef struct LDAPsortkey {
char *sk_attrtype;
char *sk_matchruleoid;
int sk_reverseorder;
} LDAPsortkey;
/*
* Virtual List View (vlv) control
*/
/*
* structure that describes a VirtualListViewRequest control.
* note that ldvlist_index and ldvlist_size are only relevant to
* ldap_create_virtuallist_control() if ldvlist_attrvalue is NULL.
*/
typedef struct ldapvirtuallist {
/*
* ldapv3 LDAPControl
*/
typedef struct ldapcontrol
{
char *ldctl_oid;
/*
* the "ldctl_value" field of this structure used to be a pointer to
* struct berval. To make this structure compliant to the latest c-api
* draft, it is changed to "struct berval ldctl_value"
*/
char ldctl_iscritical;
/*
* specific LDAP instantiations of BER types we know about
*/
/* general stuff */
/* Tag for modrdn request */
/* Tags for Extensible filter match */
/* tags for EXTENDED OPERATIONS */
/* tags for Virtual List View control */
/* tag for sort control */
/* possible operations a client can invoke */
/* New in ldapv3 application + constructed */
/* version 3.0 compatibility stuff */
/* possible result types a server can return */
/* new in ldapv3, application + constructed */
/* new in ldapv3, application + constructed */
/* authentication methods available */
/* New with ldapv3 */
/* 3.0 compatibility auth methods */
/* filter types */
/* 3.0 compatibility filter types */
/* substring filter component types */
/* 3.0 compatibility substring filter component types */
/* search scopes */
/* Used when parsing URL, if scope not found. *LDAP_SCOPE_BASE is to use then */
/* ldap_result number of messages that should be returned */
/* default limit on nesting of referrals */
/* SASL mechanisms */
/* Next ones are not supported so far by SunDS 2.0 */
/*
* structure for ldap friendly mapping routines
*/
typedef struct friendly {
char *f_unfriendly;
char *f_friendly;
} FriendlyMap;
/*
* Structures for URL handling
*/
typedef struct ldap_url_extension {
char *lue_type;
char *lue_value;
int lue_iscritical;
} LDAPURLExt;
typedef struct ldap_url_desc {
char *lud_host;
int lud_port;
char *lud_dn;
char **lud_attrs;
int lud_scope;
char *lud_filter;
} LDAPURLDesc;
/*
* possible error codes we can return
*/
/* Not used in ldapv3 */
/* New in ldapv3 */
/* End of new */
/* Following in not used in ldapv3 */
/* Following is new in ldapv3 */
/* Reserved for API */
/* New code with ldapv3 ? */
/* debugging stuff */
#ifdef LDAP_DEBUG
extern int ldap_debug;
#ifdef LDAP_SYSLOG
extern int ldap_syslog;
extern int ldap_syslog_level;
#endif
/* More values for http gateway */
#ifdef LDAP_SYSLOG
{ \
if (ldap_debug & level) \
if (ldap_syslog & level) \
}
#else /* LDAP_SYSLOG */
#ifndef WINSOCK
if (ldap_debug & level) \
#else /* !WINSOCK */
#endif /* !WINSOCK */
#endif /* LDAP_SYSLOG */
#else /* LDAP_DEBUG */
#endif /* LDAP_DEBUG */
#ifndef NEEDPROTOS
#ifdef LDAP_SSL
extern LDAP *ldap_ssl_open();
#endif /* LDAP_SSL */
#ifdef STR_TRANSLATION
extern void ldap_set_string_translators();
#ifdef LDAP_CHARSET_8859
extern int ldap_t61_to_8859();
extern int ldap_8859_to_t61();
#endif /* LDAP_CHARSET_8859 */
#endif /* STR_TRANSLATION */
extern LDAPMessage *ldap_first_entry();
extern LDAPMessage *ldap_next_entry();
extern char *ldap_get_dn();
extern char *ldap_dn2ufn();
extern char **ldap_explode_dn();
extern char *ldap_first_attribute();
extern char *ldap_next_attribute();
extern char **ldap_get_values();
extern struct berval **ldap_get_values_len();
extern void ldap_value_free();
extern void ldap_value_free_len();
extern int ldap_count_values();
extern int ldap_count_values_len();
extern char *ldap_err2string();
extern void ldap_getfilter_free();
extern LDAPFiltDesc *ldap_init_getfilter();
extern LDAPFiltDesc *ldap_init_getfilter_buf();
extern LDAPFiltInfo *ldap_getfirstfilter();
extern LDAPFiltInfo *ldap_getnextfilter();
extern void ldap_setfilteraffixes();
extern void ldap_build_filter();
extern void ldap_flush_cache();
extern void ldap_set_cache_options();
extern void ldap_uncache_entry();
extern void ldap_uncache_request();
extern char *ldap_friendly_name();
extern void ldap_free_friendlymap();
extern LDAP *cldap_open();
extern void cldap_setretryinfo();
extern void cldap_close();
extern LDAPFiltDesc *ldap_ufn_setfilter();
extern int ldap_ufn_timeout();
extern int ldap_sort_entries();
extern int ldap_sort_values();
extern int ldap_sort_strcasecmp();
void ldap_free_urldesc();
void ldap_free_urlexts();
void ldap_set_rebind_proc();
void ldap_enable_translation();
/* Begin Display Template Prototypes */
typedef int (*writeptype)();
int ldap_init_templates();
int ldap_init_templates_buf();
void ldap_free_templates();
struct ldap_disptmpl *ldap_first_disptmpl();
struct ldap_disptmpl *ldap_next_disptmpl();
struct ldap_disptmpl *ldap_name2template();
struct ldap_disptmpl *ldap_oc2template();
char **ldap_tmplattrs();
struct ldap_tmplitem *ldap_first_tmplrow();
struct ldap_tmplitem *ldap_next_tmplrow();
struct ldap_tmplitem *ldap_first_tmplcol();
struct ldap_tmplitem *ldap_next_tmplcol();
int ldap_entry2text_search();
int ldap_entry2text();
int ldap_vals2text();
int ldap_entry2html_search();
int ldap_entry2html();
int ldap_vals2html();
int ldap_init_searchprefs();
int ldap_init_searchprefs_buf();
void ldap_free_searchprefs();
struct ldap_searchobj *ldap_first_searchobj();
struct ldap_searchobj *ldap_next_searchobj();
#else /* NEEDPROTOS */
#endif
/*
* Abandon functions
*/
LDAPControl ** clientctrls);
/*
* Add functions
*/
/*
* Bind functions
*/
/* DEPRECATED */
/* DEPRECATED */
#ifdef LDAP_REFERRALS
/* DEPRECATED */
void *extra_arg);
#endif /* LDAP_REFERRALS */
/*
* Simple bind functions
*/
/*
* SASL functions
*/
struct berval **servercredp);
/*
* Kerberos functions
*/
/* DEPRECATED */
/* DEPRECATED */
/* DEPRECATED */
/* DEPRECATED */
/* DEPRECATED */
#ifndef NO_CACHE
/*
* Cache functions
*/
#endif /* !NO_CACHE */
/*
* Compare functions
*/
/*
* Delete functions
*/
/*
* Error functions
*/
char *ldap_err2string(int err);
/* DEPRECATED */
/* DEPRECATED */
/*
* Modify functions
*/
/*
* Modrdn functions
*/
/* DEPRECATED : use ldap_rename instead */
/* DEPRECATED : use ldap_rename_s instead */
/* DEPRECATED : use ldap_rename instead */
int deleteoldrdn);
/* DEPRECATED : use ldap_rename_s instead */
int deleteoldrdn);
/*
* Rename functions
*/
/*
*/
/* DEPRECATED : use ldap_init instead */
#ifdef LDAP_SSL
/* DEPRECATED : use ldap_ssl_init instead */
#endif
/*
* Entry functions
*/
/*
* Message functions
*/
/*
* Reference functions
*/
/*
* Entry functions
*/
LDAPMessage *e);
/*
* DN functions
*/
char *ldap_dn2ufn(char *dn);
char **ldap_explode_dns(char *dn);
int ldap_is_dns_dn(char *dn);
/*
* Attribute parsing functions
*/
BerElement **ber);
BerElement *ber);
void ldap_memfree(char *mem);
/*
* Attribute Value functions
*/
char *target);
int ldap_count_values(char **vals);
void ldap_value_free(char **vals);
/*
* Result functions
*/
/*
* Search functions
*/
LDAPMessage **res);
/*
* UFN functions
*/
void *cancelparm);
int ldap_ufn_timeout(void *tvparam);
/*
* Unbind functions
*/
/*
* Filter functions
*/
char *value);
/*
* Functions to free LDAPFiltDesc and LDAPmod
*/
/*
* Friendly name functions
*/
FriendlyMap **map);
/*
* Connectionless LDAP functions
*/
/*
* Sort functions
*/
int (*cmp)());
int ldap_sort_strcasecmp(char **a, char **b);
/*
* URL functions
*/
int ldap_is_ldap_url(char *url);
LDAPMessage **res);
/*
* in Character Set functions
*/
#ifdef STR_TRANSLATION
unsigned int *lenp, int free_input);
unsigned int *lenp, int free_input);
int enable);
#ifdef LDAP_CHARSET_8859
int free_input);
int free_input);
#endif /* LDAP_CHARSET_8859 */
#endif /* STR_TRANSLATION */
/*
* Diplay Template functions
*/
int ldap_init_templates(char *file,
struct ldap_disptmpl **tmpllistp);
struct ldap_disptmpl **tmpllistp);
struct ldap_disptmpl *ldap_first_disptmpl(
struct ldap_disptmpl *tmpllist);
struct ldap_disptmpl *ldap_next_disptmpl(
struct ldap_disptmpl *tmpllist);
struct ldap_disptmpl *tmpllist);
struct ldap_tmplitem *row);
struct ldap_tmplitem *row);
char *urlprefix);
/*
* Search Preferences functions
*/
int ldap_init_searchprefs(char *file,
struct ldap_searchobj **solistp);
struct ldap_searchobj **solistp);
struct ldap_searchobj *ldap_first_searchobj(
struct ldap_searchobj *solist);
struct ldap_searchobj *ldap_next_searchobj(
/*
* Option functions
*/
/*
* Control functions
*/
/*
* Simple Page Control functions
*/
/*
* Server Side Sort control functions
*/
/*
* Virtual List View control functions
*/
LDAPControl **ctrlp);
unsigned long *target_posp, unsigned long *list_sizep,
int *errcodep);
#endif /* NEEDPROTOS */
#ifdef __cplusplus
}
#endif
#endif /* _LDAP_H */