defines.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
  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. #ifndef __defines_h__
  12. #define __defines_h__
  13. /**
  14. * @file
  15. * Global constants ("#defines") used by the ngIRCd.
  16. */
  17. /* Internal flags */
  18. /** Flag: there is no connection. */
  19. #define NONE -1
  20. /** Flag: connection is (still) established. */
  21. #define CONNECTED true
  22. /** Flag: connection isn't established (any more). */
  23. #define DISCONNECTED false
  24. /** Tag for outbound server links. */
  25. #define TOKEN_OUTBOUND -2
  26. /* Generic buffer sizes */
  27. /** Max. length of a line in the configuration file. */
  28. #define LINE_LEN 1024
  29. /** Max. length of a log message. */
  30. #define MAX_LOG_MSG_LEN 256
  31. /** Max. length of file name. */
  32. #define FNAME_LEN 256
  33. /** Max. length of fully qualified host names (e. g. "abc.domain.tld"). */
  34. #define HOST_LEN 256
  35. /** Max. length of random salt */
  36. #define RANDOM_SALT_LEN 32
  37. /* Size of structures */
  38. /** Max. count of configurable servers. */
  39. #define MAX_SERVERS 64
  40. /** Max. number of WHOWAS list items that can be stored. */
  41. #define MAX_WHOWAS 64
  42. /** Size of default connection pool. */
  43. #define CONNECTION_POOL 100
  44. /** Size of buffer for PAM service name. */
  45. #define MAX_PAM_SERVICE_NAME_LEN 64
  46. /* Hard-coded (default) options */
  47. /** Delay after startup before outgoing connections are initiated in seconds. */
  48. #define STARTUP_DELAY 1
  49. /** Time to delay re-connect attempts in seconds. */
  50. #define RECONNECT_DELAY 3
  51. /** Configuration file name. */
  52. #define CONFIG_FILE "/ngircd.conf"
  53. /** Directory containing optional configuration snippets. */
  54. #define CONFIG_DIR "/ngircd.conf.d"
  55. /** Name of the MOTD file. */
  56. #define MOTD_FILE "/ngircd.motd"
  57. /** Name of the help file. */
  58. #define HELP_FILE "/Commands.txt"
  59. /** Default chroot() directory. */
  60. #define CHROOT_DIR ""
  61. /** Default file for the process ID. */
  62. #define PID_FILE ""
  63. /* Sizes of "IRC elements": nicks, users, ... */
  64. /** Max. length of an IRC ID (incl. NULL); see RFC 2812 section 1.1 and 1.2.1. */
  65. #define CLIENT_ID_LEN 64
  66. /** Default nick length (including NULL), see. RFC 2812 section 1.2.1. */
  67. #define CLIENT_NICK_LEN_DEFAULT 10
  68. /** Maximum nickname length (including NULL). */
  69. #define CLIENT_NICK_LEN 32
  70. /** Max. password length (including NULL). */
  71. #define CLIENT_PASS_LEN 65
  72. /** Max. length of user name ("login"; incl. NULL), RFC 2812, section 1.2.1. */
  73. #ifndef STRICT_RFC
  74. # define CLIENT_USER_LEN 20
  75. #else
  76. # define CLIENT_USER_LEN 10
  77. #endif
  78. /** Max. length of user names saved for authentication (used by PAM) */
  79. #ifdef PAM
  80. # define CLIENT_AUTHUSER_LEN 64
  81. #endif
  82. /** Max. length of "real names" (including NULL). */
  83. #define CLIENT_NAME_LEN 32
  84. /** Max. host name length (including NULL). */
  85. #define CLIENT_HOST_LEN 64
  86. /** Max. mask lenght (including NULL). */
  87. #define MASK_LEN (2 * CLIENT_HOST_LEN)
  88. /** Max. length of all client modes (including NULL). */
  89. #define CLIENT_MODE_LEN 21
  90. /** Max. length of server info texts (including NULL). */
  91. #define CLIENT_INFO_LEN 128
  92. /** Max. length of away messages (including NULL). */
  93. #define CLIENT_AWAY_LEN 128
  94. /** Max. length of client flags (including NULL). */
  95. #define CLIENT_FLAGS_LEN 16
  96. /** Max. length of a channel name (including NULL), see RFC 2812 section 1.3. */
  97. #define CHANNEL_NAME_LEN 51
  98. /** Max. length of channel modes (including NULL). */
  99. #define CHANNEL_MODE_LEN 21
  100. /** Max. IRC command length (including NULL), see. RFC 2812 section 3.2. */
  101. #define COMMAND_LEN 513
  102. /* Read and write buffer sizes */
  103. /** Size of the read buffer of a connection in bytes. */
  104. #define READBUFFER_LEN 2048
  105. /** Size that triggers write buffer flushing if more space is needed. */
  106. #define WRITEBUFFER_FLUSH_LEN 4096
  107. /** Maximum size of the write buffer of a connection in bytes. */
  108. #define WRITEBUFFER_MAX_LEN 32768
  109. /** Maximum size of the write buffer of a server link connection in bytes. */
  110. #define WRITEBUFFER_SLINK_LEN 65536
  111. /* IRC/IRC+ protocol */
  112. /** Implemented IRC protocol version, see RFC 2813 section 4.1.1. */
  113. #define PROTOVER "0210"
  114. /** Protocol suffix, see RFC 2813 section 4.1.1. */
  115. #define PROTOIRC "-IRC"
  116. /** Protocol suffix used by the IRC+ protocol, see <doc/Protocol.txt>. */
  117. #define PROTOIRCPLUS "-IRC+"
  118. #ifdef IRCPLUS
  119. /** Standard IRC+ flags. */
  120. # define IRCPLUSFLAGS "CHLMSX"
  121. #endif
  122. /** Supported user modes. */
  123. #define USERMODES "abBcCFiIoqrRswx"
  124. /** Supported channel modes. */
  125. #define CHANMODES "abehiIklmMnoOPqQrRstvVz"
  126. /** Supported channel types. */
  127. #define CHANTYPES "#&+"
  128. /** Away message for users connected to linked servers. */
  129. #define DEFAULT_AWAY_MSG "Away"
  130. /** Default ID for "topic owner". */
  131. #define DEFAULT_TOPIC_ID "-Server-"
  132. /** Prefix for NOTICEs from the server to users. Some servers use '*'. */
  133. #define NOTICE_TXTPREFIX ""
  134. /** Suffix for oversized messages that have been shortened and cut off. */
  135. #define CUT_TXTSUFFIX "[CUT]"
  136. /* Defaults and limits for IRC commands */
  137. /** Max. number of elemets allowed in channel invite and ban lists. */
  138. #define MAX_HNDL_CHANNEL_LISTS 50
  139. /** Max. number of channel modes with arguments per MODE command. */
  140. #define MAX_HNDL_MODES_ARG 5
  141. /** Max. number of targets per PRIVMSG/NOTICE/... command. */
  142. #define MAX_HNDL_TARGETS 25
  143. /** Max. number of WHO replies. */
  144. #define MAX_RPL_WHO 25
  145. /** Max. number of WHOIS replies. */
  146. #define MAX_RPL_WHOIS 10
  147. /** Default count of WHOWAS command replies. */
  148. #define DEF_RPL_WHOWAS 5
  149. /** Max count of WHOWAS command replies. */
  150. #define MAX_RPL_WHOWAS 25
  151. #endif
  152. /* -eof- */