7372cd162d024b76324182b4bff915fec11a4aa7
[NeonServV5.git] / src / main.h
1 /* main.h - NeonServ v5.1
2  * Copyright (C) 2011  Philipp Kreil (pk910)
3  * 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License 
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
16  */
17 #ifndef _main_h
18 #define _main_h
19
20 #define NEONSERV_VERSION "5.1.0"
21
22 #ifndef BOTWAR_ALERT_CHAN
23 #define BOTWAR_ALERT_CHAN NULL
24 #endif
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include <ctype.h>
30 #ifdef WIN32
31 #include <windows.h>
32 #include <winsock2.h>
33 #else
34 #include <sys/types.h>
35 #include <sys/socket.h>
36 #include <netinet/in.h>
37 #include <arpa/inet.h>
38 #include <netdb.h>
39 #endif
40 #include <unistd.h>
41 #include <stdarg.h>
42 #include <time.h>
43
44 #if __GNUC__
45 #define PRINTF_LIKE(M,N) __attribute__((format (printf, M, N)))
46 #else
47 #define PRINTF_LIKE(M,N)
48 #endif
49
50 #if __GNUC__ >= 2
51 #define UNUSED_ARG(ARG) ARG __attribute__((unused))
52 #elif defined(S_SPLINT_S)
53 #define UNUSED_ARG(ARG) /*@unused@*/ ARG
54 #define const /*@observer@*/ /*@temp@*/
55 #else
56 #define UNUSED_ARG(ARG) ARG
57 #endif
58
59 #define STRINGIFY_(x) #x
60 #define STRINGIFY(x) STRINGIFY_(x)
61  
62 #if defined(__GNUC__)
63 #if defined(__GNUC_PATCHLEVEL__)
64 #define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)
65 #else
66 #define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__)
67 #endif
68 #elif defined (__IMAGECRAFT__)
69 #define COMPILER "ICCAVR"
70 #else
71 #define COMPILER "Unknown"
72 #endif
73
74 #define SOCKET_SELECT_TIME 2
75
76 #define NICKLEN         30
77 #define USERLEN         10
78 #define AUTHLEN         32
79 #define HOSTLEN         63
80 #define REALLEN         50
81 #define TOPICLEN        500
82 #define CHANNELLEN      200
83 #define MAXLEN          512
84 #define TRIGGERLEN      50
85 #define MAXNUMPARAMS    200 /* maximum number of parameters in one line */
86 #define MAXLANGUAGES    5
87 #define MAXMODES        6
88 #define INVITE_TIMEOUT  30
89 #define BOTWAR_DETECTION_TIME 7
90 #define BOTWAR_DETECTION_EVENTS 6
91
92 //valid nick chars
93 #define VALID_NICK_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890{|}~[\\]^-_`"
94 //the first char is a little bit different
95 //                              0        1         2         3         4         5          6
96 //                              1234567890123456789012345678901234567890123456789012345678 9012   62
97 #define VALID_NICK_CHARS_FIRST "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~[\\]^_`"
98 #define VALID_NICK_CHARS_FIRST_LEN 62
99
100 #define TEMPUSER_LIST_INDEX VALID_NICK_CHARS_FIRST_LEN
101
102 extern time_t start_time;
103
104 int stricmp (const char *s1, const char *s2);
105 int stricmplen (const char *s1, const char *s2, int len);
106
107 #endif