Network Working Group                                          C. Newman
Internet Draft: ACAP                                            Innosoft
Document: draft-ietf-acap-spec-02.txt                        J. G. Myers
Expire in six months                                          March 1997


           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.









Newman                                                          [Page i]


Internet DRAFT                    ACAP                    March 21, 1997





                           Table of Contents



Status of this Memo ...............................................    i
Abstract ..........................................................    i
ACAP Protocol Specification .......................................    1
0.       Changes from Last Internet Draft .........................    1
0.1.     Open Issues ..............................................    2
1.       Conventions Used in this Document ........................    3
2.       Protocol Overview ........................................    3
2.1.     Link Level ...............................................    3
2.2.     Commands and Responses ...................................    3
2.2.1.   Client Protocol Sender and Server Protocol Receiver ......    3
2.2.2.   Server Protocol Sender and Client Protocol Receiver ......    4
2.3.     State and Flow Diagram ...................................    5
2.3.1.   Non-Authenticated State ..................................    5
2.3.2.   Authenticated State ......................................    5
2.3.3.   Logout State .............................................    6
2.4.     Operational Considerations ...............................    6
2.4.1.   Untagged Status Updates ..................................    6
2.4.2.   Response when no Command in Progress .....................    6
2.4.3.   Autologout Timer .........................................    7
2.4.4.   Multiple Commands in Progress ............................    7
2.5.     Datasets and Entries .....................................    7
2.6.     Predefined Attributes ....................................    7
2.7.     Attribute metadata .......................................    9
2.8.     Operational Command Overview .............................    9
3.       Protocol Elements ........................................   10
3.1.     Data Formats .............................................   10
3.1.1.   Atom .....................................................   10
3.1.2.   Number ...................................................   10
3.1.3.   String ...................................................   10
3.1.3.1. 8-bit and Binary Strings .................................   11
3.2.     ACAP URL scheme ..........................................   11
3.2.1.   ACAP URL User Name and Authentication Mechanism ..........   12
3.2.2.   Relative ACAP URLs .......................................   12
3.3.     Contexts .................................................   13
3.4.     Orderings ................................................   13
3.5.     Server Status Responses ..................................   14
3.6.     Server Command Continuation Request ......................   15
4.       Protocol Specification ...................................   16
4.1.     Initial Connection .......................................   16
4.1.1.   ACAP Untagged Response ...................................   16
4.2.     Any State ................................................   17



Newman                                                        [Page iii]


Internet DRAFT                    ACAP                    March 21, 1997


4.2.1.   NOOP Command .............................................   17
4.2.2.   LOGOUT Command ...........................................   18
4.2.3.   OK Response ..............................................   18
4.2.4.   NO Response ..............................................   18
4.2.5.   BAD Response .............................................   19
4.2.6.   BYE Untagged Response ....................................   19
4.3.     Non-Authenticated State ..................................   20
4.3.1.   AUTHENTICATE Command .....................................   20
4.3.2.   LOGIN Command ............................................   22
4.4.     Searching ................................................   22
4.4.1.   SEARCH Command ...........................................   22
4.4.2.   ENTRY Intermediate Response ..............................   26
4.4.3.   MODTIME Intermediate Response ............................   26
4.5.     Contexts .................................................   27
4.5.1.   FREECONTEXT Command ......................................   27
4.5.2.   UPDATECONTEXT Command ....................................   27
4.5.3.   ADDTO Untagged Response ..................................   28
4.5.4.   REMOVEFROM Untagged Response .............................   28
4.5.5.   CHANGE Untagged Response .................................   28
4.5.6.   MODTIME Untagged Response ................................   29
4.6.     Dataset modification .....................................   29
4.6.1.   STORE Command ............................................   29
4.6.2.   DELETE Command ...........................................   30
4.6.3.   DELETEDSINCE Command .....................................   30
4.6.4.   DELETED Intermediate Response ............................   31
4.7.     Access Control Lists .....................................   31
4.7.1.   SETACL Command ...........................................   33
4.7.2.   DELETEACL Command ........................................   33
4.7.3.   MYRIGHTS Command .........................................   34
4.7.4.   MYRIGHTS Intermediate Response ...........................   34
4.8.     Quotas ...................................................   35
4.8.1.   SETQUOTA Command .........................................   35
4.8.2.   GETQUOTA Command .........................................   35
4.8.3.   QUOTA Intermediate Response ..............................   36
4.9.     Advisory locking .........................................   36
4.9.1.   LOCK Command .............................................   36
4.9.2.   UNLOCK Command ...........................................   37
4.10.    Extensions ...............................................   38
5.       Dataset Management .......................................   39
5.1.     Dataset Inheritance ......................................   39
5.2.     Dataset attributes .......................................   39
6.       Namespace conventions ....................................   40
6.1.     Dataset Namespace ........................................   40
6.2.     Attribute Namespace ......................................   40
7.       Registration procedures ..................................   40
7.1.     Ordering Functions .......................................   41
7.2.     ACAP Capabilities ........................................   41
7.3.     Dataset Classes ..........................................   42



Newman                                                         [Page iv]


Internet DRAFT                    ACAP                    March 21, 1997


7.4.     Private Attribute Subtree ................................   42
8.       Formal Syntax ............................................   43
9.       Security Considerations ..................................   50
10.      Authors' Addresses .......................................   50
Appendices ........................................................   51
A.       References ...............................................   51
B.       ACAP Keyword Index .......................................   52












































Newman                                                          [Page v]


Internet DRAFT                    ACAP                    March 21, 1997


ACAP Protocol Specification



0.       Changes from Last Internet Draft

   1) Added reference to definitions of MUST, SHOULD, etc.

   2) Removed last mention of "NIL".

   3) Renamed "name" to "entry".

   4) Datasets are ordered in a server-determined manner.

   5) "acl" metadata is read-write, changing "acl" metadata cases change
   in modtime.

   6) return error on fetch of undefined metadata.

   7) Added "subdataset" attribute and discussion of dataset hierarchy.

   8) Changed "request response" to "request", and "result response" to
   "result" to simplify the text.

   9) Removed "Child Dataset Attributes" and added "Operational Command
   Overview"

   10) Restructured document a bit, adding a "protocol elements" section

   11) Added "*" rule to the RETURN search modifier.

   12) Added the DEPTH search modifier.

   13) Added predefined orderings.

   14) Added ACAP URL scheme

   15) Removed NOTIFYCONTEXT command, added NOTIFYCONTEXT search
   modifier.

   16) DELETEDFROM -> intermediate DELETED response

   17) Added second argument to LIMIT search modifier.

   18) Added "[" and "]" to atom_specials to deal with special
   information tokens cleanly removed "*" and "%"

   19) made resp_text into quoted string to simplify parsing.



Newman                                                          [Page 1]


Internet DRAFT                    ACAP                    March 21, 1997


   20) Added SASL list to Capability greeting.

   21) Removed ACL, LISTRIGHTS, GETACL, NOACL in favor of dataset
   management attributes

   22) Added AND to SEARCH keys and removed parentheses around SEARCH
   keys.

   23) simplified MYRIGHTS command and result

   24) Simplified STORE and DELETE using entry-path

   25) Remove locking of entire dataset.  Add MODTIME intermediate
   result to LOCK command.

   26) Added GETQUOTA and SETQUOTA.

   27) Astring is removed from the grammar, except for LOGIN.

   28) Changed term "shadow" to "inherit"

   29) Added dataset management section

   30) Added sort-hint

   31) Added QUOTA and PERMISSION response codes

   32) Added registration procedures

0.1.     Open Issues

   1) Document structure: do you like it?

   2) There was discomfort at the last IETF about removing an attribute
   by storing "" into it.

   3) Need to define precise Unicode-based ordering function, if one
   exists that isn't a nightmare to implement.  If it is a nightmare to
   implement, we can make it a SHOULD rather than a MUST.

   4) Synchronization issues.  Context position numbers have same
   synchronization problems as IMAP sequence numbers.  Should we
   disallow untagged responses between commands and copy the IDLE
   extension model from IMAP?

   5) Should we build in a client-id command for logging/debugging
   purposes?




Newman                                                          [Page 2]


Internet DRAFT                    ACAP                    March 21, 1997


   6) Should we remove the LOGIN command and define a DUMB SASL
   mechanism to replace it?

   7) Do we really need the LOCK/UNLOCK commands?

1.       Conventions Used in this Document

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

   The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"
   in this document are to be interpreted as described in RFC xxxx.

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

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 674.


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.

   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.


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.




Newman                                                          [Page 3]


Internet DRAFT                    ACAP                    March 21, 1997


   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
   <section>); 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 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.


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 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
   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



Newman                                                          [Page 4]


Internet DRAFT                    ACAP                    March 21, 1997


   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.


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.







Newman                                                          [Page 5]


Internet DRAFT                    ACAP                    March 21, 1997


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.     Operational Considerations


2.4.1.   Untagged Status Updates

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


2.4.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.





Newman                                                          [Page 6]


Internet DRAFT                    ACAP                    March 21, 1997


2.4.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.4.4.   Multiple Commands in Progress

   The client is not required to wait for the completion result 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.

2.5.     Datasets and Entries

   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 <section>.
   There must be exactly one "entry" attribute, whose value is unique
   amongst all entries in the dataset and contains zero or more UTF-8
   characters other than slash ("/").

   Entries in a dataset are ordered in a server-determined manner.

   The value of an attribute 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.6.     Predefined Attributes

   Attribute names which do not contain a dot (".") are reserved for
   standardized attributes which have meaning in any dataset.  The





Newman                                                          [Page 7]


Internet DRAFT                    ACAP                    March 21, 1997


   following attributes are defined by the ACAP protocol.

   entry  Contains the name of the entry.

   modtime
          Contains the date and time, in UTC, any value or acl 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
          ascending modtime values.

   createtime
          The modtime of the operation that created the entry.  This is
          read-only.

   subdataset
          If this attribute is set, it indicates the existence of a
          sub-dataset of the current dataset whose final path component
          is the name of the entry.

          The value consists of a list of CRLF separated relative ACAP
          URLs (see section <section> for ACAP URL specification) which
          may be used to locate where the sub-dataset is actually
          stored.  The base URL for the subdataset attribute is formed
          by appending the entry name followed by a "/" to the end of
          the parent dataset name.

          For example, if the dataset "/option/user" has an entry "john"
          with a subdataset attribute of ".", then there exists a
          dataset "/option/user/john".  If the value of the subdataset
          attribute was instead
          "//;AUTH=*@other.acap.domain/option/user/john" that would
          indicate the dataset is actually located on a different ACAP
          server.

          A dataset is created by storing a "subdataset" attribute
          including ".", and a sub-hierarchy of datasets is deleted by
          clearing the value of the "subdataset" attribute on the entry



Newman                                                          [Page 8]


Internet DRAFT                    ACAP                    March 21, 1997


          in the upper dataset.


2.7.     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.

   value  The 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-write.  See section <section> for the
          contents of an ACL.

   myrights
          The set of rights that the client has to the attribute/value
          pair.  Read-only.  See section <section> for the possible
          rights.

   Additional items of metadata may be defined in extensions to this
   protocol.  Servers must respond to queries of unrecognized metadata
   by returning an error.

2.8.     Operational Command Overview

   The AUTHENTICATE, LOGIN, NOOP, and LOGOUT commands provide basic
   protocol services.  The SEARCH command is used to select, sort, fetch
   and monitor changes to attribute values and metadata.  The
   UPDATECONTEXT and FREECONTEXT commands are also used to assist
   monitoring changes in attribute values and metadata.  The STORE and
   DELETE commands are used to add, modify and delete entries and
   attributes.  The DELETEDSINCE command is used to assist a client



Newman                                                          [Page 9]


Internet DRAFT                    ACAP                    March 21, 1997


   resynchronizing a cache with the server.  The SETQUOTA, GETQUOTA,
   SETACL, DELETEACL and MYRIGHTS commands are used to examine or
   modifty quota usages and access permissions.

3.       Protocol Elements

   This section defines data formats and other protocol elements used
   throughout the ACAP protocol.

3.1.     Data Formats

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


3.1.1.   Atom

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


3.1.2.   Number

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


3.1.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-



Newman                                                         [Page 10]


Internet DRAFT                    ACAP                    March 21, 1997


   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.



3.1.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.

3.2.     ACAP URL scheme

   ACAP URLs are used within the ACAP protocol for the "subdataset"
   attribute, referrals and inheritance.  They provide a convenient
   syntax for referring to other ACAP datasets.  The ACAP URL follows
   the common Internet scheme syntax as defined in [BASIC-URL].  If
   :<port> is omitted, the port defaults to 674.

   An ACAP URL has the following general form:

   url-acap ::= "acap://" url-server "/" url-enc-entry [url-filter]

   The <url-server> element (defined below) includes the hostname, and
   optional user name, authentication mechanism and port number.  The
   <url-enc-entry> element contains the name of an entry path encoded
   according to the rules in [BASIC-URL].

   The <url-filter> element is made up of up to three components.  The
   first is a <url-attr-list> which specifies a list of interesting
   attributes (the default is all attributes).  The second is <url-



Newman                                                         [Page 11]


Internet DRAFT                    ACAP                    March 21, 1997


   depth> which specifies the DEPTH of the search.

   Note that unsafe or reserved characters such as " " or "?" must be
   encoded according to the rules defined in [BASIC-URL].  Note that
   octets encoded in the %A0 format with the high bit set are
   interpreted according to UTF-8 [UTF8].

3.2.1.   ACAP URL User Name and Authentication Mechanism

   A user name and/or authentication mechanism may be supplied.  They
   are used in the "LOGIN" or "AUTHENTICATE" commands after making the
   connection to the ACAP server.  If no user name or authentication
   mechanism the user name "anonymous" is used with the "LOGIN" command
   and the password is supplied as the Internet e-mail address of the
   end user accessing the resource.  If the URL supplies just a user
   name, the program interpreting the ACAP URL SHOULD request one from
   the user if necessary.

   An authentication mechanism can be expressed by adding
   ";AUTH=<enc_auth_type>" to the end of the user name.  When such an
   <enc_auth_type> is indicated, the client SHOULD request appropriate
   credentials from that mechanism and use the "AUTHENTICATE" command
   instead of the "LOGIN" command.  If no user name is specified, one
   SHOULD be obtained from the mechanism or requested from the user as
   appropriate.

   The string ";AUTH=*" indicates that the client SHOULD select an
   appropriate authentication mechanism.  It MAY use any mechanism
   listed in the initial ACAP response.  If no user name is specified
   and no appropriate authentication mechanisms are available, the
   client SHOULD fall back to anonymous login as described above.  This
   allows a URL which grants read-write access to authorized users, and
   read-only anonymous access to other users.

   Note that if unsafe or reserved characters such as " " or ";" are
   present in the user name or authentication mechanism, they MUST be
   encoded as described in BASE-URL [BASE-URL].

3.2.2.   Relative ACAP URLs

   Because ACAP uses "/" as the hierarchy separator for dataset paths,
   it works well with the relative URL rules defined in REL-URL [REL-
   URL].

   The <aauth> grammar element is considered part of the user name for
   purposes of resolving relative ACAP URLs.

   The base URL for a relative URL stored in an attribute's value is



Newman                                                         [Page 12]


Internet DRAFT                    ACAP                    March 21, 1997


   formed by taking the path to the dataset containing that attribute,
   appending a "/" followed by the entry name of the entry containing
   that attitude followed by "/".

3.3.     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.4.     Orderings

   An ordering is a named collation function which takes two input
   strings and determines whether they are greater than, less than, or
   equal to each other.  Orderings are used both for simple equality
   searching, for ordinal comparision searching and for sorting of
   attributes.  An ordering is prefixed by either "+" or "-".  If
   prefixed by "-", then the order is reversed.

   Additional ordering functions may be registered with IANA according
   to the rules in section <section>.

   The following ordering functions are defined by this standard:

      octet The octet ordering function interprets the value of an
            attribute as a series of unsigned octets with ordinal values
            from 0 to 255.  The end of the string is interpreted as an
            ordinal value of -1.  Each octet pair is compared in
            sequence until the octets are unequal or the end of the
            string is reached.  The +octet form collates smaller ordinal
            values earlier, and the -octet form collates larger ordinal
            values earlier.  For non-binary values, the +octet ordering
            is equivalent to the ANSI C strcmp() function applied to C
            string representations of the values.

      en-nocase
            The en-nocase ordering function first applies a mapping to
            the attribute values which translates all US-ASCII letters
            to uppercase (octet values 0x61 to 0x7A are translated to
            octet values 0x41 to 0x5A respectively), then applies the
            octet ordering function as described above.  With this



Newman                                                         [Page 13]


Internet DRAFT                    ACAP                    March 21, 1997


            function the values "hello" and "HELLO" have the same
            ordinal value and are considered equal.

      numeric
            The numeric ordering function assigns ordinal values based
            on a US-ASCII encoded decimal positive integer
            interpretation.  With the +numeric function, all values
            which do not begin with a digit are considered equal with an
            ordinal value of -1.  Otherwise, all US-ASCII digits (octet
            values 0x30 to 0x39) are interpreted starting from the
            beginning of the string to the first non-digit or the end of
            the string.


3.5.     Server Status Responses

   An OK, NO or BAD response from the server, whether tagged or
   untagged, is considered a status response.  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 entry is already locked by another client.

      PERMISSION     A STORE, SETQUOTA, SETACL or LOCK command failed
                     due to insufficient permission.

      QUOTA          A STORE command which would have increased the size
                     of the dataset failed due to insufficient quota.

      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 one of the
                     datasets 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



Newman                                                         [Page 14]


Internet DRAFT                    ACAP                    March 21, 1997


                     matching entries.

      TRYFREECONTEXT This 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.

      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 MUST
      ignore response codes that they do not recognize.

3.6.     Server Command Continuation Request

   The command continuation request 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'"









Newman                                                         [Page 15]


Internet DRAFT                    ACAP                    March 21, 1997


4.       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.


4.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
   <section>.

4.1.1.   ACAP Untagged 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 defined in a standards track or IESG
      approved experimental RFC and registered with IANA according to
      the rules in section <section>.

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





Newman                                                         [Page 16]


Internet DRAFT                    ACAP                    March 21, 1997


      The following initial capabilities are defined:


      CONTEXTLIMIT
            The CONTEXTLIMIT capability has one argument which is a
            number describing the maximum number of contexts the server
            supports per connection.  This number MUST be greater than
            100.

      IMPLEMENTATION
            The IMPLEMENTATION capability has one argument which is a
            string describing the server implementation.  ACAP clients
            MUST NOT alter their behavior based on this value.  It is
            intended primarily for debugging purposes.

      ORDERINGS
            The ORDERINGS capability includes a list of the
            ordering/comparison functions which the server supports.
            See section <section> for a description of
            ordering/comparison functions.

      SASL  The SASL capability includes a list of the authentication
            mechanisms supported by the server.  See [SASL] for more
            information.


   Example:    S: * OK IMPLEMENTATION("ACME v3.5") SASL("CRAM-MD5"
               "GSSAPI")

4.2.     Any State

   The following commands and responses are valid in any state.

4.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




Newman                                                         [Page 17]


Internet DRAFT                    ACAP                    March 21, 1997


      to reset any inactivity autologout timer on the server.

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


4.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)


4.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"


4.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



Newman                                                         [Page 18]


Internet DRAFT                    ACAP                    March 21, 1997


      command may still complete successfully.  The human-readable text
      describes the condition.

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


4.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
      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"
               C: A444 NOOP Hello
               S: A444 BAD "invalid arguments"


4.2.6.   BYE Untagged 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



Newman                                                         [Page 19]


Internet DRAFT                    ACAP                    March 21, 1997


      accept a session from this client.

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


4.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.


4.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.



Newman                                                         [Page 20]


Internet DRAFT                    ACAP                    March 21, 1997


      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 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".

      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














Newman                                                         [Page 21]


Internet DRAFT                    ACAP                    March 21, 1997


      resort.

   Example:    S: * OK IMPLEMENTATION("Blorfysoft v3.5")
               SASL(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.


4.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"



4.4.     Searching

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











Newman                                                         [Page 22]


Internet DRAFT                    ACAP                    March 21, 1997


4.4.1.   SEARCH Command

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

   Data:       intermediate responses: ENTRY, MODTIME
               untagged responses: ADDTO, REMOVEFROM, CHANGE, 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:

      DEPTH number   The SEARCH command will traverse the dataset tree
                     up to the specified depth.  ENTRY responses will
                     include the full path to the entry.  This MUST NOT
                     be combined with a SORT or MAKECONTEXT operator.

      LIMIT number number
                     Limits the number of intermediate ENTRY responses
                     that the search may generate.  The first numeric
                     argument specifies the limit, the second number
                     specifies the number of entries to return if the
                     number of matches exceeds the limit.  If the limit
                     is exceeded, the SEARCH command still succeeds,
                     returning the number of matches in a TOOMANY
                     special information token in the tagged OK
                     response.

      MAKECONTEXT context
                     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



Newman                                                         [Page 23]


Internet DRAFT                    ACAP                    March 21, 1997


                     commands to search the set of matching entries.

                     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
                     <section>.

      NOTIFYCONTEXT  Requests that the server send untagged ADDTO,
                     REMOVEFROM, CHANGE, and MODTIME responses while the
                     context created or referenced by this SEARCH
                     command exists.  The server MAY issue untagged
                     ADDTO, REMOVEFROM, CHANGE and MODTIME notifications
                     for a context at any time between the issuing of
                     the SEARCH command with NOTIFYCONTEXT and the
                     completion of a FREECONTEXT command for the
                     context.  After issuing a sequence of ADDTO,
                     REMOVEFROM or CHANGE notifications, the server MUST
                     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 SEARCH on the
                     context with a NOTIFYCONTEXT modifier, and this MAY
                     be used to change the list of attributes and
                     metadata included in ADDTO and CHANGE responses for
                     the context.

      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 parenthesis is a list of attributes,
                     each optionally followed by a parenthesized list of
                     metadata.  If the parenthesized list of metadata is
                     not specified, it defaults to "(value)".

                     An attribute name with a trailing "*" requests all
                     attributes with that prefix.  A "*" by itself
                     requests all attributes.  If the parenthesized list
                     of metadata is not specified with an attribute with



Newman                                                         [Page 24]


Internet DRAFT                    ACAP                    March 21, 1997


                     a trailing "*", it defaults to "(attribute value)".

                     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.  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
                     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.  Search keys may be
      combined using the AND, and OR search keys.  For example, the
      criteria (the newline is for readability and not part of the
      criteria):
          AND COMPARE modtime +octet "19951206103400"
              COMPARE modtime -octet "19960112000000"
      refers to all entries modified between 10:34 December 6 1995 and
      midnight January 12, 1996 UTC.

      The currently defined search keys are as follows.

      AND search-key1 search-key2
           Entries that match both search keys.

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



Newman                                                         [Page 25]


Internet DRAFT                    ACAP                    March 21, 1997


           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]

4.4.2.   ENTRY Intermediate Response

Data:       entry name
            entry data

      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.

4.4.3.   MODTIME Intermediate 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.





Newman                                                         [Page 26]


Internet DRAFT                    ACAP                    March 21, 1997


4.5.     Contexts

   The following commands use contexts created by a SEARCH command with
   a MAKECONTEXT modifier.


4.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"


4.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.

      The UPDATECONTEXT command SHOULD NOT be used to poll for updates.




Newman                                                         [Page 27]


Internet DRAFT                    ACAP                    March 21, 1997


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


4.5.3.   ADDTO Untagged Response

   Data:       context name
               entry name
               position
               metadata 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 metadat contained in the entry which match
      the RETURN statement specified in the last SEARCH command on the
      context with NOTIFYCONTEXT.

   Example:    S: * ADDTO "blurdybloop" "fred" 15 ("addressbook.email"
               "fred@rock.org")


4.5.4.   REMOVEFROM Untagged Response

   Data:       context name
               entry name
               old position

      The untagged REMOVEFROM response informs the client that an entry
      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


4.5.5.   CHANGE Untagged Response

   Data:       context name
               entry name
               old position
               new position
               metadata 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.



Newman                                                         [Page 28]


Internet DRAFT                    ACAP                    March 21, 1997


      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
               ("addressbook.email" "fred@stone.org")

4.5.6.   MODTIME Untagged 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: * MODTIME mycontext "19970320162338"

4.6.     Dataset modification

   The following commands and responses handle modification of datasets.


4.6.1.   STORE Command

   Arguments:  entry path
               attribute/value 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 "entry" 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



Newman                                                         [Page 29]


Internet DRAFT                    ACAP                    March 21, 1997


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

   Example:    C: A342 STORE "/addressbook/user/fred/Barney Rubble"
                       "addressbook.phone" "555-1234"
               "addressbook.email" ""
               S: A342 OK "Store completed"


4.6.2.   DELETE Command

   Arguments:  entry path

   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.  If there is no such entry, the command
      simply returns a tagged OK response.

   Example:    C: A344 DELETE "/addressbook/user/fred/Dino"
               S: A344 OK "Delete completed"
               C: A345 DELETE "/addressbook/user/fred/Dino"
               S: A345 OK "Entry doesn't exist"


4.6.3.   DELETEDSINCE Command

   Arguments:  dataset name
               time

   Data:       intermediate response: DELETED

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

      The DELETEDSINCE command returns in intermediate DELETED 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




Newman                                                         [Page 30]


Internet DRAFT                    ACAP                    March 21, 1997


      TOOOLD special information token in the tagged NO response.

   Example:    C: Z4S9 DELETEDSINCE "/mailboxes/common" 19951205103412
               S: Z4S9 DELETED "blurdybloop"
               S: Z4S9 DELETED "anteaters"
               S: Z4S9 OK "DELETEDSINCE completed"
               C: Z4U3 DELETEDSINCE "/mailboxes/common" 19951009040854
               S: Z4U3 NO [TOOOLD] "Don't have that information"


4.6.4.   DELETED Intermediate Response

   Data:       entry name

      The untagged DELETED response occurs as a result of a DELETEDSINCE
      command.  It returns an entry that has been deleted from the
      dataset specified in the DELETEDSINCE command.

   Example:    S: Z4S9 DELETED "blurdybloop"

4.7.     Access Control Lists

   An access control list is a tab-separated 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
   i - insert (store a new value)
   o - override (see section <section>)
   a - administer (perform store on ACL attribute/metadata)

   An implementation may force rights to always or never be granted.
   Rights are never tied, unlike the IMAP ACL extension [IMAP-ACL].



Newman                                                         [Page 31]


Internet DRAFT                    ACAP                    March 21, 1997


   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
   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 "entry" attribute of the entry.
   Implementations should take care not to reveal via error messages the
   existence of an entry for which the client does not have 'r' rights.
   A client does not need access to the "subdataset" attribute of the
   parent dataset in order to access the contents of a 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.









Newman                                                         [Page 32]


Internet DRAFT                    ACAP                    March 21, 1997


4.7.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, one is created.


   Example:    C: A123 SETACL ("/addressbook/user/joe/public") anyone r
               S: A123 OK "Setacl complete"
               C: A124 SETACL ("/mailboxes/common") B1FF rwa
               S: A124 NO [PERMISSION] "'B1FF' not permitted to modify
               access rights
                                 for '/mailboxes/common'"



4.7.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.




Newman                                                         [Page 33]


Internet DRAFT                    ACAP                    March 21, 1997


   Example:    C: A223 DELTEACL ("/addressbook/user/joe/public") anyone
               S: A223 OK "Deleteacl complete"
               C: A224 DELETEACL ("/mailboxes/common")
               S: A224 NO "Can't delete top-level acl for dataset"
               C: A225 DELETEACL ("/addressbook/user/fred"
               "addressbook.email" "barney")
               S: A225 OK "Deleteacl complete"



4.7.3.   MYRIGHTS Command

   Arguments:  acl object

   Data:       intermediate 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 dataset or dataset attribute in an intermediate
      MYRIGHTS reply.


   Example:    C: A003 MYRIGHTS ("/mailboxes/common")
               S: A003 MYRIGHTS "r" ""
               S: A003 OK "Myrights complete"
               C: A004 MYRIGHTS ("/user/joe/mailboxes"
               "mailbox.subscribe")
               S: A004 MYRIGHTS "rwa" "ra"
               S: A004 OK "Myrights complete"



4.7.4.   MYRIGHTS Intermediate Response

   Data:       rights
               implicit rights

      The MYRIGHTS response occurs as a result of a MYRIGHTS command.
      The first argument is the set of rights that the client has for
      the object referred to in the MYRIGHTS command.  The second
      argument is the set of implicit rights the client has for the
      object regardless of what the ACL contains.






Newman                                                         [Page 34]


Internet DRAFT                    ACAP                    March 21, 1997


4.8.     Quotas

   Quotas are used to manage storage consumed by ACAP datasets.  A quota
   root is a place where a resource limit may be set which applies to an
   implementation dependant subset of datasets.


4.8.1.   SETQUOTA Command

   Arguments:  quota root
               resource limit in kilobytes

   Data:       intermediate responses: QUOTA

   Result:     OK - Quota root resource limit modified
               NO - Quota failure: can't modify resourse limit
               BAD - command unknown or arguments invalid

      The SETQUOTA command takes the name of a quota root and a number
      indicating the desired resource limit in kilobytes on all datasets
      within that root.  A value of "0" indicates no resource limit is
      desired.

      If the named quota root did not previously exist and a value other
      than "0" is specified, an implementation SHOULD create it.  If the
      quota root exists and a value of "0" is specified, an
      implementation SHOULD delete the quota root.  In either case the
      implementation may change the quota root which applies to any
      number of datasets.

   Example:    C: A042 SETQUOTA "/user/fred" 1024
               S: A042 QUOTA "/user/fred" 1024 0
               S: A042 OK "Setquota completed"



4.8.2.   GETQUOTA Command

   Arguments:  dataset

   Data:       intermediate responses: QUOTA

   Result:     OK - Quota information returned
               NO - Quota failure: can't access resourse limit
               BAD - command unknown or arguments invalid

      The GETQUOTA command takes the name of a dataset, and returns in
      an intermediate QUOTA response the name of the quota root, the



Newman                                                         [Page 35]


Internet DRAFT                    ACAP                    March 21, 1997


      amount of the resource limit on that root and the amount of that
      resource limit which is used.

   Example:    C: A043 GETQUOTA "/option/user/fred/common"
               S: A043 QUOTA "/user/fred" 1024 50
               S: A043 OK "Getquota completed"



4.8.3.   QUOTA Intermediate Response

   Data:       quota root
               resource limit in kilobytes
               amount of resource limit used

      The QUOTA intermediate response is generated as a result of a
      SETQUOTA or GETQUOTA command.  It includes the name of the quota
      root, the resource limit in kilobytes and the amount of resource
      limit used.


4.9.     Advisory locking

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


4.9.1.   LOCK Command

   Arguments:  dataset name
               list of entry names
               optional list of metadata to return

   Data:       intermediate responses: ENTRY, MODTIME

   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 command is successful, the server must ensure that no other
      client will be able to successfully lock any of the named entries
      in the dataset until the successful client either performs a



Newman                                                         [Page 36]


Internet DRAFT                    ACAP                    March 21, 1997


      matching UNLOCK command or closes the connection.

      If some other client has obtained 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
      and metadata is present, the server returns the appropriate data
      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.

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

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



4.9.2.   UNLOCK Command

   Arguments:  dataset name
               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 a list
      of entry names.  It releases any semaphores the client may have
      previously obtained on those entries by using the LOCK command.
      If the client did not have a lock on one of the entries, the
      command succeeds anyway.






Newman                                                         [Page 37]


Internet DRAFT                    ACAP                    March 21, 1997


4.10.    Extensions

   In order to simplify the process of extending the protocol, clients
   MUST ignore unknown server responses which meet the syntax of
   response-extend.  In addition, clients MUST ignore server response
   codes which meet the syntax of resp-code-ext.  Availability of new
   commands MUST be announced via a capability on the initial greeting
   line and such commands SHOULD meet the syntax of command-extend.











































Newman                                                         [Page 38]


Internet DRAFT                    ACAP                    March 21, 1997


5.       Dataset Management

   The entry with an empty name in the dataset is used to hold
   management information for the dataset as a whole.

5.1.     Dataset Inheritance

   It is possible for a dataset to inherit data from another.  Data in
   the inherited dataset appears in the inheriting dataset, except where
   explicitly overridden by data in the inheriting dataset.

   The inherited dataset specifies which values may be overridden in the
   inheriting datasets.  If an inherited 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 an inheriting dataset.

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

   Servers MUST support at least two levels of inheritance.  This
   permits a user's dataset such as "/options/user/fred/common" to
   inherit from a group dataset such as "/options/group/dinosaur
   operators/common" which in turn inherits from a server-wide dataset
   such as "/options/common/common".

5.2.     Dataset attributes

   The following attributes apply to management of the dataset when
   stored in the "" entry of a dataset.


   dataset.acl
        This holds the default access control list for the dataset.  It
        can not be modified by the STORE command, only by the SETACL and
        DELETEACL commands.

   dataset.acl.<attribute>
        This holds the default access control list for an attribute
        within the dataset. It can not be modified by the STORE command,
        only by the SETACL and DELETEACL commands.

   dataset.inherit
        This holds the name of a dataset to inherit according to the





Newman                                                         [Page 39]


Internet DRAFT                    ACAP                    March 21, 1997


        rules in section <section>.

   dataset.sort-hint.<attribute>
        This contains a space separated list of ordering functions.  An
        implementation MAY use it as a hint that a SORT modifier with
        the specified ordering function for the given attribute is
        likely to be used. For example, an implementation might wish to
        index those attributes which have a sort hint.  Implementations
        are free to ignore this field.


6.       Namespace conventions


6.1.     Dataset Namespace

   The dataset namespace is a slash-separated hierarchy.  By convention,
   the first component of the dataset namespace is a dataset class.  A
   dataset class SHOULD be published as an RFC which includes predefined
   set of attributes and their meanings.  The second component of the
   dataset name is "common", "group", or "user" for server-wide, group-
   wide, or per-user datasets respectively.  For group or user datasets,
   the third component of the dataset name is the name of the group or
   the LOGIN/AUTHENTICATE identifier for the user.  Other components of
   the dataset name are specific to the dataset class.

   Dataset classes MUST be registered with IANA according to the rules
   in section <section>.  Dataset classes which are intended for
   interoperable use MUST be published as a standards track or IESG
   approved experimental RFC.

6.2.     Attribute Namespace

   Attribute names which do not contain a dot (".") are reserved for
   standardized attributes which have meaning in any dataset.  In order
   to simplify implementations, the attribute namespace is intended to
   be unique across all datasets.  To achieve this, attribute names are
   prefixed with the dataset class name followed by a dot (".").
   Attributes which effect management of the dataset are prefixed with
   "dataset.".  In addition, a subtree of the "private." namespace may
   be registered with IANA according to the rules in section <section>.
   ACAP implementors are encouraged to help define interoperable dataset
   classes rather than using the private attribute namespace.

7.       Registration procedures

   ACAP's usefulness comes from providing a structured storage model for
   all sorts of configuration data.  However, for its potential to be



Newman                                                         [Page 40]


Internet DRAFT                    ACAP                    March 21, 1997


   achieved, it is important that the Internet community strives for the
   following goals:

   (1) Standardization.  It is very important to standardize dataset
   classes.  The authors hope that ACAP achieves the success that SNMP
   has seen with the definition of numerous standards track MIBs.

   (2) Community Review.  In the absence of standardization, it is
   important to get community review on a proposal to improve the
   engineering quality.  Community review is strongly recommended prior
   to registration.  The ACAP developers mailing list <ietf-
   acap@andrew.cmu.edu> may be used for this purpose.

   (3) Registration.  Registration serves a two-fold purpose.  First it
   prevents use of the same name for different purposes, and second it
   provides a one-stop list which can be used to locate existing
   extensions.

   The following registration templates may be used to register ACAP
   protocol elements.

7.1.     Ordering Functions

   Additional ordering functions may be registered with IANA on a
   first-come, first-serve basis.  Ordering functions intended for
   interoperable use SHOULD be defined as a standards track or IESG
   approved experimental RFC.

   To: XXX@XXX.XXX
   Subject: Registration of new ACAP ordering function

   Ordering name:

   Scope: Any Dataset / Specific Dataset class / Specific locality

   Published Specification(s):

   (If the published specification is not standards track, or no
    published specifiction is referenced then the ordering function is
    assumed to be for limited use)

   Person and email address to contact for further information:

7.2.     ACAP Capabilities

   New ACAP capabilities MUST be standards track or IESG approved
   experimental RFCs.  Registration provides a simple way to locate all
   extensions.  Careful consideration should be made before extending



Newman                                                         [Page 41]


Internet DRAFT                    ACAP                    March 21, 1997


   the protocol, as it can lead to complexity or interoperability
   problems.

   To: XXX@XXX.XXX
   Subject: Registration of ACAP capability

   Capability name:

   Capability keyword:

   Capability arguments:

   standards track/IESG-approved experimental RFC number:

7.3.     Dataset Classes

   A dataset class provides a core set of attributes for use in a
   specified hierarchy.  It may also define rules for the dataset
   hierarchy underneath that class.  Community review of dataset classes
   is strongly encouraged.  Classes intended for interoperable use
   should be written as standards track or IESG approved experimental
   RFCs.

   To: XXX@XXX.XXX
   Subject: Registration of ACAP dataset class

   Dataset class name/attribute prefix:

   Purpose:

   Required attributes:

   Optional attributes:

   Published Specification(s):

   (The published specification must be freely available on the
   Internet or included with the registration.  It should include ABNF
   [as defined in RFC 822] for the specified attributes.)

   Person and email address to contact for further information:

7.4.     Private Attribute Subtree

   A private attribute subtree may be registered on a first come, first
   serve basis.  Private attributes may be used to store information
   specific to a particular client within an ACAP entry of any dataset
   class.  Whenever possible, private attributes should be avoided in



Newman                                                         [Page 42]


Internet DRAFT                    ACAP                    March 21, 1997


   favor of improving interoperable dataset class definitions.

   To: XXX@XXX.XXX
   Subject: Registration of ACAP private prefix

   Private Prefix: private.

   Person and email address to contact for further information:

   (company names and addresses should be included when appropriate)

8.       Formal Syntax

   The following syntax specification uses the augmented Backus-Naur
   Form (BNF) notation as specified in [IMAIL] 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

   ATOM-CHAR        ::= <any CHAR except ATOM-SPECIALS>

   ATOM-SPECIALS    ::= "(" / ")" / "{" / "[" / "]" /
                        SPACE / CTL / QUOTED-SPECIALS

   BASE64-CHAR      ::= ALPHA / DIGIT / "+" / "/"

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

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

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

   CRLF             ::= CR LF

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




Newman                                                         [Page 43]


Internet DRAFT                    ACAP                    March 21, 1997


   DIGIT            ::= "0" / DIGIT-NZ

   DIGIT-NZ         ::= "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"

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

   OCTET            ::= <any octet value 0x00 - 0xFF>

   QUOTED-CHAR      ::= <any TEXT-UTF8-CHAR except QUOTED-SPECIALS> /
                       "\" QUOTED-SPECIALS

   QUOTED-SPECIALS  ::= <"> / "\"

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

   TEXT-CHAR        ::= <any CHAR except CR and LF>

   TEXT-UTF8-CHAR   ::= <any UTF8-CHAR except CR and LF>

   UTF8-CHAR        ::= <TODO: UTF-8 character>

   acl-identifier   ::= string

   acl-object       ::= "(" dataset [SPACE attribute [SPACE entry-name]] ")"

   acl-rights       ::= quoted

   astring          ::= atom / string

   atom             ::= 1*ATOM-CHAR

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

   auth-type        ::= atom
                        ;; as defined in SASL [SASL]

   base64-token     ::= *(4BASE64-CHAR) [base64-terminal]

   base64-terminal  ::= (2BASE64-CHAR "==") / (3BASE64-CHAR "=")

   command          ::= tag SPACE (command-any / command-auth /
                        command-nonauth) CRLF
                        ;; Modal based on state

   command-login    ::= "LOGIN" SPACE astring SPACE astring




Newman                                                         [Page 44]


Internet DRAFT                    ACAP                    March 21, 1997


   command-authent  ::= "AUTHENTICATE" SPACE atom [SPACE base64-token]
                        *(CRLF base64-token)

   command-any      ::= "NOOP"

   command-auth     ::= command-delacl / command-delete / command-dsince /
                        command-freectx / command-getquota /
                        command-lock / command-myrights / command-search /
                        command-setacl / command-setquota / command-store /
                        command-unlock
                        ;; only valid in authenticaticated state

   command-delacl   ::= "DELETEACL" SPACE acl-object [SPACE acl-identifier]

   command-delete   ::= "DELETE" SPACE entry-path

   command-dsince   ::= "DELETEDSINCE" SPACE dataset SPACE time

   command-extend   ::= atom [SPACE #extension-data]

   command-freectx  ::= "FREECONTEXT" SPACE context

   command-getquota ::= "GETQUOTA" SPACE dataset

   command-lock     ::= "LOCK" SPACE dataset SPACE "(" 1#entry-name ")"
                        [ SPACE "(" #metadata ")" ]

   command-myrights ::= "MYRIGHTS" SPACE acl-object

   command-nonauth  ::= command-login / command-authent
                        ;; only valid in non-authenticated state

   command-search   ::= "SEARCH" SPACE (dataset / context)
                        *(SPACE search-modifier)
                        SPACE search-criteria

   command-setacl   ::= "SETACL" SPACE acl-object SPACE acl-identifier
                        SPACE acl-rights

   command-setquota ::= "SETQUOTA" SPACE quota-root SPACE number

   command-store    ::= "STORE" SPACE entry-path 1*(SPACE attribute
                        SPACE value)

   command-unlock   ::= "UNLOCK" SPACE dataset SPACE "(" 1#entry-name ")"

   context          ::= string
                        ;; MUST NOT begin with slash ("/")



Newman                                                         [Page 45]


Internet DRAFT                    ACAP                    March 21, 1997


   continue-req     ::= "+" SPACE (resp-text / base64-token)

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

   entry            ::= entry-name / entry-path

   entry-name       ::= string
                        ;; entry name MUST NOT contain slash

   entry-path       ::= string
                        ;; slash-separated path to entry
                        ;; begins with slash

   entry-relative   ::= string
                        ;; potentially relative path to entry

   extension-data   ::= string / number / "(" #extension-data ")"

   initial-greeting ::= "*" SPACE "ACAP" *(SPACE init-capability) CRLF

   init-capability  ::= atom [ "(" string ")" ]

   literal          ::= "{" number [ "+" ] "}" CRLF *OCTET
                        ;; The number represents the number of octets
                        ;; MUST be literal-utf8 except for values of
                        ;; attributes whose names end in ".bin"

   literal-utf8     ::= "{" number [ "+" ] "}" CRLF *UTF8-CHAR
                        ;; The number represents the number of octets

   metadata         ::= attribute [ "(" 1#metadata-type ")" ]

   metadata-partial ::= "value<" number "." nz-number ">"

   metadata-type    ::= "acl" / "attribute" / "myrights" / "size" /
                        metadata-partial / "value"

   number           ::= 1*DIGIT

   nz-number        ::= DIGIT-NZ *DIGIT

   ordering         ::= ("+" / "-") atom

   quota-root       ::= dataset

   quoted           ::= <"> *QUOTED-CHAR <">



Newman                                                         [Page 46]


Internet DRAFT                    ACAP                    March 21, 1997


   response         ::= *response-data response-done

   response-addto   ::= "*" SPACE "ADDTO" SPACE context SPACE entry-name
                        SPACE number SPACE #return-data

   response-bye     ::= "*" SPACE "BYE" SPACE resp-body CRLF
                       ;; Server will disconnect condition

   response-change  ::= "*" SPACE "CHANGE" SPACE context SPACE entry-name
                        SPACE number SPACE number SPACE #return-data

   response-data    ::= response-change / response-deleted /
                        response-entry / response-mtimei /
                        response-mtimeu / response-myright /
                        response-remove / response-stat / response-bye

   response-deleted ::= tag SPACE "DELETED" SPACE entry-name

   response-done    ::= tag SPACE resp-cond-state CRLF

   response-entry   ::= tag SPACE "ENTRY" SPACE entry SPACE #return-data

   response-extend  ::= tag SPACE atom [SPACE 1#extension-data]

   response-mtimei  ::= tag SPACE "MODTIME" SPACE time

   response-mtimeu  ::= "*" SPACE "MODTIME" SPACE context SPACE time

   response-myright ::= tag SPACE "MYRIGHTS" SPACE acl-rights

   response-remove  ::= "*" SPACE "REMOVEFROM" SPACE context SPACE
                        entry-name SPACE number

   response-stat    ::= "*" SPACE resp-cond-state CRLF

   resp-body        ::= ["[" resp-code "]" SPACE] quoted

   resp-code        ::= "ALERT" / "LOCKED" / "PERMISSION" / "QUOTA" /
                        resp-code-refer / resp-code-many /
                        "TRYFREECONTEXT" / resp-code-ext

   resp-code-ext    ::= atom [SPACE 1#extension-data]
                        ;; extension-data MUST NOT contain "]"

   resp-code-many  ::= "TOOMANY" SPACE nz_number

   resp-code-refer  ::= "REFER" SPACE 1#(<"> url-relative <">)




Newman                                                         [Page 47]


Internet DRAFT                    ACAP                    March 21, 1997


   resp-cond-state  ::= ("OK" / "NO" / "BAD") SPACE resp-body
                        ;; Status condition

   return-data      ::= string / number

   searchkey-equal  ::= "EQUAL" SPACE attribute SPACE ordering SPACE value

   searchkey-comp   ::= "COMPARE" SPACE attribute SPACE ordering SPACE value

   searchkey-strict ::= "COMPARESTRICT" SPACE attribute SPACE ordering
                        SPACE value

   searchkey-range  ::= "RANGE" SPACE nz-number SPACE nz-number

   searchmod-depth  ::= "DEPTH" SPACE number

   searchmod-limit  ::= "LIMIT" SPACE number SPACE number

   searchmod-make   ::= "MAKECONTEXT" SPACE context

   searchmod-notify ::= "NOTIFYCONTEXT"

   searchmod-return ::= "RETURN" SPACE "(" #metadata ")"

   searchmod-sort   ::= "SORT" SPACE "(" 1#(attribute SPACE ordering) ")"

   search-criteria  ::= searchkey-equal / searchkey-comp /
                        searchkey-strict / searchkey-range /
                        "NOT" SPACE search-criteria /
                        "OR" SPACE search-criteria SPACE search-criteria /
                        "AND" SPACE search-criteria SPACE search-criteria

   search-modifier  ::= searchmod-depth / searchmod-limit /
                        searchmod-make / searchmod-notify /
                        searchmod-return / searchmod-sort

   string           ::= quoted / literal

   tag              ::= 1*<any ATOM-CHAR except "+" or "*">

   time             ::= <"> time-year time-month time-day time-hour
                        time-minute time-second time-subsecond <">

   time-day         ::= 2DIGIT ;; 00-31

   time-hour        ::= 2DIGIT ;; 00-23

   time-minute      ::= 2DIGIT ;; 00-59



Newman                                                         [Page 48]


Internet DRAFT                    ACAP                    March 21, 1997


   time-month       ::= 2DIGIT ;; 01-12

   time-second      ::= 2DIGIT ;; 00-60

   time-subsecond   ::= *DIGIT

   time-year        ::= 4DIGIT

   value            ::= string

   url-acap         ::= "acap://" url-server "/" url-enc-entry [url-filter]
                        ;; url-enc-entry interpreted relative to "/"

   url-attr-list    ::= url-enc-attr *("&" url-enc-attr)

   url-auth         ::= ";AUTH=" ("*" / auth-type)

   url-achar        ::= uchar / "&" / "=" / "~"
                        ;; See RFC 1738 for definition of "uchar"

   url-char         ::= uchar / "=" / "~" / ":" / "@" / "/"
                        ;; See RFC 1738 for definition of "uchar"

   url-depth        ::= "DEPTH=" number

   url-enc-attr     ::= 1*url-char
                        ;; encoded version of attribute name

   url-enc-auth     ::= 1*url-achar
                        ;; encoded version of auth-type above

   url-enc-entry    ::= 1*url-char
                        ;; encoded version of entry-relative above

   url-enc-search   ::= 1*url-char
                        ;; encoded version of search-criteria above

   url-enc-user     ::= *url-achar
                        ;; encoded version of login userid

   url-filter       ::= "?" url-attr-list ["?" url-depth ["?" url-enc-search]]

   url-relative     ::= url-acap / [url-enc-entry] [url-filter]
                        ;; url-enc-entry is relative to base URL

   url-server       ::= [url-user [url-auth] "@"] hostport
                        ;; See RFC 1738 for definition of "hostport"




Newman                                                         [Page 49]


Internet DRAFT                    ACAP                    March 21, 1997


9.       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 AUTHENTICATE command.

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

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


10.      Authors' Addresses

   Chris Newman
   Innosoft International, Inc.
   1050 East Garvey Ave. South
   West Covina, CA 91790 USA

   Email: chris.newman@innosoft.com


   John G. Myers

   Email: jgm+@cmu.edu

























Newman                                                         [Page 50]


Internet DRAFT                    ACAP                    March 21, 1997


Appendices

A.       References

   [IMAP4] Crispin, M., "Internet Message Access Protocol - Version
   4rev1", RFC 2060, University of Washington, December 1996.

       <ftp://ds.internic.net/rfc/rfc2060.txt>

   [IMAP-ACL] Myers, J., "IMAP4 ACL extension", RFC 2086, Carnegie
   Mellon, January 1997.

       <ftp://ds.internic.net/rfc/rfc2086.txt>

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

   [IMAIL] Crocker, D., "Standard for the Format of ARPA Internet Text
   Messages", STD 11, RFC 822, University of Delaware, August 1982.

       <ftp://ds.internic.net/rfc/rfc822.txt>

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

       <ftp://ds.internic.net/rfc/rfc2044.txt>

   [BASIC-URL] Berners-Lee, Masinter, McCahill, "Uniform Resource
   Locators (URL)", RFC 1738, CERN, Xerox Coproration, University of
   Minnesota, December 1994.

       <ftp://ds.internic.net/rfc/rfc1738.txt>

   [REL-URL] Fielding, "Relative Uniform Resource Locators", RFC 1808,
   UC Irvine, June 1995.

       <ftp://ds.internic.net/rfc/rfc1808.txt>














Newman                                                         [Page 51]


Internet DRAFT                    ACAP                    March 21, 1997


B.       ACAP Keyword Index


       ACAP (untagged response) ...................................   16
       ADDTO (untagged response) ..................................   28
       ALERT (response code) ......................................   14
       AND (search keyword) .......................................   25
       AUTHENTICATE (command) .....................................   20
       BAD (response) .............................................   19
       BYE (untagged response) ....................................   19
       CHANGE (untagged response) .................................   28
       COMPARE (search keyword) ...................................   25
       COMPARESTRICT (search keyword) .............................   26
       CONTEXTLIMIT (ACAP capability) .............................   17
       DELETE (command) ...........................................   30
       DELETEACL (command) ........................................   33
       DELETED (intermediate response) ............................   31
       DELETEDSINCE (command) .....................................   30
       DEPTH (search modifier) ....................................   23
       ENTRY (intermediate response) ..............................   26
       EQUAL (search keyword) .....................................   26
       FREECONTEXT (command) ......................................   27
       GETQUOTA (command) .........................................   35
       IMPLEMENTATION (ACAP capability) ...........................   17
       LIMIT (search modifier) ....................................   23
       LOCK (command) .............................................   36
       LOCKED (response code) .....................................   14
       LOGIN (command) ............................................   22
       LOGOUT (command) ...........................................   18
       MAKECONTEXT (search modifier) ..............................   23
       MODTIME (intermediate response) ............................   26
       MODTIME (untagged response) ................................   29
       MYRIGHTS (command) .........................................   34
       MYRIGHTS (intermediate response) ...........................   34
       NO (response) ..............................................   18
       NOOP (command) .............................................   17
       NOT (search keyword) .......................................   26
       NOTIFYCONTEXT (search modifier) ............................   24
       OK (response) ..............................................   18
       OR (search keyword) ........................................   26
       ORDERINGS (ACAP capability) ................................   17
       PERMISSION (response code) .................................   14
       QUOTA (intermediate response) ..............................   36
       QUOTA (response code) ......................................   14
       RANGE (search keyword) .....................................   26
       REFER (response code) ......................................   14
       REMOVEFROM (untagged response) .............................   28
       RETURN (search modifier) ...................................   24
       SASL (ACAP capability) .....................................   17



Newman                                                         [Page 52]


Internet DRAFT                    ACAP                    March 21, 1997



       SEARCH (command) ...........................................   22
       SETACL (command) ...........................................   33
       SETQUOTA (command) .........................................   35
       SORT (search keyword) ......................................   25
       STORE (command) ............................................   29
       TOOMANY (response code) ....................................   14
       TRYFREECONTEXT (response code) .............................   15
       UNLOCK (command) ...........................................   37
       UPDATECONTEXT (command) ....................................   27
       acl (attribute metadata) ...................................    9
       anyone (ACL identifier) ....................................   31
       attribute (attribute metadata) .............................    9
       createtime (predefined attribute) ..........................    8
       dataset.acl (dataset attribute) ............................   39
       dataset.acl.<attribute> (dataset attribute) ................   39
       dataset.inherit (dataset attribute) ........................   39
       dataset.sort-hint.<attribute> (dataset attribute) ..........   40
       en-nocase (ordering function) ..............................   13
       entry (predefined attribute) ...............................    8
       modtime (predefined attribute) .............................    8
       myrights (attribute metadata) ..............................    9
       numeric (ordering function) ................................   14
       octet (ordering function) ..................................   13
       size (attribute metadata) ..................................    9
       subdataset (predefined attribute) ..........................    8
       value (attribute metadata) .................................    9
       value<ORIGIN.SIZE> (attribute metadata) ....................    9
























Newman                                                         [Page 53]