solaris-int.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef _SOLARISINT_H
#define _SOLARISINT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
#include "ldap.h"
/*
* These were moved from lber.h. This should have been ifdef'd with
* _SOLARIS_SDK but since we do not want to expose these in lber.h its
* not possible to ifndef it there.
*/
#define LBER_OPT_REMAINING_BYTES 0x01
#define LBER_OPT_TOTAL_BYTES 0x02
#define LBER_OPT_USE_DER 0x04
#define LBER_OPT_TRANSLATE_STRINGS 0x08
#define LBER_OPT_BYTES_TO_WRITE 0x10
#define LBER_OPT_MEMALLOC_FN_PTRS 0x20
#define LBER_OPT_DEBUG_LEVEL 0x40
/*
* LBER_USE_DER is defined for compatibility with the C LDAP API RFC.
* In our implementation, we recognize it (instead of the numerically
* identical LBER_OPT_REMAINING_BYTES) in calls to ber_alloc_t() and
* ber_init_w_nullchar() only. Callers of ber_set_option() or
* ber_get_option() must use LBER_OPT_USE_DER instead. Sorry!
*/
#define LBER_USE_DER 0x01
#define LBER_SOCKBUF_OPT_TO_FILE 0x001
#define LBER_SOCKBUF_OPT_TO_FILE_ONLY 0x002
#define LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE 0x004
#define LBER_SOCKBUF_OPT_NO_READ_AHEAD 0x008
#define LBER_SOCKBUF_OPT_DESC 0x010
#define LBER_SOCKBUF_OPT_COPYDESC 0x020
#define LBER_SOCKBUF_OPT_READ_FN 0x040
#define LBER_SOCKBUF_OPT_WRITE_FN 0x080
#define LBER_SOCKBUF_OPT_EXT_IO_FNS 0x100
#ifndef _SOLARIS_SDK
/*
* The following is not used by solaris. Just kept to stay in sync with
* iplanet and also a place holder (0x200)
*/
#define LBER_SOCKBUF_OPT_VALID_TAG 0x200
#endif /* !_SOLARIS_SDK */
/*
* Socket buffer structure associated to the LDAP connection
*/
/* 0x4000 + 0x0F02 = 0x4F02 = 20226 - API extension */
#define LBER_OPT_ON ((void *) 1)
#define LBER_OPT_OFF ((void *) 0)
/* Used in various functions */
#define LBER_FUNC_VALUE -1
struct lextiof_socket_private; /* Defined by the extended I/O */
/* callback functions */
struct lextiof_session_private; /* Defined by the extended I/O */
/* callback functions */
/* This is modeled after the PRIOVec that is passed to the NSPR
writev function! The void* is a char* in that struct */
typedef struct ldap_x_iovec {
char *ldapiov_base;
int ldapiov_len;
} ldap_x_iovec;
/*
* libldap read and write I/O function callbacks. The rest of the I/O callback
* types are defined in ldap.h
*/
/*
* Structure for use with LBER_SOCKBUF_OPT_EXT_IO_FNS:
*/
struct lber_x_ext_io_fns {
/* lbextiofn_size should always be set to LBER_X_EXTIO_FNS_SIZE */
int lbextiofn_size;
};
#define LBER_X_EXTIO_FNS_SIZE sizeof(struct lber_x_ext_io_fns)
/*
* liblber memory allocation callback functions. These are global to all
* Sockbufs and BerElements. Install your own functions by using a call
* like this: ber_set_option( NULL, LBER_OPT_MEMALLOC_FN_PTRS, &memalloc_fns );
*/
struct lber_memalloc_fns {
};
/*
* Functions marked as Project Private in PSARC case and moved
* from lber.h
*/
void *value );
void *value );
void *value );
void *value );
BerElement *ber );
/*
* The following was moved from ldap.h
*/
/*
* These extended I/O function callbacks echo the BSD socket API but accept
* an extra pointer parameter at the end of their argument list that can
* be used by client applications for their own needs. For some of the calls,
* the pointer is a session argument of type struct lextiof_session_private *
* that is associated with the LDAP session handle (LDAP *). For others, the
* pointer is a socket specific struct lextiof_socket_private * argument that
* is associated with a particular socket (a TCP connection).
*
* The lextiof_session_private and lextiof_socket_private structures are not
* defined by the LDAP C API; users of this extended I/O interface should
* define these themselves.
*
* The combination of the integer socket number (i.e., lpoll_fd, which is
* the value returned by the CONNECT callback) and the application specific
* socket argument (i.e., lpoll_socketarg, which is the value set in *sockargpp
* by the CONNECT callback) must be unique.
*
* The types for the extended READ and WRITE callbacks are actually in lber.h.
*
* The CONNECT callback gets passed both the session argument (sessionarg)
* and a pointer to a socket argument (socketargp) so it has the
* opportunity to set the socket-specific argument. The CONNECT callback
* also takes a timeout parameter whose value can be set by calling
* ldap_set_option( ld, LDAP_X_OPT_..., &val ). The units used for the
* timeout parameter are milliseconds.
*
* A POLL interface is provided instead of a select() one. The timeout is
* in milliseconds.
* A NEWHANDLE callback function is also provided. It is called right
* after the LDAP session handle is created, e.g., during ldap_init().
* If the NEWHANDLE callback returns anything other than LDAP_SUCCESS,
* the session handle allocation fails.
*
* A DISPOSEHANDLE callback function is also provided. It is called right
* before the LDAP session handle and its contents are destroyed, e.g.,
* during ldap_unbind().
*/
/* LDAP poll()-like descriptor:
*/
typedef struct ldap_x_pollfd { /* used by LDAP_X_EXTIOF_POLL_CALLBACK */
int lpoll_fd; /* integer file descriptor / socket */
struct lextiof_socket_private
/* pointer socket and for use by */
/* application */
short lpoll_events; /* requested event */
short lpoll_revents; /* returned event */
/* Event flags for lpoll_events and lpoll_revents:
*/
/* Options passed to LDAP_X_EXTIOF_CONNECT_CALLBACK to modify socket behavior:
*/
/* extended I/O callback function prototypes:
*/
int timeout /* milliseconds */,
unsigned long options, /* bitmapped options */
struct lextiof_session_private *sessionarg,
struct lextiof_socket_private **socketargp
#ifdef _SOLARIS_SDK
, void **datapriv );
#else
);
#endif
int s, struct lextiof_socket_private *socketarg );
struct lextiof_session_private *sessionarg );
/* Structure to hold extended I/O function pointers:
*/
struct ldap_x_ext_io_fns {
/* lextiof_size should always be set to LDAP_X_EXTIO_FNS_SIZE */
int lextiof_size;
void *lextiof_session_arg;
};
#define LDAP_X_EXTIO_FNS_SIZE sizeof(struct ldap_x_ext_io_fns)
/*
* Utility functions for parsing space-separated host lists (useful for
* implementing an extended I/O CONNECT callback function).
*/
struct ldap_x_hostlist_status;
struct ldap_x_hostlist_status **statusp );
struct ldap_x_hostlist_status *status );
/*
* I/O callback functions (note that types for the read and write callbacks
* are actually in lber.h):
*/
int option, ... );
LBER_SOCKET s );
LBER_SOCKET s );
/*
* Structure to hold I/O function pointers:
*/
struct ldap_io_fns {
};
/********* the functions in the following section are experimental ***********/
/*
* SSL option (an API extension):
*/
/*
* Referral hop limit (an API extension):
*/
/*
* DNS resolver callbacks (an API extension --LDAP_API_FEATURE_X_DNS_FUNCTIONS).
* Note that gethostbyaddr() is not currently used.
*/
typedef struct LDAPHostEnt {
char *ldaphe_name; /* official name of host */
char **ldaphe_aliases; /* alias list */
int ldaphe_addrtype; /* host address type */
int ldaphe_length; /* length of address */
char **ldaphe_addr_list; /* list of addresses from name server */
} LDAPHostEnt;
struct ldap_dns_fns {
void *lddnsfn_extradata;
int lddnsfn_bufsize;
};
/*
* Generalized cache callback interface:
*/
/* cache strategies */
#define LDAP_CACHE_CHECK 0
#define LDAP_CACHE_POPULATE 1
#define LDAP_CACHE_LOCALDB 2
int method);
int deleteoldrdn);
struct ldap_cache_fns {
void *lcf_private;
};
const char *filter);
/*
* Memory allocation callback functions (an API extension --
* LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS). These are global and can
* not be set on a per-LDAP session handle basis. Install your own
* functions by making a call like this:
* ldap_set_option( NULL, LDAP_OPT_MEMALLOC_FN_PTRS, &memalloc_fns );
*
* look in lber.h for the function typedefs themselves.
*/
struct ldap_memalloc_fns {
};
/*
* Memory allocation functions (an API extension)
*/
void ldap_x_free( void *ptr );
/*
* Extra thread callback functions (an API extension --
* LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS)
*/
struct ldap_extra_thread_fns {
};
/*
* Debugging level (an API extension)
*/
/* On UNIX, there's only one copy of ldap_debug */
/* On NT, each dll keeps its own module_ldap_debug, which */
/* points to the process' ldap_debug and needs initializing after load */
#ifdef _WIN32
extern int *module_ldap_debug;
typedef void (*set_debug_level_fn_t)(int*);
#endif
/************************ end of experimental section ************************/
/*
* utility routines
*/
/*
* UTF-8 routines (should these move into libnls?)
*/
/* number of bytes in character */
/* find next character */
/* find previous character */
/* copy one character */
/* total number of characters */
/* get one UCS-4 character, and move *src to the next character */
/* UTF-8 aware strtok_r() */
/* like isalnum(*s) in the C locale */
/* like isalpha(*s) in the C locale */
/* like isdigit(*s) in the C locale */
/* like isxdigit(*s) in the C locale */
/* like isspace(*s) in the C locale */
#define LDAP_UTF8PREV(s) ldap_utf8prev(s)
#define LDAP_UTF8DEC(s) (s=ldap_utf8prev(s))
#define LDAP_UTF8COPY(d,s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8copy(d,s) : ((*(d) = *(s)), 1))
#ifdef __cplusplus
}
#endif
#endif /* _SOLARISINT_H */