1 /*
2  *  ircd-ratbox: A slightly useful ircd.
3  *  ircd_defs.h: A header for ircd global definitions.
4  *
5  *  Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6  *  Copyright (C) 1996-2002 Hybrid Development Team
7  *  Copyright (C) 2002-2005 ircd-ratbox development team
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
22  *  USA
23  *
24  *  $Id: ircd_defs.h 26006 2008-09-04 21:39:48Z androsyn $
25  */
26 
27 /*
28  * NOTE: NICKLEN and TOPICLEN do not live here anymore. Set it with configure
29  * Otherwise there are no user servicable part here.
30  *
31  */
32  /* ircd_defs.h - Global size definitions for record entries used
33   * througout ircd. Please think 3 times before adding anything to this
34   * file.
35   */
36 #ifndef INCLUDED_ircd_defs_h
37 #define INCLUDED_ircd_defs_h
38 
39 /* For those unfamiliar with GNU format attributes, a is the 1 based
40  * argument number of the format string, and b is the 1 based argument
41  * number of the variadic ... */
42 #ifdef __GNUC__
43 #define AFP(a,b) __attribute__((format (printf, a, b)))
44 #else
45 #define AFP(a,b)
46 #endif
47 
48 
49 #ifdef __GNUC__
50 #define ss_assert(expr)	do								\
51 			if(!(expr)) {							\
52 				ilog(L_MAIN, 						\
53 				"file: %s line: %d (%s): Assertion failed: (%s)",	\
54 				__FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); 	\
55 				sendto_realops_flags(UMODE_ALL, L_ALL, 			\
56 				"file: %s line: %d (%s): Assertion failed: (%s)",	\
57 				__FILE__, __LINE__, __PRETTY_FUNCTION__, #expr);	\
58 			}								\
59 			while(0)
60 #else
61 #define ss_assert(expr)	do								\
62 			if(!(expr)) {							\
63 				ilog(L_MAIN, 						\
64 				"file: %s line: %d: Assertion failed: (%s)",		\
65 				__FILE__, __LINE__, #expr); 				\
66 				sendto_realops_flags(UMODE_ALL, L_ALL,			\
67 				"file: %s line: %d: Assertion failed: (%s)"		\
68 				__FILE__, __LINE__, #expr);				\
69 			}								\
70 			while(0)
71 #endif
72 
73 #ifdef SOFT_ASSERT
74 #define s_assert(expr) ss_assert(expr)
75 #else
76 #define s_assert(expr)	do { ss_assert(expr); assert(expr); } while(0)
77 #endif
78 
79 #if !defined(CONFIG_RATBOX_LEVEL_3)
80 #  error Incorrect config.h for this revision of ircd.
81 #endif
82 
83 #define HOSTLEN         63	/* Length of hostname.  Updated to         */
84 				/* comply with RFC1123                     */
85 
86 #define USERLEN         10
87 #define REALLEN         50
88 #define KILLLEN         90
89 #define CHANNELLEN      200
90 #define LOC_CHANNELLEN	50
91 #define IDLEN		10
92 
93 /* always v6 sized, as we can have a v6 sockhost for a remote client */
94 #define HOSTIPLEN	53	/* sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255.ipv6") */
95 
96 /* reason length of klines, parts, quits etc */
97 #define REASONLEN	120
98 
99 #define AWAYLEN		90
100 
101 /* 23+1 for \0 */
102 #define KEYLEN          24
103 #define BUFSIZE         512	/* WARNING: *DONT* CHANGE THIS!!!! */
104 #define MAXRECIPIENTS   20
105 #define MAXBANLENGTH    1024
106 #define OPERNICKLEN     NICKLEN*2	/* Length of OPERNICKs. */
107 
108 #define USERHOST_REPLYLEN       (NICKLEN+HOSTLEN+USERLEN+5)
109 #define MAX_DATE_STRING 32	/* maximum string length for a date string */
110 
111 #define HELPLEN         400
112 #define DEFAULT_TOPICLEN	160	/* Default topiclen */
113 #define MAX_TOPICLEN		390	/* Max topiclen */
114 /*
115  * message return values
116  */
117 #define CLIENT_EXITED    -2
118 #define CLIENT_PARSE_ERROR -1
119 #define CLIENT_OK	1
120 
121 #ifdef RB_IPV6
122 #define PATRICIA_BITS	128
123 #else
124 #define PATRICIA_BITS	32
125 #endif
126 
127 
128 
129 #endif /* INCLUDED_ircd_defs_h */
130