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