defines.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. * Copyright (c)2001-2012 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 256
  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 16
  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. /* Hard-coded (default) options */
  45. /** Delay after startup before outgoing connections are initiated in seconds. */
  46. #define STARTUP_DELAY 1
  47. /** Time to delay re-connect attempts in seconds. */
  48. #define RECONNECT_DELAY 3
  49. /** Configuration file name. */
  50. #define CONFIG_FILE "/ngircd.conf"
  51. /** Name of the MOTD file. */
  52. #define MOTD_FILE "/ngircd.motd"
  53. /** Default chroot() directory. */
  54. #define CHROOT_DIR ""
  55. /** Default file for the process ID. */
  56. #define PID_FILE ""
  57. /* Sizes of "IRC elements": nicks, users, ... */
  58. /** Max. length of an IRC ID (incl. NULL); see RFC 2812 section 1.1 and 1.2.1. */
  59. #define CLIENT_ID_LEN 64
  60. /** Default nick length (including NULL), see. RFC 2812 section 1.2.1. */
  61. #define CLIENT_NICK_LEN_DEFAULT 10
  62. /** Maximum nickname length (including NULL). */
  63. #define CLIENT_NICK_LEN 32
  64. /** Max. password length (including NULL). */
  65. #define CLIENT_PASS_LEN 21
  66. /** Max. length of user name ("login"; incl. NULL), RFC 2812, section 1.2.1. */
  67. #ifndef STRICT_RFC
  68. # define CLIENT_USER_LEN 20
  69. #else
  70. # define CLIENT_USER_LEN 10
  71. #endif
  72. /** Max. length of "real names" (including NULL). */
  73. #define CLIENT_NAME_LEN 32
  74. /** Max. host name length (including NULL). */
  75. #define CLIENT_HOST_LEN 64
  76. /** Max. length of all client modes (including NULL). */
  77. #define CLIENT_MODE_LEN 21
  78. /** Max. length of server info texts (including NULL). */
  79. #define CLIENT_INFO_LEN 64
  80. /** Max. length of away messages (including NULL). */
  81. #define CLIENT_AWAY_LEN 128
  82. /** Max. length of client flags (including NULL). */
  83. #define CLIENT_FLAGS_LEN 16
  84. /** Max. length of a channel name (including NULL), see RFC 2812 section 1.3. */
  85. #define CHANNEL_NAME_LEN 51
  86. /** Max. length of channel modes (including NULL). */
  87. #define CHANNEL_MODE_LEN 21
  88. /** Max. IRC command length (including NULL), see. RFC 2812 section 3.2. */
  89. #define COMMAND_LEN 513
  90. /* Read and write buffer sizes */
  91. /** Size of the read buffer of a connection in bytes. */
  92. #define READBUFFER_LEN 2048
  93. /** Size that triggers write buffer flushing if more space is needed. */
  94. #define WRITEBUFFER_FLUSH_LEN 4096
  95. /** Maximum size of the write buffer of a connection in bytes. */
  96. #define WRITEBUFFER_MAX_LEN 32768
  97. /** Maximum size of the write buffer of a server link connection in bytes. */
  98. #define WRITEBUFFER_SLINK_LEN 65536
  99. /* IRC/IRC+ protocol */
  100. /** Implemented IRC protocol version, see RFC 2813 section 4.1.1. */
  101. #define PROTOVER "0210"
  102. /** Protocol suffix, see RFC 2813 section 4.1.1. */
  103. #define PROTOIRC "-IRC"
  104. /** Protocol suffix used by the IRC+ protocol, see <doc/Protocol.txt>. */
  105. #define PROTOIRCPLUS "-IRC+"
  106. #ifdef IRCPLUS
  107. /** Standard IRC+ flags. */
  108. # define IRCPLUSFLAGS "CHLMSX"
  109. #endif
  110. /** Supported user modes. */
  111. #define USERMODES "abBcCioqrRswx"
  112. /** Supported channel modes. */
  113. #define CHANMODES "abehiIklmMnoOPqQrRstvVz"
  114. /** Away message for users connected to linked servers. */
  115. #define DEFAULT_AWAY_MSG "Away"
  116. /** Default ID for "topic owner". */
  117. #define DEFAULT_TOPIC_ID "-Server-"
  118. /** Prefix for NOTICEs from the server to users. Some servers use '*'. */
  119. #define NOTICE_TXTPREFIX ""
  120. /** Suffix for oversized messages that have been shortened and cut off. */
  121. #define CUT_TXTSUFFIX "[CUT]"
  122. /* Defaults and limits for IRC commands */
  123. /** Max. number of elemets allowed in channel invite and ban lists. */
  124. #define MAX_HNDL_CHANNEL_LISTS 50
  125. /** Max. number of channel modes with arguments per MODE command. */
  126. #define MAX_HNDL_MODES_ARG 5
  127. /** Max. number of WHO replies. */
  128. #define MAX_RPL_WHO 25
  129. /** Max. number of WHOIS replies. */
  130. #define MAX_RPL_WHOIS 10
  131. /** Default count of WHOWAS command replies. */
  132. #define DEF_RPL_WHOWAS 5
  133. /** Max count of WHOWAS command replies. */
  134. #define MAX_RPL_WHOWAS 25
  135. #endif
  136. /* -eof- */