]> git.sur5r.net Git - openldap/blob - contrib/whois++/whois++.h
SLAPD_SCHEMA_NOT_COMPAT: ACL cleanup (not yet working)
[openldap] / contrib / whois++ / whois++.h
1 /*
2  *                      W H O I S + +
3  *
4  * Author:      Mark R. Prior
5  *              Communications and Systems Branch
6  *              Information Technology Division
7  *              The University of Adelaide
8  * E-mail:      mrp@itd.adelaide.edu.au
9  * Date:        October 1992
10  * Copyright:   (C) 1992, The University of Adelaide
11  * Version:     1.7
12  * Description:
13  *      This is an experimental implementation of the proposed IETF
14  *      WNILS WG update to the whois/nicname protocol (whois++).
15  *
16  * Redistribution and use in source and binary forms are permitted
17  * provided that the above copyright notice and this paragraph are
18  * duplicated in all such forms and that any documentation,
19  * advertising materials, and other materials related to such
20  * distribution and use acknowledge that the software was developed
21  * by the University of Adelaide. The name of the University may not
22  * be used to endorse or promote products derived from this software
23  * without specific prior written permission.
24  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
25  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
26  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27  */
28
29 #include <stdio.h>
30 #include <string.h>
31 #include <ctype.h>
32 #include <errno.h>
33 #include <dirent.h>
34 #if defined(INTERNATIONAL)
35 #include <langinfo.h>
36 #include <locale.h>
37 #include <nl_types.h>
38 #endif
39 #include <sys/types.h>
40 #include <sys/param.h>
41 #include <sys/time.h>
42 #include <netinet/in.h>
43 #include "syslog.h"
44 #include <ldap.h>
45
46 #define EQ(x,y)         (strcasecmp(x,y) == 0)
47
48 #if defined(sun)
49 extern  int     sys_nerr;
50 extern  char    *sys_errlist[];
51 #define strerror(_e)    ( ( ( (_e) >= 0 ) && ( (_e) < sys_nerr ) ) ? \
52                 sys_errlist[(_e)] : "Undocumented error code" )
53 #endif
54
55 #if !defined(TRUE)
56 #define TRUE                    1
57 #define FALSE                   0
58 #endif
59
60 #if defined(MAIN)
61 #define EXTERN
62 #else
63 #define EXTERN                  extern
64 #endif
65
66 #if !defined(ABRIDGED_LIMIT)
67 #define ABRIDGED_LIMIT          10
68 #endif
69 #if !defined(DEFAULT_LDAPHOST)
70 #define DEFAULT_LDAPHOST        "localhost"
71 #endif
72 #if !defined(DEFAULT_SIZELIMIT)
73 #define DEFAULT_SIZELIMIT       50
74 #endif
75 #if !defined(DEFAULT_TIMELIMIT)
76 #define DEFAULT_TIMELIMIT       60
77 #endif
78 #if !defined(HELP_DIRECTORY)
79 #define HELP_DIRECTORY          "/usr/local/isode/help/whois++"
80 #endif
81 #if !defined(CONFIG_DIRECTORY)
82 #define CONFIG_DIRECTORY        "/usr/local/isode/etc/whois++"
83 #endif
84 #if !defined(DEFAULT_LANGUAGE)
85 #define DEFAULT_LANGUAGE        "english"
86 #endif
87
88 #define ATTRIBUTE_INCREMENT     10
89 #define TABLE_INCREMENT         10
90 #define DEFAULT_LINE_LENGTH     80
91 #define MIN_LINE_LENGTH         40
92 #define MAX_LINE_LENGTH         200
93
94 /*
95  * Tokens
96  */
97 #define HELP            1
98 #define LIST            2
99 #define DESCRIBE        3
100 #define VERSION         4
101 #define SHOW            5
102 #define CONSTRAINTS     6
103 #define SEARCH          7
104 #define TEMPLATE        8
105 #define HANDLE          9
106 #define ATTRIBUTE       10
107 #define VALUE           11
108 #define SEARCH_ALL      12
109 #define COMMA           13
110 #define ERROR           14
111 #define EQUALS          15
112 #define COLON           16
113 #define SEMICOLON       17
114 #define FULL            18
115 #define ABRIDGED        19
116 #define SUMMARY         20
117 #define READ            21
118 #define LANGUAGE        22
119 #define FORMAT          23
120 #define HOLD            24
121 #define MAXHITS         25
122 #define MATCH           26
123 #define LINE_LENGTH     27
124 #define COMMAND         28
125 #define TRACE           29
126
127 typedef struct {
128         char    *key;
129         char    *value;
130         } table;
131
132 EXTERN int              debug, outputFormat, lineLength, holdConnection, log;
133 EXTERN int              maxHits, numberOfTemplates, tableSize, maximumSize;
134 EXTERN char             *program, *ldaphost, *language, *locale, *base;
135 EXTERN char             *contact, *hostname, *user, *password, *helpDir;
136 EXTERN char             *configDir, *organisation, *defaultLanguage;
137 EXTERN char             *banner;
138 EXTERN char             **category;
139 EXTERN table            *templateTranslationTable;
140
141 extern int              displayDescribe(), parseCommand(char *query);
142 extern void             needHelp(char *reason);
143 extern void             showTemplate(char *template), listTemplates(char *query);
144 extern char             **specifyAttributes(char *objectClass);
145 extern char             *lowerCase(char *string), *version(void), *attributeLabel();
146 extern char             *rfc931_name();
147 extern char             *templateToObjectClass(char *template);