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