conf.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. * Please read the file COPYING, README and AUTHORS for more information.
  10. *
  11. * Configuration management (header)
  12. */
  13. #ifndef __conf_h__
  14. #define __conf_h__
  15. #include <time.h>
  16. #include "defines.h"
  17. #include "array.h"
  18. #include "portab.h"
  19. #include "tool.h"
  20. #include "ng_ipaddr.h"
  21. #include "proc.h"
  22. #include "conf-ssl.h"
  23. struct Conf_Oper {
  24. char name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */
  25. char pwd[CLIENT_PASS_LEN]; /* Password */
  26. char *mask; /* allowed host mask */
  27. };
  28. typedef struct _Conf_Server
  29. {
  30. char host[HOST_LEN]; /* Hostname */
  31. char name[CLIENT_ID_LEN]; /* IRC-Client-ID */
  32. char pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */
  33. char pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */
  34. UINT16 port; /* Server port */
  35. int group; /* Group of server */
  36. time_t lasttry; /* Last connect attempt */
  37. PROC_STAT res_stat; /* Status of the resolver */
  38. int flags; /* Flags */
  39. CONN_ID conn_id; /* ID of server connection or NONE */
  40. ng_ipaddr_t bind_addr; /* source address to use for outgoing
  41. connections */
  42. ng_ipaddr_t dst_addr[2]; /* list of addresses to connect to */
  43. #ifdef SSL_SUPPORT
  44. bool SSLConnect; /* connect() using SSL? */
  45. #endif
  46. char svs_mask[CLIENT_ID_LEN]; /* Mask of nick names that are
  47. services */
  48. } CONF_SERVER;
  49. #ifdef SSL_SUPPORT
  50. struct SSLOptions {
  51. char *KeyFile;
  52. char *CertFile;
  53. char *DHFile;
  54. array ListenPorts;
  55. array KeyFilePassword;
  56. };
  57. #endif
  58. struct Conf_Channel {
  59. char name[CHANNEL_NAME_LEN]; /* Name of the channel */
  60. char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
  61. char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
  62. char topic[COMMAND_LEN]; /* Initial topic */
  63. char keyfile[512]; /* Path and name of channel key file */
  64. unsigned long maxusers; /* maximum usercount for this channel, mode "l" */
  65. };
  66. #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
  67. #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
  68. /* Name ("Nick") of the servers */
  69. GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
  70. /* Server info text */
  71. GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
  72. /* Global server passwort */
  73. GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
  74. /* Administrative information */
  75. GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
  76. GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
  77. GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
  78. /* Message of the Day */
  79. GLOBAL array Conf_Motd;
  80. /* Ports the server should listen on */
  81. GLOBAL array Conf_ListenPorts;
  82. /* Address to which the socket should be bound or empty (=all) */
  83. GLOBAL char *Conf_ListenAddress;
  84. /* User and group ID the server should run with */
  85. GLOBAL uid_t Conf_UID;
  86. GLOBAL gid_t Conf_GID;
  87. /* A directory to chroot() in */
  88. GLOBAL char Conf_Chroot[FNAME_LEN];
  89. /* File with PID of daemon */
  90. GLOBAL char Conf_PidFile[FNAME_LEN];
  91. /* Timeouts for PING and PONG */
  92. GLOBAL int Conf_PingTimeout;
  93. GLOBAL int Conf_PongTimeout;
  94. /* Seconds between connect attempts to other servers */
  95. GLOBAL int Conf_ConnectRetry;
  96. /* Operators */
  97. GLOBAL array Conf_Opers;
  98. /* Servers */
  99. GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
  100. /* Pre-defined channels */
  101. GLOBAL array Conf_Channels;
  102. /* Pre-defined channels only */
  103. GLOBAL bool Conf_PredefChannelsOnly;
  104. /* Are IRC operators allowed to always use MODE? */
  105. GLOBAL bool Conf_OperCanMode;
  106. /* If an IRC op gives chanop privileges without being a chanop,
  107. * ircd2 will ignore the command. This enables a workaround:
  108. * It masks the command as coming from the server */
  109. GLOBAL bool Conf_OperServerMode;
  110. /* Are remote IRC operators allowed to manage this server? */
  111. GLOBAL bool Conf_AllowRemoteOper;
  112. /* Disable all DNS functions? */
  113. GLOBAL bool Conf_NoDNS;
  114. /* Disable IDENT lookups, even when compiled with support for it */
  115. GLOBAL bool Conf_NoIdent;
  116. /* Disable all usage of PAM, even when compiled with support for it */
  117. GLOBAL bool Conf_NoPAM;
  118. /* Disable service registration using "ZeroConf" */
  119. GLOBAL bool Conf_NoZeroConf;
  120. /*
  121. * try to connect to remote systems using the ipv6 protocol,
  122. * if they have an ipv6 address? (default yes)
  123. */
  124. GLOBAL bool Conf_ConnectIPv6;
  125. /* same as above, but for ipv4 hosts, default: yes */
  126. GLOBAL bool Conf_ConnectIPv4;
  127. /* Maximum number of connections to this server */
  128. GLOBAL long Conf_MaxConnections;
  129. /* Maximum number of channels a user can join */
  130. GLOBAL int Conf_MaxJoins;
  131. /* Maximum number of connections per IP address */
  132. GLOBAL int Conf_MaxConnectionsIP;
  133. /* Maximum length of a nick name */
  134. GLOBAL unsigned int Conf_MaxNickLength;
  135. #ifdef SYSLOG
  136. /* Syslog "facility" */
  137. GLOBAL int Conf_SyslogFacility;
  138. #endif
  139. GLOBAL void Conf_Init PARAMS((void));
  140. GLOBAL bool Conf_Rehash PARAMS((void));
  141. GLOBAL int Conf_Test PARAMS((void));
  142. GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
  143. GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
  144. GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
  145. GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
  146. GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
  147. GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
  148. GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
  149. GLOBAL bool Conf_IsService PARAMS((int ConfServer, const char *Nick));
  150. /* Password required by WEBIRC command */
  151. GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
  152. #ifdef DEBUG
  153. GLOBAL void Conf_DebugDump PARAMS((void));
  154. #endif
  155. #endif
  156. /* -eof- */