00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __INSPIRCD_IO_H__
00018 #define __INSPIRCD_IO_H__
00019
00020 #include <sstream>
00021 #include <string>
00022 #include <vector>
00023 #include "inspircd.h"
00024 #include "globals.h"
00025
00028 #define DEBUG 10
00029 #define VERBOSE 20
00030 #define DEFAULT 30
00031 #define SPARSE 40
00032 #define NONE 50
00033
00039 class ServerConfig : public classbase
00040 {
00041 private:
00047 std::vector<std::string> include_stack;
00048
00055 int fgets_safe(char* buffer, size_t maxsize, FILE* &file);
00056
00061 std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errorstream, bool &error, std::string filename);
00062
00063 public:
00064
00068 char ServerName[MAXBUF];
00069
00070
00071
00072
00073
00074 char Network[MAXBUF];
00075
00079 char ServerDesc[MAXBUF];
00080
00084 char AdminName[MAXBUF];
00085
00089 char AdminEmail[MAXBUF];
00090
00094 char AdminNick[MAXBUF];
00095
00098 char diepass[MAXBUF];
00099
00102 char restartpass[MAXBUF];
00103
00107 char motd[MAXBUF];
00108
00112 char rules[MAXBUF];
00113
00116 char PrefixQuit[MAXBUF];
00117
00121 char DieValue[MAXBUF];
00122
00125 char DNSServer[MAXBUF];
00126
00131 char DisabledCommands[MAXBUF];
00132
00138 char ModPath[1024];
00139
00143 char MyExecutable[1024];
00144
00151 FILE *log_file;
00152
00158 bool nofork;
00159
00166 bool unlimitcore;
00167
00171 bool AllowHalfop;
00172
00176 int dns_timeout;
00177
00182 int NetBufferSize;
00183
00187 int MaxConn;
00188
00193 unsigned int SoftLimit;
00194
00198 int MaxWhoResults;
00199
00202 int debugging;
00203
00206 int LogLevel;
00207
00211 int DieDelay;
00212
00216 char addrs[MAXBUF][255];
00217
00220 file_cache MOTD;
00221
00224 file_cache RULES;
00225
00229 char PID[1024];
00230
00238 std::stringstream config_f;
00239
00242 ClassVector Classes;
00243
00247 std::vector<std::string> module_names;
00248
00249 ServerConfig();
00250
00254 void ClearStack();
00255
00260 void Read(bool bail, userrec* user);
00261
00262 bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream);
00263 int ConfValue(char* tag, char* var, int index, char *result, std::stringstream *config);
00264 int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int index, char *result);
00265 int ConfValueEnum(char* tag,std::stringstream *config);
00266 int EnumConf(std::stringstream *config_f,const char* tag);
00267 int EnumValues(std::stringstream *config, const char* tag, int index);
00268 };
00269
00270
00271 void Exit (int);
00272 void Start (void);
00273 int DaemonSeed (void);
00274 bool FileExists (const char* file);
00275 int OpenTCPSocket (void);
00276 int BindSocket (int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr);
00277 void WritePID(std::string filename);
00278
00279 #endif