1 /* common.h - common definitions for the ldap client tools */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2010 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,
39 TOOL_VC = TOOL_EXOP | 0x400U,
41 TOOL_WRITE = (TOOL_ADD|TOOL_DELETE|TOOL_MODIFY|TOOL_MODRDN),
42 TOOL_READ = (TOOL_SEARCH|TOOL_COMPARE),
48 /* input-related vars */
50 /* misc. parameters */
51 extern tool_type_t tool_type;
63 extern char *ldaphost;
70 extern int authmethod;
72 extern int want_bindpw;
73 extern struct berval passwd;
75 #ifdef HAVE_CYRUS_SASL
76 extern unsigned sasl_flags;
77 extern char *sasl_realm;
78 extern char *sasl_authc_id;
79 extern char *sasl_authz_id;
80 extern char *sasl_mech;
81 extern char *sasl_secprops;
85 extern char *assertion;
88 extern int manageDSAit;
91 extern int preread, postread;
92 extern ber_int_t pr_morePagedResults;
93 extern struct berval pr_cookie;
94 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
96 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
97 extern ber_int_t vlvPos;
98 extern ber_int_t vlvCount;
99 extern struct berval *vlvContext;
102 extern struct timeval nettimeout;
104 /* Defined in common.c, set in main() */
105 extern const char __Version[];
107 /* Defined in main program */
108 extern const char options[];
110 void usage LDAP_P(( void )) LDAP_GCCATTR((noreturn));
111 int handle_private_option LDAP_P(( int i ));
113 /* Defined in common.c */
114 void tool_init LDAP_P(( tool_type_t type ));
115 void tool_common_usage LDAP_P(( void ));
116 void tool_args LDAP_P(( int, char ** ));
117 LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
118 void tool_bind LDAP_P(( LDAP * ));
119 void tool_unbind LDAP_P(( LDAP * ));
120 void tool_destroy LDAP_P(( void ));
121 void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int ));
122 int tool_check_abandon LDAP_P(( LDAP *ld, int msgid ));
123 void tool_perror LDAP_P((
130 void tool_print_ctrls LDAP_P(( LDAP *ld, LDAPControl **ctrls ));
131 int tool_write_ldif LDAP_P(( int type, char *name, char *value, ber_len_t vallen ));
132 int tool_is_oid LDAP_P(( const char *s ));
137 #endif /* _CLIENT_TOOLS_COMMON_H_ */