<?xml version="1.0" encoding="UTF-8"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     version="3"
     docName="draft-srijal-sime-protocol-00"
     category="std"
     ipr="trust200902"
     submissionType="IETF">
  <front>
    <title abbrev="SIME">SIME: Srijal's Integrated Mail Extensions</title>
    <author fullname="Srijal Dutta" initials="S." surname="Dutta">
      <organization>Independent</organization>
      <address>
        <email>srijaldutta.official+sime@gmail.com</email>
      </address>
    </author>
    <date day="16" month="September" year="2025"/>
    <abstract>
      <t>This document specifies the SIME protocol, a decentralized, atomic protocol for inter-domain mail transmission and entity-to-entity communication. It defines packet types, headers, MX/SRV-based trust verification, TCP-based delivery, and SIME Extensions for attachments. All servers act as Domain Authorities (DA), and inter-domain transactions are governed by atomic protocol rules.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>SIME (Srijal's Integrated Mail Extensions) is a decentralized protocol designed to provide reliable messaging between users in different Domain Authorities (DA). Each DA manages its own user authentication and registration rules. Atomic protocol enforcement ensures inter-domain transactions follow strict compatibility, reliability, and security rules.</t>
      <t>All SIME traffic is conducted over TCP to ensure reliable delivery.</t>
    </section>

    <section title="Terminology">
      <t>DA (Domain Authority) - Server managing a domain and its users</t>
      <t>ID - Disposable session identifier (e.g., JWT)</t>
      <t>Transaction ID - Identifier assigned per transaction session</t>
      <t>TCP - Transmission Control Protocol (mandatory transport)</t>
      <t>MAIL Packet - Packet containing mail messages</t>
      <t>CONV Packet - Packet for general communication</t>
      <t>MX/SRV Record - DNS record or SRV record pointing to server endpoint for inter-domain verification</t>
    </section>

    <section title="Overview of SIME Protocol">
      <t>- Users authenticate with their DA and receive disposable IDs.</t>
      <t>- Communication is TCP-only to prevent packet loss.</t>
      <t>- Two primary packet types: CONV and MAIL.</t>
      <t>- Inter-domain transactions require MX/SRV verification to ensure messages reach the correct DA server.</t>
      <t>- Atomic rules enforce uniformity; non-compliant servers are rejected.</t>
    </section>

    <section title="Packet Types">
      <t>CONV Packets:</t>
      <t>Used for login and general communications:</t>
      <figure>
        <artwork><![CDATA[
LOGIN <username> <password>
START TRANSACTION <ID>
CONV <payload>
        ]]></artwork>
      </figure>

      <t>MAIL Packets:</t>
      <t>Used for sending messages:</t>
      <figure>
        <artwork><![CDATA[
PREPARE HEADERS <transact_id> X-Mailed-Type-Render: <TXT|MD|HTML>; RECIPIENT: user@domain
PREPARE MESSAGE <transact_id> <content>
END TRANSACTION <transact_id>
        ]]></artwork>
      </figure>
    </section>

    <section title="Headers">
      <t>- SENDER: Originating user (user@domain)</t>
      <t>- RECIPIENT: Destination user (user@domain)</t>
      <t>- X-Mailed-Type-Render: TXT | MD | HTML</t>
      <t>- Optional headers may be added via SIME Extensions</t>
    </section>

    <section title="Authentication and Login">
      <t>Users initiate login via CONV packet:</t>
      <figure>
        <artwork><![CDATA[
LOGIN <username> <password>
        ]]></artwork>
      </figure>

      <t>Server responses:</t>
      <figure>
        <artwork><![CDATA[
SUCCESS LOGIN : <ID>
ERROR AUTH
        ]]></artwork>
      </figure>
      <t>Disposable IDs are required for subsequent packets.</t>
    </section>

    <section title="Message Flow">
      <t>1. User logs in: CONV Packet → LOGIN → SUCCESS LOGIN : &lt;ID&gt;</t>
      <t>2. User initiates transaction: CONV Packet → START TRANSACTION &lt;ID&gt;</t>
      <t>3. Server validates ID:</t>
      <t>- Success → returns transaction acknowledgment</t>
      <t>- Failure → returns ERROR AUTH</t>
      <t>4. User sends MAIL packet:</t>
      <t>- PREPARE HEADERS &lt;transact_id&gt; ...</t>
      <t>- PREPARE MESSAGE &lt;transact_id&gt; &lt;content&gt;</t>
      <t>5. User ends transaction: END TRANSACTION &lt;transact_id&gt;</t>
      <t>6. Server responds with SENT or appropriate error.</t>
    </section>

    <section title="Atomic Protocol Rules">
      <t>- No version negotiation; all inter-domain servers must implement the exact protocol.</t>
      <t>- Non-compliant servers are rejected.</t>
      <t>- Transactions must be atomic: either all steps succeed or fail.</t>
    </section>

    <section title="Inter-Domain Transactions">
      <t>- DA MX/SRV record must point to verified server endpoint.</t>
      <t>- Messages are sent only to verified MX/SRV endpoints.</t>
      <t>- Servers not listed or failing verification are rejected.</t>
    </section>

    <section title="Error Codes">
      <t>- ERROR AUTH : Invalid login/session</t>
      <t>- ERROR TRANS : Transaction initiation failure</t>
      <t>- ERROR HEADER : Invalid or missing headers</t>
      <t>- ERROR MXVER : Inter-domain MX/SRV verification failure</t>
      <t>- ERROR PACKET : Malformed packet</t>
      <t>- ERROR SEND : Message could not be delivered</t>
    </section>

    <section title="Security Considerations">
      <t>- All packets use TCP for reliable delivery.</t>
      <t>- Authentication handled per DA; disposable IDs required.</t>
      <t>- TLS is recommended for inter-domain traffic.</t>
      <t>- Disposable IDs and transaction IDs mitigate replay attacks.</t>
      <t>- Inter-domain trust relies on MX/SRV verification; unverified endpoints are rejected.</t>
      <t>- Confidentiality and integrity of message content require TLS or optional message signing.</t>
      <t>- Reviewers should note that deployment must account for standard-compliant DNS/SRV usage instead of arbitrary IP:PORT MX records.</t>
    </section>

    <section title="MX/SRV Verification">
      <t>- Each DA must publish a SIME MX or SRV record specifying its server endpoint.</t>
      <t>- Inter-domain messages are routed only to verified endpoints.</t>
      <t>- Unverified endpoints are rejected.</t>
    </section>

    <section title="SIME Extensions for Attachments">
      <t>- ATTACHMENT: &lt;filename&gt;</t>
      <t>- ENCODING: base64 | hex</t>
      <t>- Optional metadata headers supported</t>
      <t>- Attached in content as: &lt;UNICODE UTF-8: 0xEF 0xBF 0xBF&gt;&lt;hex|base64&gt; &lt;encoded attachment&gt;&lt;UNICODE UTF-8: 0xEF 0xBF 0xBF&gt;</t>
    </section>

    <section title="Packet Syntax">
      <figure>
        <artwork><![CDATA[
CONV-PACKET   = LOGIN-PACKET / TRANSACTION-PACKET / GENERAL-CONV
LOGIN-PACKET  = "LOGIN" SP USERNAME SP PASSWORD CRLF
TRANSACTION-PACKET = "START TRANSACTION" SP ID CRLF / CONV SP PAYLOAD CRLF
MAIL-PACKET  = "PREPARE HEADERS" SP TRANSACTION-ID SP HEADER-FIELDS CRLF
               "PREPARE MESSAGE" SP TRANSACTION-ID SP CONTENT CRLF
               "END TRANSACTION" SP TRANSACTION-ID CRLF

USERNAME     = 1*(ALPHA / DIGIT / "-" / "_")
PASSWORD     = 1*(ALPHA / DIGIT / SYMBOL)
TRANSACTION-ID = 1*DIGIT
HEADER-FIELDS = *(HEADER-NAME ":" SP HEADER-VALUE CRLF)
CONTENT      = *(OCTET)
        ]]></artwork>
      </figure>
    </section>

    <section title="Example Message Flow">
      <figure>
        <artwork><![CDATA[
User                 DA-A                 DA-B
 | LOGIN             |                     |
 |------------------>| SUCCESS LOGIN      |
 | START TRANSACTION |                     |
 |------------------>| TRANS_ID: 67890    |
 | PREPARE HEADERS   |                     |
 |------------------>| PROCEED             |
 | PREPARE MESSAGE   |                     |
 |------------------>| PROCEED             |
 | END TRANSACTION   |                     |
 |------------------>| SENT                |
        ]]></artwork>
      </figure>
    </section>
</middle>
<back>
  <references title="Normative References">
    <reference anchor="RFC793" target="https://www.rfc-editor.org/rfc/rfc793">
      <front>
        <title>Transmission Control Protocol</title>
        <author initials="J." surname="Postel"/>
        <date year="1981"/>
      </front>
      <seriesInfo name="RFC" value="793"/>
    </reference>

    <reference anchor="RFC7519" target="https://www.rfc-editor.org/rfc/rfc7519">
      <front>
        <title>JSON Web Token (JWT)</title>
        <author initials="M." surname="Jones"/>
        <date year="2015"/>
      </front>
      <seriesInfo name="RFC" value="7519"/>
    </reference>

    <reference anchor="RFC5321" target="https://www.rfc-editor.org/rfc/rfc5321">
      <front>
        <title>Simple Mail Transfer Protocol</title>
        <author initials="J." surname="Klensin"/>
        <date year="2008"/>
      </front>
      <seriesInfo name="RFC" value="5321"/>
    </reference>
  </references>

  <section title="Authors' Addresses">
    <t>Srijal Dutta</t>
    <t>Email: srijaldutta.official+sime@gmail.com</t>
  </section>
</back>
</rfc>
