00001 /* +------------------------------------+ 00002 * | Inspire Internet Relay Chat Daemon | 00003 * +------------------------------------+ 00004 * 00005 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. 00006 * E-mail: 00007 * <brain@chatspike.net> 00008 * <Craig@chatspike.net> 00009 * 00010 * Written by Craig Edwards, Craig McLure, and others. 00011 * This program is free but copyrighted software; see 00012 * the file COPYING for details. 00013 * 00014 * --------------------------------------------------- 00015 */ 00016 00017 #ifndef __INSPIRCD_H__ 00018 #define __INSPIRCD_H__ 00019 00020 #include "inspircd_config.h" 00021 #include <string> 00022 #include <stdio.h> 00023 #include <unistd.h> 00024 #include <signal.h> 00025 #include <time.h> 00026 #include <netdb.h> 00027 #include <string.h> 00028 #include <errno.h> 00029 #include <sys/types.h> 00030 00031 #ifndef _LINUX_C_LIB_VERSION 00032 #include <sys/socket.h> 00033 #include <sys/stat.h> 00034 #include <netinet/in.h> 00035 #endif 00036 00037 #include <arpa/inet.h> 00038 #include <string> 00039 #include <deque> 00040 00041 #include "inspircd_io.h" 00042 #include "users.h" 00043 #include "channels.h" 00044 #include "socket.h" 00045 #include "mode.h" 00046 #include "socketengine.h" 00047 #include "command_parse.h" 00048 00049 // some misc defines 00050 00051 #define ERROR -1 00052 #define TRUE 1 00053 #define FALSE 0 00054 #define MAXSOCKS 64 00055 #define MAXCOMMAND 32 00056 00057 /* 00058 flags for use with WriteMode 00059 00060 #define WM_AND 1 00061 #define WM_OR 2 00062 00063 flags for use with OnUserPreMessage and OnUserPreNotice 00064 00065 #define TYPE_USER 1 00066 #define TYPE_CHANNEL 2 00067 #define TYPE_SERVER 3 00068 00069 #define IS_LOCAL(x) (x->fd > -1) 00070 #define IS_REMOTE(x) (x->fd < 0) 00071 #define IS_MODULE_CREATED(x) (x->fd == FD_MAGIC_NUMBER) 00072 */ 00073 00074 class serverstats 00075 { 00076 public: 00077 int statsAccept; 00078 int statsRefused; 00079 int statsUnknown; 00080 int statsCollisions; 00081 int statsDns; 00082 int statsDnsGood; 00083 int statsDnsBad; 00084 int statsConnects; 00085 int statsSent; 00086 int statsRecv; 00087 int BoundPortCount; 00088 00089 serverstats() 00090 { 00091 statsAccept = statsRefused = statsUnknown = 0; 00092 statsCollisions = statsDns = statsDnsGood = 0; 00093 statsDnsBad = statsConnects = statsSent = statsRecv = 0; 00094 BoundPortCount = 0; 00095 } 00096 }; 00097 00098 00099 class InspIRCd 00100 { 00101 00102 private: 00103 char MODERR[MAXBUF]; 00104 void erase_factory(int j); 00105 void erase_module(int j); 00106 00107 public: 00108 time_t startup_time; 00109 ModeParser* ModeGrok; 00110 CommandParser* Parser; 00111 SocketEngine* SE; 00112 serverstats* stats; 00113 00114 void MakeLowerMap(); 00115 std::string GetRevision(); 00116 std::string GetVersionString(); 00117 char* ModuleError(); 00118 bool LoadModule(const char* filename); 00119 bool UnloadModule(const char* filename); 00120 InspIRCd(int argc, char** argv); 00121 int Run(); 00122 00123 }; 00124 00125 /* userrec optimization stuff */ 00126 void AddServerName(std::string servername); 00127 const char* FindServerNamePtr(std::string servername); 00128 00129 #endif