Reformat
[yaz-moved-to-github.git] / src / charneg-3.asn
1 NegotiationRecordDefinition-charSetandLanguageNegotiation-3
2 {Z39-50-negotiationRecordDefinition CharSetandLanguageNegotiation-3 (3)}
3 DEFINITIONS ::= BEGIN
4 IMPORTS LanguageCode FROM RecordSyntax-explain;
5
6 CharSetandLanguageNegotiation ::= CHOICE{
7    proposal [1]   IMPLICIT OriginProposal,
8    response [2]   IMPLICIT TargetResponse}
9 --
10 -- For character sets:
11 --  Origin proposes one, two, or all three of the following, in order of
12 --  preference:
13 --       (a) 2022 character sets.
14 --       (b) 10646 character set.
15 --       (c) Private character set.
16 --
17 --    The target responds with one of (a), (b), or (c), indicating the
18 --    character set(s) to be supported for all name and message strings.
19 --
20 --    If the origin includes (a),
21 --     the origin proposes:
22 --        (1)  A proposed environment: 7-bit, 8-bit, or no-preference.
23 --        (2)  A set of iso 2022 registration numbers.
24 --        (3)  One or more proposed initial sets of registration numbers,
25 --             for c0, c1, g0, g1, g2 and g3. These must come from (2).
26 --        (4)  The proposed encoding level.
27 --      And if the target selects (a), it responds with:
28 --        (1)  A selected environment: 7-bit or 8-bit.
29 --        (2)  A subset of the set of iso 2022 registration numbers proposed
30 --             by the origin.
31 --        (3)  The initial set of registrations, which must come from (2)
32 --             but need not be from the set of initial registrations proposed
33 --             by the origin.
34 --        (4)  The encoding level; less than or equal to that proposed.
35 --
36 --    If the origin includes (b),
37 --     The origin proposes:
38 --        (1)  (optionally) A list of collections (i.e. subsets of characters from the
39 --             complete 10646 definition).
40 --        (2)  An implementation level.
41 --        (3) Syntax/form: e.g. ucs-2, ucs-4, utf-8, utf-16.
42 --    And if the target selects (b), it responds by choosing a subset of the
43 --    collections proposed by the origin in (1) and an implementation level less
44 --    than or equal to that proposed by the origin in (2).
45 --
46 --    If the origin includes (c), the origin proposes one of the following:
47 --        (1)  A list of private character sets, by one or more object
48 --             identifiers.
49 --        (2)  A list of private character sets, by an EXTERNAL.
50 --        (3)  An indication to use a private, previously agreed upon
51 --             character set.
52 --    And if the target selects (c):
53 --    -  If the origin proposed (1), the target should respond with (1), and
54 --       the list of object identifiers should be a subset of the list that
55 --       the origin included.
56 --    -  If the origin proposed (2), the target should respond with (2), using
57 --       the same EXTERNAL definition (but not necessarily the same content)
58 --       used by the origin.
59 --    -  If the origin proposed (3), the target should respond with (3).
60 --
61 --    For Languages:
62 --     The origin optionally proposes one or more language codes. The target
63 --     response may include a single language code, which indicates the
64 --     language to be used for all message strings. The target may include or
65 --     omit this, whether or not the origin included a proposed set, and the
66 --     language code indicated need not be from among those proposed.
67 --
68 --
69
70 OriginProposal ::= SEQUENCE {
71   proposedCharSets           [1] IMPLICIT SEQUENCE OF CHOICE{
72                -- Each should occur at most once, and in order of preference
73                -- (the "order of preference" is the reason why this is
74                -- "SEQUENCE OF CHOICE" rather than just "SEQUENCE")
75                                 iso2022        [1] Iso2022,
76                                 iso10646       [2] IMPLICIT Iso10646,
77                                 private        [3] PrivateCharacterSet} OPTIONAL,
78                                    -- proposedCharSets must be omitted
79                                    -- if origin proposes version 2
80   proposedlanguages          [2] IMPLICIT SEQUENCE OF LanguageCode OPTIONAL,
81   recordsInSelectedCharSets  [3] IMPLICIT BOOLEAN OPTIONAL
82                        -- default 'false'. See rule 6 above.
83                        }
84
85 TargetResponse ::= SEQUENCE{
86   selectedCharSets           [1] CHOICE{
87                                    iso2022        [1] Iso2022,
88                                    iso10646       [2] IMPLICIT Iso10646,
89                                    private        [3] PrivateCharacterSet,
90                                    none           [4] IMPLICIT NULL
91                                             -- If selected, no negotiation
92                                             -- is assumed to be in force
93                                             -- for character sets.
94                                                      } OPTIONAL,
95                                    -- Omitted if and only if proposedCharSets
96                                    -- was Omitted in the request.
97   selectedLanguage           [2] IMPLICIT LanguageCode OPTIONAL,
98   recordsInSelectedCharSets  [3] IMPLICIT BOOLEAN OPTIONAL
99                   -- Omitted if and only if 'recordsInSelectedCharSets' was omitted
100                   -- in the request.  See rule 6 above.
101                        }
102
103
104 PrivateCharacterSet ::= CHOICE{
105    viaOid                 [1] IMPLICIT SEQUENCE OF OBJECT IDENTIFIER,
106    externallySpecified    [2] IMPLICIT EXTERNAL,
107    previouslyAgreedUpon   [3] IMPLICIT NULL}
108
109 -- IMPORTED
110 -- LanguageCode ::= GeneralString -- from ANSI Z39.53-1994
111
112 -- Definition of ISO2022
113 -- For ISO 2022, the following is negotiated:
114 --   1)   The environment: 7-bit or 8-bit;
115 --   2)   a set of registration numbers (from the ISO Register of coded
116 --        character sets) for graphical and  control character sets;
117 --   3)   g0, g1, g2, g3, c0, c1, the registration numbers of the graphical and
118 --        control character sets that are  initially designated to g0, g1, etc.
119 --       The origin submits one or more sequences of values for
120 --        g0, g1, g2, g3, c0, c1 (for each sequence: at least one of
121 --        g0 and g1 must be included; g2 and g3 are optional and
122 --         may be included only if g1 is included;
123 --        c0 should be included; and c1 is optional); the target
124 --        selects one of the proposed sequences.
125 --   4)   gleft: which of g0, g1, g2 or g3, initially has GL shift status in
126 --        an 8-bit environment or has shift status in a 7-bit environment; and
127 --   5)   gright: which of g1, g2 or g3 initially has GR shift status in an
128 --        8-bit environment.
129
130 Iso2022 ::= CHOICE{
131  originProposal   [1] IMPLICIT SEQUENCE{
132             proposedEnvironment    [0] Environment OPTIONAL,
133                                          -- omitted means no preference
134             proposedSets           [1] IMPLICIT SEQUENCE OF INTEGER,
135             proposedInitialSets    [2] IMPLICIT SEQUENCE OF
136                                              InitialSet,
137             proposedLeftAndRight   [3] IMPLICIT LeftAndRight},
138  targetResponse   [2] IMPLICIT SEQUENCE{
139             selectedEnvironment    [0] Environment,
140             selectedSets           [1] IMPLICIT SEQUENCE OF INTEGER,
141             selectedinitialSet     [2] IMPLICIT InitialSet,
142             selectedLeftAndRight   [3] IMPLICIT LeftAndRight}}
143
144 Environment ::= CHOICE{
145    sevenBit    [1] IMPLICIT NULL,
146    eightBit    [2] IMPLICIT NULL}
147
148 InitialSet::= SEQUENCE{
149       g0    [0] IMPLICIT INTEGER OPTIONAL,
150       g1    [1] IMPLICIT INTEGER OPTIONAL,
151                            -- one of g0 and g1 must be included
152       g2    [2] IMPLICIT INTEGER OPTIONAL,
153       g3    [3] IMPLICIT INTEGER OPTIONAL,
154                            --g2 and/or g3 may be included
155                            -- only if g1 was included
156       c0    [4] IMPLICIT INTEGER,
157       c1    [5] IMPLICIT INTEGER OPTIONAL}
158
159 LeftAndRight ::= SEQUENCE{
160             gLeft         [3] IMPLICIT INTEGER{
161                                    g0 (0),
162                                    g1 (1),
163                                    g2 (2),
164                                    g3 (3)},
165             gRight        [4] IMPLICIT INTEGER{
166                                    g1 (1),
167                                    g2 (2),
168                                    g3 (3)} OPTIONAL}
169
170 -- Definition of Iso10646
171 --
172 -- The 10646 object identifier looks like:
173 --        1.0.10646.1.implementationLevel.repertoireSubset.arc1.arc2. ....
174 --
175 -- (The second '1' is for "part 1" of 10646.)
176 --
177 -- ImplementationLevel is 1-3
178 --
179 -- repertoireSubset is 0 or 1, for 'all' or 'collections'.
180 -- The arcs are present only if repertoireSubset is 'collections',
181 -- in which case  arc1, arc2, etc., are the
182 -- identifiers of collections of character repertoires.
183 --
184 -- There is a second 10646 oid, for specifying syntax/form:
185 --        1.0.10646.1.0.form
186 --
187 -- (The second '0' represents "transfer syntax".)
188 --
189 --  where values of form include:
190 --  2: ucs-2
191 --  4: ucs-4
192 --  5: utf-16
193 --  8: utf-8
194
195 Iso10646 ::= SEQUENCE{
196    collections    [1] IMPLICIT OBJECT IDENTIFIER OPTIONAL,
197                        --oid of form 1.0.10646.1.implementationLevel
198                        -- .repertoireSubset.arc1.arc2. ....
199                        -- Target to choose a subset of the collections
200                        -- proposed by the origin, and an implementation level
201                        -- less than or equal to that proposed.
202                        --
203                        -- when 'collections' is omitted,
204                        -- 'implementationLevel' defaults to 3.
205                        --
206    encodingLevel  [2] IMPLICIT OBJECT IDENTIFIER
207                        -- oid of form 1.0.10646.1.0.form
208                     -- where value of 'form' is 2, 4, 5, or 8
209                       -- for ucs-2, ucs-4, utf-16, utf-8
210                                    }
211 END
212