]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspircd.h
Removed unused check for valid channel name - if it's invalid, it won't exist in...
[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 #include <sstream>
41
42 #include "inspircd_io.h"
43 #include "users.h"
44 #include "channels.h"
45 #include "socket.h"
46 #include "mode.h"
47 #include "socketengine.h"
48 #include "command_parse.h"
49
50 // some misc defines
51 #define ERROR -1
52 #define MAXCOMMAND 32
53
54 // crucial defines
55 #define ETIREDGERBILS EAGAIN
56
57 // This define is used in place of strcmp when we 
58 // want to check if a char* string contains only one
59 // letter. Pretty fast, its just two compares and an
60 // addition.
61 #define IS_SINGLE(x,y) ( (*x == y) && (*(x+1) == 0) )
62
63 template<typename T> inline std::string ConvToStr(const T &in)
64 {
65         std::stringstream tmp;
66         if (!(tmp << in)) return std::string();
67         return tmp.str();
68 }
69
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         void BuildISupport();
104         void MoveTo(std::string modulename,int slot);
105         bool expire_run;
106
107  public:
108         time_t startup_time;
109         ModeParser* ModeGrok;
110         CommandParser* Parser;
111         SocketEngine* SE;
112         serverstats* stats;
113
114         void MakeLowerMap();
115         std::string GetRevision();
116         std::string GetVersionString();
117         char* ModuleError();
118         bool LoadModule(const char* filename);
119         bool UnloadModule(const char* filename);
120         void MoveToLast(std::string modulename);
121         void MoveToFirst(std::string modulename);
122         void MoveAfter(std::string modulename, std::string after);
123         void MoveBefore(std::string modulename, std::string before);
124         InspIRCd(int argc, char** argv);
125         void DoOneIteration(bool process_module_sockets);
126         int Run();
127
128 };
129
130 /* userrec optimization stuff */
131 void AddServerName(std::string servername);
132 const char* FindServerNamePtr(std::string servername);
133 bool FindServerName(std::string servername);
134
135 #endif