<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfcXXXX.dtd">
<?rfc toc="yes"?>

<rfc ipr="full2026" docName="draft-baudis-irc-capab-00a.dtd">
 <front>

  <title>IRC client capabilities setup protocol</title>

  <author initials="P." surname="Baudis" fullname="Petr Baudis">
   <organization />
   <address>
    <postal>
     <street>Masarykovo nam. 4</street>
     <city>Jihlava</city> <code>58601</code>
     <country>CZ</country>
    </postal>
    <phone>+420 776 584 544</phone>
    <email>pasky@ji.cz</email>
    <uri>http://pasky.ji.cz/</uri>
   </address>
  </author>

  <date month="September" year="2002" />

  <area>Applications</area>
  <keyword>I-D</keyword>
  <keyword>Internet-Draft</keyword>
  <keyword>IRC</keyword>
  <keyword>Internet Relay Chat</keyword>
  <keyword>CAPAB</keyword>
  <keyword>Capabilities</keyword>

  <abstract>

   <t>This memo presents a way for IRC servers and clients to negotiate
optional features of protocol further used for their communication.</t>

  </abstract>

 </front>


 <middle>

  <section title="Introduction">

   <t>Due to the nature of IRC development in the past decade, with most
organizations expanding and altering protocol specifications at will, the
protocol for communication between IRC client and server contains a lot of
slight differences and special unique features depending on the particular
server used. This memo aims to standarize way of announcing such optional
protocol features to clients and way of requesting such features by
clients.</t>

   <section title="Impacts to the server-server Protocols">

    <t>Servers, when interconnected, have the ability to use various different
protocol specifications, usually unique to the IRC server type. Standarizing
compatible server-server communication inside of one IRC network is matter of
the IRC network administration and it does not influence users. Thus,
server-server protocol is not the subject of this specification.</t>

   </section>

   <section title="Current Problems">

    <section title="Bandwidth">

     <t>Due to the explosive growth of IRC, many networks are experiencing
serious problems with raw bandwidth usage of client servers. While
optimizations have been made to the server to server protocol to reduce
bandwidth usage, client side connections still make up the bulk of bandwidth
usage.</t>

     <t>Due to the expanded format of <xref target="RFC1459">RFC 1459</xref>,
there is a substantially large number of ways to address this problem without
rewriting the protocol entirely.</t>

    </section>

    <section title="Compatibility">

     <t>There is a press inside of the IRC developers community to introduce
non-standart changes to the protocol, which could violate the original IRC
specification (<xref target="RFC1459">RFC 1459</xref>) and introduce some
incompatibilities to the client-server communication, resulting in problems
with some clients. Using this specification, client could select only those of
these changes, which it could understand.</t>

    </section>

   </section>

  </section>

  <section title="Protocol Negotiation">

   <t>The primary goals of protocol negotiation are as follows:

   <list style="symbols">

    <t>Flexible expandible format that allows alternative protocol negotiation
systems to be put into place for further altering of the protocol.</t>

    <t>Fully transparent backwards compatibility on the both client and server
side, due to the vast number of clients which will not be compliant for many
years.</t>

   </list></t>

   <t>The protocol capabilities of the actual connection are always maintained
on the server side, which accepts requests and updates from the client.</t>

   <section title="Capab message">

    <figure>

     <preamble>Protocol negotiation happens through the CAPAB (short for
CAPABilities) command. The pseudo BNF representation for this message
is:</preamble>

     <artwork><![CDATA[
<message> ::= "CAPAB" <SPACE> <type> [ <SPACE> : <token> ] <crlf>
<type>    ::= "LS" | "ON" | "ACK" | "NAK"
<token>   ::= [ '-' ] <name> [ '=' <value> ] [ <SPACE> <token> ]
<name>    ::= <letter> { <letter> }
<value>   ::= <letter> { <letter> }

<letter>  ::= <alpha> | <digit> | '_'
<SPACE>   ::= ' ' { ' ' }
<crlf>    ::= CR LF
]]></artwork>

     <postamble>Note that value can be either a number or string which MUST NOT
contain any whitespace characters.</postamble>

    </figure>

    <t>The CAPAB command can be issued at any time by client, even during the
IRC handshake (sending of NICK, USER and possibly PASS). Server can send no
request CAPAB messages, only the informational ones.</t>

    <section title="CAPAB LS">

     <t>This message is used to request or announce the list of supported
capabilities. Only the client sends the capabilities list request and only the
server sends the list of them now.</t>

     <t>If there is no token list sent along the message, it is considered as a
list request. If there is <xref target="captokens">a capability tokens
list</xref> passed with the message, it is considered as the supported
capabilities list which may or may not be a reply to a list request. Note that
the tokens MUST NOT contain value nor any prefix in front of the name.</t>

     <t>Note that the capabilities list can vary depending on the capabilities
already selected by client, so the new capabilities list should be re-retrieved
by client each time when the client will turn on some capabilities
successfully.</t>

    </section>

    <section title="CAPAB ON">

     <t>This message is used by client exclusively to turn on certain protocol
capabilities. The client sends <xref target="captokens">a list of capability
tokens</xref>. The server replies with either CAPAB ACK or CAPAB NAK. Note that
if already set tokens are included in the list, the capability value is
possibly updated.  No value means that the old value is kept and the token is
silently ignored.</t>

    </section>

    <section title="CAPAB ACK">

     <t>This message is used by server to acknowledge the CAPAB ON command
previously issued by client. It means that the server confirmed al the
capabilities sent by the client. They become effective immediatelly after
&lt;crlf&gt; of this message is sent.</t>

    </section>

    <section title="CAPAB NAK">

     <t>This message is used by server to indicate some problem with the list
client sent along the CAPAB ON command. It means that none of these
capabilities become effective. The server SHOULD send the list of capabilities
with unknown name or inappropriate value along this message, with same
restrictions of their list as in CAPAB LS, unless the server couldn't properly
parse the list received from client.</t>

    </section>

   </section>

   <section title="Capability Tokens" anchor="captokens">

    <t>These tokens are formed by optional prefix, capability name and optional
capability value, as described in the pseudo-BNF above. The name length SHOULD
NOT exceed 20 characters nor be less than 3 characters. It should be chosen as
short as possible, while staying meaningful.</t>

    <t>Only one prefix is defined now - a dash ('-'). If it is specified, it
means that the capability should be turned off or reset to the default value,
respectively.</t>

    <t>Note that some capabilities may not be available all the time, but could
be offered by the server only when some other capability(ies) is (are) already
turned on. So, the capabilities can be theoretically formed in a virtual
tree.</t>

    <t>The concrete tokens (names and possibly value types) will be defined in
further documents published by <xref target="community">the IRC development
community</xref>.</t>

   </section>

   <section title="Backwards Compatibility">

    <t>In order to keep a virtually transparent compatibility with RFC 1459,
protocol negotiation must be initiated by the client. This way, earlier clients
not compatible with protocol negotiation can continue their RFC 1459 connection
unaffected. An incompatible server will simply ignore the client initiation.</t>

    <section title="CAPAB during IRC handshake">

     <t>Virtually, the CAPAB commands can be used during IRC handshake as well
as at any other time. However, the client must have some way how to determine
whether the server supports capabilities or not, prone to any possible network
lags.</t>

     <t>Probably the most viable way is using an empty NICK command after
issuing the CAPAB LS command; if 461 numeric is retrieved from the server as a
first message, it means that the server doesn't know how to reply to CAPAB
LS.</t>

     <t>Note that it is recommended to set up the capabilities during the IRC
handshake, as after 001 sent by the server, it may be already too late. For
example, the server can automatically join the client to some channel, or it
would like to send it some special messages during connect. Also see <xref
target="security">Security Considerations</xref>.</t>

    </section>

   </section>

  </section>

  <section title="Further Documents" anchor="community">

   <t>The secondary purpose of this document is to provide a framework for
definition of protocol enhancements. Documents will be published as Internet
Drafts and possibly RFCs, after a careful review by the IRC development
community.</t>

   <t>The IRC development community, as used in this document, is defined as
the authors of prominent software in use. Currently, this consists of
- but is not limited to - the development teams for the major IRC networks
  (including DALnet, EFnet, IRCnet and Undernet), as well as the development
teams for the client packages irssi, BitchX, EPIC, IRCle, and mIRC. These
people (as now) are listed <xref target="ircpeople">below</xref>.</t>

   <section title="Requirements">

    <t>All further specifications MUST be reviewed by the development
community. In order for this review to take place, the author must contact the
protocol discussion email list. The current list address is proto-desc@dal.net.
The administrative contact for this list is epiphani@dal.net.</t>

   </section>

  </section>

  <section title="Security Considerations" anchor="security">

   <t>In order to prevent possible man-in-the-middle attacks, any
security-related capabilities should be issued as soon as possible, preferrably
already during handshake. This involves for example TLS setup.</t>

  </section>

 </middle>


 <back>

  <references>
   <reference anchor="RFC1459">
    <front>
     <title>Internet Relay Chat Protocol</title>
     <author initials="J." surname="Oikarinen" fullname="Jarkko Oikarinen">
      <address>
       <postal>
	<street>Tuirantie 17 as 9</street>
	<city>Oulu</city> <code>90500</code>
	<country>FI</country>
       </postal>
       <email>jto@tolsun.oulu.fi</email>
      </address>
     </author>
     <author initials="D." surname="Reed" fullname="Darren Reed">
      <address>
       <postal>
	<street>4 Pateman Street</street>
	<city>Watsonia</city> <region>Victoria</region> <code>3087</code>
	<country>AU</country>
       </postal>
       <email>avalon@coombs.anu.edu.au</email>
      </address>
     </author>
     <date month="May" year="1993" />
    </front>
    <seriesInfo name="RFC" value="1459" />
   </reference>
  </references>

  <section title="Acknowledgements" anchor="ircpeople">

   <t>The author especially gratefully acknowledges the contributions of: Lee
Hardy, Timo Sirainen, Piotr Kucharski, Jakub Vlasek and others.</t>

   <t>The following people are part of the proto-desc@dal.net protocol
discussion list. They have provided support, input and critism to this
document.</t>

   <list style="symbols">
    <t>... Name, Email address, Affiliation ...</t>
    <t>... Name, Email address, Affiliation ...</t>
    <t>... Name, Email address, Affiliation ...</t>
   </list>

  </section>
 </back>
</rfc>
