]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspircd_io.h
Moved some other stuff into ServerConfig
[user/henk/code/inspircd.git] / include / inspircd_io.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  Inspire is copyright (C) 2002-2004 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_IO_H__
18 #define __INSPIRCD_IO_H__
19
20 #include <sstream>
21 #include <string>
22 #include <vector>
23 #include "inspircd.h"
24 #include "globals.h"
25
26 // flags for use with log()
27
28 #define DEBUG 10
29 #define VERBOSE 20
30 #define DEFAULT 30
31 #define SPARSE 40
32 #define NONE 50
33
34 class ServerConfig : public classbase
35 {
36   private:
37         std::vector<std::string> include_stack;
38         int fgets_safe(char* buffer, size_t maxsize, FILE* &file);
39         std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errorstream, bool &error, std::string filename);
40
41   public:
42         char ServerName[MAXBUF];
43         char Network[MAXBUF];
44         char ServerDesc[MAXBUF];
45         char AdminName[MAXBUF];
46         char AdminEmail[MAXBUF];
47         char AdminNick[MAXBUF];
48         char diepass[MAXBUF];
49         char restartpass[MAXBUF];
50         char motd[MAXBUF];
51         char rules[MAXBUF];
52         char PrefixQuit[MAXBUF];
53         char DieValue[MAXBUF];
54         char DNSServer[MAXBUF];
55         char DisabledCommands[MAXBUF];
56         char ModPath[1024];
57         char MyExecutable[1024];
58         FILE *log_file;
59         bool nofork;
60         bool unlimitcore;
61         bool AllowHalfop;
62         int dns_timeout;
63         int NetBufferSize;      // NetBufferSize used as the buffer size for all read() ops
64         int MaxConn;            // size of accept() backlog (128 by default on *BSD)
65         unsigned int SoftLimit;
66         int MaxWhoResults;
67         int debugging;
68         int LogLevel;
69         int DieDelay;
70         char addrs[MAXBUF][255];
71         file_cache MOTD;
72         file_cache RULES;
73         char PID[1024];
74         std::stringstream config_f;
75         ClassVector Classes;
76         std::vector<std::string> module_names;
77
78         ServerConfig();
79         void ClearStack();
80         void Read(bool bail, userrec* user);
81         bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream);
82         int ConfValue(char* tag, char* var, int index, char *result, std::stringstream *config);
83         int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int index, char *result);
84         int ConfValueEnum(char* tag,std::stringstream *config);
85         int EnumConf(std::stringstream *config_f,const char* tag);
86         int EnumValues(std::stringstream *config, const char* tag, int index);
87 };
88
89
90 void Exit (int); 
91 void Start (void); 
92 int DaemonSeed (void); 
93 bool FileExists (const char* file);
94 int OpenTCPSocket (void); 
95 int BindSocket (int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr);
96
97 /*bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream);
98 int ConfValue(char* tag, char* var, int index, char *result, std::stringstream *config);
99 int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int index, char *result);
100 int ConfValueEnum(char* tag,std::stringstream *config);
101 int EnumConf(std::stringstream *config_f,const char* tag);
102 int EnumValues(std::stringstream *config, const char* tag, int index);*/
103
104 void WritePID(std::string filename);
105
106 #endif