ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hybrid-ircservices-1/defs.h
Revision: 1209
Committed: Thu Aug 25 19:05:49 2011 UTC (14 years, 11 months ago) by michael
Content type: text/x-chdr
File size: 8560 byte(s)
Log Message:
- run everything thru indent
  "-bli0 -di1 -npcs -nut -cdw -bls -nbbo -bap"

File Contents

# Content
1 /* Basic constants, macros and prototypes.
2 *
3 * IRC Services is copyright (c) 1996-2009 Andrew Church.
4 * E-mail: <achurch@achurch.org>
5 * Parts written by Andrew Kempe and others.
6 * This program is free but copyrighted software; see the file GPL.txt for
7 * details.
8 */
9
10 #ifndef DEFS_H
11 #define DEFS_H
12
13 /*************************************************************************/
14 /****************** START OF USER-CONFIGURABLE SECTION *******************/
15 /*************************************************************************/
16
17 /******* General configuration *******/
18
19 /* Name of configuration file (in Services directory) */
20 #define IRCSERVICES_CONF PROGRAM ".conf"
21
22 /* Name of module configuration file (in Services directory) */
23 #define MODULES_CONF "modules.conf"
24
25 /* Maximum number of parameters for a configuration directive */
26 #define CONFIG_MAXPARAMS 8
27
28 /* Maximum number of channels to buffer modes for (for MergeChannelModes) */
29 #define MERGE_CHANMODES_MAX 3
30
31
32 /******* NickServ configuration *******/
33
34 /* Default language for newly registered nicks; see language.h for
35 * available languages (LANG_* constants). Unless you're running a
36 * regional network, you should probably leave this at LANG_EN_US. */
37 #define DEF_LANGUAGE LANG_EN_US
38
39
40 /******* OperServ configuration *******/
41
42 /* Define this to enable OperServ's debugging commands (Services root
43 * only). These commands are undocumented; "use the source, Luke!" */
44 /* #define DEBUG_COMMANDS */
45
46
47 /*************************************************************************/
48 /******************* END OF USER-CONFIGURABLE SECTION ********************/
49 /*************************************************************************/
50
51
52 /* Various buffer sizes */
53
54 /* Size of input buffer (note: this is different from BUFSIZ)
55 * This MUST be big enough to hold at least one full IRC message, or Bad
56 * Things will happen. */
57 #define BUFSIZE 1024
58
59 /* Maximum length of a configuration file line */
60 #define CONFIG_LINEMAX 4096
61
62 /* Size of memory-based log buffer (only used with SHOWALLOCS) */
63 #define LOGMEMSIZE 65536
64
65 /*************************************************************************/
66
67 /*
68 * The following constants define the sizes of channel name, nickname, and
69 * password buffers used in Services. These should only be adjusted if
70 * your IRC network allows longer nicknames or channel names _and_ you wish
71 * to allow such names to be used with Services. If your IRC network has
72 * smaller limits, you do not need to change these values; Services will
73 * still work fine, albeit with a tiny amount of wasted memory for each
74 * nickname and channel.
75 *
76 * WARNING: If you change these, you MUST back up your data to an XML file
77 * before making the change, and re-import the data afterwards. Database
78 * files created with different calues of CHANMAX/NICKMAX/PASSMAX are not
79 * compatible!
80 */
81
82 /* Maximum length of a channel name, including the trailing null. Any
83 * channels with a length longer than CHANMAX-1 (including the leading #)
84 * will not be usable with ChanServ. */
85 #define CHANMAX 64
86
87 /* Maximum length of a nickname, including the trailing null. This MUST be
88 * at least one greater than the maximum allowable nickname length on your
89 * network, or people will run into problems using Services! The default
90 * (32) should work for all current servers. */
91 #define NICKMAX 32
92
93 /* Maximum length of an unencrypted password, including the trailing null. */
94 #define PASSMAX 32
95
96 /*************************************************************************/
97
98 /* For convert-db, we redefine the above values to be large enough for all
99 * potential strings. Do not modify these or convert-db will explode in
100 * your face, painfully. */
101
102 #ifdef CONVERT_DB
103 # undef NICKMAX
104 # undef CHANMAX
105 # undef PASSMAX
106 # define NICKMAX 256
107 # define CHANMAX 512
108 # define PASSMAX 256
109 #endif
110
111 /*************************************************************************/
112 /*************************************************************************/
113
114 /* ---- There should be no need to modify anything below this line. ---- */
115
116 /*************************************************************************/
117 /*************************************************************************/
118
119 /* Common includes/prototypes. */
120
121
122 /* glibc seems to require this for the prototype of strsignal(). */
123 #define _GNU_SOURCE
124
125 /* Some AIX boxes define int16 and int32 on their own. Blarph. */
126 #if INTTYPE_WORKAROUND
127 # define int16 builtin_int16
128 # define int32 builtin_int32
129 #endif
130
131
132 /* We have our own encrypt(). */
133 #define encrypt encrypt_
134
135 #include <stdarg.h>
136 #include <stddef.h>
137 #include <stdio.h>
138 #include <stdlib.h>
139 #undef DEFS_H /* kludge to work around Cygwin string.h kludge to work
140 * around problem compiling in gdb... this is stupid */
141 #include <string.h>
142 #define DEFS_H
143 #include <unistd.h>
144 #include <signal.h>
145 #include <time.h>
146 #include <ctype.h>
147 #include <errno.h>
148 #include <limits.h>
149 #include <math.h>
150 #include <sys/types.h>
151 #include <sys/time.h>
152
153 #undef encrypt
154
155 #if HAVE_STDINT_H
156 # include <stdint.h>
157 #endif
158
159 #if HAVE_STRINGS_H
160 # include <strings.h>
161 #endif
162
163 #if HAVE_SYS_SELECT_H
164 /* FreeBSD (4.4-STABLE) defines LIST_REMOVE and LIST_FOREACH in
165 * <sys/queue.h>, which is included by <sys/select.h>, so make sure we
166 * include it here before list-array.h defines our own versions of those. */
167 # include <sys/select.h>
168 #endif
169
170 #ifdef _AIX
171 /* Some AIX boxes seem to have bogus includes that don't have these
172 * prototypes. */
173 extern int strcasecmp(const char *, const char *);
174 extern int strncasecmp(const char *, const char *, size_t);
175 # if 0 /* These break on some AIX boxes (4.3.1 reported). */
176 extern int gettimeofday(struct timeval *, struct timezone *);
177 extern int socket(int, int, int);
178 extern int bind(int, struct sockaddr *, int);
179 extern int connect(int, struct sockaddr *, int);
180 extern int shutdown(int, int);
181 # endif
182 # undef FD_ZERO
183 # define FD_ZERO(p) memset((p), 0, sizeof(*(p)))
184 #endif /* _AIX */
185
186 /* Alias stricmp/strnicmp to strcasecmp/strncasecmp if we have the latter
187 * but not the former. */
188 #if !HAVE_STRICMP && HAVE_STRCASECMP
189 # define stricmp strcasecmp
190 # define strnicmp strncasecmp
191 #endif
192
193 /* socklen_t for systems without it. */
194 #if !HAVE_SOCKLEN_T
195 typedef int socklen_t;
196 #endif
197
198
199 #if INTTYPE_WORKAROUND
200 # undef int16
201 # undef int32
202 #endif
203
204 /*************************************************************************/
205
206 /* System/compiler sanity checks. */
207
208
209 /* Filename and pathname maximum lengths: (these are usually defined in
210 * limits.h, but check just in case) */
211 #ifndef NAME_MAX
212 # define NAME_MAX 255
213 #endif
214 #ifndef PATH_MAX
215 # define PATH_MAX 1023
216 #endif
217
218 /* Number of signals available: */
219 #ifndef NSIG
220 # define NSIG 32
221 #endif
222
223 /*************************************************************************/
224
225 /* Various generally useful macros. */
226
227
228 /* Make sizeof() return an int regardless of compiler (avoids printf
229 * argument type warnings). */
230 #define sizeof(v) ((int)sizeof(v))
231
232 /* Length of an array: */
233 #define lenof(a) (sizeof(a) / sizeof(*(a)))
234
235 /* Sign of a number: (-1, 0, or 1) */
236 #define sgn(n) ((n)<0 ? -1 : ((n)>0))
237
238 /* Telling compilers about printf()-like functions: */
239 #ifdef __GNUC__
240 # define FORMAT(type,fmt,start) __attribute__((format(type,fmt,start)))
241 #else
242 # define FORMAT(type,fmt,start)
243 #endif
244
245 /* Macros to define a function pointer (E_FUNCPTR declares it extern).
246 * This is needed because GCC doesn't seem to like defining a pointer to a
247 * function with __attribute__s in a single statement. */
248 #ifdef __GNUC__
249 # define FUNCPTR(type,name,rest) \
250 type _##name##_t rest; \
251 typeof(_##name##_t) *name
252 # define E_FUNCPTR(type,name,rest) \
253 type _##name##_t rest; \
254 extern typeof(_##name##_t) *name
255 #else
256 # define FUNCPTR(type,name,rest) type (*name) rest
257 # define E_FUNCPTR(type,name,rest) extern type (*name) rest
258 #endif
259
260 /*************************************************************************/
261
262 /* Generic "invalid" pointer value. For use when an "invalid" value is
263 * needed and NULL cannot be used. */
264
265 #define PTR_INVALID ((const char *)-1)
266
267 /*************************************************************************/
268
269 #endif /* DEFS_H */
270
271 /*
272 * Local variables:
273 * c-file-style: "stroustrup"
274 * c-file-offsets: ((case-label . *) (statement-case-intro . *))
275 * indent-tabs-mode: nil
276 * End:
277 *
278 * vim: expandtab shiftwidth=4:
279 */