home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / rfc / rfc1698 < prev    next >
Text File  |  1994-10-22  |  67KB  |  1,628 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                         P. Furniss
  8. Request for Comments: 1698                                    Consultant
  9. Category: Informational                                     October 1994
  10.  
  11.  
  12.                   Octet Sequences for Upper-Layer OSI
  13.               to Support Basic Communications Applications
  14.  
  15. Status of this Memo
  16.  
  17.    This memo provides information for the Internet community.  This memo
  18.    does not specify an Internet standard of any kind.  Distribution of
  19.    this memo is unlimited.
  20.  
  21. Abstract
  22.  
  23.    This document states particular octet sequences that comprise the OSI
  24.    upper-layer protocols (Session, Presentation and ACSE) when used to
  25.    support applications with "basic communications requirements". These
  26.    include OSI application protocols such as X.400 P7 and Directory
  27.    Access Protocol, and "migrant" protocols, originally defined for use
  28.    over other transports.
  29.  
  30.    As well as the octet sequences which are the supporting layer headers
  31.    (and trailers) around the application data, this document includes
  32.    some tutorial material on the OSI upper layers.
  33.  
  34.    An implementation that sends the octet sequences given here, and
  35.    interprets the equivalent protocol received, will be able to
  36.    interwork with an implementation based on the base standard, when
  37.    both are being used to support an appropriate application protocol.
  38.  
  39. Table of Contents
  40.  
  41.    1. Introduction ...................................................2
  42.    2. General ........................................................3
  43.     2.1 Subdivisions of "basic communication applications" ...........3
  44.     2.2 Conformance and interworking .................................5
  45.     2.3 Relationship to other documents ..............................5
  46.    3. Contexts and titles ............................................6
  47.     3.1 The concepts of abstract and transfer syntax .................6
  48.     3.2 Use of presentation context by cookbook applications..........7
  49.     3.3 Processing Presentation-context-definition-list ..............8
  50.     3.4 Application context ..........................................9
  51.     3.5 APtitles and AEqualifiers ....................................9
  52.    4. What has to be sent and received ..............................10
  53.     4.1 Sequence of OSI protocol data units used ....................10
  54.     4.2 Which OSI fields are used ...................................12
  55.  
  56.  
  57.  
  58. Furniss                                                         [Page 1]
  59.  
  60. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  61.  
  62.  
  63.     4.3 Encoding methods and length fields ..........................14
  64.     4.3.1 Session items .............................................14
  65.     4.3.2 ASN.1/BER items (Presentation and ACSE) ...................14
  66.     4.4 BER Encoding of values for primitive datatypes ..............15
  67.     4.5 Unnecessary constructed encodings ...........................16
  68.    5. Notation ......................................................16
  69.    6. Octet sequences ...............................................17
  70.     6.1 Connection request message ..................................17
  71.     6.2 Successful reply to connection setup ........................20
  72.     6.3 Connection rejection ........................................22
  73.     6.4 Data-phase TSDU .............................................23
  74.     6.5 Closedown  - release request ................................24
  75.     6.6 Closedown - release response ................................25
  76.     6.7 Deliberate abort ............................................25
  77.     6.8 Provider abort ..............................................27
  78.     6.9 Abort accept ................................................27
  79.    7. References ....................................................27
  80.    8. Other notes ...................................................28
  81.    9. Security Considerations .......................................29
  82.    10. Author's Address .............................................29
  83.  
  84. 1.  Introduction
  85.  
  86.    The upper-layer protocols of the OSI model are large and complex,
  87.    mostly because the protocols they describe are rich in function and
  88.    options. However, for support of most applications, only a limited
  89.    portion of the function is needed. An implementation that is not
  90.    intended to be a completely general platform does not need to
  91.    implement all the features. Further, it need not reflect the
  92.    structuring of the OSI specifications - the layer of the OSI model
  93.    are purely abstract.
  94.  
  95.    This document presents the protocol elements required by the OSI
  96.    upper layers when supporting a connection-oriented application with
  97.    only basic communication requirements - that is to create a
  98.    connection, optionally negotiate the data representation,
  99.    send/receive data, close a connection and abort a connection.
  100.    Optionally, data may be sent on the connection establishment, closing
  101.    and abort messages.
  102.  
  103.    In this document, the protocol elements needed are given in terms of
  104.    the octet sequences that comprise the 'envelope' around the
  105.    application data. The envelope and its enclosing data form a
  106.    Transport Service Data Unit (TSDU) that can be passed via the OSI
  107.    Transport Service [ISO8072] (which in turn may be supported as
  108.    specified in [RFC1006] or any class of the OSI Transport Protocol
  109.    [ISO8073]).
  110.  
  111.  
  112.  
  113.  
  114. Furniss                                                         [Page 2]
  115.  
  116. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  117.  
  118.  
  119.    The octet sequences to be sent and the description of the alternative
  120.    forms that may be received are equivalent to an informal re-
  121.    specification of the relevant parts of the upper-layer protocols.
  122.    The "relevant parts" are determined by the requirements of the
  123.    supported applications (this is a reflexive definition! - if
  124.    application Z needs something that is not here, it is not supported).
  125.    The formal specifications remain the base standards, the appropriate
  126.    profiles and the requirements of the application. However, an
  127.    implementation based on this document will be able to interwork with
  128.    an implementation based directly on the full standards when both are
  129.    supporting a basic communication application. The "full"
  130.    implementation will exhibit only part of its potential behaviour,
  131.    since the application will only invoke part.
  132.  
  133.    In addition to the octet sequences, the document includes some
  134.    tutorial material.
  135.  
  136. 2.  General
  137.  
  138. 2.1 Subdivisions of "basic communication applications"
  139.  
  140.    Distinctions can be made within the "basic communication
  141.    applications", as defined above, based on how much use they make of
  142.    the OSI upper-layer services, and thus how much of the protocol
  143.    described in this memo will be used to support a particular
  144.    application. One distinction is:
  145.  
  146.       a) whether application data is sent on the connection
  147.          establishment, close and abort, or only during "date phase"
  148.          on an established connection; OR
  149.  
  150.       b) whether the application data is of only one kind (abstract
  151.          syntax) and one format (transfer syntax) or more than one
  152.          (i.e., how much use is made of the Presentation layer syntax
  153.          negotiation and identification features)
  154.  
  155.    Further distinctions are possible, but in this memo, elements of
  156.    protocol needed (or not needed) by four groups of "basic
  157.    communications application" are identified. All groups have "basic
  158.    communications requirements" in requiring only connection, data
  159.    transfer and (perhaps) orderly release of connection. The four groups
  160.    are:
  161.  
  162.       Group I: applications which send data only on an established
  163.       connection, and use a single abstract and transfer syntax.
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Furniss                                                         [Page 3]
  171.  
  172. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  173.  
  174.  
  175.       Group II: applications which send data on connection
  176.       establishment and release and use a single abstract and transfer
  177.       syntax.
  178.  
  179.       Group III: applications that send data of only one kind (one
  180.       abstract syntax) on the connection, but which have more than one
  181.       format (transfer syntax) specified (they use the Presentation
  182.       context negotiation facility).
  183.  
  184.       Group IV: applications that will send data of several kinds on the
  185.       connection (and which much therefore distinguish on each write
  186.       which kind is being sent).
  187.  
  188.    Group III applications are equivalent to Group I (or possibly Group
  189.    II) after the establishment exchange has negotiated the particular
  190.    transfer syntax that will be used on the connection.
  191.  
  192.    Possible examples of the Groups are:
  193.  
  194.       Group I: Application protocols designed for use over transport-
  195.       level protocols. Typically these are non-OSI protocols "migrated"
  196.       to an OSI environment. X Window System protocol is an example.
  197.  
  198.       Group II: OSI-originated protocols with simple requirements,
  199.       including many of the ROSE-based ones, such as Directory Access
  200.       Protocol.
  201.  
  202.       Group III: Protocols that can be treated as Group I, but for
  203.       which more than one encoding of the data is known, such as a
  204.       standardised one and a system-specific one - all implementations
  205.       understand the standard encoding, but Presentation layer
  206.       negotiation allows like-implementations to use their internal
  207.       encoding for transfer, without loss of general interworking. The
  208.       same could apply to OSI protocols.
  209.  
  210.       Group IV: OSI protocols with multiple abstract syntaxes (but with
  211.       each individual message from a single abstract syntax) that do
  212.       not use any of the special Session functional units - X.400 P7 is
  213.       an example.
  214.  
  215.    Some of the OSI protocols that are not included are those that use
  216.    more than one abstract syntax in a single message (such as FTAM or
  217.    Transaction Processing) or use Session functional units (RTSE-based
  218.    protocols, Virtual Terminal).
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. Furniss                                                         [Page 4]
  227.  
  228. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  229.  
  230.  
  231. 2.2 Conformance and interworking
  232.  
  233.    The protocol elements specified in this memo correspond to the kernel
  234.    functional units of Session, Presentation and ACSE, and the duplex
  235.    functional unit of Session.
  236.  
  237.    The octet sequences given below are derived from the specifications
  238.    in the International Standards for the protocols Session [ISO8327],
  239.    Presentation [ISO8822] and ACSE [ISO8650]. The intention of this memo
  240.    is to summarise those specifications, as applicable to the supported
  241.    application groups, so that an implementation could be developed
  242.    without direct reference to the original standards, but capable of
  243.    interworking with implementations that had made direct reference. The
  244.    OSI standards (especially Presentation) allow considerable
  245.    flexibility in the encoding of the protocol data units. Accordingly,
  246.    this memo defines particular octet sequences to be sent, and
  247.    describes the variations that can be expected in data received from
  248.    an implementation based directly on the OSI standards, rather than on
  249.    this cookbook. It is intended that an implementation that sends these
  250.    sequences and that is capable of interpreting the variations
  251.    described will be fully able to interwork with an implementation
  252.    based directly on the OSI standards. An implementation that is only
  253.    capable of interpreting the octet sequences specified in this memo
  254.    for transmission may not be able to interwork with standards-based
  255.    implementations.
  256.  
  257.    The intent is to be able to interwork with conformant implementations
  258.    in support of the relevant application (or group of applications).
  259.    Some of the OSI standards have conformance requirements that go
  260.    beyond that necessary for successful interworking, including
  261.    detection of invalid protocol. Tests for conformance sometimes go
  262.    beyond the strict conformance requirements of the standard.
  263.    Consequently an implementation based on this memo may or may not be
  264.    able to formally claim conformance to the International Standard. It
  265.    may be able to legitimately claim conformance, but fail a conformance
  266.    test, if the test is over-specified. (Efforts are being made to
  267.    correct this, but in the meantime, the target is interworking with
  268.    conformant implementations.)
  269.  
  270. 2.3 Relationship to other documents
  271.  
  272.    The flexibility allowed in the Session, Presentation and ACSE
  273.    standards is restricted in the Common Upper-Layer Requirements Part 1
  274.    [CULR-1]).  This is a proposed International Standardised Profile
  275.    (pdISP 11188-1) that can be assumed to be obeyed by most
  276.    implementations. This memo applies the restrictions of CULR-1,
  277.    especially where these concern maximum sizes of fields and the
  278.    like.Points where advantage is taken of a CULR-1 limitation are
  279.  
  280.  
  281.  
  282. Furniss                                                         [Page 5]
  283.  
  284. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  285.  
  286.  
  287.    noted.
  288.  
  289.    Additional parts of CULR are under development. Part 3 [CULR-3]
  290.    covers the protocol elements needed for "basic communications
  291.    applications", and is being developed in (informal) liaison with this
  292.    memo. CULR-3 is presented as a normal profile, largely consisting of
  293.    prescribed answers to the questions in the PICS (Protocol
  294.    Implementation Conformance Statement) of the three protocols.  CULR-3
  295.    does not make the distinction between the four Groups.  An
  296.    implementation of this memo (at least if it supported Group IV) would
  297.    be able to claim conformance to CULR-3, with the possible exception
  298.    of any more-than-interworking conformance requirements inherited by
  299.    CULR-3 from the base standards.
  300.  
  301.    An extension [XTI/mOSI] to the X/Open Transport Interface [XTI] is
  302.    shortly to be published as a preliminary specification. This defines
  303.    an API to the OSI upper-layers, again as appropriate to a basic
  304.    communications application. XTI/mOSI would be usable as an interface
  305.    to support applications in groups I, II and III, and possibly group
  306.    IV.
  307.  
  308. 3.  Contexts and titles
  309.  
  310. 3.1 The concepts of abstract and transfer syntax
  311.  
  312.    OSI includes the concepts of "abstract syntax" and "transfer syntax".
  313.    These are terms for the content (abstract syntax) and format "on-
  314.    the-line" (transfer syntax) of the protocol elements. The combination
  315.    of an abstract syntax and transfer syntax is called a presentation
  316.    context.
  317.  
  318.    Application protocols devised explicitly under OSI auspices have used
  319.    ASN.1 for the definition of the abstract syntax, and nearly all use
  320.    the Basic Encoding Rules applied to the ASN.1 to define the transfer
  321.    syntax. However, there is no such requirement in OSI in general or in
  322.    OSI Presentation, and still less is there any requirement to change
  323.    the representation of existing application protocols to ASN.1 (for
  324.    their definition) or BER (for their transmission). It is not
  325.    generally realised (even in OSI circles) that all communicating
  326.    applications, in all environments, are using some form of these,
  327.    although under different names and without the explicit
  328.    identification that the OSI Presentation provides. OSI separates the
  329.    identification of the content and format of the data from the
  330.    addressing.
  331.  
  332.    Formal specifications of non-OSI application protocols (such as
  333.    TELNET, FTP, X Windows System) generally do not use ASN.1, but will
  334.    invariably be found to define abstract and transfer syntaxes.  For a
  335.  
  336.  
  337.  
  338. Furniss                                                         [Page 6]
  339.  
  340. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  341.  
  342.  
  343.    less formalised protocol used between similar systems, the abstract
  344.    syntax may be defined simply in programming language structures, and
  345.    the transfer syntax determined by how some compiler represents this
  346.    in memory.
  347.  
  348.    The OSI Presentation protocol requires that "names" be assigned to
  349.    the abstract and transfer syntaxes of the application data that is
  350.    carried.  The names are always object identifiers ("oid"): globally
  351.    unique names assigned hierarchically. Presentation supports the
  352.    negotiation of a transfer syntax for a particular abstract syntax -
  353.    several can be offered and one selected.
  354.  
  355.    This transfer syntax negotiation facility may be especially useful
  356.    for non-ASN.1 syntaxes where there is more than one representation
  357.    available (perhaps differing in byte-ordering or character code). In
  358.    such a case, on the connection establishment, all of the transfer
  359.    syntaxes supported by the initiator are offered, and any one of these
  360.    accepted by the responder, at its own choice. If the two systems
  361.    share some "native" format they can negotiate that, avoiding
  362.    transformation into and out of a more general format that is used for
  363.    interworking with unlike systems. The same applies to an ASN.1-
  364.    defined abstract syntax, but in practice non-BER encodings of ASN.1
  365.    are rare.
  366.  
  367. 3.2 Use of presentation context by cookbook applications
  368.  
  369.    An application protocol not originally specified with OSI
  370.    Presentation in mind (a "migrant" protocol) will not normally need to
  371.    identify the abstract and transfer syntaxes being used - they are
  372.    known by some other means (effectively inferred from the addressing).
  373.    A generic (anonymous, if you like) name for both syntaxes can be used
  374.    and [CULR-3] defines object identifiers for "anonymous" abstract and
  375.    transfer syntax names (currently called "default", but this is
  376.    expected to change).
  377.  
  378.    In some cases object identifier names will be assigned for the
  379.    syntaxes of a migrant application protocol. If these exist, they
  380.    should be used.  However, since the processing required will be the
  381.    same, it will be legitimate to offer both the generic and specific
  382.    names, with the responder accepting the specific (if it knew it) and
  383.    the generic if the specific were not known - this will provide a
  384.    migration option if names are assigned to the syntaxes after
  385.    implementations are deployed using the generic names.
  386.  
  387.    For abstract syntaxes defined in ASN.1 object identifier names will
  388.    have been assigned to the abstract syntax with the specification.
  389.    This name MUST be used to identify the abstract syntax. The transfer
  390.    syntax will most often be the Basic Encoding Rules (BER) object id,
  391.  
  392.  
  393.  
  394. Furniss                                                         [Page 7]
  395.  
  396. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  397.  
  398.  
  399.    but alternatives (e.g., Packed Encoding Rules) are possible.
  400.  
  401.    For group III and group IV applications, specific object identifier
  402.    names must be used for all the abstract and transfer syntaxes. If
  403.    these names are not assigned with the specification (e.g., if the
  404.    specification not in ASN.1) they can be assigned by whoever needs
  405.    them - ideally the "owner" of the syntax specification.
  406.  
  407. 3.3 Processing Presentation-context-definition-list
  408.  
  409.    In Presentation context negotiation on connection establishment the
  410.    initiator sends a list (the presentation context definition list) of
  411.    the abstract syntaxes it intends to use, each with a list of transfer
  412.    syntaxes. Each presentation context also has an integer identifier.
  413.    To build the reply, a responder has to examine this list and work out
  414.    which of the offered presentation contexts will be accepted and which
  415.    (single) transfer syntax for each. The responder sends back the reply
  416.    field, the Presentation-context-definition-result-list, in the accept
  417.    message. The result list contains the same number of result items as
  418.    the definition-list proposed presentation-contexts. They are matched
  419.    by position, not by the identifiers (which are not present in the
  420.    result- list). An acceptance also includes the transfer syntax
  421.    accepted (as there can be several offered). This can be copied from
  422.    the definition list.
  423.  
  424.    For the group I, group II and group III cases,  only the ACSE and one
  425.    application-data P-context will be used and all other contexts
  426.    rejected. For the group IV case, several presentation contexts will
  427.    be accepted.
  428.  
  429.    However, even for group I applications there may be synonyms for an
  430.    application-data Presentation-context. Unknown synonyms are rejected.
  431.    The reply shown in 6.2 includes a rejection (It can therefore not be
  432.    the reply to the connection request shown in 6.1, since that has only
  433.    two items in the definition list.)
  434.  
  435.    In all cases, the connection responder must identify and keep the
  436.    presentation context identifiers (called pcid's here) for all the
  437.    accepted presentation contexts. These are integers (odd integers, in
  438.    this case). CULR-1 limits them to no greater than 32767, but they
  439.    will usually be <= 255 (so taking up one octet).
  440.  
  441.    A presentation context is sometimes used (i.e., data is sent using
  442.    it) before the negotiation is complete. As will be seen in section 6,
  443.    in these cases, the transfer syntax name sometimes appears with the
  444.    integer identifier.
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Furniss                                                         [Page 8]
  451.  
  452. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  453.  
  454.  
  455. 3.4 Application context
  456.  
  457.    The Association Control Service Element also exchanges the name
  458.    (another Object Identifier) of the application context, which
  459.    identifies what the communication is all about, again independently
  460.    of the naming and addressing.  As for the syntaxes, although some
  461.    name must be present in the protocol, a generic name can be used for
  462.    applications that do not have a specific name assigned. (This will
  463.    almost certainly be a group I application - if a specific name is
  464.    assigned, it must be used.) The only negotiation allowed is that the
  465.    reply may be different from that sent by the initiator. CULR-3
  466.    provides a generic application context name (i.e., assigns an object
  467.    identifier).
  468.  
  469. 3.5 APtitles and AEqualifiers
  470.  
  471.    In addition to the addressing constructs (transport address and
  472.    possibly session and presentation selectors), the communicating
  473.    application entities have names - Application-Entity titles
  474.    (AEtitle).  These are carried by ACSE as two fields -the
  475.    Application-process titles (APtitle) and the Application-entity
  476.    qualifier (AEqualifier). The AEtitle is compound, and the APtitle
  477.    consists of all but the last element, which is the AEqualifier. (This
  478.    explanation can be run backwards). There are two non-equivalent
  479.    forms. AP-titles and AE-titles can be Directory Name or an Object
  480.    Identifier. AE-qualifiers can be Relative Distinguished Name (RDN) or
  481.    an integer - the forms must match, since the AE-qualifier is the last
  482.    component of the AP-title. In practice, the Directory form is likely
  483.    to be the only one seen for a while.
  484.  
  485.    Use of the these names is rather variable. This cookbook proposes
  486.    that implementations should be able to handle any value for the
  487.    partner's names, and set (as initiator) its own names. This is
  488.    primarily to facilitate OSI:non-OSI relaying (e.g., X/osi:X/tcp),
  489.    allowing the names of the end-system to be carried to the relay,
  490.    where they can be converted into hostnames, and the lower-layer
  491.    address determined. OSI assumes that name-to-address lookup is
  492.    possible (via the Directory or other means), but does not assume
  493.    address-to-name will work. Thus the calling AE-title is needed if the
  494.    responder is to know who the initiator is. However, most protocols
  495.    work perfectly well without these names being included.
  496.  
  497.    As for their encoding, a RDN will almost always be a single attribute
  498.    value assertion, with the attribute defined either by the Directory
  499.    standard [ISO9594 = X.500], or in [Internet/Cosine Schema] [RFC1274].
  500.    Using the notation defined below, the encoding of an RDN using a
  501.    Directory-defined standard attribute is:
  502.  
  503.  
  504.  
  505.  
  506. Furniss                                                         [Page 9]
  507.  
  508. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  509.  
  510.  
  511.    31  80  {1         - RDN, [SET OF]
  512.    30  80  {2         - AttributeValueAssertion, [SEQUENCE]
  513.    06  03  5504yy     -- OID identifying an attribute named in
  514.                       -- the Directory standard
  515.                       -- which one is determined by yy
  516.    13  La  xxxxxx     -- [Printable string]
  517.                       -- could be T61 string, with tag 14
  518.    00  00  }2         - end of AVA
  519.    00  00  }1         - end of RDN
  520.  
  521.    The most likely attributes for an RDN have the following hex values
  522.    for yy.
  523.  
  524.         CommonName               03
  525.         Country                  06
  526.         Locality                 07
  527.         State/Province           08
  528.         Organisation             0A
  529.         OrganisationUnit         0B
  530.  
  531.    For non-Directory attributes, the object id name must be substituted
  532.    (thus changing the immediately preceding length)
  533.  
  534.    If there are multiple attribute value assertions in the RDN, the
  535.    group between {2 and 2} is repeated (with different attributes).
  536.    Order is not significant.
  537.  
  538.    The encoding of a [Directory] Name for the AP-titles is the RDNs
  539.    (high- order first) within
  540.  
  541.    30  80  {1        - [SEQUENCE] Name
  542.     -- put the RDN encodings here
  543.    00  00  }1
  544.  
  545.    An Object Identifier AP-title is encoded as a primitive (see below),
  546.    with the "universal" tag for an object identifier, which is 6. The
  547.    integer AE-qualifier uses the universal tag for an integer, which is
  548.    2.
  549.  
  550. 4.  What has to be sent and received
  551.  
  552. 4.1 Sequence of OSI protocol data units used
  553.  
  554.    OSI defines its facilities in terms of services but these are
  555.    abstract constructs (they do not have to correspond to procedure
  556.    calls) - the significant thing is the transmission of the resulting
  557.    protocol data unit (PDU). The PDU at each layer carries (as user
  558.    data) the PDU of the layer above. The different layers follow
  559.  
  560.  
  561.  
  562. Furniss                                                        [Page 10]
  563.  
  564. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  565.  
  566.  
  567.    different conventions for naming the pdus. This section gives an
  568.    overview of the sequence of PDUs exchanged - the details of these are
  569.    given in section 6.
  570.  
  571.    The requirements of the application are to create a connection
  572.    (strictly an association for the application-layer in OSI, but called
  573.    a connection here), to send and receive data and to close the
  574.    connection.  The PDUs used are thus:
  575.  
  576.    To create connection:
  577.  
  578.         First create transport-level connection
  579.  
  580.         Initiator sends the message defined in 6.1, which is Session
  581.         CONNECT carrying Presentation CONNECT request [CP] carrying
  582.         ACSE A-ASSOCIATE request [AARQ] optionally carrying application
  583.         data.
  584.  
  585.         Responder replies with the message defined in 6.2, which is
  586.         Session ACCEPT carrying Presentation CONNECT response [CPA]
  587.         carrying ACSE response [AARE] optionally carrying application
  588.         data.
  589.  
  590.      -  If the responder rejects the attempt, the reply will be Session
  591.         REJECT. This is defined in 6.3, where the REJECT carries no
  592.         user data. A received REJECT may carry Presentation, ACSE and
  593.         application data, although 6.3 shows only how to reject at
  594.         Session level..
  595.  
  596.    To send/receive data on an connection
  597.  
  598.         send the message defined in 6.4, which is an empty Session
  599.         GIVE-TOKEN followed by Session S-DATA carrying Presentation P-
  600.         DATA [TD] containing the application data (The GIVE-TOKEN is
  601.         just two octets required by Session for some backwards
  602.         compatibility.)
  603.  
  604.    To close connection gracefully
  605.  
  606.         One side sends the message defined in 6.5, which is Session
  607.         FINISH carrying P-RELEASE request carrying A-RELEASE request
  608.         [RLRQ] optionally carrying application data (This side may now
  609.         receive, but not send data.)
  610.  
  611.         The other side replies with the message defined in 6.6, which
  612.         is Session DISCONNECT carrying P-RELEASE response carrying A-
  613.         RELEASE response [RLRE] optionally carrying application data
  614.  
  615.  
  616.  
  617.  
  618. Furniss                                                        [Page 11]
  619.  
  620. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  621.  
  622.  
  623.         First side disconnects transport connection on receiving the
  624.         reply
  625.  
  626.    To close connection abruptly but also send application data
  627.  
  628.         Send the message defined in 6.7, which is Session ABORT
  629.         carrying Presentation U-ABORT [ARU] carry ACSE U-ABORT [ABRT]
  630.         carrying application data (delivery not guaranteed)
  631.  
  632.         On receiving Session ABORT, disconnect transport
  633.  
  634.    To close connection abruptly
  635.  
  636.      -  Either send the message defined in 6.8, which is Session ABORT
  637.         carrying nothing;
  638.  
  639.         Or, just disconnect at transport level
  640.  
  641.    A group I application is assumed (by definition) not to send data on
  642.    the establishment and release exchanges, a group II application will.
  643.  
  644.    It would be possible to use the abort-with-data facility with a group
  645.    I to send a (possibly non-standardised) error message for diagnostic
  646.    purposes.
  647.  
  648.    A special rule is used if a release collision occurs (i.e., FINISH+P-
  649.    RELEASE+RLRQ received after sending the same): the side that
  650.    initiated the original upper-layer connection waits and the other
  651.    side replies with the DISCONNECT etc.
  652.  
  653. 4.2 Which OSI fields are used
  654.  
  655.    There are a number of fields (parameters) in the pdus involved. These
  656.    can be categorised by what is needed to support applications (of a
  657.    particular Group) in general - a field may  be "useful", "send-only",
  658.    "fixed", "fixed with default", "internal" or "not important". Even
  659.    those that are not important may be received from another
  660.    implementation, but since the application has no use for them, they
  661.    can be ignored. If an implementation is intended to support only a
  662.    particular application, it may be able to downgrade the "useful" to
  663.    "not important".
  664.  
  665.    The text below describes the processing that is required for each
  666.    category and which fields are in each category.
  667.  
  668.    "Useful" - when sending, an implementation of general use should be
  669.    able to set any (legal) value of these fields (via the upper
  670.    interface from the application or via some configuration or lookup
  671.  
  672.  
  673.  
  674. Furniss                                                        [Page 12]
  675.  
  676. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  677.  
  678.  
  679.    mechanism) and SHOULD pass received values for the Calling values to
  680.    the application (for specific applications, these fields may be
  681.    either required or unnecessary.)
  682.  
  683.     AARQ:
  684.  
  685.       Called application-process title
  686.       Called application-entity qualifier
  687.       Calling application-process title
  688.       Calling application-entity qualifier
  689.  
  690.    "Send-only" - to interwork, the implementation must be able to set
  691.    any value of these, but can ignore any received value. Both are octet
  692.    strings.
  693.  
  694.       Presentation selector (up to 4 octets, limited by CULR-1)
  695.       Session selector (up to 16 octets, limited by base standard)
  696.  
  697.    "Fixed" (constant for all applications)
  698.  
  699.       abstract and transfer syntax identifiers for presentation context
  700.       for ACSE Version numbers - 2 for session, 1 for Presentation
  701.       and ACSE
  702.  
  703.    "Fixed with default" - the value is specific to the application. For
  704.    non-ASN.1 abstract syntaxes (group I or group II only) applications,
  705.    the anonymous values assigned by the OIW minimal OSI profile [CULR-3]
  706.    can be used. The CULR-3 default application context can be used where
  707.    a proper context name is neither available nor needed.
  708.  
  709.       Application context
  710.                        CULR-3  default is {1 0 11188 3 3}
  711.       Abstract syntax identifier for application data
  712.                        CULR-3 anonymous name is {1 0 11188 3 1 1}
  713.       Transfer syntax identifier for application data
  714.                        CULR-3 anonymous name is {1 0 11188 3 2 1}
  715.  
  716.    "Internal" - an arbitrary value can be sent; a received value must be
  717.    stored for use in sending.
  718.  
  719.       Presentation context identifiers for ACSE and the application
  720.       data (always odd integers)
  721.  
  722.    "Not important" - for interworking, any legal received value for the
  723.    other fields must be received (i.e., the pdu is parsed successfully),
  724.    but can then be ignored. There is no requirement (in this cookbook)
  725.    to check the existence, value or internal format of these fields.
  726.  
  727.  
  728.  
  729.  
  730. Furniss                                                        [Page 13]
  731.  
  732. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  733.  
  734.  
  735.       All other fields (which includes a large number of session
  736.       fields)
  737.  
  738. 4.3 Encoding methods and length fields
  739.  
  740.    Both Session and ASN.1/BER [ISO8824, ISO8825] use a type-length-value
  741.    structure for their encodings, but different ones. Presentation
  742.    protocol and ACSE protocol use the ASN.1/BER encoding and
  743.    consequently a Presentation PDU containing an ACSE PDU can be
  744.    constructed or parsed as if it were a single structure.
  745.  
  746.    All the protocols contain pdu fields with a compound structure. If
  747.    one of these is being ignored it may be necessary (for BER, not
  748.    session) to determine the lengths of its components to find the
  749.    length of the ignored field.
  750.  
  751.    Many of the lengths in the specification below will vary, dependent
  752.    on the values of the fields.
  753.  
  754. 4.3.1 Session items
  755.  
  756.    The type field of a session item is always a single octet.
  757.  
  758.    For session items, given a particular length, there is no
  759.    flexibility:
  760.  
  761.       If the length is less than 255, represent as one octet
  762.  
  763.       If the length is greater, represent as three octets, first is
  764.       0xFF, next two are the length, high-order octet first.
  765.  
  766.    (Some "real" implementations are known to use the second encoding in
  767.    all cases. This is wrong, but should only concern conformance
  768.    testers.)
  769.  
  770. 4.3.2 ASN.1/BER items (Presentation and ACSE)
  771.  
  772.    The type field for ASN.1-BER is the tag. Although it is possible for
  773.    large tags (>30) to be multi-octet, there are no large tags in the
  774.    protocols involved in this memo. Bit 6 (0x20) of the tag octet is 1
  775.    if the item is constructed (i.e., the value is itself one or more
  776.    ASN.1 BER items) or 0 if it is primitive.
  777.  
  778.    There is considerable flexibility, at senders option, in how lengths
  779.    are represented in BER. There are three forms: short, long and
  780.    indefinite.
  781.  
  782.       Short (usable only if the length is less than 127) : one octet
  783.  
  784.  
  785.  
  786. Furniss                                                        [Page 14]
  787.  
  788. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  789.  
  790.  
  791.       Long (usable for *any* length) : first octet has the top bit set,
  792.       the rest is a count of how many octets are holding the length
  793.       value; that many subsequent octets hold the length. A long length
  794.       may use more than the minimum number of octets (so 0x8400000001
  795.       is a valid representation of length 1)
  796.  
  797.       Indefinite (usable only for the length of a compound field) : the
  798.       single octet is 0x80, then one or more items (their tag-length-
  799.       values) and finally two octets of 0x00 (equivalent to tag and
  800.       length of zero).
  801.  
  802.    To be able to interwork generally, an implementation must be able to
  803.    handle any of these forms when receiving.
  804.  
  805.    The encodings specified in the octet sequences below use indefinite
  806.    length for all constructed items with a few exceptions. This slightly
  807.    increases the number of octets sent, but means that the length of a
  808.    varying field (e.g., user data, or a varying object identifier)
  809.    affects only the length of the item itself, and not the enclosing
  810.    lengths. It is thus possible to use the octet sequences as templates
  811.    interspersed by the varying fields.
  812.  
  813.    It is important to note that this choice of indefinite (which is
  814.    equivalent to the "Canonical Encoding Rules" variant of BER) applies
  815.    only to the Presentation and ACSE protocols themselves. It does not
  816.    apply to ASN.1/BER encoded application data. The processing required
  817.    of application data may suggest alternative "best" options.
  818.  
  819. 4.4 BER Encoding of values for primitive datatypes
  820.  
  821.    The following ASN.1 primitive datatypes are used in the thinosi
  822.    stack.
  823.  
  824.    Integers are encoded in twos-complement, high-order first. Unlike
  825.    lengths, they must be encoded in the minimum number of octets (no
  826.    leading 00 padding).
  827.  
  828.    Object Identifiers have a rather peculiar, but compressed encoding:
  829.  
  830.       Combine the first two integers of the OID into one element by
  831.       multiplying the first (always 0, 1 or 2) by 40, and add the
  832.       second.
  833.  
  834.       Each element (that one, and each subsequent integer in the OID
  835.       taken on its own), is a taken as a binary number and divided into
  836.       7-bit "bytes". This is apportioned into bits 1-7 of the minimum
  837.       number of octets. Bit 8 is one for all octets of the sequence
  838.       except the last. (This means that elements of less than 127 are
  839.  
  840.  
  841.  
  842. Furniss                                                        [Page 15]
  843.  
  844. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  845.  
  846.  
  847.       single octet integers.)
  848.  
  849.    Printable Strings - as if in ISO 646 (ASCII)
  850.  
  851.    OCTET STRING - just put the octets there
  852.  
  853. 4.5 Unnecessary constructed encodings
  854.  
  855.    BER allows the sender to break some items (such as OCTET STRINGS,
  856.    character strings) into several pieces (i.e., as constructed
  857.    encoding) or send them as primitive. CULR-1 requires that this is
  858.    only done to one level. The pieces of both OCTET STRING and character
  859.    string are tagged as if they were OCTET STRING - they have the tag
  860.    04. This memo does not include any of these optional constructions,
  861.    but they may be received in interworking.
  862.  
  863. 5.  Notation
  864.  
  865.    The constructs are shown in their tag - length - value form. All
  866.    numbers are in hexadecimal. Comments are preceded by a '-' character.
  867.    Multiple '-' mean the comment is more than just information.
  868.  
  869.    The tag column contains one of:
  870.  
  871.       single fixed octets.
  872.  
  873.       * in the tag field indicates one or more pdu fields (possibly
  874.       constructed) that may be received but are not sent. If received
  875.       they can be ignored.
  876.  
  877.       ! indicates the tag is defined elsewhere.
  878.  
  879.       .  is a place holder for the column.
  880.  
  881.       ? preceding the tag value indicates that the field is not always
  882.       present - the comment will explain.
  883.  
  884.    The length column contains one of
  885.  
  886.       explicit value
  887.  
  888.       Ls - a length according to session rules which depends on the
  889.       total size of the value (usually constructed)
  890.  
  891.       La - a length according to BER rules
  892.  
  893.       . is a placeholder
  894.  
  895.  
  896.  
  897.  
  898. Furniss                                                        [Page 16]
  899.  
  900. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  901.  
  902.  
  903.       yy is exactly one octet (i.e., one hex digit per y) holding part
  904.       of the length
  905.  
  906.    The value column contains one of
  907.  
  908.       the hex value
  909.  
  910.       xxxxxx - value of varying length (sometimes constructed)
  911.  
  912.       {n - (n = number) the start of a constructed value
  913.  
  914.       n - (n=number) the end of the constructed value with the
  915.       corresponding number. (The number is sometimes omitted on the
  916.       innermost nest of construction)
  917.  
  918.       yy - as part of a value - a variable value, each y represents one
  919.       hex digit
  920.  
  921.       ? a value, possibly constructed that may be received but is not
  922.       sent. It may be ignored if received
  923.  
  924.    Note that all presentation lengths may be received in one of the
  925.    alternative forms. All constructed lengths are shown in indefinite
  926.    form. If a received length is definite, the corresponding end item
  927.    (which will be shown here as 00 00 }n)  will become  . . }n.
  928.  
  929.    In the comments, the notation {n} refers to the constructed item
  930.    bracketed by the {n, }n fields.
  931.  
  932. 6.  Octet sequences
  933.  
  934. 6.1 Connection request message
  935.  
  936.         - CONNECT SPDU
  937.    0D  Ls  {1       - "SI" value for CONNECT = 13
  938.    *   Ls  ?        - Connection Identifier
  939.    05  06  {2       - Connect/Accept Item
  940.    13  01  00       - protocol options (probably mandatory)
  941.    *   Ls  ?
  942.  
  943.    16  01  02       -- version number (bottom bit = v1, next bit =v2.
  944.                     --     may get offers of either or both
  945.    *   Ls  ?
  946.    14  02  0002     - Session User Requirements (functional units)
  947.                     - Id (20), length (always 2), duplex fu only.
  948.                     -- On receipt, other bits may be set
  949.                     -- check that the 2 bit is set
  950.    *   Ls  ?        - we do not send any Calling Session Selector
  951.  
  952.  
  953.  
  954. Furniss                                                        [Page 17]
  955.  
  956. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  957.  
  958.  
  959.    ?34 Ls  xxxx     -- Called Session Selector (i.e., the other end's)
  960.                     -- up to 16 octets - you must set what the other
  961.                     -- side demands.  - May be anything characters,
  962.                     -- binary etc.
  963.                     -  {3} disappeared in editing
  964.    C1  Ls  {4       -- User Data, Identifier=193. if length is > 512,
  965.                     -- then identifier is 194 (hex C2) instead
  966.    - CP - P-CONNECT-RI PPDU. Everything below is in ASN.1 BER
  967.    31  80  {5       - [SET]
  968.               --- Mode-selector (the {6} group) could possibly
  969.               --- come after everything else {7}
  970.               --- This will probably only be done by
  971.               --- evil-minded conformance testers
  972.    A0  80  {6       - Mode-selector [0] IMPLICIT SET
  973.    80  01  01       - [0] IMPLICIT INTEGER {normalmode(1)}
  974.    00  00  }6
  975.    A2  La  {7       - [2] unnamed IMPLICIT SEQUENCE
  976.    *   La  ?
  977.    ?82 La  xxxx     - [2] Called-presentation-selector
  978.                     - CULR says maximum length is 4
  979.                     -- must be what the other side wants
  980.    A4  80  {8       - [4] Presentation-context-definition-list
  981.                 ---  items (the outer SEQUENCEs) within the {8} list may
  982.                 ---  be in any order.
  983.    30  80  {9       - [SEQUENCE]
  984.    02  01  01       -- Defines pcid for ACSE; received value will be
  985.                     -- a one or two octet odd integer
  986.    06  04  52010001 - [OID] for ACSE abstract syntax
  987.    30  80  {        - [SEQUENCE]
  988.    06  02  5101     - [OID] Transfer syntax name is BER
  989.    00  00  }        - end t-s list
  990.    00  00  }9       - end acse pctx defn
  991.    30  80  {10      - [SEQUENCE]
  992.    02  01  03       -- [INTEGER] Defines pcid for application data;
  993.                     -- received value will be a one or two octet odd
  994.                     -- integer
  995.    06  La  xxxxxx   - [OID] object identifier name of application
  996.                     - abstract syntax (if CULR-3 default is used, this
  997.                     - line is 06  06  28D734030101)
  998.    30  80  {11
  999.    06  La  xxxxxx   - [OID] t-s name for application data
  1000.                     - (if CULR-3 default is used, this line is
  1001.                     -  06  06  28D734030201)
  1002.                 -- will be several of these if multiple t-s offered
  1003.                 -- (application is Group III)
  1004.                 -- all will have the same tag 06
  1005.    00  00  }11      - end transfer syntax list for application p-ctx
  1006.    00  00  }10      - end application pctx definition
  1007.  
  1008.  
  1009.  
  1010. Furniss                                                        [Page 18]
  1011.  
  1012. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1013.  
  1014.  
  1015.                 -- if multiple presentation contexts are offered, (Group
  1016.                 -- IV), the {10} SEQUENCE will repeat appropriately
  1017.                 -- if multiple contexts are to be accepted, all the
  1018.                 -- pcid's must be remembered
  1019.    00  00  }8       - end of p-ctx-def-list
  1020.    *   La  ?
  1021.    61  80  {12      - [APPLICATION 1] User-data - Fully-encoded
  1022.    30  80  {13      - [SEQUENCE] PDV-list
  1023.    02  01  01      -- [INTEGER], value is acse pcid
  1024.    A0  80  {14      - [0] Single-ASN1
  1025.    - ACSE A-ASSOCIATE request APDU - AARQ
  1026.    60  80  {15      - [APPLICATION 0] - AARQ
  1027.    *   La  ?        -  protocol version defaults to 1 (only one defined)
  1028.    A1  80  {        - [1] Application-context
  1029.    06  La  xxxxxx   -- object identifier name of application context
  1030.                     - (if CULR-3 default is used, this line is
  1031.                     -  06  05  28D7340303)
  1032.    00  00  }
  1033.              -- Called application process title {16} and application
  1034.              -- entity qualifier may or may not be needed (see 3.4)
  1035.    ?A2 80  {16      - [2] Called Application-Process title
  1036.    ?!  La  xxxxxx   -- see 3.5 - either a Directory Name or an oid
  1037.    ?00 00  }16      - end Called APtitle
  1038.    ?A3 80  {17      - [3] Called Application-Entity Qualifier
  1039.    ?!  La  xxxxxx   -- see 3.5
  1040.    ?00 00  }17
  1041.    *   La  ?
  1042.              Calling AP-title and AE-qualifier may or may not be needed.
  1043.    ?A6 80  {18      - [6] Calling Application-Process title
  1044.    ?!  La  xxxxxx   -- see 3.5
  1045.    ?00 00  }18
  1046.    ?A7 80  {19      - [7] Calling Application-Entity Qualifier
  1047.    ?!  La  xxxxxx   -- see 3.5
  1048.    ?00 00  }19
  1049.    *   La  ?
  1050.             -- the user information field may or may not be required
  1051.             -- (not required for Group I)
  1052.    ?BE 80  {20      - [30] IMPLICIT SEQUENCE
  1053.    ?28 80  {21      - [EXTERNAL]
  1054.    ?06 La xxxxxx   -- [OID] This is the oid identifying the transfer
  1055.                     -- syntax used for the user data.
  1056.                     -- It is (almost certainly) required even if only
  1057.                     -- one transfer syntax was proposed.
  1058.    ?02 01  03       -  [INTEGER] this is the pcid for the application
  1059.                     -  data
  1060.    ?A0 La  xxxxxx   -- [0] single-ASN.1-type - the application data
  1061.                     --      (see paragraph at end of this section below}
  1062.    ?00 00  }21      - end of EXTERNAL
  1063.  
  1064.  
  1065.  
  1066. Furniss                                                        [Page 19]
  1067.  
  1068. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1069.  
  1070.  
  1071.             -- conceivably there may be several EXTERNALS, probably in
  1072.             -- different presentation contexts (different pcids)
  1073.    ?00 00  }20      - end of user information field
  1074.    00  00  }15      - end of AARQ
  1075.    00  00  }14      - end of single-ASN-type
  1076.    00  00  }13      - end of PDV-list
  1077.    00  00  }12      - end of Presentation User-data
  1078.    00  00  }7       - end of third element of CP-type SET
  1079.    00  00  }5       - end of CP-type
  1080.  
  1081.    The application data carried in the EXTERNAL is shown (as A0 La xxxx)
  1082.    assuming it is a single-ASN.1 type, which it often will be for group
  1083.    II (since these tend to be OSI applications). The xxxx will be the
  1084.    BER encoding of the application pdu (probably something like Z-BIND
  1085.    or Y- INITIALIZE). The length may be indefinite.
  1086.  
  1087.    If the application data is not a single ASN.1 type, but is an octet-
  1088.    aligned value, the A0 La xxxx is replaced by 81 La xxxx, where xxxx
  1089.    is the value. In this case the length must be definite (unless an
  1090.    "unnecessary" constructed encoding is used.)
  1091.  
  1092.    Identical considerations apply to the other EXTERNALs carried in the
  1093.    ACSE pdus.
  1094.  
  1095. 6.2 Successful reply to connection setup
  1096.  
  1097.    If the connection attempt is successful, the following is sent to the
  1098.    initiator on a T-DATA.
  1099.  
  1100.    0E  Ls  {1         - ACCEPT SPDU
  1101.    *   Ls  ?
  1102.    05  06  {2         - Connect/Accept Item
  1103.    13  01  00         - Protocol Options
  1104.    *   Ls  ?
  1105.    16  01  02         - version number (this shows version 2 only)
  1106.                   -- if version 2 was not offered, omit all of {2}
  1107.    *   Ls  ?
  1108.    14  02  0002       - Session User Requirements (functional units)
  1109.                       - duplex fu only (kernel is automatic)
  1110.    *   Ls  ?
  1111.    C1  Ls  {3         -- User Data.
  1112.      - CPA - P-CONNECT response
  1113.    31  80  {4         - [SET]
  1114.                       -- again, Mode-selector could come at the end
  1115.    A0  80  {          -  Mode-selector [0]
  1116.    80  01  01         -  normal mode - [0], length=1, value=1
  1117.    00  00  }
  1118.    A2  80  {5         - [2] SEQUENCE (unnamed)
  1119.  
  1120.  
  1121.  
  1122. Furniss                                                        [Page 20]
  1123.  
  1124. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1125.  
  1126.  
  1127.    *   La  ?
  1128.    A5  80  {6         - [5] P-context-definition-result-list
  1129.                    -- following result items are in the order
  1130.                    -- corresponding to the pctx-definition-list in
  1131.                    -- the connect
  1132.                    -- this example assumes that was ACSE, user, rubbish
  1133.                    -- with rubbish rejected
  1134.    30  80  {7         - [SEQUENCE] result item for acse
  1135.    80  01  00         -- [0] result, value 0 is acceptance
  1136.    81  02  5101       -  [1] accepted transfer syntax name = BER
  1137.                       - note that this has an implicit tag, not 06
  1138.    00  00  }7         - end result item for acse p-ctx
  1139.  
  1140.    30  80  {8         - [SEQUENCE] result item for application-data pctx
  1141.    80  01  00         - [0] value 0 is acceptance
  1142.    81  La  xxxxxx     - [1] oid for transfer syntax, as on definition list
  1143.                       -- if there were several (groupIII) , the one you
  1144.                       -- liked most
  1145.    00  00  }8         - end result item for app-data p-ctx
  1146.    00  00  }6         - end p-ctx-def-result-list
  1147.    *   La  ?
  1148.    61  80  {10        - [APPLICATION 1] User-data, Fully-encoded
  1149.  
  1150.    30  80  {11        - [SEQUENCE] PDV-list
  1151.    02  01  01         -- [INTEGER] value is pcid for ACSE, as stored from
  1152.                       -- the pctx-definition-list on the P-CONNECT
  1153.                       -- request
  1154.    A0  80  {12        - [0] single-ASN1-type
  1155.         - A-ASSOCIATE response APDU - AARE
  1156.    61  80  {13        - [APPLICATION 1] identifies AARE
  1157.    *   La  ?
  1158.    A1  80  {14        - [1] Application-context
  1159.    06  La  xxxxxx     - [OID] name of application context
  1160.                       - usually the same as on AARQ, can differ
  1161.    00  00  }14
  1162.    A2  03  {15        - [2] result
  1163.    02  01  00         - [INTEGER] value 0 means accepted
  1164.    00  00  }15
  1165.    A3  80  {16        - [3] result-source-diagnostic
  1166.                       - (curiously, a non-optional field)
  1167.    A1  80  {17        - [1] acse-service-user
  1168.    02  01  00         - [INTEGER] value 0 = null ! (why no implicit tag)
  1169.    00  00  }17        - end acse-service-user
  1170.    00  00  }16        - end result source diagnostic
  1171.    *   La  ?
  1172.             -- the user information field may or may not be required
  1173.             -    (not used for Group I)
  1174.    ?BE 80  {20      - [30] IMPLICIT SEQUENCE
  1175.  
  1176.  
  1177.  
  1178. Furniss                                                        [Page 21]
  1179.  
  1180. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1181.  
  1182.  
  1183.    ?28 80  {21      - [EXTERNAL]
  1184.                    -- the transfer-syntax oid is not present this time
  1185.    ?02 01  03       - [INTEGER] this is the pcid for the application
  1186.                     - data
  1187.    ?A0 La  xxxx     -- [0] single-ASN1-type (see note at end of 6.1)
  1188.    ?00 00  }21      - end of EXTERNAL
  1189.             -- conceivably there may be several EXTERNALS, probably in
  1190.             -- different presentation contexts (different pcids)
  1191.    ?00 00  }20      - end of user information field
  1192.    00  00  }13        - end AARE
  1193.    00  00  }12        - end single-asn1-type
  1194.    00  00  }11        - end PDV-list
  1195.    00  00  }10        - end Presn user-data
  1196.    00  00  }5         - end [2] implicit sequence in cpa
  1197.    00  00  }4         - end CPA-type set
  1198.  
  1199.    The following sequence are the octets need to reject a presentation
  1200.    context that was offered in the presentation-context-definition-list.
  1201.    Since the result-list matches the definition list by position, it is
  1202.    placed at the corresponding point within {6} (e.g., it would come
  1203.    immediately after {8}, if the rejected context was the third one.
  1204.  
  1205.                  -- next SEQUENCE is a rejection of a pctx
  1206.    30  80  {9         - [SEQUENCE] result item for a rejected pctx
  1207.    80  01  02         -- [0] result, value 2 is provider rejection
  1208.    82  01  00         - [2] reason, value 0 is reason-not-specified
  1209.                       -- there are other reasons, but let's keep it
  1210.                       -- simple
  1211.    00  00  }9         - end result item for rejected pctx
  1212.  
  1213. 6.3 Connection rejection
  1214.  
  1215.    Refusal is at session-level, but by session user, with no reason
  1216.    given.  This is a compromise avoiding making unfounded accusations of
  1217.    (session) protocol misbehaviour. If the implementation finds it does
  1218.    not like the received message, it is not essential to attempt to
  1219.    communicate with the partner why, though this may be helpful if the
  1220.    reason is correctly identified. (In most cases, a wise implementor
  1221.    will make sure an error message goes somewhere or other).
  1222.  
  1223.    0C  03  {1          - REFUSE SPDU
  1224.    *   Ls  ?
  1225.    32  01  00          - rejected by SS-user, no reason
  1226.  
  1227.    The far-end may send interesting things explaining why you are not
  1228.    getting interworking. If this is a session reason, the reason code
  1229.    will one octet between 81 and 86. If the rejection is higher than
  1230.    session, this will be carried on S-REFUSE (so first octet is still
  1231.  
  1232.  
  1233.  
  1234. Furniss                                                        [Page 22]
  1235.  
  1236. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1237.  
  1238.  
  1239.    0C) and the higher pdu will appear as part of the reason code, which
  1240.    will start with 02.  (The only remaining code is 01 = user
  1241.    congestion.)
  1242.  
  1243. 6.4 Data-phase TSDU
  1244.  
  1245.    This is the core of the skinny stack. The lengths shown use a
  1246.    particular set of choices for indefinite and definite lengths that
  1247.    means that the application data length only affects one field. Making
  1248.    the two earlier indefinite lengths definite would require more
  1249.    calculation - adding 4 octets after the application data is assumed
  1250.    to be quicker. This header is also designed to be 20 octets long,
  1251.    thus maintaining 4-byte alignment between transport and application
  1252.    buffers.  Implementations are recommended to use this encoding. It is
  1253.    possible to rapidly match incoming data against it - if there is no
  1254.    mismatch until the length field, the location of the beginning of the
  1255.    data can be determined without further analysis.
  1256.  
  1257.              SPDUs
  1258.    01  00  .      - S-GIVE-TOKEN - required by basic concatenation
  1259.                   - but no parameters
  1260.    01  00  .      - S-DATA - no parameters - what follows is User
  1261.                   - Information, not User Data, so is not included in
  1262.                   - the SPDU length fields
  1263.      - P-DATA PPDU - TD (why TD ? Typed-data id TTD !)
  1264.    61  80  {1     - User-data [APPLICATION 1]
  1265.    30  80  {2     - [SEQUENCE] PDV-list
  1266.    02  01  03     - [INTEGER] pcid for application data, P-CONNECT PPDU
  1267.                   - remembered by both sides
  1268.    81  83yyyyyy   xxxxxx  -- [1] octet-aligned presentation data value(s)
  1269.                  -- length of length (3 octets) then three octets yyyyyy
  1270.                  -- for the length of the user data xxxxxx
  1271.    00  00  }2      - End-of-contents for end of PDV-list
  1272.    00  00  }1      - End-of-contents for end of Presentation User-data
  1273.  
  1274.    If the application data is in ASN.1, and a single ASN.1 value is
  1275.    being sent on the TSDU, the same header can be used except for the
  1276.    tag on the presentation data values, which becomes A0 (= [0],
  1277.    constructed).
  1278.  
  1279.    If there are multiple data values to be sent, this header can be
  1280.    expanded in several ways:
  1281.  
  1282.       a) if there are several ASN.1 values from the same
  1283.          presentation context, they can be concatenated and
  1284.          treated as an octet-aligned value (using the header
  1285.          as shown above, with tag 81 (or A1 - I think its
  1286.          primitive) or each ASN.1 value can be an item
  1287.  
  1288.  
  1289.  
  1290. Furniss                                                        [Page 23]
  1291.  
  1292. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1293.  
  1294.  
  1295.          (tagged A0), one after the other
  1296.  
  1297.       b) if the data values are from different presentation
  1298.          contexts (group IV), each is in its own {2} group
  1299.          within the {1}.
  1300.  
  1301.    On receipt, for the simple octet-aligned case, the data value may
  1302.    itself have a constructed encoding - this will make the tag A1, and
  1303.    it will contain elements each tagged 04 (OCTET STRING). According to
  1304.    CULR- 1, these elements are primitive (otherwise they would be 24 of
  1305.    course).
  1306.  
  1307. 6.5 Closedown  - release request
  1308.  
  1309.    When all is done, and you want to close down gracefully, send this on
  1310.    T-DATA.
  1311.  
  1312.        - FINISH SPDU
  1313.    09  10  {1         - 9 identifies FINISH
  1314.    *   Ls  ?          - No Transport Disconnect item
  1315.                       - default is release Transport-connection
  1316.    C1  0E  {2         - User data (code 193)
  1317.        - P-RELEASE req/ind PPDU (has no name)
  1318.    61  80  {3         - [APPLICATION 1], user data, fully-encoded
  1319.    30  80  {4         - [SEQUENCE] PDV-list
  1320.    02  01  01         -- pcid for ACSE, remembered from setup
  1321.    A0  80  {5         - [0] single asn.1-type
  1322.        - A-RELEASE request APDU - RLRQ
  1323.    62  80  {6         - [APPLICATION 2] identifies RLRQ
  1324.    80  01  00         - [0] reason, value 0 means normal
  1325.    *   La  ?
  1326.             -- the user information field may or may not be required
  1327.             - ( not required for Group I)
  1328.    ?BE 80  {7       - [30] IMPLICIT SEQUENCE
  1329.    ?28 80  {8       - [EXTERNAL]
  1330.                     -- the transfer-syntax oid is not present this time
  1331.    ?02 01  03       - [INTEGER] this is the pcid for the application
  1332.                     - data
  1333.    ?A0 La  xxxxx    -- [0] single-ASN.1-type application data
  1334.                     -- (see note at end of 6.1)
  1335.    ?00 00  }8       - end of EXTERNAL
  1336.             -- conceivably there may be several EXTERNALS, probably in
  1337.             -- different presentation contexts (different pcids)
  1338.    ?00 00  }7       - end of user information field
  1339.    00  00  }6         - end of RLRQ
  1340.    00  00  }5         - end of single asn.1-type
  1341.    00  00  }4         - end of PDV-list
  1342.    00  00  }3         - end of Presentation User-data
  1343.  
  1344.  
  1345.  
  1346. Furniss                                                        [Page 24]
  1347.  
  1348. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1349.  
  1350.  
  1351. 6.6 Closedown - release response
  1352.  
  1353.    On receiving a FINISH, you send this to tell the other end it is all
  1354.    over
  1355.  
  1356.        - Session DISCONNECT SPDU
  1357.    0A  Ls  {1         - SI=10, DISCONNECT
  1358.    C1  Ls  {2         - User data
  1359.        - P-RELEASE rsp PPDU
  1360.    61  80  {3         - [APPLICATION 1], user data, fully-encoded
  1361.    30  80  {4         - [SEQUENCE] PDV-list
  1362.    02  01  01         -- [INTEGER] pcid for ACSE, remembered from setup
  1363.    A0  80  {5         - [0] single asn.1-type
  1364.        - A-RELEASE response APDU - RLRE
  1365.    63  80  {6         - [APPLICATION 3] identifies RLRE
  1366.    80  01  00         - [0] reason, value 0 means normal
  1367.    *   La  ?
  1368.             -- the user information field may or may not be required
  1369.             - (not required for Group I)
  1370.    ?BE 80  {7       - [30] IMPLICIT SEQUENCE
  1371.    ?28 80  {8       - [EXTERNAL]
  1372.                    -- the transfer-syntax oid is not present this time
  1373.    ?02 01  03       - [INTEGER] this is the pcid for the application
  1374.                     - data
  1375.    ?A0 La  xxxxx    -- [0] single-ASN.1-type application data
  1376.                     -- (see note at end of 6.1)
  1377.    ?00 00  }8       - end of EXTERNAL
  1378.             -- conceivably there may be several EXTERNALS, probably in
  1379.             -- different presentation contexts (different pcids)
  1380.    ?00 00  }7       - end of user information field
  1381.    00  00  }6         - end of RLRE
  1382.    00  00  }5         - end of single asn.1-type
  1383.    00  00  }4         - end of PDV-list
  1384.    00  00  }3         - end of Presentation userdata
  1385.  
  1386. 6.7 Deliberate abort
  1387.  
  1388.    It is not clear whether this is any use - just clearing the Transport
  1389.    connection will be more effective. It goes on T-DATA, but asks for
  1390.    the far-side to close the T-connection.
  1391.  
  1392.        - Session ABORT SPDU
  1393.    19  Ls  {1      - SI of 25 is ABORT
  1394.    11  01  03      - Transport Disconnect PV, code 17
  1395.                    --  value = '...00011'b means please
  1396.                    -- release T-conn, user abort
  1397.    *   Ls  ?
  1398.    C1  11  {2      - Session User Data
  1399.  
  1400.  
  1401.  
  1402. Furniss                                                        [Page 25]
  1403.  
  1404. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1405.  
  1406.  
  1407.        - P-U-ABORT PPDU - ARU
  1408.    A0  80  {3      - [0] implicit sequence for normal mode
  1409.    A0  80  {4      - [0] presentation-context-identifier-list
  1410.    30  80  {5      - [SEQUENCE]
  1411.    02  01  01      - [INTEGER]pcid for ACSE
  1412.    06  02  5101    - [OID] for acse transfer syntax = BER
  1413.    00  00  }5
  1414.             -- there will be one {6} group for each application
  1415.             -- presentation context that is used in this message
  1416.             -- if there is no user data, the {6} group can be
  1417.             -- omitted
  1418.    30  80  {6
  1419.    02  01  03      - [INTEGER] pcid for application data
  1420.    06  La  xxxxxx  - [OID] transfer syntax for application data
  1421.    00  00  }6
  1422.    00  00  }4      - end of presentation-context-identifier-list
  1423.    61  80  {7      - [APPLICATION 1], user data, fully-encoded
  1424.    30  80  {8      - [SEQUENCE] PDV-list
  1425.    02  01  01      - [INTEGER] pcid for ACSE as on CP PPDU
  1426.    A0  05  {9      - [0] single asn.1-type
  1427.        - A-ABORT APDU - ABRT
  1428.    64  80  {10     - [APPLICATION 4] identifies ABRT
  1429.    80  01  01      -  [0] value 1 is acse-service-provider
  1430.             -- the user information field may or may not be required
  1431.    ?BE 80  {11      - [30] IMPLICIT SEQUENCE
  1432.    ?28 80  {12      - [EXTERNAL]
  1433.                    -- the transfer-syntax oid is not present this time
  1434.                    -- (according to CULR-1)
  1435.    ?02 01  03       - [INTEGER] this is the pcid for the application
  1436.                     - data
  1437.    ?A0 La  xxxxx    -- [0] single-ASN.1-type application data
  1438.                     -- (see note at end of 6.1)
  1439.    ?00 00  }12      - end of EXTERNAL
  1440.             -- conceivably there may be several EXTERNALS, probably in
  1441.             -- different presentation contexts (different pcids)
  1442.    ?00 00  }11      - end of user information field
  1443.    00  00  }10     - end of ABRT
  1444.    00  00  }9      - end of single asn.1-type
  1445.    00  00  }8      - end of PDV-list
  1446.    00  00  }7      - end of Presentation user-data
  1447.    00  00  }3      - end of ARU-PPDU
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458. Furniss                                                        [Page 26]
  1459.  
  1460. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1461.  
  1462.  
  1463. 6.8 Provider abort
  1464.  
  1465.    Generated when an internal error occurs (i.e., something has gone
  1466.    mildly (?) wrong in the cookbook implementation). Rather than accuse
  1467.    anyone of protocol errors, we just abort at session.
  1468.  
  1469.              ABORT SPDU
  1470.    19  03  {1         - SI=25 = ABORT SPDU
  1471.    11  01  09         - Transport Disconnect PV, code 17
  1472.                     -- value = '...01001'b  release T-conn
  1473.                     --  no reason
  1474.    *   Ls  ?
  1475.  
  1476. 6.9 Abort accept
  1477.  
  1478.    If a Session abort (of any kind) is sent, it is possible that the
  1479.    far-end will send back an abort accept. If this happens, disconnect
  1480.    the transport. (The abort messages above do not propose that the
  1481.    transport connection be reused, and in this case, an abort accept is
  1482.    just the far-end passing the transport-disconnect initiative back.)
  1483.    This session message need never be sent - just disconnect transport
  1484.    on receiving an abort.
  1485.  
  1486.              ABORT ACCEPT SPDU
  1487.    1A  00  .         - SI=26 = ABORT ACCEPT SPDU, no parameters
  1488.  
  1489. 7.  References
  1490.  
  1491.    [CULR-1] ISO/IEC DISP 11188-1 - Information Technology -
  1492.    International Standardised Profile - Common Upper Layer Requirements
  1493.    - Part 1: Basic Connection oriented requirements (DISP ballot ends
  1494.    June 1994).
  1495.  
  1496.    [CULR-3] Draft of Common Upper-layer requirements - Part 3: Minimal
  1497.    OSI upper layers facilities (A later draft will be proposed as ISP
  1498.    11188/3).
  1499.  
  1500.    [ISO8072] Information processing systems - Open Systems
  1501.    Interconnection - Transport service definition; ISO, 1986.
  1502.  
  1503.    [ISO8073] Information processing systems - Open Systems
  1504.    Interconnection - Transport protocol specification; ISO, 1986.
  1505.  
  1506.    [ISO8326] Information processing systems - Open Systems
  1507.    Interconnection - Basic connection oriented session service
  1508.    definition; ISO, 1987 (or review copy of revised text = ISO/IEC
  1509.    JTC1/SC21 N4657, April 1990).
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Furniss                                                        [Page 27]
  1515.  
  1516. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1517.  
  1518.  
  1519.    [ISO8327] Information processing systems - Open Systems
  1520.    Interconnection - Basic connection oriented session protocol
  1521.    specification; ISO, 1987 (or review copy of revised text = ISO/IEC
  1522.    JTC1/SC21 N4656, April 1990).
  1523.  
  1524.    [ISO8649] Information processing systems - Open Systems
  1525.    Interconnection - Service definition for the Association Control
  1526.    Service Element; ISO, 1989.
  1527.  
  1528.    [ISO8650] Information processing systems - Open Systems
  1529.    Interconnection - Protocol specification for the Association Control
  1530.    Service Element; ISO, 1989.
  1531.  
  1532.    [ISO8822] Information processing systems - Open Systems
  1533.    Interconnection - Connection-oriented presentation service
  1534.    definition; ISO, 1989.
  1535.  
  1536.    [ISO8823] Information processing systems - Open Systems
  1537.    Interconnection - Connection-oriented presentation protocol
  1538.    specification; ISO, 1989.
  1539.  
  1540.    [ISO8824] Information technology - Open Systems Interconnection -
  1541.    Specification of Abstract Syntax Notation One (ASN.1), ISO/IEC 1990.
  1542.  
  1543.    [ISO8825] Information technology - Open Systems Interconnection -
  1544.    Specification of Basic Encoding Rules for Abstract Syntax Notation
  1545.    One, ISO/IEC 1990.
  1546.  
  1547.    [RFC1006] Rose, M., and D. Cass, "ISO Transport Services on Top of
  1548.    the TCP", STD 35, RFC 1006, Northrop Research and Technology Center,
  1549.    May 1987.
  1550.  
  1551.    [ISO9594] Information technology - Open Systems Interconnection - The
  1552.    Directory; ISO/IEC, 1990.
  1553.  
  1554.    [RFC 1274] Barker, P., and S. Kille, "The COSINE and Internet X.500
  1555.    Schema", RFC 1274, University College London, November 1991.
  1556.  
  1557. 8. Other Notes
  1558.  
  1559.    The Session, Presentation and ACSE standards have been the subject of
  1560.    considerable amendment since their first publication. The only one
  1561.    that is significant to this cookbook is Session addendum 2, which
  1562.    specifies session version 2 and unlimited user data. New editions of
  1563.    these standards, incorporating all the amendments, will be published
  1564.    during 1994.
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Furniss                                                        [Page 28]
  1571.  
  1572. RFC 1698             ThinOSI Upper-Layers Cookbook          October 1994
  1573.  
  1574.  
  1575.    The coding choices made in the cookbook are (nearly) those made by
  1576.    the "Canonical Encoding Rules", which are a form of Basic Encoding
  1577.    Rules with no optionality, specified in the new edition of ISO/IEC
  1578.    8825. A defect report has been proposed against Presentation and
  1579.    ACSE, suggesting that a note to the protocol specifications recommend
  1580.    use of the canonical encoding options when sending, and then
  1581.    optimising for this on receipt.
  1582.  
  1583. 9.  Security Considerations
  1584.  
  1585.    Security issues are not discussed in this memo.
  1586.  
  1587. 10.  Author's Address
  1588.  
  1589.    Peter Furniss
  1590.    Peter Furniss Consultants
  1591.    58 Alexandra Crescent
  1592.    Bromley, Kent BR1 4EX
  1593.    UK
  1594.  
  1595.    Phone & Fax +44 81 313 1833
  1596.    EMail: P.Furniss@ulcc.ac.uk
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626. Furniss                                                        [Page 29]
  1627.  
  1628.