]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspircd.h
Correctly use iterators and pointer to ucrec
[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 // This define is used in place of strcmp when we 
61 // want to check if a char* string contains only one
62 // letter. Pretty fast, its just two compares and an
63 // addition.
64 #define IS_SINGLE(x,y) ( (*x == y) && (*(x+1) == 0) )
65
66 class serverstats
67 {
68   public:
69         int statsAccept;
70         int statsRefused;
71         int statsUnknown;
72         int statsCollisions;
73         int statsDns;
74         int statsDnsGood;
75         int statsDnsBad;
76         int statsConnects;
77         int statsSent;
78         int statsRecv;
79         int BoundPortCount;
80
81         serverstats()
82         {
83                 statsAccept = statsRefused = statsUnknown = 0;
84                 statsCollisions = statsDns = statsDnsGood = 0;
85                 statsDnsBad = statsConnects = statsSent = statsRecv = 0;
86                 BoundPortCount = 0;
87         }
88 };
89
90
91 class InspIRCd
92 {
93
94  private:
95         char MODERR[MAXBUF];
96         void erase_factory(int j);
97         void erase_module(int j);
98         void BuildISupport();
99         void MoveTo(std::string modulename,int slot);
100         bool expire_run;
101
102  public:
103         time_t startup_time;
104         ModeParser* ModeGrok;
105         CommandParser* Parser;
106         SocketEngine* SE;
107         serverstats* stats;
108
109         void MakeLowerMap();
110         std::string GetRevision();
111         std::string GetVersionString();
112         char* ModuleError();
113         bool LoadModule(const char* filename);
114         bool UnloadModule(const char* filename);
115         void MoveToLast(std::string modulename);
116         void MoveToFirst(std::string modulename);
117         void MoveAfter(std::string modulename, std::string after);
118         void MoveBefore(std::string modulename, std::string before);
119         InspIRCd(int argc, char** argv);
120         void DoOneIteration(bool process_module_sockets);
121         int Run();
122
123 };
124
125 /* userrec optimization stuff */
126 void AddServerName(std::string servername);
127 const char* FindServerNamePtr(std::string servername);
128 bool FindServerName(std::string servername);
129
130 #endif