COSEMpdu 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- COSEMpdu/__init__.py +0 -0
- COSEMpdu/acse.py +631 -0
- COSEMpdu/apdu.py +1440 -0
- COSEMpdu/axdr.py +897 -0
- COSEMpdu/ber.py +944 -0
- COSEMpdu/byte_buffer.py +196 -0
- COSEMpdu/data.py +784 -0
- COSEMpdu/key_info.py +132 -0
- COSEMpdu/service_error.py +510 -0
- COSEMpdu/types_used.py +736 -0
- COSEMpdu/useful_types.py +73 -0
- COSEMpdu/user_information.py +133 -0
- COSEMpdu/x680/__init__.py +55 -0
- COSEMpdu/x680/bit_string.py +416 -0
- COSEMpdu/x680/boolean_type.py +26 -0
- COSEMpdu/x680/choice_type.py +71 -0
- COSEMpdu/x680/constrained_type.py +155 -0
- COSEMpdu/x680/enumerated_type.py +131 -0
- COSEMpdu/x680/generalized_time.py +458 -0
- COSEMpdu/x680/integer_type.py +133 -0
- COSEMpdu/x680/null_type.py +41 -0
- COSEMpdu/x680/object_identifier_type.py +253 -0
- COSEMpdu/x680/octet_string_type.py +49 -0
- COSEMpdu/x680/restricted_character_string_type.py +17 -0
- COSEMpdu/x680/sequence_of_type.py +81 -0
- COSEMpdu/x680/sequence_type.py +136 -0
- COSEMpdu/x680/tag.py +105 -0
- COSEMpdu/x680/tagged_type.py +54 -0
- COSEMpdu/x680/type.py +226 -0
- COSEMpdu/x690.py +159 -0
- cosempdu-0.2.0.dist-info/METADATA +24 -0
- cosempdu-0.2.0.dist-info/RECORD +34 -0
- cosempdu-0.2.0.dist-info/WHEEL +5 -0
- cosempdu-0.2.0.dist-info/top_level.txt +1 -0
COSEMpdu/__init__.py
ADDED
|
File without changes
|
COSEMpdu/acse.py
ADDED
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
"""
|
|
2
|
+
COSEM PDU Types Implementation
|
|
3
|
+
Based on COSEMpdu_GB83.txt (Green Book 8.3)
|
|
4
|
+
Implements A-XDR encoding/decoding according to IEC 61334-6 ACSE APDU Types (COSEMpdu_GB83
|
|
5
|
+
"""
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from re import A, M
|
|
8
|
+
from typing import ClassVar, Self, Optional, override
|
|
9
|
+
from . import x690
|
|
10
|
+
from .x680 import (
|
|
11
|
+
NamedType,
|
|
12
|
+
OptionalNamedType,
|
|
13
|
+
DefaultNamedType,
|
|
14
|
+
Type,
|
|
15
|
+
TaggingMode,
|
|
16
|
+
NamedBitList,
|
|
17
|
+
NamedBit,
|
|
18
|
+
NamedNumberList,
|
|
19
|
+
NamedNumber
|
|
20
|
+
)
|
|
21
|
+
from . import axdr
|
|
22
|
+
from . import ber
|
|
23
|
+
from .x680.tag import Class
|
|
24
|
+
from .ber import create_alternatives
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class ApplicationContextName(ber.ObjectIdentifierType):
|
|
29
|
+
"""Application-context-name"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class ApplicationContextName1(ber.TaggedType[ApplicationContextName]):
|
|
34
|
+
"""[1] Application-context-name"""
|
|
35
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=1)
|
|
36
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
37
|
+
value: ApplicationContextName
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass
|
|
41
|
+
class APTitle(ber.OctetStringType):
|
|
42
|
+
"""AP-title"""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass
|
|
46
|
+
class AEQualifier(ber.OctetStringType):
|
|
47
|
+
"""AE-qualifier"""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass
|
|
51
|
+
class APInvocationIdentifier(ber.IntegerType):
|
|
52
|
+
"""AP-invocation-identifier"""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class AEInvocationIdentifier(ber.IntegerType):
|
|
57
|
+
"""AE-invocation-identifier"""
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass
|
|
61
|
+
class ACSERequirements(ber.BitStringType):
|
|
62
|
+
"""ACSE-requirements"""
|
|
63
|
+
named_bits = NamedBitList((NamedBit("authentication", 0),))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@dataclass
|
|
67
|
+
class MechanismName(ber.ObjectIdentifierType):
|
|
68
|
+
"""Mechanism-name"""
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class Charstring(ber.TaggedType[ber.GraphicString]):
|
|
73
|
+
"""[0] IMPLICIT GraphicString"""
|
|
74
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=0)
|
|
75
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
76
|
+
value: ber.GraphicString
|
|
77
|
+
|
|
78
|
+
@dataclass
|
|
79
|
+
class BitString1(ber.TaggedType[ber.BitStringType]):
|
|
80
|
+
""" [1] IMPLICIT BIT STRING"""
|
|
81
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=1)
|
|
82
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
83
|
+
value: ber.BitStringType
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@dataclass
|
|
87
|
+
class AuthenticationValue(ber.ChoiceType):
|
|
88
|
+
"""Authentication-value"""
|
|
89
|
+
alternatives = ber.create_alternatives(
|
|
90
|
+
NamedType("charstring", Charstring),
|
|
91
|
+
NamedType("bitstring", BitString1)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass
|
|
96
|
+
class ImplementationData(ber.GraphicString):
|
|
97
|
+
"""Implementation-data"""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass
|
|
101
|
+
class ImplementationData29(ber.TaggedType[ImplementationData]):
|
|
102
|
+
"""[29] IMPLICIT Implementation-data"""
|
|
103
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=29)
|
|
104
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
105
|
+
value: ImplementationData
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@dataclass
|
|
109
|
+
class AssociationInformation(ber.OctetStringType):
|
|
110
|
+
"""Association-information"""
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@dataclass
|
|
114
|
+
class AssociationInformation30(ber.TaggedType[AssociationInformation]):
|
|
115
|
+
"""[30] EXPLICIT Association-information"""
|
|
116
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=30)
|
|
117
|
+
mode: ClassVar[TaggingMode] = TaggingMode.EXPLICIT
|
|
118
|
+
value: AssociationInformation
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@dataclass
|
|
122
|
+
class AssociationResult(ber.IntegerType):
|
|
123
|
+
"""Association-result"""
|
|
124
|
+
named_numbers = NamedNumberList((
|
|
125
|
+
NamedNumber("accepted", 0),
|
|
126
|
+
NamedNumber("rejected-permanent", 1),
|
|
127
|
+
NamedNumber("rejected-transient", 2),
|
|
128
|
+
))
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@dataclass
|
|
132
|
+
class Result(ber.TaggedType[AssociationResult]):
|
|
133
|
+
"""[2] Association-result"""
|
|
134
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=2)
|
|
135
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
136
|
+
value: AssociationResult
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
@dataclass
|
|
140
|
+
class AcseServiceUser(ber.IntegerType):
|
|
141
|
+
"""acse-service-user"""
|
|
142
|
+
named_numbers = NamedNumberList((
|
|
143
|
+
NamedNumber("null", 0),
|
|
144
|
+
NamedNumber("no-reason-given", 1),
|
|
145
|
+
NamedNumber("application-context-name-not-supported", 2),
|
|
146
|
+
NamedNumber("calling-AP-title-not-recognized", 3),
|
|
147
|
+
NamedNumber("calling-AP-invocation-identifier-not-recognized", 4),
|
|
148
|
+
NamedNumber("calling-AE-qualifier-not-recognized", 5),
|
|
149
|
+
NamedNumber("calling-AE-invocation-identifier-not-recognized", 6),
|
|
150
|
+
NamedNumber("called-AP-title-not-recognized", 7),
|
|
151
|
+
NamedNumber("called-AP-invocation-identifier-not-recognized", 8),
|
|
152
|
+
NamedNumber("called-AE-qualifier-not-recognized", 9),
|
|
153
|
+
NamedNumber("called-AE-invocation-identifier-not-recognized", 10),
|
|
154
|
+
NamedNumber("authentication-mechanism-name-not-recognised", 11),
|
|
155
|
+
NamedNumber("authentication-mechanism-name-required", 12),
|
|
156
|
+
NamedNumber("authentication-failure", 13),
|
|
157
|
+
NamedNumber("authentication-required", 14),
|
|
158
|
+
))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
@dataclass
|
|
162
|
+
class ServiceUser(ber.TaggedType[AcseServiceUser]):
|
|
163
|
+
"""[1] acse-service-user"""
|
|
164
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=1)
|
|
165
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
166
|
+
value: AcseServiceUser
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
@dataclass
|
|
170
|
+
class AcseServiceProvider(ber.IntegerType):
|
|
171
|
+
"""acse-service-provider"""
|
|
172
|
+
named_numbers = NamedNumberList((
|
|
173
|
+
NamedNumber("null", 0),
|
|
174
|
+
NamedNumber("no-reason-given", 1),
|
|
175
|
+
NamedNumber("no-common-acse-version", 2),
|
|
176
|
+
))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
@dataclass
|
|
180
|
+
class Provider(ber.TaggedType[AcseServiceProvider]):
|
|
181
|
+
"""[2] acse-service-provider"""
|
|
182
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=2)
|
|
183
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
184
|
+
value: AcseServiceProvider
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@dataclass
|
|
188
|
+
class AssociateSourceDiagnostic(ber.ChoiceType):
|
|
189
|
+
"""Associate-source-diagnostic"""
|
|
190
|
+
alternatives = create_alternatives(
|
|
191
|
+
NamedType("acse-service-user", ServiceUser),
|
|
192
|
+
NamedType("acse-service-provider", Provider)
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
@dataclass
|
|
197
|
+
class ResultSourceDiagnostic(ber.TaggedType[AssociateSourceDiagnostic]):
|
|
198
|
+
"""[3] Associate-source-diagnostic"""
|
|
199
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=3)
|
|
200
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
201
|
+
value: AssociateSourceDiagnostic
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
@dataclass
|
|
205
|
+
class ReleaseRequestReason(ber.IntegerType):
|
|
206
|
+
"""Release-request-reason"""
|
|
207
|
+
named_numbers = NamedNumberList((
|
|
208
|
+
NamedNumber("normal", 0),
|
|
209
|
+
NamedNumber("urgent", 1),
|
|
210
|
+
NamedNumber("user-defined", 30),
|
|
211
|
+
))
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
@dataclass
|
|
215
|
+
class RequestReason(ber.TaggedType[ReleaseRequestReason]):
|
|
216
|
+
"""[0] IMPLICIT Release-request-reason"""
|
|
217
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=0)
|
|
218
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
219
|
+
value: ReleaseRequestReason
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@dataclass
|
|
223
|
+
class ReleaseResponseReason(ber.IntegerType):
|
|
224
|
+
"""Release-response-reason"""
|
|
225
|
+
named_numbers = NamedNumberList((
|
|
226
|
+
NamedNumber("normal", 0),
|
|
227
|
+
NamedNumber("not-finished", 1),
|
|
228
|
+
NamedNumber("user-defined", 30),
|
|
229
|
+
))
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@dataclass
|
|
233
|
+
class ResponseReason(ber.TaggedType[ReleaseResponseReason]):
|
|
234
|
+
"""[0] IMPLICIT Release-response-reason"""
|
|
235
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=0)
|
|
236
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
237
|
+
value: ReleaseResponseReason
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
@dataclass
|
|
241
|
+
class ProtocolVersion(ber.BitStringType):
|
|
242
|
+
"""protocol-version"""
|
|
243
|
+
named_bits = NamedBitList((NamedBit("version1", 0),))
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
@dataclass
|
|
247
|
+
class ProtocolVersion0(ber.TaggedType[ProtocolVersion]):
|
|
248
|
+
"""[0] IMPLICIT protocol-version"""
|
|
249
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=0)
|
|
250
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
251
|
+
value: ProtocolVersion
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
DEFAULT_PROTOCOL_VERSION = ProtocolVersion0(ProtocolVersion((0,)))
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
@dataclass
|
|
258
|
+
class CalledAPTitle(ber.TaggedType[APTitle]):
|
|
259
|
+
"""[2] AP-title"""
|
|
260
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=2)
|
|
261
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
262
|
+
value: APTitle
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
@dataclass
|
|
266
|
+
class CallingAPTitle(ber.TaggedType[APTitle]):
|
|
267
|
+
"""[6] AP-title"""
|
|
268
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=6)
|
|
269
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
270
|
+
value: APTitle
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
@dataclass
|
|
274
|
+
class CalledAEQualifier(ber.TaggedType[AEQualifier]):
|
|
275
|
+
"""[3] AE-qualifier"""
|
|
276
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=3)
|
|
277
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
278
|
+
value: AEQualifier
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
@dataclass
|
|
282
|
+
class CallingAEQualifier(ber.TaggedType[AEQualifier]):
|
|
283
|
+
"""[7] AE-qualifier"""
|
|
284
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=7)
|
|
285
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
286
|
+
value: AEQualifier
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
@dataclass
|
|
290
|
+
class CalledAPInvocationIdentifier(ber.TaggedType[APInvocationIdentifier]):
|
|
291
|
+
"""[4] AP-invocation-identifier"""
|
|
292
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=4)
|
|
293
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
294
|
+
value: APInvocationIdentifier
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
@dataclass
|
|
298
|
+
class CallingAPInvocationIdentifier(ber.TaggedType[APInvocationIdentifier]):
|
|
299
|
+
"""[8] AP-invocation-identifier"""
|
|
300
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=8)
|
|
301
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
302
|
+
value: APInvocationIdentifier
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
@dataclass
|
|
306
|
+
class CalledAEInvocationIdentifier(ber.TaggedType[AEInvocationIdentifier]):
|
|
307
|
+
"""[5] AE-invocation-identifier"""
|
|
308
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=5)
|
|
309
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
310
|
+
value: AEInvocationIdentifier
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
@dataclass
|
|
314
|
+
class CallingAEInvocationIdentifier(ber.TaggedType[AEInvocationIdentifier]):
|
|
315
|
+
"""[9] AE-invocation-identifier"""
|
|
316
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=9)
|
|
317
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
318
|
+
value: AEInvocationIdentifier
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
@dataclass
|
|
322
|
+
class SenderACSERequirements(ber.TaggedType[ACSERequirements]):
|
|
323
|
+
"""[10] IMPLICIT ACSE-requirements"""
|
|
324
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=10)
|
|
325
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
326
|
+
value: ACSERequirements
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
@dataclass
|
|
330
|
+
class MechanismName11(ber.TaggedType[MechanismName]):
|
|
331
|
+
"""[11] IMPLICIT Mechanism-name tagged"""
|
|
332
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=11)
|
|
333
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
334
|
+
value: MechanismName
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
@dataclass
|
|
338
|
+
class CallingAuthenticationValue(ber.TaggedType[AuthenticationValue]):
|
|
339
|
+
"""[12] EXPLICIT Authentication-value"""
|
|
340
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=12)
|
|
341
|
+
mode: ClassVar[TaggingMode] = TaggingMode.EXPLICIT
|
|
342
|
+
value: AuthenticationValue
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
@dataclass
|
|
346
|
+
class AARQApdu(ber.SequenceType):
|
|
347
|
+
"""AARQ-apdu"""
|
|
348
|
+
components = (
|
|
349
|
+
DefaultNamedType("protocol-version", ProtocolVersion0, DEFAULT_PROTOCOL_VERSION),
|
|
350
|
+
NamedType("application-context-name", ApplicationContextName1),
|
|
351
|
+
OptionalNamedType("called-AP-title", CalledAPTitle),
|
|
352
|
+
OptionalNamedType("called-AE-qualifier", CalledAEQualifier),
|
|
353
|
+
OptionalNamedType("called-AP-invocation-id", CalledAPInvocationIdentifier),
|
|
354
|
+
OptionalNamedType("called-AE-invocation-id", CalledAEInvocationIdentifier),
|
|
355
|
+
OptionalNamedType("calling-AP-title", CallingAPTitle),
|
|
356
|
+
OptionalNamedType("calling-AE-qualifier", CallingAEQualifier),
|
|
357
|
+
OptionalNamedType("calling-AP-invocation-id", CallingAPInvocationIdentifier),
|
|
358
|
+
OptionalNamedType("calling-AE-invocation-id", CallingAEInvocationIdentifier),
|
|
359
|
+
OptionalNamedType("sender-acse-requirements", SenderACSERequirements),
|
|
360
|
+
OptionalNamedType("mechanism-name", MechanismName11),
|
|
361
|
+
OptionalNamedType("calling-authentication-value", CallingAuthenticationValue),
|
|
362
|
+
OptionalNamedType("implementation-information", ImplementationData29),
|
|
363
|
+
OptionalNamedType("user-information", AssociationInformation30),
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
@classmethod
|
|
367
|
+
def from_components(
|
|
368
|
+
cls,
|
|
369
|
+
*,
|
|
370
|
+
protocol_version: Optional[ProtocolVersion0] = None,
|
|
371
|
+
application_context_name: ApplicationContextName1,
|
|
372
|
+
called_ap_title: Optional[CalledAPTitle] = None,
|
|
373
|
+
called_ae_qualifier: Optional[CalledAEQualifier] = None,
|
|
374
|
+
called_ap_invocation_id: Optional[CalledAPInvocationIdentifier] = None,
|
|
375
|
+
called_ae_invocation_id: Optional[CalledAEInvocationIdentifier] = None,
|
|
376
|
+
calling_ap_title: Optional[CallingAPTitle] = None,
|
|
377
|
+
calling_ae_qualifier: Optional[CallingAEQualifier] = None,
|
|
378
|
+
calling_ap_invocation_id: Optional[CallingAPInvocationIdentifier] = None,
|
|
379
|
+
calling_ae_invocation_id: Optional[CalledAEInvocationIdentifier] = None,
|
|
380
|
+
sender_acse_requirements: Optional[SenderACSERequirements] = None,
|
|
381
|
+
mechanism_name: Optional[MechanismName11] = None,
|
|
382
|
+
calling_authentication_value: Optional[CallingAuthenticationValue] = None,
|
|
383
|
+
implementation_information: Optional[ImplementationData29] = None,
|
|
384
|
+
user_information: Optional[AssociationInformation30] = None,
|
|
385
|
+
) -> Self:
|
|
386
|
+
"""
|
|
387
|
+
Create AARQApdu instance from named components.
|
|
388
|
+
|
|
389
|
+
Returns:
|
|
390
|
+
Self: New AARQApdu instance with value set to _AARQApdu
|
|
391
|
+
"""
|
|
392
|
+
return cls((
|
|
393
|
+
DEFAULT_PROTOCOL_VERSION if protocol_version is None else protocol_version,
|
|
394
|
+
application_context_name,
|
|
395
|
+
called_ap_title,
|
|
396
|
+
called_ae_qualifier,
|
|
397
|
+
called_ap_invocation_id,
|
|
398
|
+
called_ae_invocation_id,
|
|
399
|
+
calling_ap_title,
|
|
400
|
+
calling_ae_qualifier,
|
|
401
|
+
calling_ap_invocation_id,
|
|
402
|
+
calling_ae_invocation_id,
|
|
403
|
+
sender_acse_requirements,
|
|
404
|
+
mechanism_name,
|
|
405
|
+
calling_authentication_value,
|
|
406
|
+
implementation_information,
|
|
407
|
+
user_information
|
|
408
|
+
))
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
@dataclass
|
|
412
|
+
class AARQ(ber.TaggedType[AARQApdu]):
|
|
413
|
+
"""[APPLICATION 0] IMPLICIT AARQ-apdu"""
|
|
414
|
+
tag: ClassVar[x690.Tag] = x690.Tag(
|
|
415
|
+
class_=Class.APPLICATION,
|
|
416
|
+
class_number=0,
|
|
417
|
+
constructed=True
|
|
418
|
+
)
|
|
419
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
420
|
+
value: AARQApdu
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
@dataclass
|
|
424
|
+
class RespondingAPTitle(ber.TaggedType[APTitle]):
|
|
425
|
+
"""[4] AP-title"""
|
|
426
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=4)
|
|
427
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
428
|
+
value: APTitle
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
@dataclass
|
|
432
|
+
class RespondingAEQualifier(ber.TaggedType[AEQualifier]):
|
|
433
|
+
"""[5] AE-qualifier"""
|
|
434
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=5)
|
|
435
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
436
|
+
value: AEQualifier
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
@dataclass
|
|
440
|
+
class RespondingAPInvocationIdentifier(ber.TaggedType[APInvocationIdentifier]):
|
|
441
|
+
"""[6] AP-invocation-identifier tagged"""
|
|
442
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=6)
|
|
443
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
444
|
+
value: APInvocationIdentifier
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
@dataclass
|
|
448
|
+
class RespondingAEInvocationIdentifier(ber.TaggedType[AEInvocationIdentifier]):
|
|
449
|
+
"""[7] AE-invocation-identifier"""
|
|
450
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=7)
|
|
451
|
+
mode: ClassVar[TaggingMode] = TaggingMode.DEFAULT
|
|
452
|
+
value: AEInvocationIdentifier
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
@dataclass
|
|
456
|
+
class ResponderACSERequirements(ber.TaggedType[ACSERequirements]):
|
|
457
|
+
"""[8] IMPLICIT ACSE-requirements tagged"""
|
|
458
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=8)
|
|
459
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
460
|
+
value: ACSERequirements
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
@dataclass
|
|
464
|
+
class MechanismName9(ber.TaggedType[MechanismName]):
|
|
465
|
+
"""[9] IMPLICIT Mechanism-name"""
|
|
466
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=9)
|
|
467
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
468
|
+
value: MechanismName
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
@dataclass
|
|
473
|
+
class RespondingAuthenticationValue(ber.TaggedType[AuthenticationValue]):
|
|
474
|
+
"""[11] EXPLICIT Authentication-value"""
|
|
475
|
+
tag: ClassVar[x690.Tag] = x690.Tag(class_=Class.CONTEXT_SPECIFIC, class_number=11)
|
|
476
|
+
mode: ClassVar[TaggingMode] = TaggingMode.EXPLICIT
|
|
477
|
+
value: AuthenticationValue
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
@dataclass
|
|
481
|
+
class AAREApdu(ber.SequenceType):
|
|
482
|
+
"""AARE-apdu"""
|
|
483
|
+
components = (
|
|
484
|
+
DefaultNamedType("protocol-version", ProtocolVersion0, DEFAULT_PROTOCOL_VERSION),
|
|
485
|
+
NamedType("application-context-name", ApplicationContextName1),
|
|
486
|
+
NamedType("result", Result),
|
|
487
|
+
NamedType("result-source-diagnostic", ResultSourceDiagnostic),
|
|
488
|
+
OptionalNamedType("responding-AP-title", RespondingAPTitle),
|
|
489
|
+
OptionalNamedType("responding-AE-qualifier", RespondingAEQualifier),
|
|
490
|
+
OptionalNamedType("responding-AP-invocation-id", RespondingAPInvocationIdentifier),
|
|
491
|
+
OptionalNamedType("responding-AE-invocation-id", RespondingAEInvocationIdentifier),
|
|
492
|
+
OptionalNamedType("responder-acse-requirements", ResponderACSERequirements),
|
|
493
|
+
OptionalNamedType("mechanism-name", MechanismName9),
|
|
494
|
+
OptionalNamedType("responding-authentication-value", RespondingAuthenticationValue),
|
|
495
|
+
OptionalNamedType("implementation-information", ImplementationData29),
|
|
496
|
+
OptionalNamedType("user-information", AssociationInformation30),
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
@classmethod
|
|
500
|
+
def from_components(
|
|
501
|
+
cls,
|
|
502
|
+
*,
|
|
503
|
+
protocol_version: Optional[ProtocolVersion0] = None,
|
|
504
|
+
application_context_name: ApplicationContextName1,
|
|
505
|
+
result: Result,
|
|
506
|
+
result_source_diagnostic: ResultSourceDiagnostic,
|
|
507
|
+
responding_ap_title: Optional[RespondingAPTitle] = None,
|
|
508
|
+
responding_ae_qualifier: Optional[RespondingAEQualifier] = None,
|
|
509
|
+
responding_ap_invocation_id: Optional[RespondingAPInvocationIdentifier] = None,
|
|
510
|
+
responding_ae_invocation_id: Optional[RespondingAEInvocationIdentifier] = None,
|
|
511
|
+
responder_acse_requirements: Optional[ResponderACSERequirements] = None,
|
|
512
|
+
mechanism_name: Optional[MechanismName9] = None,
|
|
513
|
+
responding_authentication_value: Optional[RespondingAuthenticationValue] = None,
|
|
514
|
+
implementation_information: Optional[ImplementationData29] = None,
|
|
515
|
+
user_information: Optional[AssociationInformation30] = None,
|
|
516
|
+
) -> Self:
|
|
517
|
+
return cls((
|
|
518
|
+
DEFAULT_PROTOCOL_VERSION if protocol_version is None else protocol_version,
|
|
519
|
+
application_context_name,
|
|
520
|
+
result,
|
|
521
|
+
result_source_diagnostic,
|
|
522
|
+
responding_ap_title,
|
|
523
|
+
responding_ae_qualifier,
|
|
524
|
+
responding_ap_invocation_id,
|
|
525
|
+
responding_ae_invocation_id,
|
|
526
|
+
responder_acse_requirements,
|
|
527
|
+
mechanism_name,
|
|
528
|
+
responding_authentication_value,
|
|
529
|
+
implementation_information,
|
|
530
|
+
user_information
|
|
531
|
+
))
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
@dataclass
|
|
535
|
+
class AARE(ber.TaggedType[AAREApdu]):
|
|
536
|
+
"""[1] AARE-apdu"""
|
|
537
|
+
tag: ClassVar[x690.Tag] = x690.Tag(
|
|
538
|
+
class_=Class.APPLICATION,
|
|
539
|
+
class_number=1,
|
|
540
|
+
constructed=True
|
|
541
|
+
)
|
|
542
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
543
|
+
value: AAREApdu
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
@dataclass
|
|
547
|
+
class RLRQApdu(ber.SequenceType):
|
|
548
|
+
"""RLRQ-apdu internal sequence"""
|
|
549
|
+
components = (
|
|
550
|
+
OptionalNamedType("reason", RequestReason),
|
|
551
|
+
OptionalNamedType("user-information", AssociationInformation30),
|
|
552
|
+
)
|
|
553
|
+
@classmethod
|
|
554
|
+
def from_components(
|
|
555
|
+
cls,
|
|
556
|
+
*,
|
|
557
|
+
reason: Optional[RequestReason] = None,
|
|
558
|
+
user_information: Optional[AssociationInformation30] = None,
|
|
559
|
+
) -> Self:
|
|
560
|
+
"""
|
|
561
|
+
Create RLREApdu instance from named components.
|
|
562
|
+
|
|
563
|
+
Returns:
|
|
564
|
+
Self: New RLREApdu instance
|
|
565
|
+
"""
|
|
566
|
+
return cls((
|
|
567
|
+
reason,
|
|
568
|
+
user_information,
|
|
569
|
+
))
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
@dataclass
|
|
573
|
+
class RLRQ(ber.TaggedType[RLRQApdu]):
|
|
574
|
+
"""[2] RLRQ-apdu"""
|
|
575
|
+
tag: ClassVar[x690.Tag] = x690.Tag(
|
|
576
|
+
class_=Class.APPLICATION,
|
|
577
|
+
class_number=2,
|
|
578
|
+
constructed=True
|
|
579
|
+
)
|
|
580
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
581
|
+
value: RLRQApdu
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
@dataclass
|
|
585
|
+
class RLREApdu(ber.SequenceType):
|
|
586
|
+
"""RLRE-apdu internal sequence"""
|
|
587
|
+
components = (
|
|
588
|
+
OptionalNamedType("reason", ResponseReason),
|
|
589
|
+
OptionalNamedType("user-information", AssociationInformation30),
|
|
590
|
+
)
|
|
591
|
+
|
|
592
|
+
@classmethod
|
|
593
|
+
def from_components(
|
|
594
|
+
cls,
|
|
595
|
+
*,
|
|
596
|
+
reason: Optional[ResponseReason] = None,
|
|
597
|
+
user_information: Optional[AssociationInformation30] = None,
|
|
598
|
+
) -> Self:
|
|
599
|
+
"""
|
|
600
|
+
Create RLREApdu instance from named components.
|
|
601
|
+
|
|
602
|
+
Returns:
|
|
603
|
+
Self: New RLREApdu instance
|
|
604
|
+
"""
|
|
605
|
+
return cls((
|
|
606
|
+
reason,
|
|
607
|
+
user_information,
|
|
608
|
+
))
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
@dataclass
|
|
612
|
+
class RLRE(ber.TaggedType[RLREApdu]):
|
|
613
|
+
"""[3] RLRE-apdu"""
|
|
614
|
+
tag: ClassVar[x690.Tag] = x690.Tag(
|
|
615
|
+
class_=Class.APPLICATION,
|
|
616
|
+
class_number=3,
|
|
617
|
+
constructed=True
|
|
618
|
+
)
|
|
619
|
+
mode: ClassVar[TaggingMode] = TaggingMode.IMPLICIT
|
|
620
|
+
value: RLREApdu
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
@dataclass
|
|
624
|
+
class ACSEApdu(ber.ChoiceType):
|
|
625
|
+
"""ACSE-APDU"""
|
|
626
|
+
alternatives = create_alternatives(
|
|
627
|
+
NamedType("aarq", AARQ),
|
|
628
|
+
NamedType("aare", AARE),
|
|
629
|
+
NamedType("rlrq", RLRQ),
|
|
630
|
+
NamedType("rlre", RLRE)
|
|
631
|
+
)
|