]> git.sur5r.net Git - openldap/blob - servers/slapd/shell-backends/shellutil.h
Yet another round of SLAPD_SCHEMA_NOT_COMPAT changes...
[openldap] / servers / slapd / shell-backends / shellutil.h
1 /* $OpenLDAP$ */
2 /*
3  shellutil.h
4
5  Copyright (c) 1995 Regents of the University of Michigan.
6  All rights reserved.
7
8  Redistribution and use in source and binary forms are permitted
9  provided that this notice is preserved and that due credit is given
10  to the University of Michigan at Ann Arbor. The name of the University
11  may not be used to endorse or promote products derived from this
12  software without specific prior written permission. This software
13  is provided ``as is'' without express or implied warranty.
14 */
15
16 #ifndef SHELLUTIL_H
17 #define SHELLUTIL_H
18
19 #include <ldap_cdefs.h>
20
21 LDAP_BEGIN_DECL
22
23 #define MAXLINELEN      512
24
25 #define STR_OP_SEARCH   "SEARCH"
26
27
28 struct inputparams {
29     int         ip_type;
30 #define IP_TYPE_SUFFIX          0x01
31 #define IP_TYPE_BASE            0x02
32 #define IP_TYPE_SCOPE           0x03
33 #define IP_TYPE_ALIASDEREF      0x04
34 #define IP_TYPE_SIZELIMIT       0x05
35 #define IP_TYPE_TIMELIMIT       0x06
36 #define IP_TYPE_FILTER          0x07
37 #define IP_TYPE_ATTRSONLY       0x08
38 #define IP_TYPE_ATTRS           0x09
39     char        *ip_tag;
40 };
41
42
43 struct ldsrchparms {
44     int         ldsp_scope;
45     int         ldsp_aliasderef;
46     int         ldsp_sizelimit;
47     int         ldsp_timelimit;
48     int         ldsp_attrsonly;
49     char        *ldsp_filter;
50     char        **ldsp_attrs;
51 };
52
53
54 struct ldop { 
55     int         ldop_op;
56 #define LDOP_SEARCH     0x01
57     char        **ldop_suffixes;
58     char        *ldop_dn;
59     union ldapop_params_u {
60                     struct ldsrchparms LDsrchparams;
61           }     ldop_params;
62 #define ldop_srch       ldop_params.LDsrchparams
63 };
64
65
66 struct ldattr {
67     char        *lda_name;
68     char        **lda_values;
69 };
70
71
72 struct ldentry {
73     char                *lde_dn;
74     struct ldattr       **lde_attrs;
75 };
76
77
78 #ifdef LDAP_DEBUG
79 void    debug_printf(const char *, ...) LDAP_GCCATTR((format(printf, 1, 2)));
80 #else /* LDAP_DEBUG */
81 #define debug_printf    (void) /* Ignore "arguments" */
82 #endif /* LDAP_DEBUG */
83
84 /*
85  * function prototypes
86  */
87 void write_result( FILE *fp, int code, char *matched, char *info );
88 void write_entry( struct ldop *op, struct ldentry *entry, FILE *ofp );
89 int test_filter( struct ldop *op, struct ldentry *entry );
90 void free_entry( struct ldentry *entry );
91 int attr_requested( char *name, struct ldop *op );
92 int parse_input( FILE *ifp, FILE *ofp, struct ldop *op );
93 struct inputparams *find_input_tag( char **linep );
94 void add_strval( char ***sp, char *val );
95 char *ecalloc( unsigned nelem, unsigned elsize );
96 void *erealloc( void *s, unsigned size );
97 char *estrdup( char *s );
98 extern void dump_ldop (struct ldop *op);
99
100
101 /*
102  * global variables
103  */
104 extern int      debugflg;
105 extern char     *progname;
106
107 LDAP_END_DECL
108 #endif