]> git.sur5r.net Git - openldap/blob - clients/ud/ud.h
More header work toward draft-ietf-ldapext-ldap-c-api-01.
[openldap] / clients / ud / ud.h
1 /*
2  * Copyright (c) 1991, 1992, 1993 
3  * Regents of the University of Michigan.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of Michigan at Ann Arbor. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12
13 #include "portable.h"
14
15 #if LDAP_VERSION < LDAP_VERSION3
16 /* quick fix until we have ldap_set_options */
17 #include "../libraries/libldap/ldap-int.h"
18 #endif
19
20 #ifdef DOS
21 #define MAX_VALUES      8
22 #else
23 #define MAX_VALUES      1000
24 #endif /* !DOS */
25
26 /*****************************************************************************
27  **
28  **             Limits which ud imposes.  Also subject to change.
29  **
30  *****************************************************************************/
31  
32 /*
33  *  Names are parsed somewhat like 'awk' parses them.  This is the
34  *  maximum number of components we store away.
35  *
36  *  The isnamesepartor() macro should return TRUE if x is equal to one of the
37  *  characters that delimits name fields.  The ignorechar() macro should
38  *  return TRUE if it is equal to a character that should be ignored when
39  *  parsing names.
40  */
41 #define MAX_NAME_COMPS          8
42 #define isnamesepartor(x)       (isspace(x))
43 #define isignorechar(x)         (((x) == '.') || ((x) == '_'))
44
45 /*
46  *  Quite often a search will turn up more than one match.  When it does we
47  *  print out a list of the matches, and ask the user to select the one that
48  *  s/he wants.  This defines how many we will save and show.
49  */
50 #define MAX_NUM_NAMES           128
51
52 /*
53  *  When a user displays a group, we will automatically print out this many
54  *  members and subscribers.  If the number is greater than this, we will
55  *  prompt the user before printing them.
56  */
57 #define TOO_MANY_TO_PRINT       16
58
59 /*
60  *  This is the default size of a tty if we can't figure out the actual size.
61  */
62 #define DEFAULT_TTY_HEIGHT      24
63 #define DEFAULT_TTY_WIDTH       80
64
65 /*
66  *  The number of attributes we know about must be less than this number.
67  *  Don't add lots of attributes to the list in globals.c without checking
68  *  this number too.
69  */
70 #define MAX_ATTRS       64
71
72 /*****************************************************************************
73  **
74  **             No user servicable parts beyond this point.
75  **
76  *****************************************************************************/
77
78 /*
79  *  Generic buffer sizes.
80  */
81 #define SMALL_BUF_SIZE           16
82 #define MED_BUF_SIZE            128
83 #define LARGE_BUF_SIZE          512
84
85 /*
86  *  Used to specify the operation in x_group().
87  */
88 #define G_JOIN          0
89 #define G_RESIGN        1
90
91 /*
92  *  Authentication method we will be using.
93  */
94 #ifdef HAVE_KERBEROS
95 #define UD_AUTH_METHOD          LDAP_AUTH_KRBV4
96 #else
97 #define UD_AUTH_METHOD          LDAP_AUTH_SIMPLE
98 #endif
99
100 /*
101  *  TRUE and FALSE - just in case we need them.
102  */
103 #ifndef TRUE
104 #define TRUE  1
105 #define FALSE 0
106 #endif
107
108 /*
109  *  Bound status.
110  */
111 #define UD_NOT_BOUND    0       /* bound only as the default defined above */
112 #define UD_BOUND        1       /* bound as an actual Directory entity */
113
114 /* 
115  *  Debug masks.
116  */
117 #define D_TRACE         0x0001
118 #define D_FIND          0x0002
119 #define D_GROUPS        0x0004
120 #define D_MODIFY        0x0008
121 #define D_PARSE         0x0010
122 #define D_PRINT         0x0020
123 #define D_AUTHENTICAT   0x0040
124 #define D_INITIALIZE    0x0080
125
126 /*
127  *  Used in the flags field of an attribute structure.
128  */
129 #define ATTR_FLAG_NONE          0x0000
130 #define ATTR_FLAG_PERSON        0x0001
131 #define ATTR_FLAG_GROUP         0x0002
132 #define ATTR_FLAG_PERSON_MOD    0x0010
133 #define ATTR_FLAG_GROUP_MOD     0x0020
134 #define ATTR_FLAG_MAY_EDIT      0x0040
135 #define ATTR_FLAG_SEARCH        0x0100
136 #define ATTR_FLAG_READ          0x0200
137 #define ATTR_FLAG_IS_A_DATE     0x0800
138 #define ATTR_FLAG_IS_A_DN       0x1000
139 #define ATTR_FLAG_IS_A_URL      0x2000
140 #define ATTR_FLAG_IS_A_BOOL     0x4000
141 #define ATTR_FLAG_IS_MULTILINE  0x8000
142
143 LDAP_BEGIN_DECL
144
145 /*
146  *  These are the structures we use when parsing an answer we get from the LDAP
147  *  server.
148  */
149 struct attribute {
150         char *quipu_name;
151         char *output_string;
152         void (*mod_func)();
153         unsigned short flags;
154         int number_of_values;
155         char **values;
156 };
157
158 struct entry {
159         char may_join;
160         int  subscriber_count;
161         char *DN;
162         char *name;
163         struct attribute attrs[MAX_ATTRS];
164 };
165
166 LDAP_END_DECL