]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspircd_io.h
Moved classes out of inspircd.cpp
[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 #include "globals.h"
24
25 // flags for use with log()
26
27 #define DEBUG 10
28 #define VERBOSE 20
29 #define DEFAULT 30
30 #define SPARSE 40
31 #define NONE 50
32
33 class ServerConfig
34 {
35   public:
36         char ServerName[MAXBUF];
37         char Network[MAXBUF];
38         char ServerDesc[MAXBUF];
39         char AdminName[MAXBUF];
40         char AdminEmail[MAXBUF];
41         char AdminNick[MAXBUF];
42         char diepass[MAXBUF];
43         char restartpass[MAXBUF];
44         char motd[MAXBUF];
45         char rules[MAXBUF];
46         char PrefixQuit[MAXBUF];
47         char DieValue[MAXBUF];
48         char DNSServer[MAXBUF];
49         char DisabledCommands[MAXBUF];
50         char ModPath[1024];
51         char MyExecutable[1024];
52         FILE *log_file;
53         bool nofork;
54         bool unlimitcore;
55         bool AllowHalfop;
56         int dns_timeout;
57         int NetBufferSize;      // NetBufferSize used as the buffer size for all read() ops
58         int MaxConn;            // size of accept() backlog (128 by default on *BSD)
59         unsigned int SoftLimit;
60         int MaxWhoResults;
61         int debugging;
62         int LogLevel;
63         int DieDelay;
64         char addrs[MAXBUF][255];
65         file_cache MOTD;
66         file_cache RULES;
67         char PID[1024];
68         std::stringstream config_f;
69         ClassVector Classes;
70
71         ServerConfig();
72         void Read(bool bail, userrec* user);
73 };
74
75
76 void Exit (int); 
77 void Start (void); 
78 int DaemonSeed (void); 
79 bool FileExists (const char* file);
80 int OpenTCPSocket (void); 
81 int BindSocket (int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr);
82
83 bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream);
84 int ConfValue(char* tag, char* var, int index, char *result, std::stringstream *config);
85 int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int index, char *result);
86 int ConfValueEnum(char* tag,std::stringstream *config);
87 int EnumConf(std::stringstream *config_f,const char* tag);
88 int EnumValues(std::stringstream *config, const char* tag, int index);
89 void WritePID(std::string filename);
90
91 #endif