Internet Draft                                             A. Melnikov
Document: draft-melnikov-imap-ext-abnf                       Isode Ltd
Expires: September 2005                                     March 2005



                  Collected extensions to IMAP4 ABNF
                    draft-melnikov-imap-ext-abnf-00

Status of this Memo

   By submitting this Internet-Draft, I certify that any applicable
   patent or other IPR claims of which I am aware have been disclosed,
   or will be disclosed, and any of which I become aware will be
   disclosed, in accordance with RFC 3668.

   Internet Drafts are working documents of the Internet Engineering
   Task Force (IETF), its Areas, and its Working Groups.  Note that
   other groups may also distribute working documents as Internet
   Drafts. Internet Drafts are draft documents valid for a maximum of
   six months.  Internet Drafts may be updated, replaced, or obsoleted
   by other documents at any time.  It is not appropriate to use
   Internet Drafts as reference material or to cite them other than as
   ''work in progress''.

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   A revised version of this draft document will be submitted to the
   RFC editor as a Standard Track RFC for the Internet Community.
   Discussion and suggestions for improvement are requested, and
   should be sent to ietf-imapext@imc.org and/or lemonade@ietf.org.
   Distribution of this memo is unlimited.


Abstract

   Over years many documents from IMAPEXT and LEMONADE working groups,
   as well as many individual documents have added syntactic
   extensions to many base IMAP commands described in RFC 3501. For
   ease of reference this document collects most of such ABNF changes
   in one place.

   This document updates ABNF in RFC 3501.



Table of Contents

  1. Conventions Used in this Document                              2
  2. IMAP ABNF extensions                                           2
     2.1 Optional parameters with the SELECT/EXAMINE commands       2
     2.2 Extensions to FETCH and UID FETCH Commands                 3
     2.3 Extensions to STORE and UID STORE Commands                 4
     2.4 Extensions to SEARCH Command                               4
  3. Formal Syntax                                                  5
  4. Security Considerations                                        7
  5. IANA Considerations                                            7
  6. References                                                     7
     6.1 Normative References                                       7
  7. Acknowledgments                                                7
  8. Author's Addresses                                             8
  9. Full Copyright Statement                                       8
  10. Intellectual Property                                         8
  11. Appendix A. Editorial.                                        9
     11.1 Change Log                                                9


1.   Conventions Used in this Document

   In examples, "C:" and "S:" indicate lines sent by the client and
   server respectively.

   The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"
   in this document are to be interpreted as defined in "Key words for
   use in RFCs to Indicate Requirement Levels" [KEYWORDS].

   <<Editorial comments and questions are enclosed like this>>


2.   IMAP ABNF extensions

2.1  Optional parameters with the SELECT/EXAMINE commands

   This documents adds the ability to include one or more parameters
   with the IMAP SELECT or EXAMINE commands, to turn on or off certain
   standard behaviour, or to add new optional behaviours required for
   a particular extension.

   There are two possible modes of operation:

   o  A global state change where a single use of the optional
      parameter will effect the session state from that time on,
      irrespective of subsequent SELECT/EXAMINE commands.

   o  A per-mailbox state change that will effect the session only for
      the duration of the new selected state.  A subsequent SELECT/
      EXAMINE without the optional parameter will cancel its effect
      For the newly selected mailbox.

   Optional parameters to the SELECT or EXAMINE commands are added as
   a parenthesised list of atoms or strings, and appear after the
   mailbox name in the standard SELECT or EXAMINE command.  The order
   of individual parameters is arbitrary.  Individual parameters may
   consist of one or more atoms or strings in a specific order.  If a
   parameter consists of more than one atom or string, it MUST appear
   in its own parenthesised list.  Any parameter not defined by
   extensions that the server supports MUST be rejected with a NO
   response.

      Example:

              C: a SELECT INBOX (ANNOTATE)
              S: ...
              S: a OK SELECT complete

      In the above example, a single parameter is used with the SELECT
      command.

      Example:

              C: a EXAMINE INBOX (ANNOTATE (RESPONSES "UID Responses")
                 CONDSTORE)
              S: ...
              S: a OK EXAMINE complete

      In the above example, three parameters are used with the EXAMINE
      command.  The second parameter consists of two items: an atom
      followed by a quoted string.

      Example:

              C: a SELECT INBOX (BLURDYBLOOP)
              S: a NO Unknown parameter in SELECT command

      In the above example, a parameter not supported by the server is
      incorrectly used.


2.2  Extensions to FETCH and UID FETCH Commands

    Arguments:  sequence set
                message data item names or macro
                OPTIONAL fetch modifiers

    Responses:  untagged responses: FETCH

    Result:     OK - fetch completed
                NO - fetch error: can't fetch that data
                BAD - command unknown or arguments invalid

    This document extends the syntax of the FETCH and UID FETCH
    commands (see section 6.4.5 of [IMAP4]) to include optional FETCH
    modifiers.  No fetch modifiers are defined in this document.


2.3  Extensions to STORE and UID STORE Commands

   Arguments:  message set
               OPTIONAL store modifiers
               message data item name
               value for message data item

   Responses:  untagged responses: FETCH

   Result:     OK - store completed
               NO - store error: can't store that data
               BAD - command unknown or arguments invalid

   This document extends the syntax of the STORE and UID STORE
   commands (see section 6.4.6 of [IMAP4]) to include optional STORE
   modifiers.  No store modifiers are defined in this document.


2.4  Extensions to SEARCH Command

   Arguments:  OPTIONAL result specifier
               OPTIONAL [CHARSET] specification
               searching criteria (one or more)

   Responses:  REQUIRED untagged response: SEARCH or ESEARCH

   Result:     OK - search completed
               NO - search error: can't search that [CHARSET] or
                    criteria
               BAD - command unknown or arguments invalid


   This section updates definition of the SEARCH command described in
   section 6.4.4 of [IMAP4].

   The SEARCH command is extended to allow for result options. This
   document doesn't define any result option.


3.   Formal Syntax

   The following syntax specification uses the Augmented Backus-Naur
   Form (ABNF) notation as specified in [ABNF].

   Non-terminals referenced but not defined below are as defined by
   [IMAP4].

   Except as noted otherwise, all alphabetic characters are case-
   insensitive.  The use of upper or lower case characters to define
   token strings is for editorial clarity only.  Implementations MUST
   accept these strings in a case-insensitive fashion.


     append          = "APPEND" SP mailbox 1*append-message
                       ;; only a single append-message may appear
                       ;; if MULTIAPPEND [MULTIAPPEND] capability
                       ;; is not present

     append-message  = append-opts SP append-data

     append-ext      = ;; is arbitrary bounded syntax to be defined
                       ;; by extensions. This MUST start with an
                       ;; an atom.

     append-data     = literal

     append-opts     = [SP flag-list] [SP date-time] *(SP append-ext)

     examine         = "EXAMINE" SP mailbox [select-params]
                       ;; modifies the original IMAP EXAMINE command
                       ;; to accept optional parameters

     fetch           = "FETCH" SP sequence-set SP ("ALL" / "FULL" /
                       "FAST" / fetch-att /
                       "(" fetch-att *(SP fetch-att) ")")
                       [SP fetch-modifiers]
                       ;; modifies the original IMAP4 FETCH command to
                       ;; accept optional modifiers

     fetch-modifiers = "(" fetch-modifier *(SP fetch-modifier) ")"

     fetch-modifier  = fetch-modifier-name /
                       fetch-modifier-name SP astring /
                       fetch-modifier-name SP "(" fetch-modif-params
                                              ")"
                       ;; modifiers to FETCH may contain a modifier
                       ;; name followed by zero or more atoms or
                       ;; strings - multiple items are always
                       ;; parenthesised, nesting is allowed

     fetch-modif-params  = astring *(SP astring) /
                           "(" fetch-modif-params
                               *(SP fetch-modif-params) ")"

     fetch-modifier-name = atom

     search          = "SEARCH" [search-return-opts]
                       [SP "CHARSET" SP astring] 1*(SP search-key)
                       ;; CHARSET argument to MUST be registered
                       ;; with IANA

     search-return-opts = "RETURN" SP "(" [search-return-opt
                          *(SP search-return-opt)] ")"
                          ;; SEARCH return options, e.g. MIN

     search-return-opt = search-modifier-name
                            [SP "(" search-mod-params ")"]

     search-modifier-name = atom

     search-mod-params  = astring /
                           search-mod-params
                               *(SP search-mod-params) /
                           "(" search-mod-params ")"
                          ;; same structure as for store-modparam-comp

     select          = "SELECT" SP mailbox [select-params]
                       ;; modifies the original IMAP SELECT command to
                       ;; accept optional parameters

     select-params   = SP "(" select-param *(SP select-param) ")"

     select-param    = astring / "(" astring 1*(SP astring) ")"
                       ;; parameters to SELECT may contain one or
                       ;; more atoms or strings - multiple items
                       ;; are always parenthesised

     status          = "STATUS" SP mailbox SP
                       "(" status-att-req *(SP status-att-req) ")"
                       ;; redefine STATUS command syntax defined in
                       ;; [IMAP4]

     status-att-list = status-rsp-info *(SP status-rsp-info)
                       ;; Redefines status-att-list from RFC 3501

     status-att-req  = status-att

     status-rsp-info = status-att SP number

     store           = "STORE" SP sequence-set store-modifiers
                       SP store-att-flags
                       ;; extend [IMAP4] STORE command syntax
                       ;; to allow for optional store-modifiers

     store-modifiers = [ SP "(" store-modifier *(SP store-modifier)
                         ")" ]

     store-modifier  = store-modifier-name [SP store-modif-params]
                       ;; MUST start with atom (label)

     store-modif-params = astring / "(" store-modparam-comp ")"

     store-modparam-comp  = astring /
                           store-modparam-comp
                               *(SP store-modparam-comp) /
                           "(" store-modparam-comp ")"

     <<This differs from how fetch-modif-params is defined. Is this
     desirable? Or should we use something simpler, e.g select-
     param?>>

     store-modifier-name = atom



     <<select/examine ABNF in ANNOTATE is wrong>>

     <<Add LOGIN/AUTHENTICATE, LOGOUT and CREATE?>>


4.   Security Considerations

   It is believed that this document doesn't add any new security
   concerns that were not already identified in RFC 3501.


5.   IANA Considerations

   This document doesn't define any new IMAP extension, so no action
   from IANA is required.


6.   References

6.1  Normative References

   [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
   Requirement Levels", RFC 2119, March 1997.

   [IMAP4], Crispin, M., "Internet Message Access Protocol - Version
   4rev1", RFC 3501, University of Washington, March 2003.

   [ABNF], DRUMS working group, Dave Crocker Editor, "Augmented BNF
   for Syntax Specifications: ABNF", Work in Progress.

   [MULTIAPPEND]  Crispin, M., "Internet Message Access Protocol
   (IMAP) - MULTIAPPEND Extension", RFC 3502, March 2003.


7.   Acknowledgments

   This documents is based on ideas proposed by Cyrus Daboo, Pete
   Resnick, Mark Crispin, Ken Murchison, Philip Guenther, Randall
   Gellens.

   However all errors and omissions must be attributed to the author
   of the document.

   Some text was borrowed from draft-ietf-imapext-annotate-12.txt


8.   Author's Addresses

   Alexey Melnikov
   Isode Limited
   5 Castle Business Village
   36 Station Road
   Hampton, Middlesex, TW12 2BX
   UK

   Email: Alexey.Melnikov@isode.com


9.   Full Copyright Statement

   Copyright (C) The Internet Society (2005).  This document is
   subject to the rights, licenses and restrictions contained in BCP
   78, and except as set forth therein, the authors retain all their
   rights.


   This document and the information contained herein are provided on
   an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE
   REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND
   THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES,
   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT
   THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR
   ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
   PARTICULAR PURPOSE.


10.  Intellectual Property

   The IETF takes no position regarding the validity or scope of any
   Intellectual Property Rights or other rights that might be claimed
   to pertain to the implementation or use of the technology described
   in this document or the extent to which any license under such
   rights might or might not be available; nor does it represent that
   it has made any independent effort to identify any such rights.
   Information on the procedures with respect to rights in RFC
   documents can be found in BCP 78 and BCP 79.

   Copies of IPR disclosures made to the IETF Secretariat and any
   assurances of licenses to be made available, or the result of an
   attempt made to obtain a general license or permission for the use
   of such proprietary rights by implementers or users of this
   specification can be obtained from the IETF on-line IPR repository
   at http://www.ietf.org/ipr.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights that may cover technology that may be required to implement
   this standard.  Please address the information to the IETF at ietf-
   ipr@ietf.org.

Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.


11.  Appendix A. Editorial.

   <<Note that this section will be deleted before publication>>

11.1 Change Log

   00   Initial Revision.