some modifications for WIN32 support :)
[NeonServV5.git] / src / main.h
1 #ifndef _main_h
2 #define _main_h
3
4 #define NEONSERV_VERSION "5.0.1-dev"
5
6 #include "../mysqlConfig.h"
7 #ifndef BOTWAR_ALERT_CHAN
8 #define BOTWAR_ALERT_CHAN NULL
9 #endif
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <ctype.h>
15 #ifdef WIN32
16 #include <windows.h>
17 #include <winsock2.h>
18 #else
19 #include <sys/types.h>
20 #include <sys/socket.h>
21 #include <netinet/in.h>
22 #include <arpa/inet.h>
23 #include <netdb.h>
24 #endif
25 #include <unistd.h>
26 #include <stdarg.h>
27 #include <time.h>
28
29 #if __GNUC__
30 #define PRINTF_LIKE(M,N) __attribute__((format (printf, M, N)))
31 #else
32 #define PRINTF_LIKE(M,N)
33 #endif
34
35 #if __GNUC__ >= 2
36 #define UNUSED_ARG(ARG) ARG __attribute__((unused))
37 #elif defined(S_SPLINT_S)
38 #define UNUSED_ARG(ARG) /*@unused@*/ ARG
39 #define const /*@observer@*/ /*@temp@*/
40 #else
41 #define UNUSED_ARG(ARG) ARG
42 #endif
43
44 #define STRINGIFY_(x) #x
45 #define STRINGIFY(x) STRINGIFY_(x)
46  
47 #if defined(__GNUC__)
48 #if defined(__GNUC_PATCHLEVEL__)
49 #define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)
50 #else
51 #define COMPILER "GCC" " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__)
52 #endif
53 #elif defined (__IMAGECRAFT__)
54 #define COMPILER "ICCAVR"
55 #else
56 #define COMPILER "Unknown"
57 #endif
58
59 #define SOCKET_SELECT_TIME 2
60
61 #define NICKLEN         30
62 #define USERLEN         10
63 #define AUTHLEN         32
64 #define HOSTLEN         63
65 #define REALLEN         50
66 #define TOPICLEN        500
67 #define CHANNELLEN      200
68 #define MAXLEN          512
69 #define TRIGGERLEN      50
70 #define MAXNUMPARAMS    200 /* maximum number of parameters in one line */
71 #define MAXLANGUAGES    5
72 #define MAXMODES        6
73 #define INVITE_TIMEOUT  30
74 #define BOTWAR_DETECTION_TIME 7
75 #define BOTWAR_DETECTION_EVENTS 6
76
77 //valid nick chars
78 #define VALID_NICK_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890{|}~[\\]^-_`"
79 //the first char is a little bit different
80 //                              0        1         2         3         4         5          6
81 //                              1234567890123456789012345678901234567890123456789012345678 9012   62
82 #define VALID_NICK_CHARS_FIRST "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~[\\]^_`"
83 #define VALID_NICK_CHARS_FIRST_LEN 62
84
85 #define TEMPUSER_LIST_INDEX VALID_NICK_CHARS_FIRST_LEN
86
87 extern time_t start_time;
88
89 int stricmp (const char *s1, const char *s2);
90 int stricmplen (const char *s1, const char *s2, int len);
91
92 #endif