]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspircd.h
is_uline was an inefficient piece of crap - fixed.
[user/henk/code/inspircd.git] / include / inspircd.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 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 #include "mode.h"
46 #include "socketengine.h"
47 #include "command_parse.h"
48
49 // some misc defines
50
51 #define ERROR -1
52 #define TRUE 1
53 #define FALSE 0
54 #define MAXSOCKS 64
55 #define MAXCOMMAND 32
56
57 // crucial defines
58 #define ETIREDGERBILS EAGAIN
59
60 /*
61 flags for use with WriteMode
62
63 #define WM_AND 1
64 #define WM_OR 2
65
66 flags for use with OnUserPreMessage and OnUserPreNotice
67
68 #define TYPE_USER 1
69 #define TYPE_CHANNEL 2
70 #define TYPE_SERVER 3
71
72 #define IS_LOCAL(x) (x->fd > -1)
73 #define IS_REMOTE(x) (x->fd < 0)
74 #define IS_MODULE_CREATED(x) (x->fd == FD_MAGIC_NUMBER)
75 */
76
77 class serverstats
78 {
79   public:
80         int statsAccept;
81         int statsRefused;
82         int statsUnknown;
83         int statsCollisions;
84         int statsDns;
85         int statsDnsGood;
86         int statsDnsBad;
87         int statsConnects;
88         int statsSent;
89         int statsRecv;
90         int BoundPortCount;
91
92         serverstats()
93         {
94                 statsAccept = statsRefused = statsUnknown = 0;
95                 statsCollisions = statsDns = statsDnsGood = 0;
96                 statsDnsBad = statsConnects = statsSent = statsRecv = 0;
97                 BoundPortCount = 0;
98         }
99 };
100
101
102 class InspIRCd
103 {
104
105  private:
106         char MODERR[MAXBUF];
107         void erase_factory(int j);
108         void erase_module(int j);
109         void BuildISupport();
110         void MoveTo(std::string modulename,int slot);
111         bool expire_run;
112
113  public:
114         time_t startup_time;
115         ModeParser* ModeGrok;
116         CommandParser* Parser;
117         SocketEngine* SE;
118         serverstats* stats;
119
120         void MakeLowerMap();
121         std::string GetRevision();
122         std::string GetVersionString();
123         char* ModuleError();
124         bool LoadModule(const char* filename);
125         bool UnloadModule(const char* filename);
126         void MoveToLast(std::string modulename);
127         void MoveToFirst(std::string modulename);
128         void MoveAfter(std::string modulename, std::string after);
129         void MoveBefore(std::string modulename, std::string before);
130         InspIRCd(int argc, char** argv);
131         void DoOneIteration(bool process_module_sockets);
132         int Run();
133
134 };
135
136 /* userrec optimization stuff */
137 void AddServerName(std::string servername);
138 const char* FindServerNamePtr(std::string servername);
139 bool FindServerName(std::string servername);
140
141 #endif