]> git.sur5r.net Git - openldap/blob - clients/tools/common.h
ITS#5247 fix verbose completion messages
[openldap] / clients / tools / common.h
1 /* common.h - common definitions for the ldap client tools */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2007 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
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>.
15  */
16 /* ACKNOWLEDGEMENTS:
17  * This file was initially created by Hallvard B. Furuseth based (in
18  * part) upon argument parsing code for individual tools located in
19  * this directory. 
20  */
21
22 #ifndef _CLIENT_TOOLS_COMMON_H_
23 #define _CLIENT_TOOLS_COMMON_H_
24
25 LDAP_BEGIN_DECL
26
27 typedef enum tool_type_t {
28         TOOL_SEARCH     = 0x01U,
29         TOOL_COMPARE    = 0x02U,
30         TOOL_ADD        = 0x04U,
31         TOOL_DELETE     = 0x08U,
32         TOOL_MODIFY     = 0x10U,
33         TOOL_MODRDN     = 0x20U,
34
35         TOOL_EXOP       = 0x40U,
36
37         TOOL_WHOAMI     = TOOL_EXOP | 0x100U,
38         TOOL_PASSWD     = TOOL_EXOP | 0x200U,
39
40         TOOL_WRITE      = (TOOL_ADD|TOOL_DELETE|TOOL_MODIFY|TOOL_MODRDN),
41         TOOL_READ       = (TOOL_SEARCH|TOOL_COMPARE),
42
43         TOOL_ALL        = 0xFFU
44 } tool_type_t;
45
46
47 /* input-related vars */
48
49 /* misc. parameters */
50 extern tool_type_t      tool_type;
51 extern int              contoper;
52 extern int              debug;
53 extern char             *infile;
54 extern int              dont;
55 extern int              referrals;
56 extern int              verbose;
57 extern int              ldif;
58 extern char             *prog;
59
60 /* connection */
61 extern char             *ldapuri;
62 extern char             *ldaphost;
63 extern int              ldapport;
64 extern int              use_tls;
65 extern int              protocol;
66 extern int              version;
67
68 /* authc/authz */
69 extern int              authmethod;
70 extern char             *binddn;
71 extern int              want_bindpw;
72 extern struct berval    passwd;
73 extern char             *pw_file;
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;
81 #endif
82
83 /* controls */
84 extern char             *assertion;
85 extern char             *authzid;
86 extern int              manageDIT;
87 extern int              manageDSAit;
88 extern int              noop;
89 extern int              ppolicy;
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
94 extern int              chaining;
95 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
96
97 /* options */
98 extern struct timeval   nettimeout;
99
100 /* Defined in common.c, set in main() */
101 extern const char       __Version[];
102
103 /* Defined in main program */
104 extern const char       options[];
105
106 void usage LDAP_P(( void )) LDAP_GCCATTR((noreturn));
107 int handle_private_option LDAP_P(( int i ));
108
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((
120         const char *func,
121         int err,
122         const char *extra,
123         const char *matched,
124         const char *info,
125         char **refs ));
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 ));
129
130
131 LDAP_END_DECL
132
133 #endif /* _CLIENT_TOOLS_COMMON_H_ */