Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / openldap / dist / servers / slapd / shell-backends / shellutil.h
blobe07b6152168601062573974c9ff6761ebce0cf8c
1 /* shellutil.h */
2 /* $OpenLDAP: pkg/ldap/servers/slapd/shell-backends/shellutil.h,v 1.11.2.3 2008/02/11 23:26:49 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2008 The OpenLDAP Foundation.
6 * All rights reserved.
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.
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>.
16 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
17 * All rights reserved.
19 * Redistribution and use in source and binary forms are permitted
20 * provided that this notice is preserved and that due credit is given
21 * to the University of Michigan at Ann Arbor. The name of the University
22 * may not be used to endorse or promote products derived from this
23 * software without specific prior written permission. This software
24 * is provided ``as is'' without express or implied warranty.
26 /* ACKNOWLEDGEMENTS:
27 * This work was originally developed by the University of Michigan
28 * (as part of U-MICH LDAP).
31 #ifndef SHELLUTIL_H
32 #define SHELLUTIL_H
34 #include <ldap_cdefs.h>
36 LDAP_BEGIN_DECL
38 #define MAXLINELEN 512
40 #define STR_OP_SEARCH "SEARCH"
43 struct inputparams {
44 int ip_type;
45 #define IP_TYPE_SUFFIX 0x01
46 #define IP_TYPE_BASE 0x02
47 #define IP_TYPE_SCOPE 0x03
48 #define IP_TYPE_ALIASDEREF 0x04
49 #define IP_TYPE_SIZELIMIT 0x05
50 #define IP_TYPE_TIMELIMIT 0x06
51 #define IP_TYPE_FILTER 0x07
52 #define IP_TYPE_ATTRSONLY 0x08
53 #define IP_TYPE_ATTRS 0x09
54 char *ip_tag;
58 struct ldsrchparms {
59 int ldsp_scope;
60 int ldsp_aliasderef;
61 int ldsp_sizelimit;
62 int ldsp_timelimit;
63 int ldsp_attrsonly;
64 char *ldsp_filter;
65 char **ldsp_attrs;
69 struct ldop {
70 int ldop_op;
71 #define LDOP_SEARCH 0x01
72 char **ldop_suffixes;
73 char *ldop_dn;
74 union ldapop_params_u {
75 struct ldsrchparms LDsrchparams;
76 } ldop_params;
77 #define ldop_srch ldop_params.LDsrchparams
81 struct ldattr {
82 char *lda_name;
83 char **lda_values;
87 struct ldentry {
88 char *lde_dn;
89 struct ldattr **lde_attrs;
93 #ifdef LDAP_DEBUG
94 void debug_printf(const char *, ...) LDAP_GCCATTR((format(printf, 1, 2)));
95 #else /* LDAP_DEBUG */
96 #define debug_printf (void) /* Ignore "arguments" */
97 #endif /* LDAP_DEBUG */
100 * function prototypes
102 void write_result( FILE *fp, int code, char *matched, char *info );
103 void write_entry( struct ldop *op, struct ldentry *entry, FILE *ofp );
104 int test_filter( struct ldop *op, struct ldentry *entry );
105 void free_entry( struct ldentry *entry );
106 int attr_requested( char *name, struct ldop *op );
107 int parse_input( FILE *ifp, FILE *ofp, struct ldop *op );
108 struct inputparams *find_input_tag( char **linep );
109 void add_strval( char ***sp, char *val );
110 char *ecalloc( unsigned nelem, unsigned elsize );
111 void *erealloc( void *s, unsigned size );
112 char *estrdup( char *s );
113 extern void dump_ldop (struct ldop *op);
117 * global variables
119 extern int debugflg;
120 extern char *progname;
122 LDAP_END_DECL
123 #endif