Back to index

openldap  2.4.31
shellutil.h
Go to the documentation of this file.
00001 /* shellutil.h */
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 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
00017  * All rights reserved.
00018  *
00019  * Redistribution and use in source and binary forms are permitted
00020  * provided that this notice is preserved and that due credit is given
00021  * to the University of Michigan at Ann Arbor. The name of the University
00022  * may not be used to endorse or promote products derived from this
00023  * software without specific prior written permission. This software
00024  * is provided ``as is'' without express or implied warranty.
00025  */
00026 /* ACKNOWLEDGEMENTS:
00027  * This work was originally developed by the University of Michigan
00028  * (as part of U-MICH LDAP).
00029  */
00030 
00031 #ifndef SHELLUTIL_H
00032 #define SHELLUTIL_H
00033 
00034 #include <ldap_cdefs.h>
00035 
00036 LDAP_BEGIN_DECL
00037 
00038 #define MAXLINELEN   512
00039 
00040 #define STR_OP_SEARCH       "SEARCH"
00041 
00042 
00043 struct inputparams {
00044     int              ip_type;
00045 #define IP_TYPE_SUFFIX             0x01
00046 #define IP_TYPE_BASE        0x02
00047 #define IP_TYPE_SCOPE              0x03
00048 #define IP_TYPE_ALIASDEREF  0x04
00049 #define IP_TYPE_SIZELIMIT   0x05
00050 #define IP_TYPE_TIMELIMIT   0x06
00051 #define IP_TYPE_FILTER             0x07
00052 #define IP_TYPE_ATTRSONLY   0x08
00053 #define IP_TYPE_ATTRS              0x09
00054     char      *ip_tag;
00055 };
00056 
00057 
00058 struct ldsrchparms {
00059     int              ldsp_scope;
00060     int              ldsp_aliasderef;
00061     int              ldsp_sizelimit;
00062     int              ldsp_timelimit;
00063     int              ldsp_attrsonly;
00064     char      *ldsp_filter;
00065     char      **ldsp_attrs;
00066 };
00067 
00068 
00069 struct ldop { 
00070     int              ldop_op;
00071 #define LDOP_SEARCH  0x01
00072     char      **ldop_suffixes;
00073     char      *ldop_dn;
00074     union ldapop_params_u {
00075                   struct ldsrchparms LDsrchparams;
00076          }    ldop_params;
00077 #define ldop_srch    ldop_params.LDsrchparams
00078 };
00079 
00080 
00081 struct ldattr {
00082     char      *lda_name;
00083     char      **lda_values;
00084 };
00085 
00086 
00087 struct ldentry {
00088     char             *lde_dn;
00089     struct ldattr    **lde_attrs;
00090 };
00091 
00092 
00093 #ifdef LDAP_DEBUG
00094 void   debug_printf(const char *, ...) LDAP_GCCATTR((format(printf, 1, 2)));
00095 #else /* LDAP_DEBUG */
00096 #define       debug_printf  (void) /* Ignore "arguments" */
00097 #endif /* LDAP_DEBUG */
00098 
00099 /*
00100  * function prototypes
00101  */
00102 void write_result( FILE *fp, int code, char *matched, char *info );
00103 void write_entry( struct ldop *op, struct ldentry *entry, FILE *ofp );
00104 int test_filter( struct ldop *op, struct ldentry *entry );
00105 void free_entry( struct ldentry *entry );
00106 int attr_requested( char *name, struct ldop *op );
00107 int parse_input( FILE *ifp, FILE *ofp, struct ldop *op );
00108 struct inputparams *find_input_tag( char **linep );
00109 void add_strval( char ***sp, char *val );
00110 char *ecalloc( unsigned nelem, unsigned elsize );
00111 void *erealloc( void *s, unsigned size );
00112 char *estrdup( char *s );
00113 extern void dump_ldop (struct ldop *op);
00114 
00115 
00116 /*
00117  * global variables
00118  */
00119 extern int    debugflg;
00120 extern char   *progname;
00121 
00122 LDAP_END_DECL
00123 #endif