Back to index

openldap  2.4.31
common.h
Go to the documentation of this file.
00001 /* common.h - common definitions for the ldap client tools */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 1998-2012 The OpenLDAP Foundation.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted only as authorized by the OpenLDAP
00010  * Public License.
00011  *
00012  * A copy of this license is available in the file LICENSE in the
00013  * top-level directory of the distribution or, alternatively, at
00014  * <http://www.OpenLDAP.org/license.html>.
00015  */
00016 /* ACKNOWLEDGEMENTS:
00017  * This file was initially created by Hallvard B. Furuseth based (in
00018  * part) upon argument parsing code for individual tools located in
00019  * this directory. 
00020  */
00021 
00022 #ifndef _CLIENT_TOOLS_COMMON_H_
00023 #define _CLIENT_TOOLS_COMMON_H_
00024 
00025 LDAP_BEGIN_DECL
00026 
00027 typedef enum tool_type_t {
00028        TOOL_SEARCH   = 0x01U,
00029        TOOL_COMPARE  = 0x02U,
00030        TOOL_ADD      = 0x04U,
00031        TOOL_DELETE   = 0x08U,
00032        TOOL_MODIFY   = 0x10U,
00033        TOOL_MODRDN   = 0x20U,
00034 
00035        TOOL_EXOP     = 0x40U,
00036 
00037        TOOL_WHOAMI   = TOOL_EXOP | 0x100U,
00038        TOOL_PASSWD   = TOOL_EXOP | 0x200U,
00039 
00040        TOOL_WRITE    = (TOOL_ADD|TOOL_DELETE|TOOL_MODIFY|TOOL_MODRDN),
00041        TOOL_READ     = (TOOL_SEARCH|TOOL_COMPARE),
00042 
00043        TOOL_ALL      = 0xFFU
00044 } tool_type_t;
00045 
00046 
00047 /* input-related vars */
00048 
00049 /* misc. parameters */
00050 extern tool_type_t   tool_type;
00051 extern int           contoper;
00052 extern int           debug;
00053 extern char          *infile;
00054 extern int           dont;
00055 extern int           referrals;
00056 extern int           verbose;
00057 extern int           ldif;
00058 extern ber_len_t     ldif_wrap;
00059 extern char          *prog;
00060 
00061 /* connection */
00062 extern char          *ldapuri;
00063 extern char          *ldaphost;
00064 extern int           ldapport;
00065 extern int           use_tls;
00066 extern int           protocol;
00067 extern int           version;
00068 
00069 /* authc/authz */
00070 extern int           authmethod;
00071 extern char          *binddn;
00072 extern int           want_bindpw;
00073 extern struct berval passwd;
00074 extern char          *pw_file;
00075 #ifdef HAVE_CYRUS_SASL
00076 extern unsigned             sasl_flags;
00077 extern char          *sasl_realm;
00078 extern char          *sasl_authc_id;
00079 extern char          *sasl_authz_id;
00080 extern char          *sasl_mech;
00081 extern char          *sasl_secprops;
00082 #endif
00083 
00084 /* controls */
00085 extern char          *assertion;
00086 extern char          *authzid;
00087 extern int           manageDIT;
00088 extern int           manageDSAit;
00089 extern int           noop;
00090 extern int           ppolicy;
00091 extern int           preread, postread;
00092 extern ber_int_t     pr_morePagedResults;
00093 extern struct berval pr_cookie;
00094 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
00095 extern int           chaining;
00096 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
00097 extern ber_int_t     vlvPos;
00098 extern ber_int_t     vlvCount;
00099 extern struct berval *vlvContext;
00100 
00101 /* options */
00102 extern struct timeval       nettimeout;
00103 
00104 /* Defined in common.c, set in main() */
00105 extern const char    __Version[];
00106 
00107 /* Defined in main program */
00108 extern const char    options[];
00109 
00110 void usage LDAP_P(( void )) LDAP_GCCATTR((noreturn));
00111 int handle_private_option LDAP_P(( int i ));
00112 
00113 /* Defined in common.c */
00114 void tool_init LDAP_P(( tool_type_t type ));
00115 void tool_common_usage LDAP_P(( void ));
00116 void tool_args LDAP_P(( int, char ** ));
00117 LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
00118 void tool_bind LDAP_P(( LDAP * ));
00119 void tool_unbind LDAP_P(( LDAP * ));
00120 void tool_destroy LDAP_P(( void ));
00121 void tool_exit LDAP_P(( LDAP *ld, int status )) LDAP_GCCATTR((noreturn));
00122 void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int ));
00123 int tool_check_abandon LDAP_P(( LDAP *ld, int msgid ));
00124 void tool_perror LDAP_P((
00125        const char *func,
00126        int err,
00127        const char *extra,
00128        const char *matched,
00129        const char *info,
00130        char **refs ));
00131 void tool_print_ctrls LDAP_P(( LDAP *ld, LDAPControl **ctrls ));
00132 int tool_write_ldif LDAP_P(( int type, char *name, char *value, ber_len_t vallen ));
00133 int tool_is_oid LDAP_P(( const char *s ));
00134 
00135 
00136 LDAP_END_DECL
00137 
00138 #endif /* _CLIENT_TOOLS_COMMON_H_ */