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-2013 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;
59 extern ber_len_t ldif_wrap;
64 extern char *ldaphost;
71 extern int authmethod;
73 extern int want_bindpw;
74 extern struct berval passwd;
76 #ifdef HAVE_CYRUS_SASL
77 extern unsigned sasl_flags;
78 extern char *sasl_realm;
79 extern char *sasl_authc_id;
80 extern char *sasl_authz_id;
81 extern char *sasl_mech;
82 extern char *sasl_secprops;
86 extern char *assertion;
89 extern int manageDSAit;
92 extern int preread, postread;
93 extern ber_int_t pr_morePagedResults;
94 extern struct berval pr_cookie;
95 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
97 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
98 extern ber_int_t vlvPos;
99 extern ber_int_t vlvCount;
100 extern struct berval *vlvContext;
103 extern struct timeval nettimeout;
105 /* Defined in common.c, set in main() */
106 extern const char __Version[];
108 /* Defined in main program */
109 extern const char options[];
111 void usage LDAP_P(( void )) LDAP_GCCATTR((noreturn));
112 int handle_private_option LDAP_P(( int i ));
114 /* Defined in common.c */
115 void tool_init LDAP_P(( tool_type_t type ));
116 void tool_common_usage LDAP_P(( void ));
117 void tool_args LDAP_P(( int, char ** ));
118 LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
119 void tool_bind LDAP_P(( LDAP * ));
120 void tool_unbind LDAP_P(( LDAP * ));
121 void tool_destroy LDAP_P(( void ));
122 void tool_exit LDAP_P(( LDAP *ld, int status )) LDAP_GCCATTR((noreturn));
123 void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int ));
124 int tool_check_abandon LDAP_P(( LDAP *ld, int msgid ));
125 void tool_perror LDAP_P((
132 void tool_print_ctrls LDAP_P(( LDAP *ld, LDAPControl **ctrls ));
133 int tool_write_ldif LDAP_P(( int type, char *name, char *value, ber_len_t vallen ));
134 int tool_is_oid LDAP_P(( const char *s ));
139 #endif /* _CLIENT_TOOLS_COMMON_H_ */