Internet DRAFT - draft-myers-acap-spec

draft-myers-acap-spec



HTTP/1.1 200 OK
Date: Tue, 09 Apr 2002 10:23:18 GMT
Server: Apache/1.3.20 (Unix)
Last-Modified: Mon, 25 Nov 1996 20:19:00 GMT
ETag: "3ddee3-16a12-3299ff34"
Accept-Ranges: bytes
Content-Length: 92690
Connection: close
Content-Type: text/plain


Network Working Group                                        J. G. Myers
Internet Draft: ACAP                                     Carnegie Mellon
Document: internet-drafts/draft-myers-acap-spec-01.txt     November 1996
Expire in six months


           ACAP -- Application Configuration Access Protocol


Status of this Memo

   This document is an Internet Draft.  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 a
   ``working draft'' or ``work in progress``.

   To learn the current status of any Internet-Draft, please check the
   1id-abstracts.txt listing contained in the Internet-Drafts Shadow
   Directories on ds.internic.net, nic.nordu.net, ftp.isi.edu, or
   munnari.oz.au.

   This document suggests a proposed protocol for the Internet
   community, and requests discussion and suggestions for improvements.
   Distribution of this draft is unlimited.

   The protocol discussed in this document is experimental and subject
   to change.  Persons planning on either implementing or using this
   protocol are STRONGLY URGED to get in touch with the author before
   embarking on such a project.


Abstract

   The Application Configuration Access Protocol (ACAP) is designed to
   support remote storage and access of program option, configuration
   and preference information.










Myers                                                           [Page i]

Internet DRAFT                    ACAP                 November 25, 1996


ACAP Protocol Specification



1.      Conventions Used in this Document

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

   The protocol syntax specification uses the Augmented Backus-Naur Form
   (ABNF) notation as specified in [RFC-822] with one exception; the
   delimiter used with the "#" construct is a single space (SPACE) and
   not one or more commas.

   The "::+" extension to the ABNF notation is used to allow
   nonterminals to be defined as a set of alternatives, each alternative
   being defined in a separate lines.  The sequence of productions:

           a ::+ b
           a ::+ c
           a ::+ d

   is equivalent to

           a ::= (b) / (c) / (d)


2.      Protocol Overview

2.1.    Link Level

   The ACAP protocol assumes a reliable data stream such as provided by
   TCP.  When TCP is used, an ACAP server listens on port XXXX.


2.2.    Commands and Responses

   An ACAP session consists of the establishment of a client/server
   connection, an initial greeting from the server, and client/server
   interactions.  These client/server interactions consist of a client
   command, server data, and a server completion result response.

   All interactions transmitted by client and server are in the form of
   lines; that is, strings that end with a CRLF.  The protocol receiver
   of an ACAP client or server is either reading a line, or is reading a
   sequence of octets with a known count followed by a line.  Both
   clients and servers must be capable of handling lines of arbitrary
   length.



Myers                                                           [Page 1]

Internet DRAFT                    ACAP                 November 25, 1996


2.2.1.  Client Protocol Sender and Server Protocol Receiver

   The client command begins an operation.  Each client command is
   prefixed with a identifier (typically a short alphanumeric string,
   e.g. A0001, A0002, etc.) called a "tag".  A different tag is
   generated by the client for each command.

   There are two cases in which a line from the client does not
   represent a complete command.  In one case, a command argument is
   quoted with an octet count (see the description of literal in section
   XXXX); in the other case, the command arguments require server
   feedback (see the AUTHENTICATE command).  In some of these cases, the
   server sends a command continuation request response if it is ready
   for the next part of the command.  This response is prefixed with the
   token "+".

        Note: If, instead, the server detected an error in the
        command, it sends a BAD completion response with tag
        matching the command (as described below) to reject the
        command and prevent the client from sending any more of the
        command.

        It is also possible for the server to send a completion or
        intermediate response for some other command (if multiple
        commands are in progress), or untagged data.  In either
        case, the command continuation request is still pending;
        the client takes the appropriate action for the response,
        and reads another response from the server.

   The protocol receiver of an ACAP server reads a command line from the
   client, parses the command and its arguments, and transmits server
   data and a server command completion result response.


2.2.2.  Server Protocol Sender and Client Protocol Receiver

   Data transmitted by the server to the client come in four forms:
   command continuation requests, command completion results,
   intermediate responses, and untagged responses.

   A command completion request is prefixed with the token "+".

   A command completion result response indicates the success or failure
   of the operation.  It is tagged with the same tag as the client
   command which began the operation.  Thus, if more than one command is
   in progress, the tag in a server completion response identifies the
   command to which the response applies.  There are three possible
   server completion responses: OK (indicating success), NO (indicating



Myers                                                           [Page 2]

Internet DRAFT                    ACAP                 November 25, 1996


   failure), or BAD (indicating protocol error such as unrecognized
   command or command syntax error).

   An intermediate response returns data which can only be interpreted
   within the context of a command in progress.  It is tagged with the
   same tag as the client command which began the operation.  Thus, if
   more than one command is in progress, the tag in an intermediate
   response identifies the command to which the response applies.  A
   tagged response other than "OK", "NO", or "BAD" is an intermediate
   response.

   An untagged response returns data or status messages which may be
   interpreted outside the context of a command in progress.  It is
   prefixed with the token "*".  Untagged data may be sent as a result
   of a client command, or may be sent unilaterally by the server.
   There is no syntactic difference between untagged data that resulted
   from a specific command and untagged data that were sent
   unilaterally.

   The protocol receiver of an ACAP client reads a response line from
   the server.  It then takes action on the response based upon the
   first token of the response, which may be a tag, a "*", or a "+" as
   described above.

   A client MUST be prepared to accept any server response at all times.
   This includes untagged data that it may not have requested.

   This topic is discussed in greater detail in the Server Responses
   section.

2.3.    State and Flow Diagram

   An ACAP server is in one of three states.  Most commands are valid in
   only certain states.  It is a protocol error for the client to
   attempt a command while the server is in an inappropriate state for
   that command.  In this case, a server will respond with a BAD command
   completion result.


2.3.1.  Non-Authenticated State

   In non-authenticated state, the user must supply authentication
   credentials before most commands will be permitted.  This state is
   entered when a connection starts.







Myers                                                           [Page 3]

Internet DRAFT                    ACAP                 November 25, 1996


2.3.2.  Authenticated State

   In authenticated state, the user is authenticated and most commands
   will be permitted.  This state is entered when acceptable
   authentication credentials have been provided.


2.3.3.  Logout State

   In logout state, the session is being terminated, and the server will
   close the connection.  This state can be entered as a result of a
   client request or by unilateral server decision.

            +--------------------------------------+
            |initial connection and server greeting|
            +--------------------------------------+
                      || (1)                  || (2)
                      VV                      ||
            +-----------------+               ||
            |non-authenticated|               ||
            +-----------------+               ||
             || (4)      || (3)               ||
             ||          VV                   ||
             ||          +----------------+   ||
             ||          | authenticated  |   ||
             ||          +----------------+   ||
             ||            || (4)             ||
             VV            VV                 VV
            +--------------------------------------+
            |     logout and close connection      |
            +--------------------------------------+

         (1) connection (ACAP greeting)
         (2) rejected connection (BYE greeting)
         (3) successful LOGIN or AUTHENTICATE command
         (4) LOGOUT command, server shutdown, or connection closed

2.4.    Data Formats

   ACAP uses textual commands and responses.  Data in ACAP can be in one
   of several forms: atom, number, string, parenthesized list, or NIL.


2.4.1.  Atom

   An atom consists of one to 1024 non-special characters.





Myers                                                           [Page 4]

Internet DRAFT                    ACAP                 November 25, 1996


2.4.2.  Number

   A number consists of one or more digit characters, and represents a
   numeric value.


2.4.3.  String

   A string is in one of two forms: literal and quoted string.  The
   literal form is the general form of string.  The quoted string form
   is an alternative that avoids the overhead of processing a literal at
   the cost of restrictions of what may be in a quoted string.

   A literal is a sequence of zero or more octets (including CR and LF),
   prefix-quoted with an octet count in the form of an open brace ("{"),
   the number of octets, close brace ("}"), and CRLF.  In the case of
   literals transmitted from server to client, the CRLF is immediately
   followed by the octet data.

   There are two forms of literals transmitted from client to server.
   The form where the open brace ("{") and number of octets is
   immediately followed by a close brace ("}") and CRLF is called a
   synchronizing literal.  When sending a synchronizing literal, the
   client must wait to receive a command continuation request (described
   later in this document) before sending the octet data (and the
   remainder of the command).  The other form of literal, the non-
   synchronizing literal, is used to transmit a string from client to
   server without waiting for a command continuation request.  The non-
   synchronizing literal differs from the synchronizing literal by
   having a plus ("+") between the number of octets and the close brace
   ("}") and by having the octet data immediately following the CRLF.

   A quoted string is a sequence of zero to 1024 7-bit characters,
   excluding CR, LF, double quote (<">), or backslash ("\") with double
   quote (<">) characters at each end.

   The empty string is respresented as "" (a quoted string with zero
   characters between double quotes), as {0} followed by CRLF (a
   synchronizing literal with an octet count of 0), or as {0+} followed
   by a CRLF (a non-synchronizing literal with an octet count of 0).

        Note: Even if the octet count is 0, a client transmitting a
        synchronizing literal must wait to receive a command
        continuation request.







Myers                                                           [Page 5]

Internet DRAFT                    ACAP                 November 25, 1996


2.4.3.1.        8-bit and Binary Strings

   ACAP implementations MAY transmit 8-bit octets in literals.  Except
   in the values of attributes whose names end with ".bin", these octets
   are interpreted as UTF-8 character sequences [UTF-8].  NUL octets are
   only permitted in the values of attributes whose names end with
   ".bin".  Servers SHOULD verify any non-binary string sent by the
   client has valid UTF-8 syntax before storing it.

2.5.    Operational Considerations


2.5.1.  Untagged Status Updates

   At any time, a server can send data that the client did not request.


2.5.2.  Response when no Command in Progress

   Server implementations are permitted to send an untagged response
   while there is no command in progress.  Server implementations that
   send such responses MUST deal with flow control considerations.
   Specifically, they must either (1) verify that the size of the data
   does not exceed the underlying transport's available window size, or
   (2) use non-blocking writes.


2.5.3.  Autologout Timer

   If a server has an inactivity autologout timer, that timer MUST be of
   at least 30 minutes' duration.  The receipt of ANY command from the
   client during that interval should suffice to reset the autologout
   timer.


2.5.4.  Multiple Commands in Progress

   The client is not required to wait for the completion result response
   of a command before sending another command, subject to flow control
   constraints on the underlying data stream.  Similarly, a server is
   not required to process a command to completion before beginning
   processing of the next command, unless an ambiguity would result
   because of a command that would affect the results of other commands.
   If there is such an ambiguity, the server executes commands to
   completion in the order given by the client.






Myers                                                           [Page 6]

Internet DRAFT                    ACAP                 November 25, 1996


2.6.    Datasets

   The primary data structure in ACAP is the "dataset", which is a named
   set of entries.  Datasets are named hierarchically, with each
   component of the name being preceeded by a slash ("/") and containing
   one or more UTF-8 characters (other than slash).

   Each entry in a dataset is a set of attribute/value pairs.  Each
   attribute is a hierarchical name in UTF-8, with each component of the
   name being separated with a period (".").  Each attribute/value pair
   may have additional metadata, this is described in section XXX.
   There must be exactly one "name" attribute, whose value is unique
   amongst all entries in the dataset. [OPEN ISSUE: consensus is against
   using "name" for the distinguished attribute.  Replacement has not
   been agreed on.]

   Entries in a dataset are ordered in a server-determined manner.
   [OPEN ISSUE]

   The value is a string containing one or more octets.  The semantics
   of a value are defined by the specification of its attribute.  Values
   of attributes ending in ".bin" contain arbitrary data.  Values of
   other attributes are textual and are interpreted as a sequence of
   characters encoded in UTF-8.

2.7.    Predefined Attributes

   Attribute names which do not contain a dot (".") are reserved for
   standardized attributes which have meaning in any dataset.  The
   following attributes are defined by the ACAP protocol.

   name Contains the name of the entry.

   modtime
        Contains the date and time, in UTC, any value in the entry was
        last modified.  This value is automatically updated by the
        server and may not be directly modified by the client.

        The value consists of 14 or more us-ascii digits.  The first
        four indicate the year, the next two indicate the month, the
        next two indicate the day of month, the next two indicate the
        hour (0 - 23), the next two indicate the minute, and the next
        two indicate the second.  Any further digits indicate fractions
        of a second.

        The time, particularly fractions of a second, need not be
        accurate.  It is required, however, that any two entries in a
        dataset changed by successive modifications have strictly



Myers                                                           [Page 7]

Internet DRAFT                    ACAP                 November 25, 1996


        ascending modtime values.

   createtime
        The modtime of the operation that created the entry.

2.8. Attribute metadata

   Each attribute/value pair may have additional metadata associated
   with it.  For completeness, the attribute and value themselves are
   defined as metadata.  The defined items of metadata associated with
   an attribute/value pair are:

attribute
     The attribute name.  Read-only.

valueThe value.

value<ORIGIN.SIZE>
     A substring of the value.  ORIGIN is specified as a non-negative
     decimal number indicating the octet position of the first desired
     octet.  An ORIGIN of 0 specifies the first octet of the value.
     SIZE is specified as a positive, nonzero decimal number, specifying
     the maximum number of octets desired.  Read-only.

size The length of the value, in octets.  Read-only.

acl  The access control list for the attribute/value pair, if one
     exists.  If the attribute/value pair does not have an ACL, the null
     string.  Read-only [OPEN ISSUE: allow writing?]

myrights
     The set of rights that the client has to the attribute/value pair.
     Read-only.

Additional items of metadata may be defined in extensions to this
protocol.  Servers must respond to queries of unrecognized metadata by
returning the null string [OPEN ISSUE: return error instead?].

2.9.    Child Dataset Attributes

   Attributes names starting with the "dataset." prefix are reserved for
   standardized attributes containing information about child datasets.
   The "dataset." attributes on an entry describe the child dataset with
   the same relative name as the entry.  For example, if the dataset
   "/foo/bar" has an entry "baz" with "dataset." attributes, those
   attributes pertain to the "/foo/bar/baz" dataset.

   [TODO: flesh out what these are.  Tentative list follows.]



Myers                                                           [Page 8]

Internet DRAFT                    ACAP                 November 25, 1996


       dataset.exists "y"  ; Non-empty means sub-dataset exists on this server
       dataset.referlist "acap://acap3.andrew.cmu.edu/foo/bar"
                           ; attempt to access generates [REFER] special
                           ; information token with following contents.
                           ; [OPEN ISSUE: multiple urls?]
       ; dataset.exists and dataset.referlist mutually exclusive.
       ; [OPEN ISSUE: Combine them?]

       dataset.shadows "/foo/bar"
                           ; What this dataset shadows
                           ; Only meaningful if dataset.exists non-empty.
                           ; [OPEN ISSUE: Combine?]

       dataset.subscription "show"
                           ; more limited than for mailbox lists




































Myers                                                           [Page 9]

Internet DRAFT                    ACAP                 November 25, 1996


3.      Protocol Specification

   ACAP commands and responses are described in this section.  Commands
   are organized first by the state in which the command is permitted,
   then by a general category of command type.

   Command arguments, identified by "Arguments:" in the command
   descriptions below, are described by function, not by syntax.  The
   precise syntax of command arguments is described in the Formal Syntax
   section.

   Some commands cause specific server data to be returned; these are
   identified by "Data:" in the command descriptions below.  See the
   response descriptions in the Responses section for information on
   these responses, and the Formal Syntax section for the precise syntax
   of these responses.  It is possible for server data to be transmitted
   as a result of any command; thus, commands that do not specifically
   require server data specify "no specific data for this command"
   instead of "none".

   The "Result:" in the command description refers to the possible
   tagged status responses to a command, and any special interpretation
   of these status responses.


3.1.    Initial Connection

   Upon session startup, the server sends one of two untagged responses:
   ACAP or BYE.  The untagged BYE response is described in section XXX.

3.1.1.  ACAP Response

   Data:       capability list

      The untagged ACAP response indicates the session is ready to
      accept commands and contains a space-separated listing of
      capabilities that the server supports.  Each capability is an atom
      name, possibly followed by a string argument in parenthesis.

      ACAP capability names MUST be registered with IANA.  [OPEN ISSUE:
      ESTABLISH REGISTRY].

      Client implementations SHOULD NOT require any capability name, and
      MUST ignore any unknown capability names.

      [TODO: initial capability list: IMPLEMENTATION, CONTEXTLIMIT,
      ORDERINGS]




Myers                                                          [Page 10]

Internet DRAFT                    ACAP                 November 25, 1996


   Example:    S: * ACAP IMPLEMENTATION("ACME v3.5")

3.2.        Any State

   The following commands and responses are valid in any state.

3.2.1.  NOOP Command

Arguments:  none

Data:       no specific data for this command (but see below)

Result:     OK - noop completed
            BAD - command unknown or arguments invalid

      The NOOP command always succeeds.  It does nothing.

      Since any command can return a status update as untagged data, the
      NOOP command can be used as a periodic poll for status updates
      during a period of inactivity.  The NOOP command can also be used
      to reset any inactivity autologout timer on the server.

   Example:    C: a002 NOOP
               S: a002 OK NOOP completed


3.2.2.  LOGOUT Command

   Arguments:  none

   Data:       mandatory untagged response: BYE

   Result:     OK - logout completed
               BAD - command unknown or arguments invalid

      The LOGOUT command informs the server that the client is done with
      the session.  The server must send a BYE untagged response before
      the (tagged) OK response, and then close the network connection.

   Example:    C: A023 LOGOUT
               S: * BYE ACAP Server logging out
               S: A023 OK LOGOUT completed
               (Server and client then close the connection)








Myers                                                          [Page 11]

Internet DRAFT                    ACAP                 November 25, 1996


3.2.3.  OK Response

   Data:       optional response code
               human-readable text

      The OK response indicates an information message from the server.
      When tagged, it indicates successful completion of the associated
      command.  The human-readable text may be presented to the user as
      an information message.  The untagged form indicates an
      information-only message; the nature of the information may be
      indicated by a response code.

   Example:    S: * OK [ALERT] System shutdown in 10 minutes


3.2.4.  NO Response

   Data:       optional response code
               human-readable text

      The NO response indicates an operational error message from the
      server.  When tagged, it indicates unsuccessful completion of the
      associated command.  The untagged form indicates a warning; the
      command may still complete successfully.  The human-readable text
      describes the condition.

   Example:    C: A001 LOGIN fred secret
               S: * NO [ALERT] Dataet "/addressbook/fred" is at 98% of
               quota [TODO-FIX]
               S: A001 OK LOGIN
                  ...
               C: A222 STORE /mailboxes "comp.mail.misc"
               mailbox.creation-time "19951206103412"
               S: A222 NO Permission denied


3.2.5.  BAD Response

   Data:       optional response code
               human-readable text

      The BAD response indicates an error message from the server.  When
      tagged, it reports a protocol-level error in the client's command;
      the tag indicates the command that caused the error.  The untagged
      form indicates a protocol-level error for which the associated
      command can not be determined; it may also indicate an internal





Myers                                                          [Page 12]

Internet DRAFT                    ACAP                 November 25, 1996


      server failure.  The human-readable text describes the condition.

   Example:    C: ...empty line...
               S: * BAD Empty command line
               C: A443 BLURDYBLOOP
               S: A443 BAD Unknown command


3.2.6.  BYE Response

   Data:       optional response code
               human-readable text

      The untagged BYE response indicates that the server is about to
      close the connection.  The human-readable text may be displayed to
      the user in a status report by the client.  The BYE response may
      be sent as part of a normal logout sequence, or as a panic
      shutdown announcement by the server.  It is also used by some
      server implementations as an announcement of an inactivity
      autologout.

      This response is also used as one of two possible greetings at
      session startup.  It indicates that the server is not willing to
      accept a session from this client.

   Example:    S: * BYE Autologout; idle for too long


3.3.        Non-Authenticated State

   In non-authenticated state, the AUTHENTICATE or LOGIN command
   establishes authentication and enter authenticated state.  The
   AUTHENTICATE command provides a general mechanism for a variety of
   authentication techniques, whereas the LOGIN command uses the
   traditional user name and plaintext password pair.

   Server implementations may allow non-authenticated access to certain
   information.  The convention is to use a LOGIN command with the
   userid "anonymous".  A password is required.  It is implementation-
   dependent what requirements, if any, are placed on the password and
   what access restrictions are placed on anonymous users.

   Once authenticated (including as anonymous), it is not possible to
   re-enter non-authenticated state.

   In addition to the universal commands (NOOP and LOGOUT), the
   following commands are valid in non-authenticated state:
   AUTHENTICATE and LOGIN.



Myers                                                          [Page 13]

Internet DRAFT                    ACAP                 November 25, 1996


3.3.1.  AUTHENTICATE Command

   Arguments:  SASL mechanism name
               optional initial response

   Data:       continuation data may be requested

   Result:     OK - authenticate completed, now in authenticated state
               NO - authenticate failure: unsupported authentication
                    mechanism, credentials rejected
               BAD - command unknown or arguments invalid,
                    authentication exchange cancelled

      The AUTHENTICATE command indicates an authentication mechanism to
      the server.  If the server supports the requested authentication
      mechanism, it performs an authentication protocol exchange to
      authenticate and identify the user.  Optionally, it also
      negotiates a security layer for subsequent protocol interactions.
      If the requested authentication mechanism is not supported, the
      server rejects the AUTHENTICATE command by sending a tagged NO
      response.

      [OPEN ISSUE: Change from base64 encoded literals to using binary
      literals?]

      The authentication protocol exchange consists of a series of
      server challenges and client answers that are specific to the
      authentication mechanism.  A server challenge consists of a
      command continuation request response with the "+" token followed
      by a BASE64 encoded string.  The client answer consists of a line
      consisting of a BASE64 encoded string.  If the client wishes to
      cancel an authentication exchange, it should issue a line with a
      single "*".  If the server receives such an answer, it must reject
      the AUTHENTICATE command by sending a tagged BAD response.

      The optional initial-response argument to the AUTHENTICATE command
      is used to save a round trip when using authentication mechanisms
      that are defined to send no data in the initial challenge.  When
      the initial-response argument is used with such a mechanism, the
      initial empty challenge is not sent to the client and the server
      uses the data in the initial-response argument as if it were sent
      in response to the empty challenge.  If the initial-response
      argument to the AUTHENTICATE  command is used with a mechanism
      that sends data in the initial challenge, the server rejects the
      AUTHENTICATE command by sending a tagged NO response.

      The service name specified by this protocol's profile of SASL is
      "acap".



Myers                                                          [Page 14]

Internet DRAFT                    ACAP                 November 25, 1996


      If a security layer is negotiated through the SASL authentication
      exchange, it takes effect immediately following the CRLF that
      concludes the authentication exchange for the client, and the CRLF
      of the tagged OK response for the server.

      The server is not required to support any particular
      authentication mechanism, nor are authentication mechanisms
      required to support any protection mechanisms.  If an AUTHENTICATE
      command fails with a NO response, the client may try another
      authentication mechanism by issuing another AUTHENTICATE command,
      or may attempt to authenticate by using the LOGIN command.  In
      other words, the client may request authentication types in
      decreasing order of preference, with the LOGIN command as a last
      resort.

   Example:    S: * ACAP IMPLEMENTATION("Blorfysoft v3.5")
               AUTH(KERBEROS_V4)
               C: A001 AUTHENTICATE KERBEROS_V4
               S: + AmFYig==
               C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT
                  +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd
                  WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh
               S: + or//EoAADZI=
               C: DiAF5A4gA+oOIALuBkAAmw==
               S: A001 OK Kerberos V4 authentication successful

        Note: the line breaks in the first client answer are for
        editorial clarity and are not in real authenticators.


3.3.2.  LOGIN Command

   Arguments:  user name
               password

   Data:       no specific data for this command

   Result:     OK - login completed, now in authenticated state
               NO - login failure: user name or password rejected
               BAD - command unknown or arguments invalid

      The LOGIN command identifies the user to the server and carries
      the plaintext password authenticating this user.

   Example:    C: a001 LOGIN SMITH SESAME
               S: a001 OK LOGIN completed





Myers                                                          [Page 15]

Internet DRAFT                    ACAP                 November 25, 1996


3.4.    Searching

   This section describes the SEARCH command, for retrieving data from
   datasets.


3.4.1.  SEARCH Command

   Arguments:  dataset or context name
               optional list of modifiers
               search criteria

   Data:       intermediate responses: ENTRY, MODTIME

   Result:     OK - search completed
               NO - search failure: can't perform search
               BAD - command unknown or arguments invalid

      The SEARCH command identifies a subset of entries in a dataset and
      returns information on that subset to the client.

      The first argument to SEARCH identifies what is to be searched.
      If the string begins with a slash ("/"), it is the name of a
      dataset to be searched, otherwise it is a name of a context that
      was created by a SEARCH command given previously in the session.

      Following that are zero or more modifiers to the search.  Each
      modifier may be specified at most once.  The defined modifiers
      are:

      LIMIT number   Limits the number of intermediate ENTRY responses
                     that the search may generate.  The numeric argument
                     specifies the limit.  If the search matches more
                     entries than the limit, then no ENTRY intermediate
                     responses are returned.  The SEARCH command still
                     succeeds, returning the number of matches in a
                     TOOMANY special information token in the tagged OK
                     response.

      MAKECONTEXT name
                     The SEARCH command creates a context with the name
                     given in the argument to refer to the matching
                     entries.

                     If the SEARCH is successful, the context name may
                     then be given as an argument to subsequent SEARCH
                     commands to search the set of matching entries.




Myers                                                          [Page 16]

Internet DRAFT                    ACAP                 November 25, 1996


                     If a context with the specified name already
                     exists, it is first freed.  If a new context may
                     not be created due to the server's limit on the
                     number of existing contexts, the command fails,
                     returning a TOOMANYCONTEXTS special information
                     token in the tagged NO response.

                     Contexts are discussed in more detail in section
                     XXX.

      RETURN (metadata...)
                     Specifies what is to be returned in intermediate
                     ENTRY responses.  If this modifier is not
                     specified, no intermediate ENTRY responses are
                     returned.

                     Inside the parentesis is a list of attributes, each
                     optionally followed by a parenthesized list of
                     metadata.  If the parenthesised list of metadata is
                     not specified, it defaults to "(value)".

                     [OPEN ISSUE: wildcards?]

                     Following the last intermediate ENTRY response, the
                     server returns a single intermediate MODTIME
                     response.

      SORT (attribute ordering...)
                     Specifies the order in which any resulting ENTRY
                     replies are to be returned to the client.  The SORT
                     modifier takes as an argument a parenthesized list
                     of one or more attribute/ordering pairs.  Attribute
                     lists the attribute to sort on, ordering specifies
                     the name of the collation rule to apply to the
                     values of the attribute. [TODO: list predefined
                     orderings, establish registry].  Successive
                     attribute/ordering pairs are used to apply ordering
                     of two entries only when all preceeding pairs
                     indicate two entries collate the same.

                     If the SORT modifier is used in conjunction with
                     the MAKECONTEXT modifier, the SORT modifier
                     specifies the ordering of entries in the created
                     context.

                     If no SORT modifier is specified, or none of the
                     attribute/ordering pairs indicates an order to two
                     entries, the server uses the order of the entries



Myers                                                          [Page 17]

Internet DRAFT                    ACAP                 November 25, 1996


                     that exists in the context or dataset being
                     searched.

      Following the modifiers is the search criteria.  Searching
      criteria consist of one or more search keys.  When multiple keys
      are specified, the result is the intersection (AND function) of
      all the messages that match those keys.  For example, the criteria
      COMPARE modtime +octet "19951206103400" COMPARE modtime -octet
      "19960112000000" refers to all entries modified between 10:34
      December 6 1995 and midnight January 12, 1996.  A search key may
      also be a parenthesized list of one or more search keys (e.g. for
      use with the OR and NOT keys).

      The currently defined search keys are as follows.

COMPARE attribute ordering value
               Entries for which the specified attribute collates using
               the specified ordering the same or later than the
               specified value.

COMPARESTRICT attribute ordering value
               Entries for which the specified attribute collates using
               the specified ordering later than the specified value.

EQUAL attribute ordering value
               Entries for which the specified attribute collates using
               the specified ordering the same as the specified value.

NOT search-key
               Entries that do not match the specified search key.

OR search-key1 search-key2
               Entries that match either search key.

RANGE start end Entries which are within the specified range of the
               dataset or context's ordering.  The lowest-ordered entry
               in the dataset or context is assigned number one, the
               next lowest entry is assigned number two, and so on.  The
               numeric arguments specify the lowest and highest numbers
               to match.

Example:    C: [TODO - write examples]

3.4.2.  ENTRY Response

Data:       entry name
            entry data




Myers                                                          [Page 18]

Internet DRAFT                    ACAP                 November 25, 1996


      The ENTRY intermediate response occurs as a result of a SEARCH or
      LOCK command.  This is the means by which dataset entries are
      returned to the client.  The entry with the given name matches the
      search.  Following the entry name is a set of zero or more
      strings, each containing the respective metadata, contained in the
      entry, that was specified in the RETURN search modifier.

3.4.3.  MODTIME Response

   Data:       modtime value

      The MODTIME intermediate response occurs as a result of a SEARCH
      command.  It indicates that the previously returned ENTRY
      responses include all updates to the returned entries up to and
      including the modtime value in the argument.

3.5.    Contexts

   A context is an ordered subset of entries in a dataset, created by a
   SEARCH command with a MAKECONTEXT modifier.  Context names are
   client-generated strings and must not start with the slash ('/')
   character.

   Contexts only have scope within the ACAP session they were created.
   There is a server-imposed limit on the number of contexts that may
   exist at one time within a session.  The minimum value for this limit
   is 100, if the server supports a larger limit it must advertise it in
   a CONTEXTLIMIT capability.


3.5.1.  FREECONTEXT Command

   Arguments:  context name

   Data:       no specific data for this command

   Result:     OK - freecontext completed
               NO - freecontext failure: no such context
               BAD - command unknown or arguments invalid

      The FREECONTEXT command causes the server to free all state
      associated with the named context.  The context may no longer be
      searched and the server will no longer issue any untagged
      responses for the context.  The context is no longer counted
      against the server's limit on the number of contexts.

   Example:    C: A683 FREECONTEXT blurdybloop
               S: A683 OK Freecontext completed



Myers                                                          [Page 19]

Internet DRAFT                    ACAP                 November 25, 1996


3.5.2.  NOTIFYCONTEXT Command

   Arguments:  context name
               list of attributes

   Data:       untagged responses: ADDTO REMOVEFROM CHANGE MODTIME

   Result:     OK - Notifycontext completed: notifications  enabled  for
               context
               NO - Notifycontext failed: no such context
               BAD - command unknown or arguments invalid

      The NOTIFYCONTEXT command requests the server send untagged ADDTO,
      REMOVEFROM, CHANGE, and MODTIME responses for the specified
      context, notifying the client of how the results of the SEARCH
      command that created the context would change due to modifications
      that have been made to the dataset.  Following the context name is
      the list of attributes to be returned in ADDTO and CHANGE
      responses for the context.

      [OPEN ISSUE: NOTIFYCONTEXT on contexts created from contexts, when
      the parent context has been given to the FREECONTEXT or
      NOTIFYCONTEXT command.]

      The server may issue untagged ADDTO, REMOVEFROM, or CHANGE
      notifications for a context at any time between the issuing of the
      NOTIFYCONTEXT command for the context and the completion of a
      FREECONTEXT command for the context.  After issuing a sequence of
      ADDTO, REMOVEFROM or CHANGE notifications, the server should issue
      an untagged MODTIME notification indicating that the client has
      all updates to the entries in the context up to and including the
      given modtime value.

      The client may issue a subsequent NOTIFYCONTEXT command for the
      same context, this has the effect of changing the list of
      attributes included in ADDTO and CHANGE responses for the context.

   Example:    C: Z4S9 NOTIFYCONTEXT blurdybloop
               S: Z4S9 OK notifications enabled for context












Myers                                                          [Page 20]

Internet DRAFT                    ACAP                 November 25, 1996


3.5.2.  UPDATECONTEXT Command

   Arguments:  list of context names

   Data:       untagged responses: ADDTO REMOVEFROM CHANGE MODTIME

   Result:     OK - Updatecontext completed: all updates completed
               NO - Updatecontext failed: no such context
               BAD - command unknown or arguments invalid

      The UPDATECONTEXT command causes the server to ensure that the
      client is notified of all changes to the contexts listed as
      arguments up to the current time.  The contexts listed in the
      arguments must have been previously given to a successful
      NOTIFYCONTEXT command.

      While a server may issue untagged ADDTO, REMOVEFROM, CHANGE, and
      MODTIME at any time, the UPDATECONTEXT command is used to "prod"
      the server to send any notifications it has not sent yet.

   Example:    C: Z4S9 UPDATECONTEXT blurdybloop
               S: Z4S9 OK client has been notified of all changes


3.5.4.  ADDTO Response

   Data:       context name
               entry name
               position
               attribute/value list

      The untagged ADDTO response informs the client that an entry has
      been added to a context.  The response includes the position
      number of the added entry (the first entry in the context is
      numbered 1) and those attribute/value pairs contained in the entry
      which match attributes specified in the last NOTIFYCONTEXT command
      for the context.

   Example:    S: * ADDTO blurdybloop fred 15


3.5.5.  REMOVEFROM Response

   Data:       context name
               entry name
               old position

      The untagged REMOVEFROM response informs the client that an entry



Myers                                                          [Page 21]

Internet DRAFT                    ACAP                 November 25, 1996


      has been removed from a context.  The response includes the
      position number that the removed entry used to have (the first
      entry in the context is numbered 1).

   Example:    S: * REMOVEFROM blurdybloop fred 15


3.5.6.  CHANGE Response

   Data:       context name
               entry name
               old position
               new position
               attribute/value list

      The untagged CHANGE response informs the client that an entry in a
      context has either changed position in the context or has changed
      the values of one or more of the attributes specified in the last
      NOTIFYCONTEXT command for the context.

      The response includes the previous and current position numbers of
      the entry (the first entry in the context is numbered 1) and those
      attribute/value pairs contained in the entry which match
      attributes specified in the last NOTIFYCONTEXT command for the
      context.

   Example:    S: * CHANGE blurdybloop fred 15 10

3.5.7.  MODTIME Response

Data:       context name
            modtime value

      The untagged MODTIME response informs the client that it has
      recieved all updates to entries in the context which have modtime
      values less than or equal to the modtime value in the argument.

   Example:    S: * CHANGE blurdybloop fred 15 10

3.6.    Dataset modification

   The following commands and responses handle modification of datasets.









Myers                                                          [Page 22]

Internet DRAFT                    ACAP                 November 25, 1996


3.6.1.  STORE Command

   Arguments:  dataset name
               entry name
               metadata list

   Data:       no specific data for this command

   Result:     OK - store completed
               NO - store failure: can't store that name
                    invalid UTF-8 syntax
               BAD - command unknown or arguments invalid

      Creates or modifies the named entry in the named dataset.  The
      values of metadata not specified in the command are not changed.
      Setting the "value" metadata of an attribute to the empty string
      removes the attribute from the entry.

      The reserved attribute "name" may be included in the metadata
      list.  Changing the value of this attribute indicates a request to
      rename the entry.

      The reserved attribute "modtime" may not be included in the
      metadata list, but will automatically be updated.  The reserved
      attribute "createtime" may not be included in the metadata list,
      but will automatically be set when an entry is created.

   Example:    C: A342 STORE Fred "Barney Rubble" addressbook.phone
               "555" addressbook.email ""
               S: A342 OK Store completed


3.6.2.  DELETE Command

   Arguments:  dataset name
               entry name

   Data:       no specific data for this command

   Result:     OK - delete completed
               NO - delete failure: can't delete that entry
               BAD - command unknown or arguments invalid

      Removes the named entry from the named dataset.  If there is no
      such entry in the dataset, the command simply returns a tagged OK
      response.





Myers                                                          [Page 23]

Internet DRAFT                    ACAP                 November 25, 1996


3.6.3.  DELETEDSINCE Command

   Arguments:  dataset name
               time

   Data:       untagged response: DELETEDFROM

   Result:     OK - Deletedfrom completed
               NO - Deletedfrom failure: can't read dataset
                    date too far in the past
               BAD - command unknown or arguments invalid

      The DELETEDFROM command returns in untagged [OPEN ISSUE:
      intermediate?] DELETEDFROM replies the names of entries that have
      been deleted from the named dataset since the given time.

      Servers may impose a limit on the number or age of deleted entry
      names they keep track of.  If the server does not have information
      going back to the specified time, the command fails, returning a
      TOOOLD special information token in the tagged NO response.

   Example:    C: Z4S9 DELETEDSINCE /mailboxes 19951205103412
               S: * DELETEDFROM /mailboxes shared.blurdybloop
               S: * DELETEDFROM /mailboxes shared.anteaters
               S: Z4S9 OK DELETEDSINCE completed
               C: Z4U3 DELETEDSINCE /mailboxes 19951009040854
               S: Z4U3 NO [TOOOLD] Don't have that information


3.6.4.  DELETEDFROM Response

   Data:       dataset name
               entry name

      The untagged DELETEDFROM response occurs as a result of a
      DELETEDSINCE command.  It returns the names of a dataset and an
      entry that has been deleted from the dataset.

   Example:    S: * DELETEDFROM /mailboxes shared.blurdybloop

3.7.    Dataset management

   [TODO: specify/describe attributes which control sub-datasets.]








Myers                                                          [Page 24]

Internet DRAFT                    ACAP                 November 25, 1996


3.8.    Access Control Lists

   An access control list is a set of <identifier,rights> pairs.

   Identifier is a US-ASCII string.  The identifier anyone is reserved
   to refer to the universal identity (all authentications, including
   anonymous).  All user name strings accepted by the LOGIN or
   AUTHENTICATE commands to authenticate to the ACAP server are reserved
   as identifiers for the corresponding user.  Identifiers starting with
   a dash ("-") are reserved for "negative rights", described below.
   All other identifier strings have implementation-defined semantics.

   Rights is a string listing a (possibly empty) set of alphanumeric
   characters, each character listing a set of operations which is being
   controlled.  Letters are reserved for ``standard'' rights, listed
   below.  The set of standard rights may only be extended by a
   standards-track document.  Digits are reserved for implementation or
   site defined rights.  The currently defined standard rights are:

   r - read
   w - write
   o - override (see
   a - administer (perform SETACL)

   An implementation may force rights to always or never be granted.
   [Mention that rights may not be tied, as they can be in IMAP?]

   It is possible for multiple identifiers in an access control list to
   apply to a given user (or other authentication identity).  For
   example, an ACL may include rights to be granted to the identifier
   matching the user, one or more implementation-defined identifiers
   matching groups which include the user, and/or the identifier
   "anyone".  How these rights are combined to determine the user's
   access is implementation-defined.  An implementation may choose, for
   example, to use the union of the rights granted to the applicable
   identifiers.  An implementation may instead choose, for example, to
   only use those rights granted to the most specific identifier present
   in the ACL.  A client may determine the set of rights granted to the
   logged-in user for a given mailbox by using the MYRIGHTS command.

   When an identifier in an ACL starts with a dash ("-"), that indicates
   that associated rights are to be removed from the identifier that is
   prefixed by the dash.  For example, if the identifier "-fred" is
   granted the "w" right, that indicates that the "w" right is to be
   removed from users matching the identifier "fred".  Implementations
   need not support having identifiers which start with a dash in ACLs.

   Each attribute of each entry of a dataset may potentially have an



Myers                                                          [Page 25]

Internet DRAFT                    ACAP                 November 25, 1996


   ACL.  If an attribute in an entry does not have an ACL, then access
   is controlled by a default ACL for that attribute in the dataset, if
   it exists.  If there is no default ACL for that attribute in the
   dataset, access is controlled by a default ACL for that dataset.  The
   default ACL for a dataset must exist.

   In order to perform any manipulation on an entry on a dataset, the
   client must have 'r' rights on the "name" attribute of the entry.

   [OPEN ISSUE: l, i, c, and/or d rights which only apply at the dataset
   level?  Lookup could be implemented by the 'r' right on the 'name'
   attribute of that dataset's entry in the dataset list. Insertion
   could be handled by the 'w' right on the "name" attribute in the
   dataset.  Creation and deletion of datasets are instead handled by
   the 'w' right on the "dataset.exists" and related attributes in the
   parent dataset.]

   Many of the ACL commands and responses include an ``acl object''
   parameter, for specifying what the ACL applies to.  This is a
   parenthesized list.  The list contains just the dataset name when
   referring to the default ACL for a dataset.  The list contains a
   dataset name and an attribute name when referring to the default ACL
   for an attribute in a dataset.  The list contains a dataset name, an
   attribute name, and an entry name when referring to the ACL for an
   attribute of an entry of a dataset.


3.8.1. SETACL    Command

   Arguments:  acl object
               authentication identifier
               access rights

   Data:       no specific data for this command

   Result:     OK - setacl completed
               NO - setacl failure: can't set acl
               BAD - command unknown or arguments invalid

      The SETACL command changes the access control list on the
      specified object so that the specified identifier is granted the
      permissions enumerated in rights.  If the object did not
      previously have an access control list, it does now.








Myers                                                          [Page 26]

Internet DRAFT                    ACAP                 November 25, 1996


3.8.2. DELETEACL         Command

   Arguments:  acl object
               optional authentication identifier

   Data:       no specific data for this command

   Result:     OK - deleteacl completed
               NO - deleteacl failure: can't delete acl
               BAD - command unknown or arguments invalid

      If given the optional identifier argument, the DELETEACL command
      removes any portion of the access control list on the specified
      object for the specified identifier.

      If not given the optional identifier argument, the DELETEACL
      command removes the ACL from the object entirely, causing access
      to be controlled by a higher-level default ACL.  It is an error to
      use this form of the DELETEACL command on the default ACL for a
      dataset.


3.8.3. GETACL    Command

   Arguments:  acl object

   Data:       untagged responses: ACL

   Result:     OK - getacl completed
               NO - getacl failure: can't get acl
                    acl does not exist
               BAD - command unknown or arguments invalid

      The GETACL command returns the access control list for the
      specified object in an untagged ACL reply.  If the specified
      object does not have an ACL, the command fails, returning a NOACL
      special information token in the tagged NO response.

   Example:    C: A002 GETACL ("/mailboxes")
               S: * ACL ("/mailboxes") anyone r
               S: A002 OK Getacl complete










Myers                                                          [Page 27]

Internet DRAFT                    ACAP                 November 25, 1996


3.8.4. LISTRIGHTS        Command

   Arguments:  acl object
               authentication identifier

   Data:       untagged responses: LISTRIGHTS

   Result:     OK - listrights completed
               NO - listrights failure: can't get rights list
               BAD - command unknown or arguments invalid

      The LISTRIGHTS command takes an object and an identifier and
      returns information about what rights may be granted to the
      identifier in the ACL for the object.

   Example:    C: a001 LISTRIGHTS ("/mailboxes") smith
               S: * LISTRIGHTS ("/mailboxes") smith r w
               S: a001 OK Listrights completed


               C: a005 LISTRIGHTS ("/mailboxes" archive.imap) anyone
               S: * LISTRIGHTS ("/mailboxes" archive.imap) anyone "" r w
               S: a005 OK Listrights completed


3.8.5. MYRIGHTS  Command

   Arguments:  acl object

   Data:       untagged responses: MYRIGHTS

   Result:     OK - myrights completed
               NO - myrights failure: can't get rights
               BAD - command unknown or arguments invalid

      The MYRIGHTS command returns the set of rights that the client has
      to the given object in an untagged MYRIGHTS reply.


   Example:    C: A003 MYRIGHTS ("/mailboxes")
               S: * MYRIGHTS ("/mailboxes") r
               S: A003 OK Myrights complete









Myers                                                          [Page 28]

Internet DRAFT                    ACAP                 November 25, 1996


3.8.6. ACL       Response

   Data:       acl object
               zero or more identifier rights pairs

      The ACL response occurs as a result of a GETACL command.  The
      first list is the object for which this ACL applies.  This is
      followed by zero or more pairs of strings, each pair contains the
      identifier for which the entry applies followed by the set of
      rights that the identifier has.


3.8.7. LISTRIGHTS        Response

   Data:       acl object
               identifier
               required rights
               list of optional rights

      The LISTRIGHTS response occurs as a result of a LISTRIGHTS
      command.  The first two arguments are the object and identifier
      for which this rights list applies.  Following the identifier is a
      string containing the (possibly empty) set of rights the
      identifier will always be granted in the mailbox.

      Following this are zero or more strings each containing a single
      right the identifier may be granted in the mailbox.

      The same right may not be listed more than once in the LISTRIGHTS
      command.


3.8.8. MYRIGHTS  Response

   Data:       acl object
               rights

      The MYRIGHTS response occurs as a result of a MYRIGHTS command.
      The first string is the object for which these rights apply.  The
      second string is the set of rights that the client has.

3.9.    Advisory locking

   These commands allow cooperating clients to synchronize their updates
   to datasets.






Myers                                                          [Page 29]

Internet DRAFT                    ACAP                 November 25, 1996


3.9.1.  LOCK Command

   Arguments:  dataset name
               optional list of entry names
               optional list of attribute names

   Data:       intermediate responses: ENTRY

   Result:     OK - lock completed
               NO - lock failure: can't lock dataset/entry
                    some other client has obtained lock on dataset/entry
               BAD - command unknown or arguments invalid

      The LOCK command accepts as arguments a dataset name and an
      optional list of entry names.  It attempts to acquire an exclusive
      semaphore on each of the entries in the dataset.  The dataset must
      exist, but the named entries need not.  If the optional list of
      entry names is not present, it attempts to acquire an exclusive
      semaphore on the dataset as a whole.

      If the command is successful, the server must ensure that no other
      client will be able to successfully lock either any of the named
      entries in the dataset or the dataset as a whole until the
      successful client either performs a matching UNLOCK command or
      closes the connection.  If the optional list of entry names is not
      present, the server must also ensure that no other client will be
      able to lock any entry in the in the dataset.

      If some other client has obtained either the semaphore on the
      dataset as a whole or a semaphore on one of the named entries, the
      command fails, returning a LOCKED special information token in the
      tagged NO response.

      If the command is successful and the optional list of attributes
      is present, the server returns the values of those attributes of
      those entries in intermediate ENTRY responses.

      The server should ensure that the client has permission to perform
      a STORE operation on at least one attribute of each of the
      entries.  [OPEN ISSUE: what is necessary in order to LOCK the
      entire dataset--at least one entry or all entries?]

      Even though other clients may not perform a LOCK operation on an
      entry, servers should not prevent them from performing STORE







Myers                                                          [Page 30]

Internet DRAFT                    ACAP                 November 25, 1996


      operations on the entry.

   Example:    C: A069 LOCK "/addressbook/fred" (barney)
               (addressbook.email)
               S: A069 ENTRY barney addressbook.email "barney@bedrock"
               S: A069 OK Lock completed
               C: A070 LOCK "/addressbook/shared" ("Bam Bam")
               S: A070 NO [LOCKED] Locked by Barney on client7.do.main


3.9.2.  UNLOCK Command

   Arguments:  dataset name
               optional list of entry names

   Data:       no specific data for this command

   Result:     OK - unlock completed
               NO - unlock failure: can't unlock that dataset/entry
               BAD - command unknown or arguments invalid

      The UNLOCK command accepts as arguments a dataset name and an
      optional list of entry names.  If the list of entry names is
      present, it releases any semaphores the client may have previously
      obtained on those entries by using the LOCK command.  If the list
      of entry names is not present, it removes any semaphore the client
      may have on the dataset as a whole or on any entry in the dataset.
























Myers                                                          [Page 31]

Internet DRAFT                    ACAP                 November 25, 1996


3.x.    Server Responses - Status Responses

   [TODO - put this somewhere reasonable]

   Status responses may include an optional response code.  A response
   code consists of data inside square brackets in the form of an atom,
   possibly followed by a space and arguments.  The response code
   contains additional information or status codes for client software
   beyond the OK/NO/BAD condition, and are defined when there is a
   specific action that a client can take based upon the additional
   information.

   The currently defined response codes are:

      ALERT          The human-readable text contains a special alert
                     that MUST be presented to the user in a fashion
                     that calls the user's attention to the message.

      LOCKED         The option or address book entry is already locked
                     by another client.

      REFER          This response code may be returned in a tagged NO
                     response to any command that takes a dataset name
                     as a parameter.  It is a referral, indicating that
                     the command should be retried using the dataset
                     named in the URL given in the argument.

      TOOMANY        This response code may be returned in a tagged OK
                     response to a SEARCH command which includes the
                     LIMIT modifier.  The argument returns the number of
                     matching entries.

      TOOMANYCONTEXTSThis response code may be returned in a tagged NO
                     respose to a SEARCH command which includes the
                     MAKECONTEXT modifier.  It indicates that a new
                     context may not be created due to the server's
                     limit on the number of existing contexts.

      NOACL          This response code may be returned in a tagged NO
                     response to a GETACL command.  It indicates that
                     the specified object does not have an access
                     control list associated with it.

      Additional response codes defined by particular client or server
      implementations should be prefixed with an "X" until they are
      added to a revision of this protocol.  Client implementations
      should ignore response codes that they do not recognize.




Myers                                                          [Page 32]

Internet DRAFT                    ACAP                 November 25, 1996


3.x     Server Responses - Command Continuation Request

   [TODO - put this somewhere reasonable]

   The command completion request response is indicated by a "+" token
   instead of a tag.  This indicates that the server is ready to accept
   the continuation of a command from the client.  The remainder of this
   response is a line of text.

   This response is used in the AUTHENTICATE command to transmit server
   data to the client, and request additional client data.  This
   response is also used if an argument to any command is a
   synchronizing literal.

   The client is not permitted to send the octets of a synchronizing
   literal unless the server indicates that it expects it.  This permits
   the server to process commands and reject errors on a line-by-line
   basis, assuming it checks for non-synchronizing literals at the end
   of each line.  The remainder of the command, including the CRLF that
   terminates a command, follows the octets of the literal.  If there
   are any additional command arguments the literal octets are followed
   by a space and those arguments.

   Example:    C: A001 LOGIN {11}
               S: + Ready for additional command text
               C: FRED FOOBAR {7}
               S: + Ready for additional command text
               C: fat man
               S: A001 OK LOGIN completed
               C: A044 BLURDYBLOOP {102856}
               S: A044 BAD No such command as "BLURDYBLOOP"




















Myers                                                          [Page 33]

Internet DRAFT                    ACAP                 November 25, 1996


4.      Predefined Dataset Types

     Dataset lists

       [described in section "Child Dataset Attributes"]

     Mailbox lists

       [OPEN ISSUE: Use ACAP dataset hierarchy?  How to deal with
        different separator characters.]

       name "INBOX.sent-mail"
       mailbox.serverlist "imap2.andrew.cmu.edu imap7.andrew.cmu.edu"
       mailbox.subscription "show"         ; possible values:
                                   ; read - present new messages by default
                                   ; show - display in mailbox list
                                   ; todo - present all messages by default
                                   ;  OPEN ISSUE: some other scheme?
       mailbox.disconnected-mode "cm"      ; Disconnected caching mode
                                   ; set of flags.
       mailbox.creation-time "19951206103412"
       mailbox.uidvalidity "807558230"
       mailbox.marked "y"          ; non-empty if Marked
       mailbox.noselect ""         ; non-empty if elect
       mailbox.noinferiors ""      ; non-empty if nferiors
       mailbox.acl ""              ; Access control list
                                   ;  OPEN ISSUE: how to modify.  Use IMAP4?
       mailbox.separator "."       ; Hierarchy separator char.

     Options

       name "common.from"          ; Need hierarchical registry of names?
                                   ; OPEN ISSUE: use dataset hierarchy.
       option.value "John Gardiner Myers <jgm+@cmu.edu>"


     Addressbooks

       name
       addressbook.fullname
       addressbook.alias           ; should probably not be defined ???

       addressbook.email
                                   ;  may suffix .work, .home, .mobile
       addressbook.phone           ; Voice phone #
                                   ;  may suffix .work, .home, .car, .mobile
       addressbook.fax             ; Fax phone #
                                   ;  may suffix .work, .home, .car, .mobile



Myers                                                          [Page 34]

Internet DRAFT                    ACAP                 November 25, 1996


       addressbook.pager           ; Pager phone #
                                   ;  may suffix .work, .home ???
       addressbook.address         ; Physical address
                                   ;  may suffix .work, .home
           ; All this suffix stuff seems overboard.

       addressbook.members
       addressbook.expand          ; Magic, expansion of email/members

     Media types

       name                        ; Name of media type
       mediatype.mime              ; MIME media type
       mediatype.mac-code          ; Macintosh type/creator code
       mediatype.extension         ; List of common filename extensions
       mediatype.magic-number      ; Magic number

     Bookmarks

       name
       bookmark.url

     Groups
       name
       group.members

5.      Dataset Shadowing

   It is possible for a dataset to ``shadow'' another.  Data in the
   shadowed dataset appears in the shadowing dataset, except where
   explicitly overridden by data in the shadowing dataset.

   The shadowed dataset specifies which values may be overridden in
   shadowing datasets.  If a shadowed dataset has a non-empty value for
   any given attribute in an entry, the ACL for that attribute in that
   entry must grant a user the 'o' right in order for the user to store
   a corresponding value in a shadowing dataset.

   The shadowed dataset is usually a system-wide set of defaults.  The
   system-wide dataset usually has one shadowing dataset per user,
   allowing each user to add to or modify the defaults as appropriate.

   [TODO: describe "dataset.shadows" attribute in parent dataset.]

6.      Namespace conventions

   [TODO]




Myers                                                          [Page 35]

Internet DRAFT                    ACAP                 November 25, 1996


6.1.    Dataset Namespace


6.2     Attribute Namespace

   [TODO: Have vnd. and prs. spaces.  All else for published stuff
   intended for interoperation.]

6.3     Option Namespace

   [TODO: Have vnd. and prs. spaces.  All else for published stuff
   intended for interoperation.  Should use dataset hierarchy, so vendor
   stuff can be in vendor's own sub-tree of datasets.]

6.4     ACL Identifer Namespace


9.      Formal Syntax

   The following syntax specification uses the augmented Backus-Naur
   Form (BNF) notation as specified in [RFC-822] with one exception; the
   delimiter used with the "#" construct is a single space (SPACE) and
   not one or more commas.

   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.

   alpha           ::= "A" / "B" / "C" / "D" / "E" / "F" / "G" / "H" / "I" /
                       "J" / "K" / "L" / "M" / "N" / "O" / "P" / "Q" / "R" /
                       "S" / "T" / "U" / "V" / "W" / "X" / "Y" / "Z" /
                       "a" / "b" / "c" / "d" / "e" / "f" / "g" / "h" / "i" /
                       "j" / "k" / "l" / "m" / "n" / "o" / "p" / "q" / "r" /
                       "s" / "t" / "u" / "v" / "w" / "x" / "y" / "z" /
                       ;; Case-sensitive

   astring         ::= atom / string

   atom            ::= 1*ATOM_CHAR

   ATOM_CHAR       ::= <any CHAR except atom_specials>

   atom_specials   ::= "(" / ")" / "{" / "%" / "*" / SPACE / CTL /
                       quoted_specials

   authenticate    ::= "AUTHENTICATE" SPACE auth_type *(CRLF base64)




Myers                                                          [Page 36]

Internet DRAFT                    ACAP                 November 25, 1996


   auth_type       ::= atom

   base64          ::= *(4base64_char) [base64_terminal]

   base64_char     ::= alpha / digit / "+" / "/"

   base64_terminal ::= (2base64_char "==") / (3base64_char "=")

   CHAR            ::= <any 7-bit US-ASCII character except NUL, 0x01 - 0x7f>

   CHAR8           ::= <any 8-bit octet except NUL, 0x01 - 0xff>

   command         ::= tag SPACE (command_any / command_auth /
                       command_nonauth) CRLF
                       ;; Modal based on state

   continue_req    ::= "+" SPACE (resp_text / base64)

   CR              ::= <ASCII CR, carriage return, 0x0C>

   CRLF            ::= CR LF

   CTL             ::= <any ASCII control character and DEL, 0x00-0x1f, 0x7f>

   digit           ::= "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" /
                       "8" / "9"

   LF              ::= <ASCII LF, line feed, 0x0A>

   literal         ::= "{" number [ "+" ] "}" CRLF *OCTET
                       ;; The number represents the number of octets
                       ;; May only contain NUL octets in values of attributes
                       ;; whose names end in ".bin"

   number          ::= 1*DIGIT

   quoted          ::= <"> *QUOTED_CHAR <">

   QUOTED_CHAR     ::= <any TEXT_CHAR except quoted_specials> /
                       "\" quoted_specials

   quoted_specials ::= <"> / "\"

   response        ::= *<response_data> response_done







Myers                                                          [Page 37]

Internet DRAFT                    ACAP                 November 25, 1996


   response_data   ::= "*" SPACE (resp_cond_state / resp_cond_bye /
                       mailbox_data / option_data /
                       searchaddress_d / fetchaddress_d / address_data /
                       acl_data / myrights_data) CRLF

   response_done   ::= response_tagged / response_fatal

   response_fatal  ::= "*" SPACE resp_cond_bye CRLF

   response_tagged ::= tag SPACE resp_cond_state CRLF

   resp_cond_bye   ::= "BYE" SPACE resp_text
                       ;; Server will disconnect condition

   resp_cond_state ::= ("OK" / "NO" / "BAD") SPACE resp_text
                       ;; Status condition

   resp_text       ::= ["[" resp_text_code "]" SPACE] (text_utf8)

   resp_text_code  ::= "ALERT" / "LOCKED" /
                       atom [SPACE 1*<any TEXT_UTF8_CHAR except "]">]

   SPACE           ::= <ASCII SP, space, 0x20>

   specials        ::= "(" / ")" / "{" / qspecials

   string          ::= quoted / literal

   tag             ::= 1*<any ATOM_CHAR except "+">

   text_utf8       ::= 1*TEXT_UTF8_CHAR

   TEXT_CHAR       ::= <any CHAR except CR and LF>

   TEXT_UTF8_CHAR  ::= <any UTF8_CHAR except CR and LF>

   UTF8_CHAR       ::= <TODO: UTF-8 character>

   x_command       ::= "X" atom <experimental command arguments>


           initial_greeting ::= "*" SPACE "OK" *(SPACE capability) CRLF

           capability ::= atom [ "(" astring ")" ]

           command ::+ "LOGIN" SPACE astring SPACE astring

           command ::+ "AUTHENTICATE" SPACE atom [SPACE base64-token]



Myers                                                          [Page 38]

Internet DRAFT                    ACAP                 November 25, 1996


                            *(CRLF base64-token)

           command ::+ "NOOP"

           dataset ::= astring
                   ;; slash-separated dataset name
                   ;; begins with slash

           attribute ::= astring
                   ;; dot-separated attribute name
                   ;; ends in ".bin" if value not textual

           metadata ::= attribute [ "(" 1#astring ")" ]

           value ::= astring

           command ::+ "SEARCH" SPACE (dataset / context)
                           *(SPACE search_modifier)
                           SPACE search_criteria

           search_modifier ::+ "SORT" SPACE "(" 1#(attribute SPACE ordering) ")"

           ordering ::= ("+" / "-") atom
                           ; need registry of atom orderings
                           ;   predefined: octet, en-case-insensitive
                           ;               glob
                           ;               numeric-decimal
                           ;               ignore-case-diacritical-marks (define?)

           search_modifier ::+ "RETURN" SPACE "(" #metadata ")"
                           ; MUST be included

           search_modifier ::+ "LIMIT" SPACE number

           search_modifier ::+ "MAKECONTEXT" SPACE atom

           search_criteria ::= 1#search_key

           search_key ::+ "(" search_criteria ")" /
                           "NOT" SPACE search_key /
                           "OR" SPACE search_key SPACE search_key

           search_key ::+ "EQUAL" SPACE attribute SPACE ordering SPACE astring

           search_key ::+ "COMPARE" SPACE attribute SPACE ordering SPACE astring

           search_key ::+ "COMPARESTRICT" SPACE attribute SPACE ordering SPACE astring




Myers                                                          [Page 39]

Internet DRAFT                    ACAP                 November 25, 1996


           search_key ::+ "RANGE" SPACE nz_number SPACE nz_number

           search_response ::= tag SPACE "ENTRY" SPACE entry_name SPACE *(astring)
                               / tag SPACE "MODTIME" SPACE astring

           "[REFER" SPACE url "]"

           "[TOOMANY" SPACE number "]"

           "[TOOMANYCONTEXTS]"

           context ::= astring
                   ; Must not start with "/", to distinguish from
                   ; dataset

           command ::+ "FREECONTEXT" SPACE context

           command ::+ "NOTIFYCONTEXT" SPACE context *(SPACE metadata)

           untagged_response ::+ "*" SPACE "ADDTO" SPACE context SPACE entry_name
                                           SPACE number *(SPACE astring)

           untagged_response ::+ "*" SPACE "REMOVEFROM SPACE context SPACE entry_name
                                           SPACE number

           untagged_response ::+ "*" SPACE "CHANGE" SPACE context SPACE entry_name
                                           SPACE number SPACE number
                                           *(SPACE astring)

           untagged_response ::+ "*" SPACE "MODTIME" SPACE astring


           command ::+ "STORE" SPACE dataset SPACE entry_name
                                   1*(SPACE metadata SPACE value)

           command ::+ "DELETE" SPACE dataset SPACE entry_name

           command ::+ "DELETEDSINCE" SPACE dataset SPACE time
                           ; returns DELETEDFROM untagged response, or fails

           untagged_response ::+ "*" SPACE "DELETEDFROM" SPACE dataset
                                           SPACE entry_name

           command ::+ "SETACL" SPACE acl_object
                                   SPACE identifier SPACE rights

           command ::+ "DELETEACL" SPACE acl_object
                                   SPACE identifier



Myers                                                          [Page 40]

Internet DRAFT                    ACAP                 November 25, 1996


           command ::+ "GETACL" SPACE acl_object

           untagged_response ::+ "ACL" SPACE acl_object
                                   *(SPACE identifier SPACE rights)

           command ::+ "MYRIGHTS" SPACE acl_object


           untagged_response ::+ "MYRIGHTS" SPACE acl_object
                                   SPACE rights

           acl_object      ::= "(" dataset [ SPACE attribute
                                   [ SPACE entry_name ] ] ")"

           identifier      ::= astring

           rights          ::= astring     ; "r" - read, "w" - write

           "[NOACL]"

           command ::+ "LOCK" SPACE dataset
                           [ SPACE "(" 1#entry_name ")"
                            [ SPACE "(" 1#attribute ")" ] ]

           command ::+ "UNLOCK" SPACE dataset
                           [ SPACE "(" 1#entry_name ") ]

           "[LOCKED]"




   A protocol session is as follows:

    Server: greeting
    *<Client: command (first part, if it contains a literal)
      *<Server: continue_req
        Client: request (next part)
       >
      Server: response
     >










Myers                                                          [Page 41]

Internet DRAFT                    ACAP                 November 25, 1996


10.     Security Considerations

   ACAP protocol transactions, including address book and option data,
   are sent in the clear over the network unless the optional privacy
   protection is negotiated in the AUTH command.

   Use of the LOGIN command sends passwords in the clear.  This can be
   avoided by using the AUTH command instead.

   Additional security considerations are discussed in the section
   discussing the AUTH and LOGIN commands.


11.     Author's Address

   John G. Myers
   Carnegie-Mellon University
   5000 Forbes Ave.
   Pittsburgh PA, 15213-3890

   Email: jgm+@cmu.edu






























Myers                                                          [Page 42]

Internet DRAFT                    ACAP                 November 25, 1996


Appendices

A.      References

   [IMAP4] Crispin, Mark R.,  "Internet Message Access Protocol -
   Version 4", RFC 1730.

   [SASL] Myers, J., "Simple Authentication and Security Layer (SASL)",
   draft-myers-auth-sasl-xx.txt

   [MIME-2] Moore, K., "MIME (Multipurpose Internet Mail Extensions)
   Part Two: Message Header Extensions for Non-ASCII Text", RFC 1522.

   [RFC-822] Crocker, D., "Standard for the Format of ARPA Internet Text
   Messages", STD 11, RFC 822.

   [UTF8] Yergeau, F. "UTF-8, a transformation format of Unicode and ISO
   10646", RFC 2044.

































Myers                                                          [Page 43]

Internet DRAFT                    ACAP                 November 25, 1996


B.      ACAP Keyword Index


        (command) .................................................   26
        (command) .................................................   27
        (command) .................................................   27
        (command) .................................................   27
        (command) .................................................   28
        (response) ................................................   28
        (response) ................................................   29
        (response) ................................................   29
       ACAP (response) ............................................   10
       ADDTO (response) ...........................................   21
       ALERT (response code) ......................................   32
       AUTHENTICATE (command) .....................................   14
       BAD (response) .............................................   12
       BYE (response) .............................................   13
       CHANGE (response) ..........................................   22
       DELETE (command) ...........................................   23
       DELETEDFROM (response) .....................................   24
       DELETEDSINCE (command) .....................................   24
       ENTRY (response) ...........................................   18
       FREECONTEXT (command) ......................................   19
       LOCK (command) .............................................   30
       LOGIN (command) ............................................   15
       LOGOUT (command) ...........................................   11
       MODTIME (response) .........................................   19
       MODTIME (response) .........................................   22
       NO (response) ..............................................   12
       NOOP (command) .............................................   11
       NOTIFYCONTEXT (command) ....................................   20
       OK (response) ..............................................   12
       REMOVEFROM (response) ......................................   21
       SEARCH (command) ...........................................   16
       STORE (command) ............................................   22
       UNLOCK (command) ...........................................   31
       UPDATECONTEXT (command) ....................................   20















Myers                                                          [Page 44]

Internet DRAFT                    ACAP                 November 25, 1996





                           TTTTaaaabbbblllleeee ooooffff CCCCoooonnnntttteeeennnnttttssss



Status of this Memo ...............................................    i
Abstract ..........................................................    i
ACAP Protocol Specification .......................................    1
1.      Conventions Used in this Document .........................    1
2.      Protocol Overview .........................................    1
2.1.    Link Level ................................................    1
2.2.    Commands and Responses ....................................    1
2.2.1.  Client Protocol Sender and Server Protocol Receiver .......    2
2.2.2.  Server Protocol Sender and Client Protocol Receiver .......    2
2.3.    State and Flow Diagram ....................................    3
2.3.1.  Non-Authenticated State ...................................    3
2.3.2.  Authenticated State .......................................    4
2.3.3.  Logout State ..............................................    4
2.4.    Data Formats ..............................................    4
2.4.1.  Atom ......................................................    4
2.4.2.  Number ....................................................    5
2.4.3.  String ....................................................    5
2.4.3.1.        8-bit and Binary Strings ..........................    6
2.5.    Operational Considerations ................................    6
2.5.1.  Untagged Status Updates ...................................    6
2.5.2.  Response when no Command in Progress ......................    6
2.5.3.  Autologout Timer ..........................................    6
2.5.4.  Multiple Commands in Progress .............................    6
2.6.    Datasets ..................................................    7
2.7.    Predefined Attributes .....................................    7
2.8. Attribute metadata ...........................................    8
2.9.    Child Dataset Attributes ..................................    8
3.      Protocol Specification ....................................   10
3.1.    Initial Connection ........................................   10
3.1.1.  ACAP Response .............................................   10
3.2.        Any State .............................................   11
3.2.1.  NOOP Command ..............................................   11
3.2.2.  LOGOUT Command ............................................   11
3.2.3.  OK Response ...............................................   12
3.2.4.  NO Response ...............................................   12
3.2.5.  BAD Response ..............................................   12
3.2.6.  BYE Response ..............................................   13
3.3.        Non-Authenticated State ...............................   13
3.3.1.  AUTHENTICATE Command ......................................   14
3.3.2.  LOGIN Command .............................................   15
3.4.    Searching .................................................   16



Myers                                                         [Page iii]

Internet DRAFT                    ACAP                 November 25, 1996


3.4.1.  SEARCH Command ............................................   16
3.4.2.  ENTRY Response ............................................   18
3.4.3.  MODTIME Response ..........................................   19
3.5.    Contexts ..................................................   19
3.5.1.  FREECONTEXT Command .......................................   19
3.5.2.  NOTIFYCONTEXT Command .....................................   20
3.5.2.  UPDATECONTEXT Command .....................................   20
3.5.4.  ADDTO Response ............................................   21
3.5.5.  REMOVEFROM Response .......................................   21
3.5.6.  CHANGE Response ...........................................   22
3.5.7.  MODTIME Response ..........................................   22
3.6.    Dataset modification ......................................   22
3.6.1.  STORE Command .............................................   22
3.6.2.  DELETE Command ............................................   23
3.6.3.  DELETEDSINCE Command ......................................   24
3.6.4.  DELETEDFROM Response ......................................   24
3.7.    Dataset management ........................................   24
3.8.    Access Control Lists ......................................   25
3.8.1. SETACL    Command ..........................................   26
3.8.2. DELETEACL         Command ..................................   27
3.8.3. GETACL    Command ..........................................   27
3.8.4. LISTRIGHTS        Command ..................................   27
3.8.5. MYRIGHTS  Command ..........................................   28
3.8.6. ACL       Response .........................................   28
3.8.7. LISTRIGHTS        Response .................................   29
3.8.8. MYRIGHTS  Response .........................................   29
3.9.    Advisory locking ..........................................   29
3.9.1.  LOCK Command ..............................................   30
3.9.2.  UNLOCK Command ............................................   31
3.x.    Server Responses - Status Responses .......................   32
3.x     Server Responses - Command Continuation Request ...........   33
4.      Predefined Dataset Types ..................................   34
5.      Dataset Shadowing .........................................   35
6.      Namespace conventions .....................................   35
6.1.    Dataset Namespace .........................................   36
6.2     Attribute Namespace .......................................   36
6.3     Option Namespace ..........................................   36
6.4     ACL Identifer Namespace ...................................   36
9.      Formal Syntax .............................................   36
10.     Security Considerations ...................................   42
11.     Author's Address ..........................................   42
Appendices ........................................................   43
A.      References ................................................   43
B.      ACAP Keyword Index ........................................   44







Myers                                                          [Page iv]