Protocol.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. ngIRCd - Next Generation IRC Server
  2. http://ngircd.barton.de/
  3. (c)2001-2012 Alexander Barton and Contributors.
  4. ngIRCd is free software and published under the
  5. terms of the GNU General Public License.
  6. -- Protocol.txt --
  7. I. Compatibility
  8. ~~~~~~~~~~~~~~~~
  9. The ngIRCd implements the Internet Relay Chat (IRC) protocol version 2.10
  10. as defined in RFC ("request for comment") 1459 and 2810-2813. These (and
  11. probably further relevant RFCs) are listed in doc/RFC.txt.
  12. Unfortunately, even the "original" ircd doesn't follow these specifications
  13. in all details. But because the ngIRCd should be a fully compatible
  14. replacement for this server ("ircd") it tries to emulate these differences.
  15. If you don't like this behavior please ./configure the ngIRCd using the
  16. "--enable-strict-rfc" command line option. But keep in mind: not all IRC
  17. clients are compatible with a server configured that way, some can't even
  18. connect at all! Therefore this option usually isn't desired for "normal
  19. server operation".
  20. II. The IRC+ Protocol
  21. ~~~~~~~~~~~~~~~~~~~~~
  22. Starting with version 0.5.0, the ngIRCd extends the original IRC protocol
  23. as defined in RFC 2810-2813. This enhanced protocol is named "IRC+". It is
  24. backwards compatible to the "plain" IRC protocol and will only be used by
  25. the ngIRCd if it detects that the peer supports it as well.
  26. The "PASS" command is used to detect the protocol and peer versions see
  27. RFC 2813 (section 4.1.1) and below.
  28. II.1 Register new server link
  29. Command: PASS
  30. Parameters: <password> <version> <flags> [<options>]
  31. Used by: servers only (with these parameters)
  32. <password> is the password for this new server link as defined in the server
  33. configuration which is sent to the peer or received from it.
  34. <version> consists of two parts and is at least 4, at most 14 characters
  35. long: the first four bytes contain the IRC protocol version number, whereas
  36. the first two bytes represent the major version, the last two bytes the
  37. minor version (the string "0210" indicates version 2.10, e.g.).
  38. The following optional(!) 10 bytes contain an implementation-dependent
  39. version number. Servers supporting the IRC+ protocol as defined in this
  40. document provide the string "-IRC+" here.
  41. Example for <version>: "0210-IRC+".
  42. <flags> consists of two parts separated with the character "|" and is at
  43. most 100 bytes long. The first part contains the name of the implementation
  44. (ngIRCd sets this to "ngircd", the original ircd to "IRC", e.g.). The second
  45. part is implementation-dependent and should only be parsed if the peer
  46. supports the IRC+ protocol as well. In this case the following syntax is
  47. used: "<serverversion>[:<serverflags>]".
  48. <serverversion> is an ASCII representation of the clear-text server version
  49. number, <serverflags> indicates the supported IRC+ protocol extensions (and
  50. may be empty!).
  51. The following <serverflags> are defined at the moment:
  52. - C: The server supports the CHANINFO command.
  53. - L: INVITE- and BAN-lists should be synchronized between servers: if the
  54. peer understands this flag, it will send "MODE +I" and "MODE +b"
  55. commands after the server link has been established.
  56. - H: The server supports the "enhanced server handshake", see section II.2
  57. for a detailed description.
  58. - M: Changing client "metadata" (hostname, real name, ...) using the
  59. METADATA command is supported.
  60. - o: IRC operators are allowed to change channel- and channel-user-modes
  61. even if they aren't channel-operator of the affected channel.
  62. - S: The server supports the SERVICE command (on this link).
  63. - X: Server supports XOP channel modes (owner, admin, halfop) and supports
  64. these user prefixes in CHANINFO commands, for example.
  65. - Z: Compressed server links are supported by the server.
  66. Example for a complete <flags> string: "ngircd|0.7.5:CZ".
  67. The optional parameter <options> is used to propagate server options as
  68. defined in RFC 2813, section 4.1.1.
  69. II.2 Enhanced Server Handshake
  70. The "enhanced server handshake" is used when both servers support this IRC+
  71. extension, which is indicated by the 'H' flag in the <serverflags> sent with
  72. the PASS command, see section II.1.
  73. It basically means, that after exchanging the PASS and SERVER commands the
  74. server is not registered in the network (as usual), but that IRC numerics
  75. are exchanged until the numeric 376 (ENDOFMOTD) is received. Afterwards the
  76. peer is registered in the network as with the regular IRC protocol.
  77. A server implementing the enhanced server handshake (and indicating this
  78. using 'H' in the <serverflags>) MUST ignore all unknown numerics to it
  79. silently.
  80. In addition, such a server should at least send the numeric 005 (ISUPPORT)
  81. to its peer, containing the following information. Syntax: <key>=<value>,
  82. one token per IRC parameter. If the server has to send more than 12 token
  83. it must send separate ISUPPORT numerics (this is a limitation of the IRC
  84. protocol which allows at max 15 arguments per command).
  85. - NICKLEN: Maximum nickname length. Default: 9.
  86. - CASEMAPPING: Case mapping used for nick- and channel name comparing.
  87. Default: "ascii", the chars [a-z] are lowercase of [A-Z].
  88. - PREFIX: List of channel modes a person can get and the respective prefix
  89. a channel or nickname will get in case the person has it. The order of the
  90. modes goes from most powerful to least powerful. Default: "(ov)@+"
  91. - CHANTYPES: Supported channel prefixes. Default: "#".
  92. - CHANMODES: List of channel modes for 4 types, separated by comma (","):
  93. Mode that adds or removes a nick or address to a list, mode that changes
  94. a setting (both have always has a parameter), mode that changes a setting
  95. and only has a parameter when set, and mode that changes a setting and
  96. never has a parameter. For example "bI,k,l,imnPst".
  97. - CHANLIMIT: Maximum number of channels allowed to join by channel prefix,
  98. for example "#:10".
  99. Please see <http://www.irc.org/tech_docs/005.html> for details.
  100. The information exchanged using ISUPPORT can be used to detect configuration
  101. incompatibilities (different maximum nickname length, for example) and
  102. therefore to disconnect the peer prior to registering it in the network.
  103. II.3 Exchange channel-modes, topics, and persistent channels
  104. Command: CHANINFO
  105. Parameters: <channel> +<modes> [[<key> <limit>] <topic>]
  106. Used by: servers only
  107. CHANINFO is used by servers to inform each other about a channel: its
  108. modes, channel key, user limits and its topic. The parameter combination
  109. <key> and <limit> is optional, as well as the <topic> parameter, so that
  110. there are three possible forms of this command:
  111. CHANINFO <channel> +<modes>
  112. CHANINFO <channel> +<modes> <topic>
  113. CHANINFO <channel> +<modes> <key> <limit> <topic>
  114. If the channel already exists on the server receiving the CHANINFO command,
  115. it only adopts the <modes> (or the <topic>) if there are no modes (or topic)
  116. already set. It there are already values set the server ignores the
  117. corresponding parameter.
  118. If the channel doesn't exists at all it will be created.
  119. The parameter <key> must be ignored if a channel has no key (the parameter
  120. <modes> doesn't list the "k" channel mode). In this case <key> should
  121. contain "*" because the parameter <key> is required by the CHANINFO syntax
  122. and therefore can't be omitted. The parameter <limit> must be ignored when
  123. a channel has no user limit (the parameter <modes> doesn't list the "l"
  124. channel mode). In this case <limit> should be "0".
  125. II.4 Update webchat/proxy client information
  126. Command: WEBIRC
  127. Parameters: <password> <username> <hostname> <ip-address>
  128. Used by: unregistered clients only
  129. The WEBIRC command is used by some Web-to-IRC gateways to set the correct
  130. user name and host name of users instead of their own. It must be the very
  131. first command sent to the server, even before USER and NICK commands!
  132. The <password> must be set in the server configuration file to prevent
  133. unauthorized clients to fake their identity; it is an arbitrary string.
  134. II.5 Client character encoding conversion
  135. Command: CHARCONV
  136. Parameters: <client-charset>
  137. Used by: registered clients
  138. Replies: RPL_IP_CHARCONV, ERR_IP_CHARCONV
  139. A client can set its character set encoding using the CHARCONV command:
  140. after receiving such a command, the server translates all message data
  141. received from the client using the set <client-charset> to the server
  142. encoding (UTF-8), and all message data which is to be sent to the client
  143. from the server encoding (UTF-8) to <client-charset>.
  144. The list of supported client character sets is implementation dependent.
  145. If a client sets its <client-charset> to the server encoding (UTF-8),
  146. it disables all conversions; the connection behaves as if no CHARCONV
  147. command has been sent at all in this session.
  148. II.6 Update client "metadata"
  149. Command: METADATA
  150. Parameters: <target> <key> <value>
  151. Used by: servers only
  152. The METADATA command is used on server-links to update "metadata" information
  153. of clients, like the hostname, the info text ("real name"), or the user name.
  154. The server updates its client database according to the received <key> and
  155. <value> parameters, and passes the METADATA command on to all the other
  156. servers in the network that support this command (see section II.1 "Register
  157. new server link", <serverflag> "M"), even if it doesn't support the given
  158. <key> itself: unknown <key> names are ignored silently!
  159. The following <key> names are defined:
  160. - "host": the hostname of a client (can't be empty)
  161. - "cloakhost": the cloaked hostname of a client
  162. - "info": info text ("real name") of a client
  163. - "user": the user name of a client (can't be empty)
  164. III. Numerics used by IRC+ Protocol
  165. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  166. The IRC+ protocol uses numerics in the range 800-899 which aren't used by
  167. RFC 2812 and hopefully don't clash with other implementations ...
  168. Numerics 800-849 are used for status and success messages, and numerics
  169. 850-899 are failure and error messages.
  170. III.1 IRC+ status and success numerics
  171. 801 - RPL_IP_CHARCONV
  172. %1 :Client encoding set"
  173. %1 client character set
  174. III.2 IRC+ failure and error numerics
  175. 851 - ERR_IP_CHARCONV
  176. :Can't initialize client encoding