1 /* common.h - common definitions for the ldap client tools */
2 /* $OpenLDAP: pkg/ldap/clients/tools/common.h,v 1.24.2.3 2008/02/11 23:26:38 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2008 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This file was initially created by Hallvard B. Furuseth based (in
18 * part) upon argument parsing code for individual tools located in
22 #ifndef _CLIENT_TOOLS_COMMON_H_
23 #define _CLIENT_TOOLS_COMMON_H_
27 typedef enum tool_type_t
{
37 TOOL_WHOAMI
= TOOL_EXOP
| 0x100U
,
38 TOOL_PASSWD
= TOOL_EXOP
| 0x200U
,
40 TOOL_WRITE
= (TOOL_ADD
|TOOL_DELETE
|TOOL_MODIFY
|TOOL_MODRDN
),
41 TOOL_READ
= (TOOL_SEARCH
|TOOL_COMPARE
),
47 /* input-related vars */
49 /* misc. parameters */
50 extern tool_type_t tool_type
;
62 extern char *ldaphost
;
69 extern int authmethod
;
71 extern int want_bindpw
;
72 extern struct berval passwd
;
74 #ifdef HAVE_CYRUS_SASL
75 extern unsigned sasl_flags
;
76 extern char *sasl_realm
;
77 extern char *sasl_authc_id
;
78 extern char *sasl_authz_id
;
79 extern char *sasl_mech
;
80 extern char *sasl_secprops
;
84 extern char *assertion
;
87 extern int manageDSAit
;
90 extern int preread
, postread
;
91 extern ber_int_t pr_morePagedResults
;
92 extern struct berval pr_cookie
;
93 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
95 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
98 extern struct timeval nettimeout
;
100 /* Defined in common.c, set in main() */
101 extern const char __Version
[];
103 /* Defined in main program */
104 extern const char options
[];
106 void usage
LDAP_P(( void )) LDAP_GCCATTR((noreturn
));
107 int handle_private_option
LDAP_P(( int i
));
109 /* Defined in common.c */
110 void tool_init
LDAP_P(( tool_type_t type
));
111 void tool_common_usage
LDAP_P(( void ));
112 void tool_args
LDAP_P(( int, char ** ));
113 LDAP
*tool_conn_setup
LDAP_P(( int dont
, void (*private_setup
)( LDAP
* ) ));
114 void tool_bind
LDAP_P(( LDAP
* ));
115 void tool_unbind
LDAP_P(( LDAP
* ));
116 void tool_destroy
LDAP_P(( void ));
117 void tool_server_controls
LDAP_P(( LDAP
*, LDAPControl
*, int ));
118 int tool_check_abandon
LDAP_P(( LDAP
*ld
, int msgid
));
119 void tool_perror
LDAP_P((
126 void tool_print_ctrls
LDAP_P(( LDAP
*ld
, LDAPControl
**ctrls
));
127 int tool_write_ldif
LDAP_P(( int type
, char *name
, char *value
, ber_len_t vallen
));
128 int tool_is_oid
LDAP_P(( const char *s
));
133 #endif /* _CLIENT_TOOLS_COMMON_H_ */