conf.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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.34 2005/03/20 13:54:06 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 "portab.h"
  20. typedef struct _Conf_Oper
  21. {
  22. char name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */
  23. char pwd[CLIENT_PASS_LEN]; /* Password */
  24. char *mask;
  25. } CONF_OPER;
  26. typedef struct _Conf_Server
  27. {
  28. char host[HOST_LEN]; /* Hostname */
  29. char ip[16]; /* IP address (Resolver) */
  30. char name[CLIENT_ID_LEN]; /* IRC-Client-ID */
  31. char pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */
  32. char pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */
  33. UINT16 port; /* Server port */
  34. int group; /* Group of server */
  35. time_t lasttry; /* Last connect attempt */
  36. RES_STAT *res_stat; /* Status of the resolver */
  37. int flags; /* Flags */
  38. CONN_ID conn_id; /* ID of server connection or NONE */
  39. } CONF_SERVER;
  40. typedef struct _Conf_Channel
  41. {
  42. char name[CHANNEL_NAME_LEN]; /* Name of the channel */
  43. char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
  44. char topic[CHANNEL_TOPIC_LEN]; /* Initial topic */
  45. } CONF_CHANNEL;
  46. #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
  47. #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
  48. /* Name ("Nick") of the servers */
  49. GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
  50. /* Server info text */
  51. GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
  52. /* Global server passwort */
  53. GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
  54. /* Administrative information */
  55. GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
  56. GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
  57. GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
  58. /* File with MOTD text */
  59. GLOBAL char Conf_MotdFile[FNAME_LEN];
  60. /* Phrase with MOTD text */
  61. GLOBAL char Conf_MotdPhrase[LINE_LEN];
  62. /* Ports the server should listen on */
  63. GLOBAL UINT16 Conf_ListenPorts[MAX_LISTEN_PORTS];
  64. GLOBAL int Conf_ListenPorts_Count;
  65. /* Address to which the socket should be bound or empty (=all) */
  66. GLOBAL char Conf_ListenAddress[16];
  67. /* User and group ID the server should run with */
  68. GLOBAL unsigned int Conf_UID;
  69. GLOBAL unsigned int Conf_GID;
  70. /* A directory to chroot() in */
  71. GLOBAL char Conf_Chroot[FNAME_LEN];
  72. /* File with PID of daemon */
  73. GLOBAL char Conf_PidFile[FNAME_LEN];
  74. /* Timeouts for PING and PONG */
  75. GLOBAL int Conf_PingTimeout;
  76. GLOBAL int Conf_PongTimeout;
  77. /* Seconds between connect attempts to other servers */
  78. GLOBAL int Conf_ConnectRetry;
  79. /* Operators */
  80. GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
  81. GLOBAL int Conf_Oper_Count;
  82. /* Servers */
  83. GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
  84. /* Pre-defined channels */
  85. GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
  86. GLOBAL int Conf_Channel_Count;
  87. /* Are IRC operators allowed to always use MODE? */
  88. GLOBAL bool Conf_OperCanMode;
  89. /* If an IRC op gives chanop privileges without being a chanop,
  90. * ircd2 will ignore the command. This enables a workaround:
  91. * It masks the command as coming from the server */
  92. GLOBAL bool Conf_OperServerMode;
  93. /* Maximum number of connections to this server */
  94. GLOBAL long Conf_MaxConnections;
  95. /* Maximum number of channels a user can join */
  96. GLOBAL int Conf_MaxJoins;
  97. /* Maximum number of connections per IP address */
  98. GLOBAL int Conf_MaxConnectionsIP;
  99. GLOBAL void Conf_Init PARAMS((void ));
  100. GLOBAL void Conf_Rehash PARAMS((void ));
  101. GLOBAL int Conf_Test PARAMS((void ));
  102. GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
  103. GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
  104. GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
  105. GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port ));
  106. GLOBAL bool Conf_DisableServer PARAMS(( char *Name ));
  107. GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ));
  108. #endif
  109. /* -eof- */