File: JsonData.asn

package info (click to toggle)
eclipse-titan 8.2.0-1
  • links: PTS
  • area: main
  • in suites: bookworm, sid
  • size: 103,544 kB
  • sloc: cpp: 271,008; ansic: 33,683; yacc: 23,419; makefile: 15,483; lex: 9,204; java: 4,848; perl: 4,555; sh: 2,242; xml: 1,378; javascript: 85; awk: 48; php: 32; python: 13
file content (226 lines) | stat: -rw-r--r-- 5,358 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
--/////////////////////////////////////////////////////////////////////////////
-- Copyright (c) 2000-2021 Ericsson Telecom AB
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the Eclipse Public License v2.0
-- which accompanies this distribution, and is available at
-- https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
--
-- Contributors:
--   Balasko, Jeno
--   Baranyi, Botond
--
--/////////////////////////////////////////////////////////////////////////////
JsonData
DEFINITIONS

AUTOMATIC TAGS

::=

BEGIN

IMPORTS ;

-- Type definitions --
----------------------

-- Sequence of
SeqOfInt ::= SEQUENCE OF INTEGER

-- Sequence
SeqProduct ::= SEQUENCE {
  name UniversalString,
  price REAL,
  id OCTET STRING OPTIONAL,
  available BOOLEAN
}

-- Choice
Number ::= CHOICE {
  decimal INTEGER,
  binary BIT STRING,
  hexadecimal OCTET STRING
}

-- Choice containing all string types
AnyString ::= CHOICE {
  generalstr GeneralString,
  numericstr NumericString,
  utf8str UTF8String,
  printablestr PrintableString,
  universalstr UniversalString,
  bmpstr BMPString,
  graphicstr GraphicString,
  ia5str IA5String,
  teletexstr TeletexString,
  videotexstr VideotexString,
  visiblestr VisibleString
}

-- Sequence of strings
ManyStrings ::= SEQUENCE OF AnyString

-- Set containing all of the above
ComplexSet ::= SET {
  product SeqProduct,
  numbers SET OF Number,
  strings ManyStrings
}

Priority        ::= ENUMERATED { low, normal, medium, high, urgent }

Conditionality  ::= ENUMERATED { optional, conditional, mandatory }

ProtocolElem-ID   ::= INTEGER (0..65535)

-- IOC
PROTOCOL-ELEMS ::= CLASS
{
    &id             ProtocolElem-ID UNIQUE,
    &priority       Priority,
    &Value,
    &conditionality Conditionality
}
WITH SYNTAX
{
    ID                  &id
    PRIORITY            &priority
    TYPE                &Value
    CONDITIONALITY      &conditionality
}

-- parameterized type
ProtocolElem-Field {PROTOCOL-ELEMS : ElemsSetParam} ::= SEQUENCE
{
    id                  PROTOCOL-ELEMS.&id            ({ElemsSetParam}),
    priority            PROTOCOL-ELEMS.&priority      ({ElemsSetParam}{@id}),
    val                 PROTOCOL-ELEMS.&Value         ({ElemsSetParam}{@id})
}


-- Information objects
ies-Set-Element-1 PROTOCOL-ELEMS ::=
{
    ID 0
    PRIORITY low
    TYPE INTEGER
    CONDITIONALITY mandatory
}

ies-Set-Element-2 PROTOCOL-ELEMS ::=
{
    ID 1
    PRIORITY high
    TYPE IA5String
    CONDITIONALITY optional
}
-- Information Object Set
Elems-Set PROTOCOL-ELEMS ::= { ies-Set-Element-1 | ies-Set-Element-2 }


-- instantiation
ProtocolElem-Field1 ::= ProtocolElem-Field {{Elems-Set}}

ProtocolElem-Field2 ::= ProtocolElem-Field {{ies-Set-Element-2 }}

-- Choice containing NULL
Price ::= CHOICE
{
  value REAL,
  invaluable NULL
}

-- Sequence containing an object identifier and an ANY type
Object ::= SEQUENCE
{
  id OBJECT IDENTIFIER,
  data ANY
}

-- Sequence containing an optional NULL field
HasNull ::= SEQUENCE
{
  theNull NULL OPTIONAL
}

-- Renaming basic ASN.1 types for use in TTCN-3
AsnNull ::= NULL
AsnInt ::= INTEGER
AsnVisibleString ::= VisibleString
AsnAny ::= ANY


-- Values and their encoding --
-------------------------------

-- SeqOfInt
c-ints SeqOfInt ::= { 1, 3, 6 }

c-ints-str VisibleString ::= "[1,3,6]"

-- SeqProduct
c-product SeqProduct ::= {
  name "TV",
  price 250.0,
  id '1D65'H,
  available TRUE
}

c-product-str VisibleString ::= "{""name"":""TV"",""price"":250.000000,""id"":""1D65"",""available"":true}"

-- Number
c-number Number ::= binary : '1100'B

c-number-str VisibleString ::= "{""binary"":""1100""}"

-- ManyStrings
c-strings ManyStrings ::= {
  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"
}

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""}]"

-- ComplexSet
c-set-val ComplexSet ::= {
  product {
    name "Headset",
    price 28.5,
    available FALSE
  },
  numbers {
    hexadecimal : '16678D'H,
    decimal : 12
  },
  strings {
    printablestr : "first",
    numericstr : "2"
  }
}

c-set-val-str VisibleString ::= "{""product"":{""name"":""Headset"",""price"":28.500000,""available"":false},""numbers"":[{""hexadecimal"":""16678D""},{""decimal"":12}],""strings"":[{""printablestr"":""first""},{""numericstr"":""2""}]}"

-- Object
c-obj Object ::= {
  id { joint-iso-itu-t remote-operations(4) informationObjects(5) version1(0) },
  data 'DEADBEEF'H
}

c-obj-str VisibleString ::= "{""id"":""2.4.5.0"",""data"":""DEADBEEF""}"

-- HasNull
c-null HasNull ::= { theNull NULL }
c-not-null HasNull ::= {}

c-null-str VisibleString ::= "{""theNull"":null}"
c-not-null-str VisibleString ::= "{}"

END