]> jfr.im git - irc/rqf/shadowircd.git/blame - include/ircd_defs.h
[svn] - note the I/O reworking
[irc/rqf/shadowircd.git] / include / ircd_defs.h
CommitLineData
212380e3 1/*
2 * charybdis: An advanced 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-2004 ircd-ratbox development team
8 * Copyright (C) 2005-2006 Charybdis development team
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
61569b65 25 * $Id: ircd_defs.h 3225 2007-03-04 23:42:55Z jilles $
212380e3 26 */
27
28/*
29 * NOTE: NICKLEN and TOPICLEN do not live here anymore. Set it with configure
30 * Otherwise there are no user servicable part here.
31 *
32 */
33 /* ircd_defs.h - Global size definitions for record entries used
34 * througout ircd. Please think 3 times before adding anything to this
35 * file.
36 */
37#ifndef INCLUDED_ircd_defs_h
38#define INCLUDED_ircd_defs_h
39
40#include "config.h"
41
42/* For those unfamiliar with GNU format attributes, a is the 1 based
43 * argument number of the format string, and b is the 1 based argument
44 * number of the variadic ... */
45#ifdef __GNUC__
46#define AFP(a,b) __attribute__((format (printf, a, b)))
47#else
48#define AFP(a,b)
49#endif
50
51
52#include "s_log.h"
53#include "send.h"
54
55#ifdef SOFT_ASSERT
56#ifdef __GNUC__
57#define s_assert(expr) do \
58 if(!(expr)) { \
59 ilog(L_MAIN, \
60 "file: %s line: %d (%s): Assertion failed: (%s)", \
61 __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
62 sendto_realops_snomask(SNO_GENERAL, L_ALL, \
63 "file: %s line: %d (%s): Assertion failed: (%s)", \
64 __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
65 } \
66 while(0)
67#else
68#define s_assert(expr) do \
69 if(!(expr)) { \
70 ilog(L_MAIN, \
71 "file: %s line: %d: Assertion failed: (%s)", \
72 __FILE__, __LINE__, #expr); \
73 sendto_realops_snomask(SNO_GENERAL, L_ALL, \
74 "file: %s line: %d: Assertion failed: (%s)" \
75 __FILE__, __LINE__, #expr); \
76 } \
77 while(0)
78#endif
79#else
80#define s_assert(expr) assert(expr)
81#endif
82
83#if !defined(CONFIG_RATBOX_LEVEL_1)
84# error Incorrect config.h for this revision of ircd.
85#endif
86
87/*
88 * This defines the version of the data structures used in the ircd.
89 * In the event of a mismatch (i.e. this is incremented due to a major
90 * change that cannot be accomidated for in the ircd), then a hard
91 * restart occurs.
92 */
93#define CHARYBDIS_DV 0x00010200 /* 1.2.0 */
94
95#define HOSTLEN 63 /* Length of hostname. Updated to */
96 /* comply with RFC1123 */
97
98#define USERLEN 10
99#define REALLEN 50
100#define CHANNELLEN 200
101#define LOC_CHANNELLEN 50
102
103/* reason length of klines, parts, quits etc */
61569b65 104/* for quit messages, note that a client exit server notice
105 * :012345678901234567890123456789012345678901234567890123456789123 NOTICE * :*** Notice -- Client exiting: 012345678901234567 (0123456789@012345678901234567890123456789012345678901234567890123456789123) [] [1111:2222:3333:4444:5555:6666:7777:8888]
106 * takes at most 246 bytes (including CRLF and '\0') and together with the
107 * quit reason should fit in 512 */
108#define REASONLEN 260 /* kick/part/quit */
109#define BANREASONLEN 390 /* kline/dline/gline */
110#define AWAYLEN TOPICLEN
111#define KILLLEN 200 /* with Killed (nick ()) added this should fit in quit */
212380e3 112
113/* 23+1 for \0 */
114#define KEYLEN 24
115#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */
116#define MAXRECIPIENTS 20
117#define MAXBANLENGTH 1024
118#define OPERNICKLEN NICKLEN*2 /* Length of OPERNICKs. */
119
120#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5)
121#define MAX_DATE_STRING 32 /* maximum string length for a date string */
122
123#define HELPLEN 400
124
125/*
126 * message return values
127 */
128#define CLIENT_EXITED -2
129#define CLIENT_PARSE_ERROR -1
130#define CLIENT_OK 1
131
132#ifdef IPV6
133#ifndef AF_INET6
134#error "AF_INET6 not defined"
135#endif
136
137
138#else /* #ifdef IPV6 */
139
140#ifndef AF_INET6
141#define AF_INET6 AF_MAX /* Dummy AF_INET6 declaration */
142#endif
143#endif /* #ifdef IPV6 */
144
145
146#ifdef IPV6
147#define irc_sockaddr_storage sockaddr_storage
148#else
149#define irc_sockaddr_storage sockaddr
150#define ss_family sa_family
151#ifdef SOCKADDR_IN_HAS_LEN
152#define ss_len sa_len
153#endif
154#endif
155
156#ifdef IPV6
157#define PATRICIA_BITS 128
158#else
159#define PATRICIA_BITS 32
160#endif
161
162#ifdef SOCKADDR_IN_HAS_LEN
163#define SET_SS_LEN(x, y) (x).ss_len = (y)
164#define GET_SS_LEN(x) x.ss_len
165#else
166#define SET_SS_LEN(x, y)
167#ifdef IPV6
168#define GET_SS_LEN(x) x.ss_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)
169#else
170#define GET_SS_LEN(x) sizeof(struct sockaddr_in)
171#endif
172#endif
173
174
175#endif /* INCLUDED_ircd_defs_h */