]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspircd_io.h
Moved a ton of *Conf functions into the ServerConfig class
[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
35 {
36   private:
37         std::vector<std::string> include_stack;
38         fgets_safe(char* buffer, size_t maxsize, FILE* &file);
39
40   public:
41         char ServerName[MAXBUF];
42         char Network[MAXBUF];
43         char ServerDesc[MAXBUF];
44         char AdminName[MAXBUF];
45         char AdminEmail[MAXBUF];
46         char AdminNick[MAXBUF];
47         char diepass[MAXBUF];
48         char restartpass[MAXBUF];
49         char motd[MAXBUF];
50         char rules[MAXBUF];
51         char PrefixQuit[MAXBUF];
52         char DieValue[MAXBUF];
53         char DNSServer[MAXBUF];
54         char DisabledCommands[MAXBUF];
55         char ModPath[1024];
56         char MyExecutable[1024];
57         FILE *log_file;
58         bool nofork;
59         bool unlimitcore;
60         bool AllowHalfop;
61         int dns_timeout;
62         int NetBufferSize;      // NetBufferSize used as the buffer size for all read() ops
63         int MaxConn;            // size of accept() backlog (128 by default on *BSD)
64         unsigned int SoftLimit;
65         int MaxWhoResults;
66         int debugging;
67         int LogLevel;
68         int DieDelay;
69         char addrs[MAXBUF][255];
70         file_cache MOTD;
71         file_cache RULES;
72         char PID[1024];
73         std::stringstream config_f;
74         ClassVector Classes;
75         std::vector<std::string> module_names;
76
77         ServerConfig();
78         void ClearStack();
79         void Read(bool bail, userrec* user);
80         bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream);
81         int ConfValue(char* tag, char* var, int index, char *result, std::stringstream *config);
82         int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int index, char *result);
83         int ConfValueEnum(char* tag,std::stringstream *config);
84         int EnumConf(std::stringstream *config_f,const char* tag);
85         int EnumValues(std::stringstream *config, const char* tag, int index);
86 };
87
88
89 void Exit (int); 
90 void Start (void); 
91 int DaemonSeed (void); 
92 bool FileExists (const char* file);
93 int OpenTCPSocket (void); 
94 int BindSocket (int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr);
95
96 /*bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream);
97 int ConfValue(char* tag, char* var, int index, char *result, std::stringstream *config);
98 int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int index, char *result);
99 int ConfValueEnum(char* tag,std::stringstream *config);
100 int EnumConf(std::stringstream *config_f,const char* tag);
101 int EnumValues(std::stringstream *config, const char* tag, int index);*/
102
103 void WritePID(std::string filename);
104
105 #endif