<?rfc toc="yes"?>
<rfc ipr="full2026" docName="draft-smith-irc-dcc2-files-00">
	<front>
		<title abbrev="IRC DCC2 File Transfers">Updated Internet Relay Chat (IRC) Client to Client Protocol (DCC2) File Transfers</title>
		<author initials="D." surname="Smith" fullname="Dan Smith" role="editor">
			<organization abbrev="Algenta">Algenta Technologies L.L.C.</organization>
			<address>
				<postal>
					<street>1640 Sky Line Dr</street>
					<city>Stevens Point</city>
					<code>54481</code>
					<country>USA</country>
					<region>WI</region>
				</postal>
				<phone>01-608-213-2867</phone>
				<email>dan @ algenta</email>
				<uri>http://www.algenta.com</uri>
			</address>
		</author>
		<date day="7" month="May" year="2004"/>
		<area>Internet</area>
		<keyword>I-D</keyword>
		<keyword>Internet-Draft</keyword>
		<keyword>IRC</keyword>
		<keyword>DCC</keyword>
		<keyword>DCC2</keyword>
		<abstract>
			<t>The Direct Client Connection v2 (DCC2) specification describes how to create file transfers between individual IRC clients.  This draft describes two direct client connection file transfer protocols, a singe file transfer protocol with file details exchanged over IRC and an advanced multi-file protocol with file details exchanged over a direct client connection.</t>
		</abstract>
	</front>
	<middle>
		<section title="Introduction">
			<section title="Background">
				<t>
			The Direct Client Connection 2.0 (DCC2) is a specification currently under development by the <eref target="http://www.dcc2.org/">Client Connection 2.0 community</eref>.
			</t>
				<t>
DCC2 creates a framework for standardized connection negotiation between IRC clients. DCC2's design allows clients to automatically negotiate acceptable connection parameters, and makes it possible for users' clients to review the parameters and automate decision-making in the connection negotiation process.
</t>
				<t>
For more information on the DCC2 specification please consult the <eref target="http://www.dcc2.org/">DCC2 community documentation</eref>.
</t>
			</section>
			<section title="Motivation">
				<t>
The current DCC protocol does not address IPv4 vs. IPv6 issues, SSL/TLS encryption negotiation, NAT and Firewall traversal, and multiple file/directory file transfers.  DCC file transfers are also flawed in requiring acknowledgement of received bytes during the transfer, something that the underlying TCP protocol already ensures.  Many IRC clients have implemented extensions that try to solve these problems, but the result has been fragmentation of the DCC protocol.  This fragmentation is to a point where only the most simple functions work between different clients.  
</t>
				<t>
DCC2 has been introduced to solve these problems and insure interoperability between all IRC clients.  The DCC2 negotiation system has also been designed to be extensible to incorporate future technological developments more easily that the original IRCII DCC implementation.
</t>
			</section>
			<section title="Conventions">
				<t>
The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "MAY" in this document are to be interpreted as described in <xref target="RFC2119">RFC-2119</xref>.
</t>
			</section>
		</section>
		<section title="DCC2 Overview">
			<t>
		DCC2 allows IRC clients to negotiate connection settings using a handshake mechanism for agreement to protocol usage.  Protocols available on the offering client are published to the receiving client.  The receiving client can then reply to the offering client, listing the subset of the available protocols that must be used.  The receiving client also has the option to open the connection if the offering client cannot accept incoming connections.</t>
			<t>The available protocols and options are presented as a list of space separated tokens or token=value pairs.  These tokens are standardized and listed here.  Additional tokens can be added through the DCC2.org community process.</t>
		</section>
		<section title="File Transfers">
			<section title="Single File">
				<t>Single file transfers are initiated over IRC using the DCC2 negotiation protocol.  File name, size, and an optional offset are exchanged via IRC messages.  This exchange is covered in the DCC2 negotiation documentation.</t>
				<t>
		After a TCP connection has been established, the offering client sends all the bytes of the file to the receiving client.  The receiving client reads bytes from the connection until SIZE bytes have been read.  In the case of an offset, the client will read SIZE-OFFSET bytes.  When all bytes have been transferred, the
		receiving client must close the connection.		
		</t>
			</section>
			<section title="Multi File Transfers">
				<section title="Motivation">
					<t>With a file transfer established outside of IRC, it is possible to send multiple files and directories since message length is not restricted. This is useful for sending multiple files without possibly being kicked off an IRC server for flooding, or for sending documents in a directory structure.  With additional file metadata, file hashes can optionally be obtained and checked.  Privacy is also increased since file name and size information can be transferred directly between clients without revealing information to a IRC server.  For added privacy, file transfers can optionally be encrypted.</t>
				</section>
				<section title="Method">
					<t>
		After a TCP connection has been established, the offering client sends all the bytes of the Multi File header description to the receiving client.  The receiving client
		reads the header description and sends requests for files over the connection using an identifier, or an identifier and an offset.  The offering client sends the bytes of the requested files in the order the requests arrived.  When the receiving client has received a the files that it wants from the published files list, the receiving client sends a complete message and closes the connection.</t>
				</section>
				<section title="Multi Send Syntax">
					<t>
The DCC2 MULTI protocol allows the receiving client to request a file from a published set, resuming of a file in a published set, and the ability to end a session.  Only the receiving client may send any commands over the connection.  All messages end with the newline character.  The offering client must not send any command syntax.  The syntax follows, specified using ABNF rules (as per <xref target="RFC2234">RFC2234</xref>): 
<figure>
							<artwork>
dcc2-multi = dcc2-multireq | dcc2-multiend LF

dcc2-multireq       = `SEND FILE=' 1*(alpha|digit) [ space 'OFFSET=' 1*digit ] 

dcc2-multiend = 'COMPLETE'                                                                         
</artwork>
						</figure>
					</t>
					<figure>
						<preamble>Example Receiving client commands</preamble>
						<artwork>
SEND FILE=0
SEND FILE=1 OFFSET=3429342
SEND FILE=2
COMPLETE
</artwork>
					</figure>
				</section>
				<section title="Multi Header">
					<section title="Description">
						<t>The header defines all files that are present in a file transfer.  Each file consists of a series of name:value pairs of metadata.  Each file section is seperated by a double newline.  The syntax follows, specified using ABNF rules (as per <xref target="RFC2234">RFC2234</xref>): 
<figure>
								<artwork>
multi = file-section 0*(LF LF file-section)

file-section = header-section 0*(header-section)

header-section = 1*(alpha | digit | '-') ':' SPACE header-value LF

header-value = 1*(%x01-09 | %x0B-7F) 
</artwork>
							</figure>
						</t>
					</section>
					<section title="Required Header Fields">
						<section title="id">
							<t>A unique value in this header, used to request a file.</t>
						</section>
						<section title="name">
							<t>A file name, or a relative path and file name.</t>
						</section>
						<section title="size">
							<t>The file size in bytes.</t>
						</section>
					</section>
					<section title="Optional Header Fields">
						<section title="description">
							<t>A human readable file description.</t>
						</section>
						<section title="sha1">
							<t>A SHA1 file hash, as described by RFC 3174.</t>
						</section>
						<section title="content-type">
							<t>The MIME type of the file.</t>
						</section>
					</section>
					<section title="Example">
						<t>Example Header document:
		<figure>
								<artwork><![CDATA[
id: 1
name: /trip-photos/1.jpg
size: 435321

id: 2a
name: /trip-photos/2.jpg
size: 542672

id: 4
name: /trip-photos/17.jpg
size: 203428
description: Me and my girl at the airport
sha1: a9993e364706816aba3e25717850c26c9cd0d89d
content-type: image/jpeg
]]></artwork>
							</figure>
						</t>
					</section>
				</section>
			</section>
		</section>
		<section title="Security Considerations">
			<t>Ports under 1024 are privileged on most systems, and should not be used for direct client connections.</t>
			<t>IRC client writers should be careful with directory structures when dealing with file sharing operations.  Relative paths can using ../ can lead to security
			risks</t>
			<t>IRC clients should look carefully at the speed of sending DCC2 REFUSED and DCC2 CANNOTACCEPT due to the potential for flooding attacks.  When possible the messages should be sent to give the user context as to why the transfer failed</t>
		</section>
		<section title="Notes">
			<t>
This draft is also present on the DCC2 site at the address 
<eref target="http://www.dcc2.org/specifications/draft-smith-irc-dcc2-files-00.txt">http://www.dcc2.org/specifications/draft-smith-irc-dcc2-files-00.txt</eref>. 
Enriched HTML and XML versions can be found at the addresses 
<eref target="http://www.dcc2.org/specifications/draft-smith-irc-dcc2-files-00.html">http://www.dcc2.org/specifications/draft-smith-irc-dcc2-files-00.htm</eref> and
<eref target="http://www.dcc2.org/specifications/draft-smith-irc-dcc2-files-00.xml">http://www.dcc2.org/specifications/draft-smith-irc-dcc2-files-00.xml</eref> respectively. The XML version 
is compliant to <xref target="RFC2629">RFC-2629</xref>.
</t>
		</section>
		<section title="Acknowledgments">
			<t>  
This draft was produced by the 
<eref target="http://www.dcc2.org/">DCC2 community</eref>; 
please see 
<eref target="http://www.dcc2.org/members/">authors and contributors</eref>.</t>
			<t>Thanks to Marshall Rose for his conversion tools from the 
<xref target="RFC2629">RFC-2629</xref> XML format to HTML and RFC.</t>
		</section>
	</middle>
	<back>
		<references title="References">
			<reference anchor="RFC2119">
				<front>
					<title>Key words for use in RFCs to Indicate Requirement Levels</title>
					<author initials="S.O." surname="Bradner" fullname="Scott O. Bradner">
						<organization>Harvard University</organization>
						<address>
							<postal>
								<street>Holyoke Center, Room 813</street>
								<street>1350 Massachusettes Avenue</street>
								<city>Cambridge</city>
								<region>MA</region>
								<code>02138</code>
								<country>US</country>
							</postal>
							<phone>+1 617 495 3864</phone>
							<email>sob@harvard.edu</email>
						</address>
					</author>
					<date month="March" year="1997"/>
				</front>
				<seriesInfo name="RFC" value="2119"/>
				<seriesInfo name="BCP" value="14"/>
			</reference>
			<reference anchor="RFC2629">
				<front>
					<title>Writing I-Ds and RFCs using XML</title>
					<author initials="M.T." surname="Rose" fullname="Marshall T. Rose">
						<organization>Invisible Worlds, Inc.</organization>
						<address>
							<postal>
								<street>660 York Street</street>
								<city>San Francisco</city>
								<region>CA</region>
								<code>94110</code>
								<country>US</country>
							</postal>
							<phone>+1 415 695 3975</phone>
							<email>mrose@not.invisible.net </email>
							<uri>http://invisible.net/</uri>
						</address>
					</author>
					<date month="June" year="1999"/>
				</front>
				<seriesInfo name="RFC" value="2629"/>
			</reference>
			<reference anchor="RFC2234">
				<front>
					<title>Augmented BNF for Syntax Specifications: ABNF</title>
					<author initials="D." surname="Crocker" fullname="D. Crocker">
						<organization>Demon Internet Ltd.</organization>
					</author>
					<author initials="P." surname="Overel" fullname="P. Overel">
						<organization>Demon Internet Ltd.</organization>
					</author>
					<date month="November" year="1997"/>
				</front>
				<seriesInfo name="RFC" value="2234"/>
			</reference>
		</references>
	</back>
</rfc>
