Commit | Line | Data |
---|---|---|
970ed795 | 1 | --***************************************************************************** |
3abe9331 | 2 | -- Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
3 | -- All rights reserved. This program and the accompanying materials |
4 | -- are made available under the terms of the Eclipse Public License v1.0 | |
5 | -- which accompanies this distribution, and is available at | |
6 | -- http://www.eclipse.org/legal/epl-v10.html | |
7 | --***************************************************************************** | |
8 | JsonData | |
9 | DEFINITIONS | |
10 | ||
11 | AUTOMATIC TAGS | |
12 | ||
13 | ::= | |
14 | ||
15 | BEGIN | |
16 | ||
17 | IMPORTS ; | |
18 | ||
19 | -- Type definitions -- | |
20 | ---------------------- | |
21 | ||
af710487 | 22 | -- Sequence of |
970ed795 EL |
23 | SeqOfInt ::= SEQUENCE OF INTEGER |
24 | ||
af710487 | 25 | -- Sequence |
970ed795 EL |
26 | SeqProduct ::= SEQUENCE { |
27 | name UniversalString, | |
28 | price REAL, | |
29 | id OCTET STRING OPTIONAL, | |
30 | available BOOLEAN | |
31 | } | |
32 | ||
af710487 | 33 | -- Choice |
970ed795 EL |
34 | Number ::= CHOICE { |
35 | decimal INTEGER, | |
36 | binary BIT STRING, | |
37 | hexadecimal OCTET STRING | |
38 | } | |
39 | ||
af710487 | 40 | -- Choice containing all string types |
970ed795 EL |
41 | AnyString ::= CHOICE { |
42 | generalstr GeneralString, | |
43 | numericstr NumericString, | |
44 | utf8str UTF8String, | |
45 | printablestr PrintableString, | |
46 | universalstr UniversalString, | |
47 | bmpstr BMPString, | |
48 | graphicstr GraphicString, | |
49 | ia5str IA5String, | |
50 | teletexstr TeletexString, | |
51 | videotexstr VideotexString, | |
52 | visiblestr VisibleString | |
53 | } | |
54 | ||
af710487 | 55 | -- Sequence of strings |
970ed795 EL |
56 | ManyStrings ::= SEQUENCE OF AnyString |
57 | ||
af710487 | 58 | -- Set containing all of the above |
970ed795 EL |
59 | ComplexSet ::= SET { |
60 | product SeqProduct, | |
61 | numbers SET OF Number, | |
62 | strings ManyStrings | |
63 | } | |
64 | ||
af710487 | 65 | Priority ::= ENUMERATED { low, normal, medium, high, urgent } |
66 | ||
67 | Conditionality ::= ENUMERATED { optional, conditional, mandatory } | |
68 | ||
69 | ProtocolElem-ID ::= INTEGER (0..65535) | |
70 | ||
71 | -- IOC | |
72 | PROTOCOL-ELEMS ::= CLASS | |
73 | { | |
74 | &id ProtocolElem-ID UNIQUE, | |
75 | &priority Priority, | |
76 | &Value, | |
77 | &conditionality Conditionality | |
78 | } | |
79 | WITH SYNTAX | |
80 | { | |
81 | ID &id | |
82 | PRIORITY &priority | |
83 | TYPE &Value | |
84 | CONDITIONALITY &conditionality | |
85 | } | |
86 | ||
87 | -- parameterized type | |
88 | ProtocolElem-Field {PROTOCOL-ELEMS : ElemsSetParam} ::= SEQUENCE | |
89 | { | |
90 | id PROTOCOL-ELEMS.&id ({ElemsSetParam}), | |
91 | priority PROTOCOL-ELEMS.&priority ({ElemsSetParam}{@id}), | |
92 | val PROTOCOL-ELEMS.&Value ({ElemsSetParam}{@id}) | |
93 | } | |
94 | ||
95 | ||
96 | -- Information objects | |
97 | ies-Set-Element-1 PROTOCOL-ELEMS ::= | |
98 | { | |
99 | ID 0 | |
100 | PRIORITY low | |
101 | TYPE INTEGER | |
102 | CONDITIONALITY mandatory | |
103 | } | |
104 | ||
105 | ies-Set-Element-2 PROTOCOL-ELEMS ::= | |
106 | { | |
107 | ID 1 | |
108 | PRIORITY high | |
109 | TYPE IA5String | |
110 | CONDITIONALITY optional | |
111 | } | |
112 | -- Information Object Set | |
113 | Elems-Set PROTOCOL-ELEMS ::= { ies-Set-Element-1 | ies-Set-Element-2 } | |
114 | ||
115 | ||
116 | -- instantiation | |
117 | ProtocolElem-Field1 ::= ProtocolElem-Field {{Elems-Set}} | |
118 | ||
119 | ProtocolElem-Field2 ::= ProtocolElem-Field {{ies-Set-Element-2 }} | |
120 | ||
121 | -- Choice containing NULL | |
122 | Price ::= CHOICE | |
123 | { | |
124 | value REAL, | |
125 | invaluable NULL | |
126 | } | |
127 | ||
128 | -- Sequence containing an object identifier and an ANY type | |
129 | Object ::= SEQUENCE | |
130 | { | |
131 | id OBJECT IDENTIFIER, | |
132 | data ANY | |
133 | } | |
134 | ||
135 | -- Sequence containing an optional NULL field | |
136 | HasNull ::= SEQUENCE | |
137 | { | |
138 | theNull NULL OPTIONAL | |
139 | } | |
140 | ||
3abe9331 | 141 | -- Renaming basic ASN.1 types for use in TTCN-3 |
142 | AsnNull ::= NULL | |
143 | AsnInt ::= INTEGER | |
144 | AsnVisibleString ::= VisibleString | |
145 | AsnAny ::= ANY | |
146 | ||
af710487 | 147 | |
970ed795 EL |
148 | -- Values and their encoding -- |
149 | ------------------------------- | |
150 | ||
151 | -- SeqOfInt | |
152 | c-ints SeqOfInt ::= { 1, 3, 6 } | |
153 | ||
154 | c-ints-str VisibleString ::= "[1,3,6]" | |
155 | ||
156 | -- SeqProduct | |
157 | c-product SeqProduct ::= { | |
158 | name "TV", | |
159 | price 250.0, | |
160 | id '1D65'H, | |
161 | available TRUE | |
162 | } | |
163 | ||
164 | c-product-str VisibleString ::= "{""name"":""TV"",""price"":250.000000,""id"":""1D65"",""available"":true}" | |
165 | ||
166 | -- Number | |
167 | c-number Number ::= binary : '1100'B | |
168 | ||
169 | c-number-str VisibleString ::= "{""binary"":""1100""}" | |
170 | ||
171 | -- ManyStrings | |
172 | c-strings ManyStrings ::= { | |
173 | generalstr : "General String <o", | |
174 | numericstr : "1 457 664", | |
175 | utf8str : "Doesn't actually contain non-ASCII characters", | |
176 | printablestr : "hello", | |
177 | universalstr : "not so universal, apparently", | |
178 | bmpstr : "abc", | |
179 | ia5str : "one two three", | |
180 | teletexstr : "Let's just bug out and call it even, OK?!", | |
181 | videotexstr : "abc123;.", | |
182 | visiblestr : "invisible" | |
183 | } | |
184 | ||
185 | c-strings-str VisibleString ::= "[{""generalstr"":""General String <o""},{""numericstr"":""1 457 664""},{""utf8str"":""Doesn't actually contain non-ASCII characters""},{""printablestr"":""hello""},{""universalstr"":""not so universal, apparently""},{""bmpstr"":""abc""},{""ia5str"":""one two three""},{""teletexstr"":""Let's just bug out and call it even, OK?!""},{""videotexstr"":""abc123;.""},{""visiblestr"":""invisible""}]" | |
186 | ||
187 | -- ComplexSet | |
188 | c-set-val ComplexSet ::= { | |
189 | product { | |
190 | name "Headset", | |
191 | price 28.5, | |
192 | available FALSE | |
193 | }, | |
194 | numbers { | |
195 | hexadecimal : '16678D'H, | |
196 | decimal : 12 | |
197 | }, | |
198 | strings { | |
199 | printablestr : "first", | |
200 | numericstr : "2" | |
201 | } | |
202 | } | |
203 | ||
204 | c-set-val-str VisibleString ::= "{""product"":{""name"":""Headset"",""price"":28.500000,""available"":false},""numbers"":[{""hexadecimal"":""16678D""},{""decimal"":12}],""strings"":[{""printablestr"":""first""},{""numericstr"":""2""}]}" | |
205 | ||
af710487 | 206 | -- Object |
207 | c-obj Object ::= { | |
208 | id { joint-iso-itu-t remote-operations(4) informationObjects(5) version1(0) }, | |
209 | data 'DEADBEEF'H | |
210 | } | |
211 | ||
212 | c-obj-str VisibleString ::= "{""id"":""2.4.5.0"",""data"":""DEADBEEF""}" | |
213 | ||
214 | -- HasNull | |
215 | c-null HasNull ::= { theNull NULL } | |
216 | c-not-null HasNull ::= {} | |
217 | ||
218 | c-null-str VisibleString ::= "{""theNull"":null}" | |
219 | c-not-null-str VisibleString ::= "{}" | |
220 | ||
970ed795 | 221 | END |