Make default virtual host work for .12, and make IPv4-only
[ircu2.10.12-pk.git] / include / s_conf.h
index 7742f93568007bf9dbfb5f1950a7d21c0b92f714..763c78d477ff6b3dd2ccb1c3f51f871bc286c0c1 100644 (file)
 #include <sys/types.h>
 #define INCLUDED_sys_types_h
 #endif
-#ifndef INCLUDED_netinet_in_h
-#include <netinet/in.h>        /* struct in_addr */
-#define INCLUDED_netinet_in_h
-#endif
+#include "client.h"
 
 struct Client;
 struct SLink;
 struct TRecord;
+struct Message;
 
 
 /*
@@ -35,14 +33,12 @@ struct TRecord;
 #define CONF_MATCH              0x40000000
 #define CONF_CLIENT             0x0002
 #define CONF_SERVER             0x0004
-#define CONF_LOCOP              0x0010
 #define CONF_OPERATOR           0x0020
 #define CONF_LEAF               0x1000
 #define CONF_HUB                0x4000
 #define CONF_UWORLD             0x8000
 
-#define CONF_OPS                (CONF_OPERATOR | CONF_LOCOP)
-#define CONF_CLIENT_MASK        (CONF_CLIENT | CONF_OPS | CONF_SERVER)
+#define CONF_CLIENT_MASK        (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER)
 
 #define IsIllegal(x)    ((x)->status & CONF_ILLEGAL)
 
@@ -50,19 +46,24 @@ struct TRecord;
  * Structures
  */
 
-struct ConfItem {
-  struct ConfItem*         next;
-  unsigned int             status;      /* If CONF_ILLEGAL, delete when no clients */
-  unsigned int             clients;     /* Number of *LOCAL* clients using this */
-  struct ConnectionClass*  conn_class;  /* Class of connection */
-  struct in_addr           ipnum;       /* ip number of host field */
-  char*                    host;
-  char*                    passwd;
-  char*                    name;
-  time_t                   hold;        /* Hold until this time (calendar time) */
-  int                      dns_pending; /* a dns request is pending */
-  unsigned short           port;
-  char                            bits;        /* Number of bits for ipkills */
+struct ConfItem
+{
+  struct ConfItem *next;
+  unsigned int status;      /* If CONF_ILLEGAL, delete when no clients */
+  unsigned int clients;     /* Number of *LOCAL* clients using this */
+  struct ConnectionClass *conn_class;  /* Class of connection */
+  struct irc_sockaddr origin;  /* local address */
+  struct irc_sockaddr address; /* ip and port */
+  char *host;
+  char *origin_name;
+  char *passwd;
+  char *name;
+  time_t hold; /* Hold until this time (calendar time) */
+  int dns_pending; /* a dns request is pending */
+  unsigned char bits; /* Number of bits for ipkills. */
+  struct Privs privs; /* Priviledges for opers. */
+  /* Used to detect if a privilege has been touched. */
+  struct Privs privs_dirty;
 };
 
 struct ServerConf {
@@ -70,32 +71,40 @@ struct ServerConf {
   char*              hostname;
   char*              passwd;
   char*              alias;
-  struct in_addr     address;
-  int                port;
+  struct irc_in_addr address;
   int                dns_pending;
   int                connected;
   time_t             hold;
   struct ConnectionClass*  conn_class;
 };
 
+struct qline
+{
+  struct qline *next;
+  char *chname;
+  char *reason;
+};
+
 struct DenyConf {
   struct DenyConf*    next;
   char*               hostmask;
   char*               message;
   char*               usermask;
-  unsigned int        s_addr;
-  char                is_file;
-  char                ip_kill;
-  char                bits;        /* Number of bits for ipkills */
+  struct irc_in_addr  address;
+  unsigned int        flags;
+  unsigned char       bits;        /* Number of bits for ipkills */
 };
 
+#define DENY_FLAGS_FILE     0x0001 /* Comment is a filename */
+#define DENY_FLAGS_IP       0x0002 /* K-line by IP address */
+#define DENY_FLAGS_REALNAME 0x0004 /* K-line by real name */
+
 /*
  * A line: A:<line 1>:<line 2>:<line 3>
  */
 struct LocalConf {
   char*          name;
   char*          description;
-  struct in_addr vhost_address;
   unsigned int   numeric;
   char*          location1;
   char*          location2;
@@ -145,6 +154,22 @@ enum AuthorizationCheckResult {
   ACR_BAD_SOCKET
 };
 
+struct nick_host {
+  struct nick_host *next;
+  int nicklen; /* offset of @ part of server string */
+  char nick[1]; /* start of nick@server string */
+};
+
+struct s_map {
+  struct s_map *next;
+  struct Message *msg;
+  char *name;
+  char *command;
+  char *prepend;
+  struct nick_host *services;
+};
+
+
 /*
  * GLOBALS
  */
@@ -154,6 +179,8 @@ extern struct tm        motd_tm;
 extern struct MotdItem* motd;
 extern struct MotdItem* rmotd;
 extern struct TRecord*  tdata;
+extern struct s_map*    GlobalServiceMapList;
+extern struct qline*    GlobalQuarantineList;
 
 /*
  * Proto types
@@ -185,5 +212,9 @@ extern void read_tlines(void);
 extern int find_kill(struct Client *cptr);
 extern int find_restrict(struct Client *cptr);
 extern struct MotdItem* read_motd(const char* motdfile);
+extern const char *find_quarantine(const char* chname);
+extern void lookup_confhost(struct ConfItem *aconf);
+
+extern void yyerror(const char *msg);
 
 #endif /* INCLUDED_s_conf_h */