1 module asn1.types.identification;
2 import std.typecons : Nullable;
3 import asn1.types.universal.objectidentifier;
4 
5 ///
6 public
7 struct ASN1ContextNegotiation
8 {
9     ///
10     public ptrdiff_t presentationContextID = 0;
11     ///
12     public ObjectIdentifier transferSyntax;
13 
14     // To use the terms of the pre-1994 EXTERNAL definition:
15     public alias directReference = transferSyntax;
16     public alias indirectReference = presentationContextID;
17 }
18 
19 ///
20 public
21 struct ASN1Syntaxes
22 {
23     ///
24     public ObjectIdentifier abstractSyntax;
25     ///
26     public ObjectIdentifier transferSyntax;
27 }
28 
29 ///
30 public alias ASN1ContextSwitchingTypeID = ASN1ContextSwitchingTypeIdentification;
31 /**
32     This can be used for the creation of Externals, EmbeddedPDVs, and CharacterStrings.
33 */
34 public
35 struct ASN1ContextSwitchingTypeIdentification
36 {
37     ///
38     public Nullable!ASN1Syntaxes syntaxes;
39     ///
40     public Nullable!ObjectIdentifier syntax;
41     ///
42     public ptrdiff_t presentationContextID = 0;
43     ///
44     public Nullable!ASN1ContextNegotiation contextNegotiation;
45     ///
46     public Nullable!ObjectIdentifier transferSyntax;
47     ///
48     public bool fixed;
49 
50     // To use the terms of the pre-1994 EXTERNAL definition:
51     public alias directReference = syntax;
52     public alias indirectReference = presentationContextID;
53 }
54 
55 /*
56 CHARACTER STRING ::= [UNIVERSAL 29] SEQUENCE {
57     identification CHOICE {
58         syntaxes SEQUENCE {
59             abstract OBJECT IDENTIFIER,
60             transfer OBJECT IDENTIFIER },
61         syntax OBJECT IDENTIFIER,
62         presentation-context-id INTEGER,
63         context-negotiation SEQUENCE {
64             presentation-context-id INTEGER,
65             transfer-syntax OBJECT IDENTIFIER },
66         transfer-syntax OBJECT IDENTIFIER,
67         fixed NULL },
68     string-value OCTET STRING }
69 
70 EmbeddedPDV ::= [UNIVERSAL 11] IMPLICIT SEQUENCE {
71     identification CHOICE {
72         syntaxes SEQUENCE {
73             abstract OBJECT IDENTIFIER,
74             transfer OBJECT IDENTIFIER },
75         syntax OBJECT IDENTIFIER,
76         presentation-context-id INTEGER,
77         context-negotiation SEQUENCE {
78             presentation-context-id INTEGER,
79             transfer-syntax OBJECT IDENTIFIER },
80         transfer-syntax OBJECT IDENTIFIER,
81         fixed NULL },
82     data-value-descriptor ObjectDescriptor OPTIONAL,
83     data-value OCTET STRING }
84 (WITH COMPONENTS { ... , data-value-descriptor ABSENT })
85 
86 EXTERNAL ::= [UNIVERSAL 8] IMPLICIT SEQUENCE {
87     identification CHOICE {
88         syntax OBJECT IDENTIFIER,
89         presentation-context-id INTEGER,
90         context-negotiation SEQUENCE {
91             presentation-context-id INTEGER,
92             transfer-syntax OBJECT IDENTIFIER } },
93     data-value-descriptor ObjectDescriptor OPTIONAL,
94     data-value OCTET STRING }
95 */