<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc subcompact="no"?>
<?rfc symrefs="yes"?>
<?rfc comments="yes" ?>
<?rfc inline="yes" ?>

<rfc ipr="trust200902" category="info" docName='draft-melnikov-email-over-pmul-01'>
  <front>
    <title abbrev="Email over ACP 142">
      Mail Transfer Protocol over ACP 142
    </title>
    <author initials="D." surname="Wilson" fullname="David Wilson">
      <organization>Isode Ltd</organization>
      <address>
        <postal>
          <street>14 Castle Mews</street>
          <city>Hampton</city>
          <region>Middlesex</region>
          <code>TW12 2NP</code>
          <country>UK</country>
        </postal>
        <email>David.Wilson@isode.com</email>
      </address>
    </author>
    <author role="editor" initials="A." surname="Melnikov" fullname="Alexey Melnikov">
      <organization>Isode Ltd</organization>
      <address>
        <postal>
          <street>14 Castle Mews</street>
          <city>Hampton</city>
          <region>Middlesex</region>
          <code>TW12 2NP</code>
          <country>UK</country>
        </postal>
        <email>Alexey.Melnikov@isode.com</email>
      </address>
    </author>

    <date year="2017" />
    
    <!--One or more extra keywords which don't appear in the title-->
    <keyword>P_Mul</keyword>
      
    <abstract>

    <t>
      ACP 142 defines P_Mul, which is a protocol for reliable multicast in bandwidth constrained and
      delayed acknowledgement (EMCON) environments running over UDP.
      This document is a specification of the basic protocol for
      electronic mail transfer over P_MUL. It also described how to gateway
      this basic protocol to/from Simple Mail Transfer Protocol (RFC 5321).
    </t>
	
    </abstract>
    
  </front>
  <middle>

    <section title="Introduction">

      <t>
        P_MUL <xref target="ACP142A"/> is a protocol for reliable multicast in bandwidth constrained and
        delayed acknowledgement environments running over UDP. The objectives of
        this protocol are first to take advantage of the bandwidth saving
        feature of using the multicast service as supported by modern
        computer networks and second to allow message transfer under EMCON
        conditions. EMCON (Emission Control) or "Radio Silence" means that, although receiving
        nodes are able to receive messages, they are not able to acknowledge
        the receipt of messages.
      </t>

      <t>
        The objective of this protocol is to take advantage of multicast
        communication for the transfer of messages between MTAs (Message
        Transfer Agents) on a single multicast network under <!--normal - which
        means dialogue oriented - communication conditions and under--> EMCON
        conditions. EMCON condition means that a receiving node is able to
        receive messages, but it cannot - for a relitive long time (hours or
        even days) - acknowledge the received messages.
      </t>

        <figure title="Figure 1">
          <preamble>
            This illustrates a simple multicast scenario, where the same
            message has to be sent from MTA 1 to MTA 2 and to MTA 3.
          </preamble>
<artwork><![CDATA[
                                         +-------+
                                      /->| MTA 2 |
           +-------+       +-------+ /   +-------+
           | MTA 1 |<----->| Router|<
           +-------+       +-------+ \   +-------+
                                      \->| MTA 3 |
                                         +-------+
]]></artwork>
          <postamble>Typical MTA Configuration</postamble>
        </figure>

      <t>
        Using a multicast instead of an unicast communication service in the
        above MTA configuration only one message transmission from MTA 1 to
        the Router is required, instead of two as required with unicast.
        This saves the transmision of one message and thus network bandwidth
        utilisation.  Depending on the network bandwidth (in some radio
        networks less than 9.6 Kb/s) this saving can be of vital importance.
        The saving in bandwidth utilisation becomes even greater with every
        additional receiving MTA.
      </t>

      <t>
        As P_Mul employs a connectionless transport protocol to transmit
        messages, the reliable message transfer is guaranteed even in those
        cases, when for a certain period of time one or more of the receiving
        MTAs are not able or allowed to acknowledge completely received
        messages.
      </t>

      <t>
        This protocol specification requires fixed multicast groups and a
        well known knowledge at each participating node(MTA) about the group
        memberships to one or more multicast groups of each participating
        node.
      </t>

      <t>
        This document defines application protocol MULE (Multicast Email) for transferring Internet Mail messages <xref target="RFC5322"/>
        over ACP 142 P_Mul.
      </t>

    </section>
    
    <section title="Conventions Used in This Document">
      
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
	    "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in
	    this document are to be interpreted as described in
	    <xref target="RFC2119"/>.</t>

      <t>This document is also using terminology from <xref target="RFC5321"/>.</t>

    </section>

    <section title="Gatewaying from Internet Mail">

      <!--////Probably need to add some text about connection establishment, connection teardown, etc.-->

      <section title="Sending Internet Messages" anchor="gateway-from-internet">

          <t>
          When the content type for a message is an Internet message content type <!--///Is this a P_Mul thing? Probably need a reference -->
          (which may be 7bit, 8bit or binary MIME), this is transported using
          ACP 142 <xref target="ACP142A"/>. <!--Gateway from Internet Mail assumes that a whole ACP 142 network
          either supports the Internet content type or does not.-->

          Firstly, for each mail message a BSMTP-like payload is formed, as described in <xref target="payload-create"/>.
          Secondly, the created payload is compressed and encoded as specified in <xref target="payload-compress"/>.
          Thirdly, the compressed payload is sent by P_Mul as a series of Address_PDU and one or more DATA_PDUs.
          When the message has an associated MT-PRIORITY value <xref target="RFC6710"/>,
          the MappedPriority(value) is included as the Priority field of corresponding ACP 142 PDUs,
          including Address_PDU, DATA_PDUs, DISCARD_MESSAGE_PDU. Here MappedPriority(x) is defined as "-1 * x + 6".
          </t>

          <t>
          The sender of the message can assume that the receiver supports the
          following ESMTP extensions:
            DSN <xref target="RFC3461"/>,
            SIZE <xref target="RFC1870"/>,
            8BITMIME <xref target="RFC6152"/>,
            MT-PRIORITY <xref target="RFC6710"/>,
            DELIVERBY <xref target="RFC2852"/>.
          </t>

          <t>
            The receiver MAY accept BINARYMIME <xref target="RFC3030"/> SMTP extension. This is a matter for bilateral
            agreement. As the message content size can always be determined from
            the compression wrapper and the size of the envelope,
            no special handling is needed for binary messages.
          </t>

          <t>
            <!--///This probably needs a bit more explanation-->
            The set of ACP 142 destinations for the message is derived from the next
            hop MTAs for each of the recipients.
          </t>

          <!--///David wrote:
          <t>
            A configuration question is if we need some per-peer MTA mechanism for
            determining if Internet content is supported over ACP 142 for the peer.
            This needs to be determined at routing time. It really only applies if
            the sending MTA is a MIXER gateway, which could convert the Internet content
            to X.400 for transfer. The problem is that in the routing and conversion
            calculation there is no mechanism for peer-MTA controls on allowed content
            types.
          </t>
          -->

        <section title="BSMTP-like Payload construction" anchor="payload-create">

          <t>MULE uses BSMTP-like payload which differs from BSMTP <xref target="RFC2442"/>.
          ESMTP is using capability negotiation, which is not practical when EMCON is used,
          as there is no way for a recipient to return capabilities before a message can be sent. For that reason,
          there is no point in including EHLO capabilities. "MAIL FROM:" and "RCPT TO:" prefixes can also be eluded
          in order to save a few bytes.
          </t>
          
          <t>
            For each received message, the corresponding BSMTP-like payload is constructed as follows
            (Lines are terminated using CR LF):

            <list style='bullets'>

              <t>
                The first line is what would be used for the data following "MAIL FROM:"
                in the SMTP dialogue. I.e. it contains the return-path address, within
                &lt;&gt;'s followed by any ESMTP extension parameters to the MAIL FROM command.
              </t>

              <t>
                After that, there is a separate line for each recipient of the message.
                The value is what would follow "RCPT TO:" in the SMTP dialogue,
                i.e. the recipient address within &lt;&gt;'s
                followed by any ESMTP extension parameters to the corresponding RCPT TO command.
              </t>

              <t>
                The list of recipients is terminated by an empty line (i.e. just CR LF)
              </t>

              <t>
              The message content follows the empty line. There is no need for
              transparency ("dot stuffing") or terminating CRLF.CRLF as the end of
              the message content is indicated by the end of the data
              (See <xref target="payload-compress"/> for more details).
              </t>
              
            </list>
          </t>

          <t>
            <figure>
              <preamble>
                Example of a BSMTP-like payload
              </preamble>
              <artwork>
                <![CDATA[
<from@example.com> MT-PRIORITY=4 BODY=8BITMIME RET=HDRS ENVID=QQ314159
<to1@example.net> NOTIFY=SUCCESS,FAILURE ORCPT=rfc822;Bob@enterprise.example.net
<to2@example.net> NOTIFY=SUCCESS,FAILURE

From: from@example.com
To: To1 <to1@example.net>, To2 <to2@example.net>
Date: 27 Apr 2017 16:17 +0100
Subject: a test
MIME-Version: 1.0
Content-type: text/plain; charset=utf-8
Content-transfer-encoding: 8bit

This is worth <poundsign>100
              ]]>
              </artwork>
              <postamble></postamble>
            </figure>
          </t>

          <t>
            <figure>
              <preamble>
                ABNF for the BSMTP-like payload is:
              </preamble>
              <artwork type="abnf"><![CDATA[
bsmtp-like-payload = envelope CRLF payload
envelope = FROM-line 1*RCPT-line
FROM-line = reverse-path [SP mail-parameters] CRLF
RCPT-line = forward-path [SP rcpt-parameters] CRLF

payload = *OCTET
          ; Conforms to message syntax as defined in RFC 5322 and extended in MIME

OCTET = <any 0-255 octet value>
reverse-path = <as defined in RFC 5321>
forward-path = <as defined in RFC 5321>
mail-parameters = <as defined in RFC 5321>
rcpt-parameters = <as defined in RFC 5321>
              ]]></artwork>
              <postamble></postamble>
            </figure>
          </t>

        </section>

        <section title="Payload compression" anchor="payload-compress">

          <t>
            BSMTP-like payload (<xref target="payload-create"/>) is compressed using zlibCompress <xref target="RFC1951"/> and
            placed in the compressedContent field of
            the CompressedContentInfo element defined in Section 4.2.6 of <xref target="STANAG-4406"/>.
            This is then encoded as BER encoding <xref target="ITU.X690.2002"/> of the CompressedData ASN.1 structure.
            For convenience, ASN.1 of the CompressedData structure is included below.
            The contentType-ShortForm value used by MULE is 25.
          </t>

          <t>The above procedure is similar to how X.400 messages are sent using Annex E of STANAG 4406 Ed 2.
          This makes it easier to implement MTAs that support both Internet messages and X.400 messages in the same code base.</t>
          
          <t>
            The Compressed Data Type (CDT) consists of content of any type that is
            compressed using a specified algorithm. The following object identifier identifies the
            Compressed Data Type:
            
            <figure>
              <preamble>
              </preamble>
              <artwork><![CDATA[
            id-mmhs-CDT ID ::= { iso(1) identified-organization(3) nato(26) stanags(0)
                                  mmhs(4406) object-identifiers(0) id-mcont(4) 2 }
              ]]></artwork>
              <postamble></postamble>
            </figure>
            
            <figure>
              <preamble>
                The Compressed Data Type are defined by the following ASN.1 type:
              </preamble>
              <artwork><![CDATA[
DEFINITIONS ::=
BEGIN
CompressedData ::= SEQUENCE {
                     compressionAlgorithm CompressionAlgorithmIdentifier,
                     compressedContentInfo CompressedContentInfo
                   }
CompressionAlgorithmIdentifier ::= CHOICE {
                     algorithmID-ShortForm [0] AlgorithmID-ShortForm,
                     algorithmID-OID [1] OBJECT IDENTIFIER 
                   }
AlgorithmID-ShortForm ::= INTEGER { zlibCompress (0) }
CompressedContentInfo ::= SEQUENCE {
                     CHOICE {
                       contentType-ShortForm [0] ContentType-ShortForm,
                       contentType-OID [1] OBJECT IDENTIFIER
                     },
                     compressedContent [0] EXPLICIT OCTET STRING
                   }
ContentType-ShortForm ::= INTEGER {
                     unidentified (0),
                     external (1), -- identified by the object-identifier
                                   -- of the EXTERNAL content
                     p1 (2),
                     p3 (3),
                     p7 (4)
                   }
END
              ]]></artwork>
              <postamble></postamble>
            </figure>
          </t>

        </section>

      </section>      

      <section title="Error handling">

        <t>
          As MULE doesn't allow next hop MTA to return immediate Response Codes for FROM-line or any of recipients in RCPT-line,
          MTAs that are compliant with this specification that receive a message that can't be delivered <!--or encounters another condition that requires generation of DSN as per <xref target="RFC3461"/>-->
          MUST generate a non delivery DSN report <xref target="RFC6522"/> message which includes message/delivery-status body part <xref target="RFC3464"/>
          and submit it using MULE to the FROM-line return-path address.</t>

        <t>TBC: Also need to describe how to handle FROM-line or RCPT-line parameters that we don't understand.
        Probably, they can be rejected on receipt or be relayed to the final destination/gateway, which can decide what to do with them.</t>

      </section>


      <section title="Use of BDAT">
        <t>If SMTP CHUNKING extension is used by the SMTP side, data from all BDAT blocks
        is concatenated into continuous block and is used as the message payload.
        Use of BINARYMIME <xref target="RFC3030"/> might need to be enabled in the FROM-line.</t>
        
        <t>BURL <xref target="RFC4468"/> SMTP extension only applies to SMTP Submission,
        so it is already mapped to BDAT/DATA by the time it reaches MULE.</t>
      </section>

    </section>

    <section title="Gatewaying to Internet Mail">

      <t>Gatewaying from ACP 142 environment to Internet Email is the reverse of the process specified in <xref target="gateway-from-internet"/>.
      Firstly, the message is reassembled from one or more DATA_PDUs.
      Secondly, if the contentType-ShortForm value is 25, the BSMTP-like payload is extracted from compressedContent field
      and uncompressed as specified in <xref target="payload-compress"/>.
      Thirdly, the BSMTP-like payload is converted to SMTP transaction (see <xref target="payload-create"/>).
      (The first line of the BSMTP-like payload is prepended with "MAIL FROM:" and
      each following line (until the empty line is encountered) is prepended with "RCPT TO:".
      After skipping the empty delimiting line, the rest of the payload is the message body.
      This can be either sent using DATA or a series of BDAT commands, depending on capabilities of the receiving SMTP system.)
      </t>
      
      <section title="Error handling">

        <t>ESMTP extension parameters to MAIL FROM and RCPT TO SMTP commands obtained from BSMTP-like payload
        are processed according to specifications of the corresponding ESMTP extensions.
        </t>

        <!--///Does this mean discarding such payloads?-->
        <t>Failures to extract or uncompres BSMTP-like payload are handled according to ACP 142.</t>

      </section>

    </section>

    <section title="IANA Considerations">

      <t>IANA is requested to create a new registry "Multicast Email SMTP extensions". SMTP extensions registered in the "SMTP Service Extensions" IANA registry
      can be registered in this new registry. Registration procedure for the new registry is "Specification Required".
      Registration requests should include SMTP extension name, status (see <xref target="iana-mule-smtp"/>) and specification reference.</t>

      <section title="Mapping of existing SMTP extensions to MULE" anchor="iana-mule-smtp">

        <t>The following table summarizes how different SMTP extensions can be gatewayed to/from MULE.
        Each extension has one of the following statuses: "required" (required to be supported on the SMTP side),
        "disallowed" (incompatible with this protocol),
        "N/A" (not relevant, because they affect commands other than MAIL FROM and RCPT TO. Can be used on the SMTP side) or "supported".</t>

        <texttable>
        <ttcol>SMTP Extension Keyword</ttcol><ttcol>Reference</ttcol><ttcol>Status</ttcol>

        <c>SIZE</c><c><xref target="RFC1870"/></c><c>Required</c>
        <c>8BITMIME</c><c><xref target="RFC6152"/></c><c>Required</c>
        <c>DSN</c><c><xref target="RFC3461"/></c><c>Required</c>
        <c>MT-PRIORITY</c><c><xref target="RFC6710"/></c><c>Required</c>
        <c>DELIVERBY</c><c><xref target="RFC2852"/></c><c>Required</c>
        <c>BINARYMIME</c><c><xref target="RFC3030"/></c><c>Supported</c>
        <c>PIPELINING</c><c><xref target="RFC2920"/></c><c>N/A</c>
        <c>CHUNKING</c><c><xref target="RFC3030"/></c><c>N/A</c>
        <c>BURL</c><c><xref target="RFC4468"/></c><c>N/A</c>
        <c>ENHANCEDSTATUSCODES</c><c><xref target="RFC2034"/></c><c>Supported (through DSN)</c>
        <c>CHECKPOINT</c><c><xref target="RFC1845"/></c><c>Disallowed</c>
        <c>RRVS</c><c><xref target="RFC7293"/></c><c>Supported</c>
        <c>NO-SOLICITING</c><c><xref target="RFC3865"/></c><c>N/A</c>
        <c>SUBMITTER</c><c><xref target="RFC4405"/></c><c>Supported</c>
        <c>CONNEG</c><c><xref target="RFC4141"/></c><c>Disallowed</c>
        <c>STARTTLS</c><c><xref target="RFC3207"/></c><c>N/A</c>
        <c>AUTH</c><c><xref target="RFC4954"/></c><c>N/A (MAIL FROM parameter is supported)</c>
          
<!-- ////Need to analyze the following:

<c>ETRN</c><c><xref target="RFC1985"/></c><c></c>
<c>ATRN</c><c><xref target="RFC2645"/></c><c></c>

<c>MTRK</c><c><xref target="RFC3885"/></c><c></c>
<c>FUTURERELEASE</c><c><xref target="RFC4865"/></c><c></c>
<c>CONPERM</c><c><xref target="RFC4141"/></c><c>Not sure!</c>
<c>SMTPUTF8</c><c><xref target="RFC6531"/></c><c></c>
<c></c><c></c><c></c>
-->
          
        </texttable>

      </section>

    </section>

    <section title="Security Considerations" anchor="seccons">

      <t>TBD.</t>

    </section>
    
  </middle>
  <back>
    <references title="Normative References">
      
      <?rfc include="reference.RFC.1951"?> <!-- ZLIB Compress -->
      <?rfc include="reference.RFC.2119"?> <!-- Keywords -->
      <?rfc include="reference.RFC.5321"?> <!-- ESMTP -->
      <?rfc include="reference.RFC.5322"?> <!-- Email Format -->
      <?rfc include="reference.RFC.1870"?> <!-- SIZE -->
      <?rfc include="reference.RFC.2852"?> <!-- DELIVERBY -->
      <?rfc include="reference.RFC.3461"?> <!-- DSN SMTP extension -->
      <?rfc include="reference.RFC.3464"?> <!-- message/delivery-status -->
      <?rfc include="reference.RFC.6522"?> <!-- multipart/report -->
      
      <?rfc include="reference.RFC.6710"?> <!-- MT-PRIORITY -->
      <?rfc include="reference.RFC.6152"?> <!-- 8BITMIME -->
      <?rfc include="reference.RFC.3030"?> <!-- BINARYMIME, CHUNKING -->
      <?rfc include="reference.RFC.5234"?> <!-- ABNF -->
      
      <!--////Add a reference for ASN.1-->

      <reference anchor="ITU.X690.2002">
        <front>
        <title>
        Information Technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)
        </title>
        <author>
        <organization>International Telecommunications Union</organization>
        </author>
        <date month="July" year="2002"/>
        </front>
        <seriesInfo name="ITU-T" value="Recommendation X.690"/>
      </reference>
      
      <reference anchor="ACP142A">
        <front>
          <title>Common Messaging strategy and procedures</title>

          <!--CCEB == COMBINED COMMUNICATIONS-ELECTRONICS BOARD-->
          <author fullname="CCEB">
            <!--
			<organization></organization>
-->
          </author>

          <date month="August" year="2008" />
        </front>

        <seriesInfo name="ACP" value="142(A)" />

        <!--The following no longer works: http://jcs.dtic.mil/j6/cceb/acps/acp142 -->
        <format target="https://wss.apan.org/s/CCEB/public/Forms/acps.aspx" type="HTML" />

      </reference>

      <reference anchor="STANAG-4406">
        <front>
          <title>STANAG 4406 Edition 2: Military Message Handling System</title>
          <author fullname="NATO">
          </author>
          <date month="March" year="2005"/>
        </front>

        <seriesInfo name="STANAG" value="4406 Ed. 2"/>
      </reference>

    </references>

    <references title="Informative References">
      
      <?rfc include="reference.RFC.1845"?> <!-- CHECKPOINT -->
      <?rfc include="reference.RFC.2034"?> <!-- ENHANCEDSTATUSCODES -->

      <?rfc include="reference.RFC.2442"?> <!-- Batch SMTP Media Type -->

      <?rfc include="reference.RFC.2920"?> <!-- PIPELINING -->

      <?rfc include="reference.RFC.3207"?> <!-- SMTP STARTTLS -->
      <?rfc include="reference.RFC.3865"?> <!-- SMTP No Soliciting -->
      <?rfc include="reference.RFC.4141"?> <!-- SMTP and MIME Extensions for Content Conversion -->
      <?rfc include="reference.RFC.4405"?> <!-- SMTP Extension for Indicating Responsible Submitter -->
      <?rfc include="reference.RFC.4468"?> <!-- BURL -->
      <?rfc include="reference.RFC.4954"?> <!-- SMTP AUTH -->
      <?rfc include="reference.RFC.7293"?> <!-- SMTP RRVS -->

    </references>

    <section title="Acknowledgements">
	
      <t>Thank you to Steve Kille for suggestions, comments and corrections on this document.</t>

      <t>Some text was borrowed from draft-riechmann-multicast-mail-00, thus work of authors of that document is greatefully acknowledged.</t>
      
    </section>
    
  </back>
</rfc>
