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