1 /* main.h - NeonServ v5.3
2 * Copyright (C) 2011-2012 Philipp Kreil (pk910)
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.
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.
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/>.
19 #include "../config.h"
21 #define NEONSERV_VERSION "5.3"
22 #define VERSION_PATCHLEVEL 543
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>
46 #define THREAD_MUTEX_INIT(var) { \
47 pthread_mutexattr_t mutex_attr; \
48 pthread_mutexattr_init(&mutex_attr);\
49 pthread_mutexattr_setkind_np(&mutex_attr, PTHREAD_MUTEX_RECURSIVE_NP);\
50 pthread_mutex_init(&var, mutex_attr); \
52 #define SYNCHRONIZE(var) pthread_mutex_lock(&var)
53 #define DESYNCHRONIZE(var) pthread_mutex_unlock(&var)
56 #define THREAD_MUTEX_INIT(var)
57 #define SYNCHRONIZE(var)
58 #define DESYNCHRONIZE(var)
62 #define PRINTF_LIKE(M,N) __attribute__((format (printf, M, N)))
64 #define PRINTF_LIKE(M,N)
68 #define UNUSED_ARG(ARG) ARG __attribute__((unused))
69 #elif defined(S_SPLINT_S)
70 #define UNUSED_ARG(ARG) /*@unused@*/ ARG
71 #define const /*@observer@*/ /*@temp@*/
73 #define UNUSED_ARG(ARG) ARG
76 #define STRINGIFY_(x) #x
77 #define STRINGIFY(x) STRINGIFY_(x)
80 #if defined(__GNUC_PATCHLEVEL__)
81 #define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)
83 #define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__)
85 #elif defined (__IMAGECRAFT__)
86 #define COMPILER "ICCAVR"
88 #define COMPILER "Unknown"
91 #define SOCKET_SELECT_TIME 1
92 #define SOCKET_RECONNECT_TIME 20
100 #define CHANNELLEN 200
102 #define TRIGGERLEN 50
103 #define MAXNUMPARAMS 200 /* maximum number of parameters in one line */
104 #define MAXLANGUAGES 5
106 #define INVITE_TIMEOUT 30
107 #define BOTWAR_DETECTION_TIME 7
108 #define BOTWAR_DETECTION_EVENTS 6
109 #define REWHO_TIMEOUT 10 /* wait 10 seconds before WHO an unauthed user again */
112 #define VALID_NICK_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890{|}~[\\]^-_`"
113 //the first char is a little bit different
115 // 1234567890123456789012345678901234567890123456789012345678 9012 62
116 #define VALID_NICK_CHARS_FIRST "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~[\\]^_`"
117 #define VALID_NICK_CHARS_FIRST_LEN 62
119 #define TEMPUSER_LIST_INDEX VALID_NICK_CHARS_FIRST_LEN
121 extern time_t start_time;
122 extern int statistics_enabled;
124 int stricmp (const char *s1, const char *s2);
125 int stricmplen (const char *s1, const char *s2, int len);
127 void restart_bot(int do_hard_restart);
129 void reload_config();
131 void statistics_update();