conf.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. * Copyright (c)2001,2002 by 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. * $Id: conf.h,v 1.49 2008/03/18 20:12:47 fw Exp $
  12. *
  13. * Configuration management (header)
  14. */
  15. #ifndef __conf_h__
  16. #define __conf_h__
  17. #include <time.h>
  18. #include "defines.h"
  19. #include "array.h"
  20. #include "portab.h"
  21. #include "tool.h"
  22. #include "ng_ipaddr.h"
  23. typedef struct _Conf_Oper
  24. {
  25. char name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */
  26. char pwd[CLIENT_PASS_LEN]; /* Password */
  27. char *mask;
  28. } CONF_OPER;
  29. typedef struct _Conf_Server
  30. {
  31. char host[HOST_LEN]; /* Hostname */
  32. char name[CLIENT_ID_LEN]; /* IRC-Client-ID */
  33. char pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */
  34. char pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */
  35. UINT16 port; /* Server port */
  36. int group; /* Group of server */
  37. time_t lasttry; /* Last connect attempt */
  38. RES_STAT res_stat; /* Status of the resolver */
  39. int flags; /* Flags */
  40. CONN_ID conn_id; /* ID of server connection or NONE */
  41. ng_ipaddr_t bind_addr; /* source address to use for outgoing connections */
  42. ng_ipaddr_t dst_addr[2]; /* list of addresses to connect to */
  43. } CONF_SERVER;
  44. typedef struct _Conf_Channel
  45. {
  46. char name[CHANNEL_NAME_LEN]; /* Name of the channel */
  47. char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
  48. char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
  49. unsigned long maxusers; /* maximum usercount for this channel, mode "l" */
  50. array topic; /* Initial topic */
  51. } CONF_CHANNEL;
  52. #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
  53. #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
  54. /* Name ("Nick") of the servers */
  55. GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
  56. /* Server info text */
  57. GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
  58. /* Global server passwort */
  59. GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
  60. /* Administrative information */
  61. GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
  62. GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
  63. GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
  64. /* File with MOTD text */
  65. GLOBAL char Conf_MotdFile[FNAME_LEN];
  66. /* Phrase with MOTD text */
  67. GLOBAL char Conf_MotdPhrase[LINE_LEN];
  68. /* Ports the server should listen on */
  69. GLOBAL array Conf_ListenPorts;
  70. /* Address to which the socket should be bound or empty (=all) */
  71. GLOBAL char *Conf_ListenAddress;
  72. /* User and group ID the server should run with */
  73. GLOBAL uid_t Conf_UID;
  74. GLOBAL gid_t Conf_GID;
  75. /* A directory to chroot() in */
  76. GLOBAL char Conf_Chroot[FNAME_LEN];
  77. /* File with PID of daemon */
  78. GLOBAL char Conf_PidFile[FNAME_LEN];
  79. /* Timeouts for PING and PONG */
  80. GLOBAL int Conf_PingTimeout;
  81. GLOBAL int Conf_PongTimeout;
  82. /* Seconds between connect attempts to other servers */
  83. GLOBAL int Conf_ConnectRetry;
  84. /* Operators */
  85. GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
  86. GLOBAL unsigned int Conf_Oper_Count;
  87. /* Servers */
  88. GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
  89. /* Pre-defined channels */
  90. GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
  91. GLOBAL unsigned int Conf_Channel_Count;
  92. /* Pre-defined channels only */
  93. GLOBAL bool Conf_PredefChannelsOnly;
  94. /* Are IRC operators allowed to always use MODE? */
  95. GLOBAL bool Conf_OperCanMode;
  96. /* Disable all DNS functions? */
  97. GLOBAL bool Conf_NoDNS;
  98. /*
  99. * try to connect to remote systems using the ipv6 protocol,
  100. * if they have an ipv6 address? (default yes)
  101. */
  102. GLOBAL bool Conf_ConnectIPv6;
  103. /* same as above, but for ipv4 hosts, default: yes */
  104. GLOBAL bool Conf_ConnectIPv4;
  105. /* If an IRC op gives chanop privileges without being a chanop,
  106. * ircd2 will ignore the command. This enables a workaround:
  107. * It masks the command as coming from the server */
  108. GLOBAL bool Conf_OperServerMode;
  109. /* Maximum number of connections to this server */
  110. GLOBAL long Conf_MaxConnections;
  111. /* Maximum number of channels a user can join */
  112. GLOBAL int Conf_MaxJoins;
  113. /* Maximum number of connections per IP address */
  114. GLOBAL int Conf_MaxConnectionsIP;
  115. /* Maximum length of a nick name */
  116. GLOBAL unsigned int Conf_MaxNickLength;
  117. GLOBAL void Conf_Init PARAMS((void));
  118. GLOBAL bool Conf_Rehash PARAMS((void));
  119. GLOBAL int Conf_Test PARAMS((void));
  120. GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
  121. GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
  122. GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
  123. GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port ));
  124. GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
  125. GLOBAL bool Conf_DisableServer PARAMS(( char *Name ));
  126. GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ));
  127. #endif
  128. /* -eof- */