1 module asn1.types.universal.embeddedpdv;
2 import asn1.types.identification;
3 
4 /* REVIEW:
5     I am going to need some help with this one. I cannot decide
6     what the WITH COMPONENTS line means below. I hope it does
7     not mean that ANYTHING can be in an EmbeddedPDV.
8 */
9 ///
10 public alias EmbeddedPDV = EmbeddedPresentationDataValue;
11 /**
12     An $(MONO EmbeddedPDV) is a constructed data type, defined in
13     the $(LINK https://www.itu.int, International Telecommunications Union)'s
14     $(LINK https://www.itu.int/rec/T-REC-X.680/en, X.680).
15 
16     The specification defines $(MONO EmbeddedPDV) as:
17 
18     $(PRE
19         EmbeddedPDV ::= [UNIVERSAL 11] IMPLICIT SEQUENCE {
20             identification CHOICE {
21                 syntaxes SEQUENCE {
22                     abstract OBJECT IDENTIFIER,
23                     transfer OBJECT IDENTIFIER },
24                 syntax OBJECT IDENTIFIER,
25                 presentation-context-id INTEGER,
26                 context-negotiation SEQUENCE {
27                     presentation-context-id INTEGER,
28                     transfer-syntax OBJECT IDENTIFIER },
29                 transfer-syntax OBJECT IDENTIFIER,
30                 fixed NULL },
31             data-value-descriptor ObjectDescriptor OPTIONAL,
32             data-value OCTET STRING }
33         (WITH COMPONENTS { ... , data-value-descriptor ABSENT })
34     )
35 
36     This assumes $(MONO AUTOMATIC TAGS), so all of the $(MONO identification)
37     choices will be $(MONO CONTEXT-SPECIFIC) and numbered from 0 to 5.
38 
39     The following additional constraints are applied to the abstract syntax
40     when using Canonical Encoding Rules or Distinguished Encoding Rules,
41     which are also defined in the
42     $(LINK https://www.itu.int/en/pages/default.aspx, International Telecommunications Union)'s
43     $(LINK http://www.itu.int/rec/T-REC-X.690/en, X.690 - ASN.1 encoding rules):
44 
45     $(PRE
46         EmbeddedPDV ( WITH COMPONENTS {
47             ... ,
48             identification ( WITH COMPONENTS {
49                 ... ,
50                 presentation-context-id ABSENT,
51                 context-negotiation ABSENT } ) } )
52     )
53 
54     The stated purpose of the constraints shown above is to restrict the use of
55     the $(MONO presentation-context-id), either by itself or within the
56     context-negotiation, which makes the following the effective abstract
57     syntax of $(MONO EmbeddedPDV) when using Canonical Encoding Rules or
58     Distinguished Encoding Rules:
59 
60     $(PRE
61         EmbeddedPDV ::= [UNIVERSAL 11] IMPLICIT SEQUENCE {
62             identification CHOICE {
63                 syntaxes SEQUENCE {
64                     abstract OBJECT IDENTIFIER,
65                     transfer OBJECT IDENTIFIER },
66                 syntax OBJECT IDENTIFIER,
67                 presentation-context-id INTEGER,
68                 context-negotiation SEQUENCE {
69                     presentation-context-id INTEGER,
70                     transfer-syntax OBJECT IDENTIFIER },
71                 transfer-syntax OBJECT IDENTIFIER,
72                 fixed NULL },
73             data-value-descriptor ObjectDescriptor OPTIONAL,
74             data-value OCTET STRING }
75                 ( WITH COMPONENTS {
76                     ... ,
77                     identification ( WITH COMPONENTS {
78                         ... ,
79                         presentation-context-id ABSENT,
80                         context-negotiation ABSENT } ) } )
81     )
82 
83     With the constraints applied, the abstract syntax for $(MONO EmbeddedPDV)s encoded
84     using Canonical Encoding Rules or Distinguished Encoding Rules becomes:
85 
86     $(PRE
87         EmbeddedPDV ::= [UNIVERSAL 11] IMPLICIT SEQUENCE {
88             identification CHOICE {
89                 syntaxes SEQUENCE {
90                     abstract OBJECT IDENTIFIER,
91                     transfer OBJECT IDENTIFIER },
92                 syntax OBJECT IDENTIFIER,
93                 transfer-syntax OBJECT IDENTIFIER,
94                 fixed NULL },
95             data-value-descriptor ObjectDescriptor OPTIONAL,
96             data-value OCTET STRING }
97     )
98 */
99 public
100 struct EmbeddedPresentationDataValue
101 {
102     /**
103         A field indicating the the transfer syntax used to indicate the means
104         by which the data-value field is encoded. Can also be used to specify
105         the abstract syntax of what is encoded.
106     */
107     public ASN1ContextSwitchingTypeID identification;
108     /// The encoded data
109     public ubyte[] dataValue;
110 }