2e627939b8d49df4bdf77093f8cf161259c1b72b
[NeonServV5.git] / src / main.h
1 /* main.h - NeonServ v5.2
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.2"
21 #define VERSION_PATCHLEVEL 414
22
23 #ifndef BOTWAR_ALERT_CHAN
24 #define BOTWAR_ALERT_CHAN NULL
25 #endif
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <ctype.h>
31 #ifdef WIN32
32 #include <windows.h>
33 #include <winsock2.h>
34 #else
35 #include <sys/types.h>
36 #include <sys/socket.h>
37 #include <netinet/in.h>
38 #include <arpa/inet.h>
39 #include <netdb.h>
40 #include <sys/wait.h>
41 #endif
42 #include <unistd.h>
43 #include <stdarg.h>
44 #include <sys/time.h>
45 #include <time.h>
46
47 #if __GNUC__
48 #define PRINTF_LIKE(M,N) __attribute__((format (printf, M, N)))
49 #else
50 #define PRINTF_LIKE(M,N)
51 #endif
52
53 #if __GNUC__ >= 2
54 #define UNUSED_ARG(ARG) ARG __attribute__((unused))
55 #elif defined(S_SPLINT_S)
56 #define UNUSED_ARG(ARG) /*@unused@*/ ARG
57 #define const /*@observer@*/ /*@temp@*/
58 #else
59 #define UNUSED_ARG(ARG) ARG
60 #endif
61
62 #define STRINGIFY_(x) #x
63 #define STRINGIFY(x) STRINGIFY_(x)
64  
65 #if defined(__GNUC__)
66 #if defined(__GNUC_PATCHLEVEL__)
67 #define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)
68 #else
69 #define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__)
70 #endif
71 #elif defined (__IMAGECRAFT__)
72 #define COMPILER "ICCAVR"
73 #else
74 #define COMPILER "Unknown"
75 #endif
76
77 #define SOCKET_SELECT_TIME    1
78 #define SOCKET_RECONNECT_TIME 20
79
80 #define NICKLEN         30
81 #define USERLEN         10
82 #define AUTHLEN         32
83 #define HOSTLEN         63
84 #define REALLEN         50
85 #define TOPICLEN        500
86 #define CHANNELLEN      200
87 #define MAXLEN          512
88 #define TRIGGERLEN      50
89 #define MAXNUMPARAMS    200 /* maximum number of parameters in one line */
90 #define MAXLANGUAGES    5
91 #define MAXMODES        6
92 #define INVITE_TIMEOUT  30
93 #define BOTWAR_DETECTION_TIME 7
94 #define BOTWAR_DETECTION_EVENTS 6
95 #define REWHO_TIMEOUT   10 /* wait 10 seconds before WHO an unauthed user again */
96
97 //valid nick chars
98 #define VALID_NICK_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890{|}~[\\]^-_`"
99 //the first char is a little bit different
100 //                              0        1         2         3         4         5          6
101 //                              1234567890123456789012345678901234567890123456789012345678 9012   62
102 #define VALID_NICK_CHARS_FIRST "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~[\\]^_`"
103 #define VALID_NICK_CHARS_FIRST_LEN 62
104
105 #define TEMPUSER_LIST_INDEX VALID_NICK_CHARS_FIRST_LEN
106
107 extern time_t start_time;
108 extern int statistics_enabled;
109
110 int stricmp (const char *s1, const char *s2);
111 int stricmplen (const char *s1, const char *s2, int len);
112
113 void restart_bot(int hard_restart);
114 void stop_bot();
115 void reload_config();
116
117 void statistics_update();
118
119 #endif