]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/defines.h
defines.h: Code cleanup and (a little bit) more documentation
[ngircd-alex.git] / src / ngircd / defines.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  */
11
12 #ifndef __defines_h__
13 #define __defines_h__
14
15 /**
16  * @file
17  * Global constants ("#defines") used by the ngIRCd.
18  */
19
20
21 /* Internal flags */
22
23 /** Flag: there is no connection. */
24 #define NONE -1
25
26 /** Flag: connection is (still) established. */
27 #define CONNECTED true
28
29 /** Flag: connection isn't established (any more). */
30 #define DISCONNECTED false
31
32 /** Tag for outbound server links. */
33 #define TOKEN_OUTBOUND -2
34
35
36 /* Generic buffer sizes */
37
38 /** Max. length of a line in the configuration file. */
39 #define LINE_LEN 256
40
41 /** Max. length of a log message. */
42 #define MAX_LOG_MSG_LEN 256
43
44 /** Max. length of file name. */
45 #define FNAME_LEN 256
46
47 /** Max. lenght of fully qualified host names (e. g. "abc.domain.tld"). */
48 #define HOST_LEN 256
49
50
51 /* Size of structures */
52
53 /** Max. count of configurable servers. */
54 #define MAX_SERVERS 16
55
56 /** Max. number of WHOWAS list items that can be stored. */
57 #define MAX_WHOWAS 64
58
59 /** Size of default connection pool. */
60 #define CONNECTION_POOL 100
61
62
63 /* Hard-coded (default) options */
64
65 /** Delay after startup before outgoing connections are initiated in seconds. */
66 #define STARTUP_DELAY 1
67
68 /** Time to delay re-connect attempts in seconds. */
69 #define RECONNECT_DELAY 3
70
71 /** Configuration file name. */
72 #define CONFIG_FILE "/ngircd.conf"
73
74 /** Name of the MOTD file. */
75 #define MOTD_FILE "/ngircd.motd"
76
77 /** Default chroot() directory. */
78 #define CHROOT_DIR ""
79
80 /** Default file for the process ID. */
81 #define PID_FILE ""
82
83
84 /* Sizes of "IRC elements": nicks, users, ... */
85
86 /** Max. length of an IRC ID (incl. NULL); see RFC 2812 section 1.1 and 1.2.1. */
87 #define CLIENT_ID_LEN 64
88
89 /** Default nick length (including NULL), see. RFC 2812 section 1.2.1. */
90 #define CLIENT_NICK_LEN_DEFAULT 10
91
92 /** Maximum nick name length (including NULL). */
93 #define CLIENT_NICK_LEN 32
94
95 /** Max. password length (including NULL). */
96 #define CLIENT_PASS_LEN 21
97
98 /** Max. length of user name ("login"; incl. NULL), RFC 2812, section 1.2.1. */
99 #define CLIENT_USER_LEN 10
100
101 /** Max. length of "real names" (including NULL). */
102 #define CLIENT_NAME_LEN 32
103
104 /** Max. host name length (including NULL). */
105 #define CLIENT_HOST_LEN 64
106
107 /** Max. length of all client modes (including NULL). */
108 #define CLIENT_MODE_LEN 16
109
110 /** Max. length of server info texts (including NULL). */
111 #define CLIENT_INFO_LEN 64
112
113 /** Max. length of away messages (including NULL). */
114 #define CLIENT_AWAY_LEN 128
115
116 /** Max. length of client flags (including NULL). */
117 #define CLIENT_FLAGS_LEN 16
118
119 /** Max. length of a channel name (including NULL), see RFC 2812 section 1.3. */
120 #define CHANNEL_NAME_LEN 51
121
122 /** Max. length of channel modes (including NULL). */
123 #define CHANNEL_MODE_LEN 9
124
125 /** Max. IRC command length (including NULL), see. RFC 2812 section 3.2. */
126 #define COMMAND_LEN 513
127
128
129 /* Read and write buffer sizes */
130
131 /** Size of the read buffer of a connection in bytes. */
132 #define READBUFFER_LEN 2048
133
134 /** Size that triggers write buffer flushing if more space is needed. */
135 #define WRITEBUFFER_FLUSH_LEN 4096
136
137 /** Maximum size of the write buffer of a connection in bytes. */
138 #define WRITEBUFFER_MAX_LEN 32768
139
140 /** Maximum size of the write buffer of a server link connection in bytes. */
141 #define WRITEBUFFER_SLINK_LEN 65536
142
143
144 /* IRC/IRC+ protocol */
145
146 /** Implemented IRC protocol version, see RFC 2813 section 4.1.1. */
147 #define PROTOVER "0210"
148
149 /** Protocol suffix, see RFC 2813 section 4.1.1. */
150 #define PROTOIRC "-IRC"
151
152 /** Protocol suffix used by the IRC+ protocol, see <doc/Protocol.txt>. */
153 #define PROTOIRCPLUS "-IRC+"
154
155 #ifdef IRCPLUS
156 /** Standard IRC+ flags. */
157 # define IRCPLUSFLAGS "CHLS"
158 #endif
159
160 /** Supported user modes. */
161 #define USERMODES "aciorRswx"
162
163 /** Supported channel modes. */
164 #define CHANMODES "biIklmnoOPRstvz"
165
166 /** Away message for users connected to linked servers. */
167 #define DEFAULT_AWAY_MSG "Away"
168
169 /** Default ID for "topic owner". */
170 #define DEFAULT_TOPIC_ID "-Server-"
171
172 /** Prefix for NOTICEs from the server to users. Some servers use '*'. */
173 #define NOTICE_TXTPREFIX ""
174
175 /** Suffix for oversized messages that have been shortened and cut off. */
176 #define CUT_TXTSUFFIX "[CUT]"
177
178
179 /* Defaults and limits for IRC commands */
180
181 /** Default count of WHOWAS command replies */
182 #define DEFAULT_WHOWAS 5
183
184 /** Max. number of channel modes with arguments per MODE command */
185 #define MAX_CMODES_ARG 5
186
187
188 #endif
189
190 /* -eof- */