]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspircd.h
0ebc3420cbc44411b78044afe3d6750a76781be1
[user/henk/code/inspircd.git] / include / inspircd.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #ifndef __INSPIRCD_H__
18 #define __INSPIRCD_H__
19
20 #include "inspircd_config.h"
21 #include <string>
22 #include <stdio.h>
23 #include <unistd.h>
24 #include <signal.h>
25 #include <time.h>
26 #include <netdb.h>
27 #include <string.h>
28 #include <errno.h>
29 #include <sys/types.h>
30
31 #ifndef _LINUX_C_LIB_VERSION
32 #include <sys/socket.h>
33 #include <sys/stat.h>
34 #include <netinet/in.h>
35 #endif
36
37 #include <arpa/inet.h>
38 #include <string>
39 #include <deque>
40
41 #include "inspircd_io.h"
42 #include "users.h"
43 #include "channels.h"
44 #include "socket.h"
45
46 // some misc defines
47
48 #define ERROR -1
49 #define TRUE 1
50 #define FALSE 0
51 #define MAXSOCKS 64
52 #define MAXCOMMAND 32
53
54 // flags for use with WriteMode
55
56 #define WM_AND 1
57 #define WM_OR 2
58
59 // flags for use with OnUserPreMessage and OnUserPreNotice
60
61 #define TYPE_USER 1
62 #define TYPE_CHANNEL 2
63 #define TYPE_SERVER 3
64
65 #define IS_LOCAL(x) (x->fd > -1)
66 #define IS_REMOTE(x) (x->fd < 0)
67 #define IS_MODULE_CREATED(x) (x->fd == FD_MAGIC_NUMBER)
68
69 typedef void (handlerfunc) (char**, int, userrec*);
70
71 class serverstats
72 {
73   public:
74         int statsAccept;
75         int statsRefused;
76         int statsUnknown;
77         int statsCollisions;
78         int statsDns;
79         int statsDnsGood;
80         int statsDnsBad;
81         int statsConnects;
82         int statsSent;
83         int statsRecv;
84         int BoundPortCount;
85
86         serverstats()
87         {
88                 statsAccept = statsRefused = statsUnknown = 0;
89                 statsCollisions = statsDns = statsDnsGood = 0;
90                 statsDnsBad = statsConnects = statsSent = statsRecv = 0;
91                 BoundPortCount = 0;
92         }
93 };
94
95
96 class InspIRCd
97 {
98
99  private:
100         char MODERR[MAXBUF];
101         void erase_factory(int j);
102         void erase_module(int j);       
103
104  public:
105         time_t startup_time;
106
107         std::string GetRevision();
108         std::string GetVersionString();
109         char* ModuleError();
110         bool LoadModule(const char* filename);
111         bool UnloadModule(const char* filename);
112         InspIRCd(int argc, char** argv);
113         int Run();
114
115 };
116
117 /* userrec optimization stuff */
118 void AddServerName(std::string servername);
119 const char* FindServerNamePtr(std::string servername);
120
121 #endif