This commit was generated by cvs2svn to compensate for changes in r2,
[ircu2.10.12-pk.git] / include / s_conf.h
1 #ifndef S_CONF_H
2 #define S_CONF_H
3
4 #include "list.h"
5 #include <netinet/in.h>
6 #include <netdb.h>
7
8 /*=============================================================================
9  * General defines
10  */
11
12 /*-----------------------------------------------------------------------------
13  * Macro's
14  */
15
16 #define CONF_ILLEGAL            0x80000000
17 #define CONF_MATCH              0x40000000
18 #define CONF_CLIENT             0x0002
19 #define CONF_CONNECT_SERVER     0x0004
20 #define CONF_NOCONNECT_SERVER   0x0008
21 #define CONF_LOCOP              0x0010
22 #define CONF_OPERATOR           0x0020
23 #define CONF_ME                 0x0040
24 #define CONF_KILL               0x0080
25 #define CONF_ADMIN              0x0100
26 #ifdef  R_LINES
27 #define CONF_RESTRICT           0x0200
28 #endif
29 #define CONF_CLASS              0x0400
30 #define CONF_LEAF               0x1000
31 #define CONF_LISTEN_PORT        0x2000
32 #define CONF_HUB                0x4000
33 #define CONF_UWORLD             0x8000
34 #define CONF_CRULEALL           0x00200000
35 #define CONF_CRULEAUTO          0x00400000
36 #define CONF_TLINES             0x00800000
37 #define CONF_IPKILL             0x00010000
38
39 #define CONF_OPS                (CONF_OPERATOR | CONF_LOCOP)
40 #define CONF_SERVER_MASK        (CONF_CONNECT_SERVER | CONF_NOCONNECT_SERVER)
41 #define CONF_CLIENT_MASK        (CONF_CLIENT | CONF_OPS | CONF_SERVER_MASK)
42 #define CONF_CRULE              (CONF_CRULEALL | CONF_CRULEAUTO)
43 #define CONF_KLINE              (CONF_KILL | CONF_IPKILL)
44
45 #define IsIllegal(x)    ((x)->status & CONF_ILLEGAL)
46
47 /*=============================================================================
48  * Structures
49  */
50
51 struct ConfItem {
52   unsigned int status;          /* If CONF_ILLEGAL, delete when no clients */
53   unsigned int clients;         /* Number of *LOCAL* clients using this */
54   struct in_addr ipnum;         /* ip number of host field */
55   char *host;
56   char *passwd;
57   char *name;
58   unsigned short int port;
59   time_t hold;                  /* Hold action until this time
60                                    (calendar time) */
61 #ifndef VMSP
62   struct ConfClass *confClass;  /* Class of connection */
63 #endif
64   struct ConfItem *next;
65 };
66
67 struct MotdItem {
68   char line[82];
69   struct MotdItem *next;
70 };
71
72 struct trecord {
73   char *hostmask;
74   struct MotdItem *tmotd;
75   struct tm tmotd_tm;
76   struct trecord *next;
77 };
78
79 enum AuthorizationCheckResult {
80   ACR_OK,
81   ACR_NO_AUTHORIZATION,
82   ACR_TOO_MANY_IN_CLASS,
83   ACR_TOO_MANY_FROM_IP,
84   ACR_ALREADY_AUTHORIZED,
85   ACR_BAD_SOCKET
86 };
87
88 /*=============================================================================
89  * Proto types
90  */
91
92 extern aConfItem *find_conf_host(Link *lp, char *host, int statmask);
93 extern void det_confs_butmask(aClient *cptr, int mask);
94 extern enum AuthorizationCheckResult attach_Iline(aClient *cptr,
95     struct hostent *hp, char *sockhost);
96 extern aConfItem *count_cnlines(Link *lp);
97 extern int detach_conf(aClient *cptr, aConfItem *aconf);
98 extern enum AuthorizationCheckResult attach_conf(aClient *cptr,
99     aConfItem *aconf);
100 extern aConfItem *find_admin(void);
101 extern aConfItem *find_me(void);
102 extern aConfItem *attach_confs(aClient *cptr, const char *name, int statmask);
103 extern aConfItem *attach_confs_host(aClient *cptr, char *host, int statmask);
104 extern aConfItem *find_conf_exact(char *name, char *user, char *host,
105     int statmask);
106 extern aConfItem *find_conf_name(char *name, int statmask);
107 extern aConfItem *find_conf(Link *lp, const char *name, int statmask);
108 extern aConfItem *find_conf_ip(Link *lp, char *ip, char *user, int statmask);
109 extern int rehash(aClient *cptr, int sig);
110 extern int initconf(int opt);
111 extern void read_tlines(void);
112 extern int find_kill(aClient *cptr);
113 extern int find_restrict(aClient *cptr);
114 extern int m_killcomment(aClient *sptr, char *parv, char *filename);
115 extern aMotdItem *read_motd(char *motdfile);
116
117 extern aConfItem *conf;
118 extern aGline *gline;
119 extern struct tm motd_tm;
120 extern aMotdItem *motd;
121 extern aMotdItem *rmotd;
122 extern atrecord *tdata;
123
124 #endif /* S_CONF_H */