Home | History | Annotate | Line # | Download | only in tools
      1  1.3  christos /*	$NetBSD: common.h,v 1.4 2025/09/05 21:16:13 christos Exp $	*/
      2  1.2  christos 
      3  1.1     lukem /* common.h - common definitions for the ldap client tools */
      4  1.2  christos /* $OpenLDAP$ */
      5  1.1     lukem /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
      6  1.1     lukem  *
      7  1.4  christos  * Copyright 1998-2024 The OpenLDAP Foundation.
      8  1.1     lukem  * All rights reserved.
      9  1.1     lukem  *
     10  1.1     lukem  * Redistribution and use in source and binary forms, with or without
     11  1.1     lukem  * modification, are permitted only as authorized by the OpenLDAP
     12  1.1     lukem  * Public License.
     13  1.1     lukem  *
     14  1.1     lukem  * A copy of this license is available in the file LICENSE in the
     15  1.1     lukem  * top-level directory of the distribution or, alternatively, at
     16  1.1     lukem  * <http://www.OpenLDAP.org/license.html>.
     17  1.1     lukem  */
     18  1.1     lukem /* ACKNOWLEDGEMENTS:
     19  1.1     lukem  * This file was initially created by Hallvard B. Furuseth based (in
     20  1.1     lukem  * part) upon argument parsing code for individual tools located in
     21  1.1     lukem  * this directory.
     22  1.1     lukem  */
     23  1.1     lukem 
     24  1.1     lukem #ifndef _CLIENT_TOOLS_COMMON_H_
     25  1.1     lukem #define _CLIENT_TOOLS_COMMON_H_
     26  1.1     lukem 
     27  1.1     lukem LDAP_BEGIN_DECL
     28  1.1     lukem 
     29  1.1     lukem typedef enum tool_type_t {
     30  1.1     lukem 	TOOL_SEARCH	= 0x01U,
     31  1.1     lukem 	TOOL_COMPARE	= 0x02U,
     32  1.1     lukem 	TOOL_ADD	= 0x04U,
     33  1.1     lukem 	TOOL_DELETE	= 0x08U,
     34  1.1     lukem 	TOOL_MODIFY	= 0x10U,
     35  1.1     lukem 	TOOL_MODRDN	= 0x20U,
     36  1.1     lukem 
     37  1.1     lukem 	TOOL_EXOP	= 0x40U,
     38  1.1     lukem 
     39  1.1     lukem 	TOOL_WHOAMI	= TOOL_EXOP | 0x100U,
     40  1.1     lukem 	TOOL_PASSWD	= TOOL_EXOP | 0x200U,
     41  1.3  christos 	TOOL_VC		= TOOL_EXOP | 0x400U,
     42  1.1     lukem 
     43  1.1     lukem 	TOOL_WRITE	= (TOOL_ADD|TOOL_DELETE|TOOL_MODIFY|TOOL_MODRDN),
     44  1.1     lukem 	TOOL_READ	= (TOOL_SEARCH|TOOL_COMPARE),
     45  1.1     lukem 
     46  1.1     lukem 	TOOL_ALL	= 0xFFU
     47  1.1     lukem } tool_type_t;
     48  1.1     lukem 
     49  1.1     lukem 
     50  1.1     lukem /* input-related vars */
     51  1.1     lukem 
     52  1.1     lukem /* misc. parameters */
     53  1.1     lukem extern tool_type_t	tool_type;
     54  1.1     lukem extern int		contoper;
     55  1.1     lukem extern int		debug;
     56  1.1     lukem extern char		*infile;
     57  1.1     lukem extern int		dont;
     58  1.1     lukem extern int		referrals;
     59  1.1     lukem extern int		verbose;
     60  1.1     lukem extern int		ldif;
     61  1.2  christos extern ber_len_t	ldif_wrap;
     62  1.1     lukem extern char		*prog;
     63  1.1     lukem 
     64  1.1     lukem /* connection */
     65  1.1     lukem extern char		*ldapuri;
     66  1.1     lukem extern int		use_tls;
     67  1.1     lukem extern int		protocol;
     68  1.1     lukem extern int		version;
     69  1.1     lukem 
     70  1.1     lukem /* authc/authz */
     71  1.1     lukem extern int		authmethod;
     72  1.1     lukem extern char		*binddn;
     73  1.1     lukem extern int		want_bindpw;
     74  1.1     lukem extern struct berval	passwd;
     75  1.1     lukem extern char		*pw_file;
     76  1.1     lukem #ifdef HAVE_CYRUS_SASL
     77  1.1     lukem extern unsigned		sasl_flags;
     78  1.1     lukem extern char		*sasl_realm;
     79  1.1     lukem extern char		*sasl_authc_id;
     80  1.1     lukem extern char		*sasl_authz_id;
     81  1.1     lukem extern char		*sasl_mech;
     82  1.1     lukem extern char		*sasl_secprops;
     83  1.1     lukem #endif
     84  1.1     lukem 
     85  1.1     lukem /* controls */
     86  1.1     lukem extern char		*assertion;
     87  1.1     lukem extern char		*authzid;
     88  1.1     lukem extern int		manageDIT;
     89  1.1     lukem extern int		manageDSAit;
     90  1.1     lukem extern int		noop;
     91  1.1     lukem extern int		ppolicy;
     92  1.1     lukem extern int		preread, postread;
     93  1.1     lukem extern ber_int_t	pr_morePagedResults;
     94  1.1     lukem extern struct berval	pr_cookie;
     95  1.1     lukem #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
     96  1.1     lukem extern int		chaining;
     97  1.1     lukem #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
     98  1.2  christos extern ber_int_t	vlvPos;
     99  1.2  christos extern ber_int_t	vlvCount;
    100  1.2  christos extern struct berval	*vlvContext;
    101  1.1     lukem 
    102  1.3  christos /* features */
    103  1.3  christos extern int		backlog;
    104  1.3  christos 
    105  1.1     lukem /* options */
    106  1.1     lukem extern struct timeval	nettimeout;
    107  1.1     lukem 
    108  1.1     lukem /* Defined in common.c, set in main() */
    109  1.1     lukem extern const char	__Version[];
    110  1.1     lukem 
    111  1.1     lukem /* Defined in main program */
    112  1.1     lukem extern const char	options[];
    113  1.1     lukem 
    114  1.1     lukem void usage LDAP_P(( void )) LDAP_GCCATTR((noreturn));
    115  1.1     lukem int handle_private_option LDAP_P(( int i ));
    116  1.1     lukem 
    117  1.1     lukem /* Defined in common.c */
    118  1.1     lukem void tool_init LDAP_P(( tool_type_t type ));
    119  1.1     lukem void tool_common_usage LDAP_P(( void ));
    120  1.1     lukem void tool_args LDAP_P(( int, char ** ));
    121  1.1     lukem LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
    122  1.1     lukem void tool_bind LDAP_P(( LDAP * ));
    123  1.1     lukem void tool_unbind LDAP_P(( LDAP * ));
    124  1.1     lukem void tool_destroy LDAP_P(( void ));
    125  1.2  christos void tool_exit LDAP_P(( LDAP *ld, int status )) LDAP_GCCATTR((noreturn));
    126  1.1     lukem void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int ));
    127  1.1     lukem int tool_check_abandon LDAP_P(( LDAP *ld, int msgid ));
    128  1.1     lukem void tool_perror LDAP_P((
    129  1.1     lukem 	const char *func,
    130  1.1     lukem 	int err,
    131  1.1     lukem 	const char *extra,
    132  1.1     lukem 	const char *matched,
    133  1.1     lukem 	const char *info,
    134  1.1     lukem 	char **refs ));
    135  1.1     lukem void tool_print_ctrls LDAP_P(( LDAP *ld, LDAPControl **ctrls ));
    136  1.1     lukem int tool_write_ldif LDAP_P(( int type, char *name, char *value, ber_len_t vallen ));
    137  1.1     lukem int tool_is_oid LDAP_P(( const char *s ));
    138  1.1     lukem 
    139  1.1     lukem 
    140  1.1     lukem LDAP_END_DECL
    141  1.1     lukem 
    142  1.1     lukem #endif /* _CLIENT_TOOLS_COMMON_H_ */
    143