aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asn1/inap/inap.cnf42
-rw-r--r--asn1/qsig/qsig.cnf5
-rw-r--r--asn1/rnsap/rnsap.cnf41
-rw-r--r--asn1/rrlp/rrlp.cnf5
-rw-r--r--epan/dissectors/packet-inap.c43
-rw-r--r--epan/dissectors/packet-qsig.c2
-rw-r--r--epan/dissectors/packet-rnsap.c8
-rw-r--r--epan/dissectors/packet-rrlp.c4
-rw-r--r--epan/dissectors/packet-spnego.c2
-rwxr-xr-xtools/asn2wrs.py489
10 files changed, 439 insertions, 202 deletions
diff --git a/asn1/inap/inap.cnf b/asn1/inap/inap.cnf
index 1099490a29..7b46769549 100644
--- a/asn1/inap/inap.cnf
+++ b/asn1/inap/inap.cnf
@@ -2,35 +2,10 @@
# inap conformation file
# $Id$
-#.MODULE_IMPORT
-
#.EXPORTS
#.NO_EMIT
-#.CLASS EXTENSION
-ExtensionType
-criticality TypeReference Criticality
-id TypeReference Code
-#.END
-
-#.CLASS COMMON-BOUNDS
-numOfExtensions TypeReference NUM-OF-EXTENSIONS
-#.END
-#.CLASS SCF-SSF-BOUNDS
-highLayerCompatibilityLength
-#.END
-#.CLASS TRIGGER
-Parameter
-id
-#.END
-
-#.CLASS UISCRIPT
-SpecificInfo
-Result
-id TypeReference Code
-#.END
-
#.TYPE_RENAME
#.FIELD_RENAME
@@ -88,27 +63,22 @@ CancelArg
RequestCurrentStatusReportResultArg
ReceivedInformationArg
-#.FN_BODY T_triggerId
- offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
- NULL);
-#.FN_BODY T_triggerPar
-/* FIX ME */
-#.FN_BODY T_uIScriptSpecificInfo
+#.FN_BODY TriggerData/triggerPar
/* FIX ME */
-#.FN_BODY T_uIScriptResult
+#.FN_BODY ScriptEventArg/uIScriptResult
/* FIX ME */
-#.FN_BODY T_uIScriptSpecificInfo
+#.FN_BODY ScriptCloseArg/uIScriptSpecificInfo
/* FIX ME */
-#.FN_BODY T_uIScriptSpecificInfo_01
+#.FN_BODY ScriptInformationArg/uIScriptSpecificInfo
/* FIX ME */
-#.FN_BODY T_uIScriptSpecificInfo_02
+#.FN_BODY ScriptRunArg/uIScriptSpecificInfo
/* FIX ME */
-#.FN_BODY T_value
+#.FN_BODY ExtensionField/value
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
diff --git a/asn1/qsig/qsig.cnf b/asn1/qsig/qsig.cnf
index 7d13b13106..663925bc31 100644
--- a/asn1/qsig/qsig.cnf
+++ b/asn1/qsig/qsig.cnf
@@ -36,11 +36,6 @@ IntResultList
#.END
-#.CLASS EXTENSION
-ArgumentType
-extensionId ObjectIdentifierType
-#.END
-
#.TYPE_RENAME
ActivateDivArg/extension ADExtension
DeactivateDivArg/extension DDExtension
diff --git a/asn1/rnsap/rnsap.cnf b/asn1/rnsap/rnsap.cnf
index a2c1ae8d68..663f87ffdc 100644
--- a/asn1/rnsap/rnsap.cnf
+++ b/asn1/rnsap/rnsap.cnf
@@ -18,47 +18,6 @@ ProcedureCode
ProtocolIE-ID
ProcedureID/ddMode
-#.CLASS RNSAP-PROTOCOL-IES
-id TypeReference ProtocolIE-ID
-criticality TypeReference Criticality
-Value
-presence TypeReference Presence
-#.END
-
-#.CLASS RNSAP-PROTOCOL-IES-PAIR
-id TypeReference ProtocolIE-ID
-firstCriticality TypeReference Criticality
-FirstValue
-secondCriticality TypeReference Criticality
-SecondValue
-presence TypeReference Presence
-#.END
-
-#.CLASS RNSAP-PROTOCOL-EXTENSION
-id TypeReference ProtocolIE-ID
-criticality TypeReference Criticality
-Extension
-presence TypeReference Presence
-#.END
-
-#.CLASS RNSAP-PRIVATE-IES
-id TypeReference PrivateIE-ID
-criticality TypeReference Criticality
-Value
-presence TypeReference Presence
-#.END
-
-
-#.CLASS RNSAP-ELEMENTARY-PROCEDURE
-InitiatingMessage
-SuccessfulOutcome
-UnsuccessfulOutcome
-Outcome
-procedureID TypeReference ProcedureID
-criticality TypeReference Criticality
-#.END
-
-
#.TYPE_RENAME
ProcedureID/ddMode DdMode
diff --git a/asn1/rrlp/rrlp.cnf b/asn1/rrlp/rrlp.cnf
index c13fe004ad..bc1cd7cfd2 100644
--- a/asn1/rrlp/rrlp.cnf
+++ b/asn1/rrlp/rrlp.cnf
@@ -21,11 +21,6 @@ VelocityEstimate
SLR-ArgExtensionContainer
#.END
-#.CLASS MAP-EXTENSION
-ExtensionType
-extensionId ObjectIdentifierType
-#.END
-
#.FN_HDR PDU
proto_tree_add_item(tree, proto_rrlp, tvb, 0, -1, FALSE);
diff --git a/epan/dissectors/packet-inap.c b/epan/dissectors/packet-inap.c
index b7b88aa7b3..4e3f1045b2 100644
--- a/epan/dissectors/packet-inap.c
+++ b/epan/dissectors/packet-inap.c
@@ -1031,7 +1031,7 @@ dissect_inap_InvokeIdType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
static int
dissect_inap_INAPOperationLocalvalue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 132 "inap.cnf"
+#line 102 "inap.cnf"
offset = dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_index, &opcode);
if (check_col(actx->pinfo->cinfo, COL_INFO)){
@@ -1078,7 +1078,7 @@ dissect_inap_INAP_OPERATION(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_inap_InvokeParameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 116 "inap.cnf"
+#line 86 "inap.cnf"
offset = dissect_invokeData(tree, tvb, offset, actx);
@@ -1107,7 +1107,7 @@ dissect_inap_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_
static int
dissect_inap_ReturnResultParameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 119 "inap.cnf"
+#line 89 "inap.cnf"
offset = dissect_returnResultData(tree, tvb, offset, actx);
@@ -1149,7 +1149,7 @@ dissect_inap_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
static int
dissect_inap_INAPLocalErrorcode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 125 "inap.cnf"
+#line 95 "inap.cnf"
offset = dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_index, &errorCode);
if (check_col(actx->pinfo->cinfo, COL_INFO)){
@@ -1196,7 +1196,7 @@ dissect_inap_INAP_ERROR(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_inap_ReturnErrorParameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 122 "inap.cnf"
+#line 92 "inap.cnf"
offset = dissect_returnErrorData(tree, tvb, offset, actx);
@@ -1519,7 +1519,7 @@ dissect_inap_CriticalityType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
static int
dissect_inap_T_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 112 "inap.cnf"
+#line 82 "inap.cnf"
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
@@ -2179,7 +2179,7 @@ dissect_inap_BCSMEvent(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_inap_T_bearerCap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 171 "inap.cnf"
+#line 141 "inap.cnf"
tvbuff_t *parameter_tvb;
@@ -2334,7 +2334,7 @@ dissect_inap_CalledPartyBusinessGroupID(gboolean implicit_tag _U_, tvbuff_t *tvb
static int
dissect_inap_CalledPartyNumber(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 142 "inap.cnf"
+#line 112 "inap.cnf"
tvbuff_t *parameter_tvb;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -2385,7 +2385,7 @@ dissect_inap_CallingPartyBusinessGroupID(gboolean implicit_tag _U_, tvbuff_t *tv
static int
dissect_inap_CallingPartyNumber(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 156 "inap.cnf"
+#line 126 "inap.cnf"
tvbuff_t *parameter_tvb;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -4663,7 +4663,7 @@ dissect_inap_NumberingPlan(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
static int
dissect_inap_OriginalCalledPartyID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 201 "inap.cnf"
+#line 171 "inap.cnf"
tvbuff_t *parameter_tvb;
@@ -4726,7 +4726,7 @@ dissect_inap_Reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_
static int
dissect_inap_RedirectingPartyID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 215 "inap.cnf"
+#line 185 "inap.cnf"
tvbuff_t *parameter_tvb;
@@ -4748,7 +4748,7 @@ dissect_inap_RedirectingPartyID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_inap_RedirectionInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 186 "inap.cnf"
+#line 156 "inap.cnf"
tvbuff_t *parameter_tvb;
@@ -5102,10 +5102,8 @@ dissect_inap_TravellingClassMark(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i
static int
dissect_inap_T_triggerId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 92 "inap.cnf"
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
- NULL);
-
+ NULL);
return offset;
}
@@ -5114,10 +5112,11 @@ dissect_inap_T_triggerId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_inap_T_triggerPar(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 95 "inap.cnf"
+#line 67 "inap.cnf"
/* FIX ME */
+
return offset;
}
@@ -7691,9 +7690,7 @@ dissect_inap_MessageReceivedArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_inap_T_uIScriptSpecificInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 97 "inap.cnf"
-/* FIX ME */
-
+#line 73 "inap.cnf"
/* FIX ME */
@@ -7722,7 +7719,7 @@ dissect_inap_ScriptCloseArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_inap_T_uIScriptResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 100 "inap.cnf"
+#line 70 "inap.cnf"
/* FIX ME */
@@ -7752,7 +7749,7 @@ dissect_inap_ScriptEventArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_inap_T_uIScriptSpecificInfo_01(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 106 "inap.cnf"
+#line 76 "inap.cnf"
/* FIX ME */
@@ -7780,7 +7777,7 @@ dissect_inap_ScriptInformationArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
static int
dissect_inap_T_uIScriptSpecificInfo_02(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 108 "inap.cnf"
+#line 78 "inap.cnf"
/* FIX ME */
@@ -9603,7 +9600,7 @@ void proto_register_inap(void) {
"inap.Triggers", HFILL }},
{ &hf_inap_triggerId,
{ "triggerId", "inap.triggerId",
- FT_NONE, BASE_NONE, NULL, 0,
+ FT_UINT32, BASE_DEC, NULL, 0,
"inap.T_triggerId", HFILL }},
{ &hf_inap_triggerPar,
{ "triggerPar", "inap.triggerPar",
diff --git a/epan/dissectors/packet-qsig.c b/epan/dissectors/packet-qsig.c
index 8007d81325..bb861a950d 100644
--- a/epan/dissectors/packet-qsig.c
+++ b/epan/dissectors/packet-qsig.c
@@ -663,7 +663,7 @@ static int dissect_extensionId(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offs
static int
dissect_qsig_T_extensionArgument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 75 "qsig.cnf"
+#line 70 "qsig.cnf"
diff --git a/epan/dissectors/packet-rnsap.c b/epan/dissectors/packet-rnsap.c
index fbf76201f7..c4cf1c58b1 100644
--- a/epan/dissectors/packet-rnsap.c
+++ b/epan/dissectors/packet-rnsap.c
@@ -3875,7 +3875,7 @@ dissect_rnsap_ProcedureCode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
0U, 255U, &ProcedureCode, FALSE);
-#line 106 "rnsap.cnf"
+#line 65 "rnsap.cnf"
if (check_col(actx->pinfo->cinfo, COL_INFO))
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "%s ",
val_to_str(ProcedureCode, rnsap_ProcedureCode_vals,
@@ -3910,7 +3910,7 @@ static const per_sequence_t ProcedureID_sequence[] = {
static int
dissect_rnsap_ProcedureID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 114 "rnsap.cnf"
+#line 73 "rnsap.cnf"
ProcedureCode = 0xFFFF;
ddMode = 0xFFFF;
ProcedureID = NULL;
@@ -3918,7 +3918,7 @@ dissect_rnsap_ProcedureID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_rnsap_ProcedureID, ProcedureID_sequence);
-#line 120 "rnsap.cnf"
+#line 79 "rnsap.cnf"
ProcedureID = ep_strdup_printf("%s/%s",
val_to_str(ProcedureCode, VALS(rnsap_ProcedureCode_vals), "unknown(%u)"),
val_to_str(ddMode, VALS(rnsap_DdMode_vals), "unknown(%u)"));
@@ -15745,7 +15745,7 @@ dissect_rnsap_LimitedPowerIncrease(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
static int
dissect_rnsap_L3_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 133 "rnsap.cnf"
+#line 92 "rnsap.cnf"
tvbuff_t *parameter_tvb;
dissector_handle_t parameter_handle = NULL;
diff --git a/epan/dissectors/packet-rrlp.c b/epan/dissectors/packet-rrlp.c
index 5e4b9f6346..54eff7432d 100644
--- a/epan/dissectors/packet-rrlp.c
+++ b/epan/dissectors/packet-rrlp.c
@@ -866,7 +866,7 @@ dissect_rrlp_TimeSlotScheme(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
static int
dissect_rrlp_Ext_GeographicalInformation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 39 "rrlp.cnf"
+#line 34 "rrlp.cnf"
tvbuff_t *parameter_tvb = NULL;
@@ -4570,7 +4570,7 @@ static const per_sequence_t PDU_sequence[] = {
static int
dissect_rrlp_PDU(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 30 "rrlp.cnf"
+#line 25 "rrlp.cnf"
proto_tree_add_item(tree, proto_rrlp, tvb, 0, -1, FALSE);
diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c
index 96277544a6..6ada42ffab 100644
--- a/epan/dissectors/packet-spnego.c
+++ b/epan/dissectors/packet-spnego.c
@@ -1,6 +1,6 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
-/* ./packet-spnego.c */
+/* .\packet-spnego.c */
/* ../../tools/asn2wrs.py -b -e -p spnego -c spnego.cnf -s packet-spnego-template spnego.asn */
/* Input file: packet-spnego-template.c */
diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py
index 9fa849c1fd..2182932f21 100755
--- a/tools/asn2wrs.py
+++ b/tools/asn2wrs.py
@@ -200,13 +200,13 @@ static_tokens = {
r'\[' : 'LBRACK',
r'\]' : 'RBRACK',
r'-' : 'MINUS',
-# r':' : 'COLON',
+ r':' : 'COLON',
#r'=' : 'EQ',
#r'"' : 'QUOTATION',
#r"'" : 'APOSTROPHE',
r';' : 'SEMICOLON',
r'@' : 'AT',
- #r'\!' : 'EXCLAMATION',
+ r'\!' : 'EXCLAMATION',
r'\^' : 'CIRCUMFLEX',
r'\&' : 'AMPERSAND',
r'\|' : 'BAR'
@@ -279,7 +279,7 @@ reserved_words = {
'TRUE' : 'TRUE',
'TYPE-IDENTIFIER' : 'TYPE_IDENTIFIER',
'UNION' : 'UNION',
-# 'UNIQUE' : 'UNIQUE',
+ 'UNIQUE' : 'UNIQUE',
'UNIVERSAL' : 'UNIVERSAL',
'UTCTime' : 'UTCTime',
'WITH' : 'WITH',
@@ -546,6 +546,7 @@ class EthCtx:
self.default_oid_variant = ''
self.default_opentype_variant = ''
self.default_containing_variant = '_pdu_new'
+ self.default_embedded_pdv_cb = None
self.default_external_type_cb = None
self.module = {}
self.module_ord = []
@@ -812,7 +813,7 @@ class EthCtx:
self.type_ord.append(ident)
#--- eth_reg_objectclass ----------------------------------------------------------
- def eth_reg_objectclass(self, ident):
+ def eth_reg_objectclass(self, ident, val):
#print "eth_reg_objectclass(ident='%s')" % (ident)
if self.objectclass.has_key(ident):
if self.objectclass[ident]['import'] and (self.objectclass[ident]['import'] == self.Module()) :
@@ -822,6 +823,7 @@ class EthCtx:
else:
raise "Duplicate object class for " + ident
self.objectclass[ident] = { 'import' : None, 'module' : self.Module(), 'proto' : self.proto }
+ self.objectclass[ident]['val'] = val
self.objectclass[ident]['export'] = self.conform.use_item('EXPORTS', ident)
self.objectclass_ord.append(ident)
@@ -1427,6 +1429,17 @@ class EthCtx:
for (m, p) in self.modules:
fx.write("%-*s %s\n" % (maxw, m, p))
fx.write('#.END\n\n')
+ for cls in self.objectclass_ord:
+ if self.objectclass[cls]['export']:
+ fx.write('#.CLASS %s\n' % (cls))
+ maxw = 2
+ for fld in self.objectclass[cls]['val'].fields:
+ w = len(fld.fld_repr()[0])
+ if (w > maxw): maxw = w
+ for fld in self.objectclass[cls]['val'].fields:
+ repr = fld.fld_repr()
+ fx.write('%-*s %s\n' % (maxw, repr[0], ' '.join(repr[1:])))
+ fx.write('#.END\n\n')
if self.Ber():
fx.write('#.IMPORT_TAG\n')
for t in self.eth_export_ord: # tags
@@ -2347,9 +2360,7 @@ class EthCnf:
if empty.match(line): continue
par = get_par(line, 1, 3, fn=fn, lineno=lineno)
if not par: continue
- if (len(par) < 2): par.append('OpenType')
- if (len(par) < 3): par.append(None)
- if not set_type_to_class(name, par[0], par[1], par[2]):
+ if not set_type_to_class(name, par[0], par[1:]):
warnings.warn_explicit("Could not set type of class member %s.&%s to %s" % (name, par[0], par[1]),
UserWarning, fn, lineno)
@@ -2415,6 +2426,10 @@ class EthCnf:
elif opt in ("-L",):
par = self.check_par(par, 0, 0, fn, lineno)
self.suppress_line = True
+ elif opt in ("EMBEDDED_PDV_CB",):
+ par = self.check_par(par, 1, 1, fn, lineno)
+ if not par: return
+ self.ectx.default_embedded_pdv_cb = par[0]
elif opt in ("EXTERNAL_TYPE_CB",):
par = self.check_par(par, 1, 1, fn, lineno)
if not par: return
@@ -2662,6 +2677,7 @@ class Type (Node):
self.name = None
self.constr = None
self.tags = []
+ self.named_list = None
Node.__init__ (self,*args, **kw)
def IsNamed(self):
@@ -2917,7 +2933,7 @@ class Value (Node):
self.name = name
def to_str(self, ectx):
- return str(self)
+ return str(self.val)
def get_dep(self):
return None
@@ -2934,7 +2950,19 @@ class ObjectClass (Node):
def eth_reg(self, ident, ectx):
if ectx.conform.omit_assignment('C', self.name, ectx.Module()): return # Assignment to omit
- ectx.eth_reg_objectclass(self.name)
+ ectx.eth_reg_objectclass(self.name, self)
+
+#--- Class_Ref -----------------------------------------------------------------
+class Class_Ref (ObjectClass):
+ pass
+
+#--- ObjectClassDefn ---------------------------------------------------------------------
+class ObjectClassDefn (ObjectClass):
+ def reg_types(self):
+ for fld in self.fields:
+ repr = fld.fld_repr()
+ set_type_to_class(self.name, repr[0], repr[1:])
+
#--- Tag ---------------------------------------------------------------
class Tag (Node):
@@ -2970,6 +2998,9 @@ class Constraint (Node):
def __str__ (self):
return "Constraint: type=%s, subtype=%s" % (self.type, self.subtype)
+ def eth_tname(self):
+ return '#' + self.type + '_' + str(id(self))
+
def IsSize(self):
return (self.type == 'Size' and self.subtype.IsValue()) \
or (self.type == 'Intersection' and (self.subtype[0].IsSize() or self.subtype[1].IsSize())) \
@@ -3200,14 +3231,6 @@ class PyQuote (Node):
def to_python (self, ctx):
return ctx.register_pyquote (self.val)
-#--- Class_Ref -----------------------------------------------------------------
-class Class_Ref (Type):
- def to_python (self, ctx):
- return self.val
-
- def eth_tname(self):
- return asn2c(self.val)
-
#--- Type_Ref -----------------------------------------------------------------
class Type_Ref (Type):
def to_python (self, ctx):
@@ -3414,7 +3437,9 @@ class SeqType (SqType):
lst = self.elt_list[:]
if hasattr(self, 'ext_list'):
lst.extend(self.ext_list)
- for e in (self.elt_list):
+ if hasattr(self, 'elt_list2'):
+ lst.extend(self.elt_list2)
+ for e in (lst):
if e.type == 'components_of':
return True
return False
@@ -3432,9 +3457,18 @@ class SeqType (SqType):
comp = self.ext_list[i].typ.get_components(ectx)
self.ext_list[i:i+1] = comp
break
+ if hasattr(self, 'elt_list2'):
+ for i in range(len(self.elt_list2)):
+ if self.elt_list2[i].type == 'components_of':
+ comp = self.elt_list2[i].typ.get_components(ectx)
+ self.elt_list2[i:i+1] = comp
+ break
def get_components(self, ectx):
- return self.elt_list[:]
+ lst = self.elt_list[:]
+ if hasattr(self, 'elt_list2'):
+ lst.extend(self.elt_list2)
+ return lst
def eth_type_default_table(self, ectx, tname):
#print "eth_type_default_table(tname='%s')" % (tname)
@@ -3457,6 +3491,10 @@ class SeqType (SqType):
for e in (self.ext_list):
f = fname + '/' + e.val.name
table += self.out_item(f, e.val, e.optional, 'ASN1_NOT_EXTENSION_ROOT', ectx)
+ if hasattr(self, 'elt_list2'):
+ for e in (self.elt_list2):
+ f = fname + '/' + e.val.name
+ table += self.out_item(f, e.val, e.optional, ext, ectx)
if (ectx.Ber()):
if (ectx.NewBer()):
table += " { NULL, 0, 0, 0, NULL }\n};\n"
@@ -3676,6 +3714,9 @@ class SequenceType (SeqType):
if hasattr(self, 'ext_list'):
for e in (self.ext_list):
e.val.eth_reg(ident, ectx, tstrip=1, parent=ident)
+ if hasattr(self, 'elt_list2'):
+ for e in (self.elt_list2):
+ e.val.eth_reg(ident, ectx, tstrip=1, parent=ident)
def eth_need_tree(self):
return True
@@ -4006,6 +4047,11 @@ class ChoiceType (Type):
body = '#error Can not decode %s' % (tname)
return body
+#--- ChoiceValue ----------------------------------------------------
+class ChoiceValue (Value):
+ def to_str(self, ectx):
+ return self.val.to_str(ectx)
+
#--- EnumeratedType -----------------------------------------------------------
class EnumeratedType (Type):
def to_python (self, ctx):
@@ -4127,6 +4173,7 @@ class EnumeratedType (Type):
else:
body = '#error Can not decode %s' % (tname)
return body
+
#--- EmbeddedPDVType -----------------------------------------------------------
class EmbeddedPDVType (Type):
def eth_tname(self):
@@ -4140,8 +4187,8 @@ class EmbeddedPDVType (Type):
def eth_type_default_pars(self, ectx, tname):
pars = Type.eth_type_default_pars(self, ectx, tname)
- if ectx.default_external_type_cb:
- pars['TYPE_REF_FN'] = ectx.default_external_type_cb
+ if ectx.default_embedded_pdv_cb:
+ pars['TYPE_REF_FN'] = ectx.default_embedded_pdv_cb
else:
pars['TYPE_REF_FN'] = 'NULL'
return pars
@@ -4150,6 +4197,9 @@ class EmbeddedPDVType (Type):
if (ectx.Ber()):
body = ectx.eth_fn_call('dissect_%(ER)s_EmbeddedPDV_Type', ret='offset',
par=(('%(IMPLICIT_TAG)s', '%(TREE)s', '%(TVB)s', '%(OFFSET)s', '%(ACTX)s', '%(HF_INDEX)s', '%(TYPE_REF_FN)s',),))
+ elif (ectx.Per()):
+ body = ectx.eth_fn_call('dissect_%(ER)s_embedded_pdv', ret='offset',
+ par=(('%(TVB)s', '%(OFFSET)s', '%(ACTX)s', '%(TREE)s', '%(HF_INDEX)s', '%(TYPE_REF_FN)s',),))
else:
body = '#error Can not decode %s' % (tname)
return body
@@ -4276,6 +4326,11 @@ class NullType (Type):
body = '#error Can not decode %s' % (tname)
return body
+#--- NullValue ----------------------------------------------------
+class NullValue (Value):
+ def to_str(self, ectx):
+ return 'NULL'
+
#--- RealType -----------------------------------------------------------------
class RealType (Type):
def to_python (self, ctx):
@@ -4843,6 +4898,47 @@ class BStringValue (Value):
vv += bstring_tab[v[i:i+4]]
return vv
+
+#--- FieldSpec ----------------------------------------------------------------
+class FieldSpec (Node):
+ def __init__(self,*args, **kw) :
+ self.name = None
+ Node.__init__ (self,*args, **kw)
+
+ def SetName(self, name):
+ self.name = name
+
+ def get_repr(self):
+ return ['#UNSUPPORTED_' + self.type]
+
+ def fld_repr(self):
+ repr = [self.name]
+ repr.extend(self.get_repr())
+ return repr
+
+class TypeFieldSpec (FieldSpec):
+ def get_repr(self):
+ return []
+
+class FixedTypeValueFieldSpec (FieldSpec):
+ def get_repr(self):
+ if isinstance(self.typ, Type_Ref):
+ repr = ['TypeReference', self.typ.val]
+ else:
+ repr = [self.typ.type]
+ return repr
+
+class FixedTypeValueSetFieldSpec (FieldSpec):
+ pass
+
+class ObjectFieldSpec (FieldSpec):
+ def get_repr(self):
+ return ['ClassReference', self.cls]
+
+class ObjectSetFieldSpec (FieldSpec):
+ def get_repr(self):
+ return ['ClassReference', self.cls]
+
#==============================================================================
def p_module_list_1 (t):
@@ -5040,11 +5136,12 @@ def p_AssignmentList_3 (t):
def p_Assignment (t):
'''Assignment : TypeAssignment
| ValueAssignment
+ | ValueSetTypeAssignment
| ObjectClassAssignment
| ObjectAssignment
| ObjectSetAssignment
- | ParameterizedTypeAssignment
- | pyquote'''
+ | ParameterizedAssignment
+ | pyquote '''
t[0] = t[1]
@@ -5092,10 +5189,20 @@ def p_ValueType (t):
| IntegerType
| ObjectIdentifierType
| OctetStringType
- | RealType'''
+ | RealType '''
t[0] = t[1]
+# 15.6
+def p_ValueSetTypeAssignment (t):
+ 'ValueSetTypeAssignment : UCASE_IDENT ValueType ASSIGNMENT ValueSet'
+ t[0] = Node('ValueSetTypeAssignment', name=t[1], typ=t[2], val=t[4])
+
+# 15.7
+def p_ValueSet (t):
+ 'ValueSet : lbraceignore rbraceignore'
+ t[0] = None
+
# 16 Definition of types and values -------------------------------------------
@@ -5151,6 +5258,7 @@ def p_Value (t):
# 16.9
def p_BuiltinValue (t):
'''BuiltinValue : BooleanValue
+ | ChoiceValue
| IntegerValue
| ObjectIdentifierValue
| RealValue
@@ -5162,7 +5270,8 @@ def p_BuiltinValue (t):
# 16.11
def p_ReferencedValue (t):
- '''ReferencedValue : DefinedValue'''
+ '''ReferencedValue : DefinedValue
+ | ValueFromObject'''
t[0] = t[1]
# 16.13
@@ -5315,13 +5424,13 @@ def p_OctetStringType (t):
# 23.1
def p_NullType (t):
- 'NullType : NULL'
- t[0] = NullType ()
+ 'NullType : NULL'
+ t[0] = NullType ()
# 23.3
-#def p_NullValue (t):
-# 'NullValue : NULL'
-# t[0] = t[1]
+def p_NullValue (t):
+ 'NullValue : NULL'
+ t[0] = NullValue ()
# 24 Notation for sequence types ----------------------------------------------
@@ -5333,10 +5442,11 @@ def p_SequenceType_1 (t):
def p_SequenceType_2 (t):
'SequenceType : SEQUENCE LBRACE ComponentTypeLists RBRACE'
+ t[0] = SequenceType (elt_list = t[3]['elt_list'])
if t[3].has_key('ext_list'):
- t[0] = SequenceType (elt_list = t[3]['elt_list'], ext_list = t[3]['ext_list'])
- else:
- t[0] = SequenceType (elt_list = t[3]['elt_list'])
+ t[0].ext_list = t[3]['ext_list']
+ if t[3].has_key('elt_list2'):
+ t[0].ext_list = t[3]['elt_list2']
def p_ExtensionAndException_1 (t):
'ExtensionAndException : ELLIPSIS'
@@ -5355,32 +5465,52 @@ def p_ComponentTypeLists_1 (t):
t[0] = {'elt_list' : t[1]}
def p_ComponentTypeLists_2 (t):
- 'ComponentTypeLists : ComponentTypeList COMMA ExtensionAndException extension_additions OptionalExtensionMarker'
- t[0] = {'elt_list' : t[1], 'ext_list' : t[4]}
+ 'ComponentTypeLists : ComponentTypeList COMMA ExtensionAndException OptionalExtensionMarker'
+ t[0] = {'elt_list' : t[1], 'ext_list' : []}
def p_ComponentTypeLists_3 (t):
- 'ComponentTypeLists : ExtensionAndException extension_additions OptionalExtensionMarker'
+ 'ComponentTypeLists : ComponentTypeList COMMA ExtensionAndException ExtensionAdditionList OptionalExtensionMarker'
+ t[0] = {'elt_list' : t[1], 'ext_list' : t[4]}
+
+def p_ComponentTypeLists_4 (t):
+ 'ComponentTypeLists : ComponentTypeList COMMA ExtensionAndException ExtensionEndMarker COMMA ComponentTypeList'
+ t[0] = {'elt_list' : t[1], 'ext_list' : [], 'elt_list2' : t[6]}
+
+def p_ComponentTypeLists_5 (t):
+ 'ComponentTypeLists : ComponentTypeList COMMA ExtensionAndException ExtensionAdditionList ExtensionEndMarker COMMA ComponentTypeList'
+ t[0] = {'elt_list' : t[1], 'ext_list' : t[4], 'elt_list2' : t[7]}
+
+def p_ComponentTypeLists_6 (t):
+ 'ComponentTypeLists : ExtensionAndException OptionalExtensionMarker'
+ t[0] = {'elt_list' : [], 'ext_list' : []}
+
+def p_ComponentTypeLists_7 (t):
+ 'ComponentTypeLists : ExtensionAndException ExtensionAdditionList OptionalExtensionMarker'
t[0] = {'elt_list' : [], 'ext_list' : t[2]}
#def p_RootComponentTypeList (t):
# 'RootComponentTypeList : ComponentTypeList'
# t[0] = t[1]
-def p_extension_additions_1 (t):
- 'extension_additions : extension_addition_list'
- t[0] = t[1]
+def p_ExtensionEndMarker (t):
+ 'ExtensionEndMarker : COMMA ELLIPSIS'
+ pass
-def p_extension_additions_2 (t):
- 'extension_additions : '
- t[0] = []
+#def p_extension_additions_1 (t):
+# 'extension_additions : extension_addition_list'
+# t[0] = t[1]
-def p_extension_addition_list_1 (t):
- 'extension_addition_list : COMMA extension_addition'
- t[0] = [t[2]]
+#def p_extension_additions_2 (t):
+# 'extension_additions : '
+# t[0] = []
-def p_extension_addition_list_2 (t):
- 'extension_addition_list : extension_addition_list COMMA extension_addition'
- t[0] = t[1] + [t[3]]
+def p_ExtensionAdditionList_1 (t):
+ 'ExtensionAdditionList : COMMA extension_addition'
+ t[0] = [t[2]]
+
+def p_ExtensionAdditionList_2 (t):
+ 'ExtensionAdditionList : ExtensionAdditionList COMMA extension_addition'
+ t[0] = t[1] + [t[3]]
def p_extension_addition_1 (t):
'extension_addition : ComponentType'
@@ -5413,6 +5543,7 @@ def p_ComponentType_4 (t):
def p_DefaultValue_1 (t):
'''DefaultValue : ReferencedValue
| BooleanValue
+ | ChoiceValue
| IntegerValue
| RealValue
| hex_string
@@ -5522,6 +5653,15 @@ def p_alternative_type_list_2 (t):
'alternative_type_list : alternative_type_list COMMA NamedType'
t[0] = t[1] + [t[3]]
+# 28.10
+def p_ChoiceValue_1 (t):
+ '''ChoiceValue : identifier COLON Value
+ | identifier COLON NullValue '''
+ val = t[3]
+ if not isinstance(val, Value):
+ val = Value(val=val)
+ t[0] = ChoiceValue (choice = t[1], val = val)
+
# 29 Notation for selection types
# 29.1
@@ -5972,9 +6112,19 @@ def p_PatternConstraint (t):
# 49 The exception identifier
# 49.4
-def p_ExceptionSpec (t):
- 'ExceptionSpec : '
- pass
+def p_ExceptionSpec_1 (t):
+ 'ExceptionSpec : EXCLAMATION ExceptionIdentification'
+ pass
+
+def p_ExceptionSpec_2 (t):
+ 'ExceptionSpec : '
+ pass
+
+def p_ExceptionIdentification (t):
+ '''ExceptionIdentification : SignedNumber
+ | DefinedValue
+ | Type COLON Value '''
+ pass
# /*-----------------------------------------------------------------------*/
# /* Value Notation Productions */
@@ -6017,21 +6167,28 @@ def p_objectreference (t):
# 7.3 Information object set references
-def p_objectsetreference (t):
- 'objectsetreference : UCASE_IDENT'
- t[0] = t[1]
+#def p_objectsetreference (t):
+# 'objectsetreference : UCASE_IDENT'
+# t[0] = t[1]
# 7.4 Type field references
-
-def p_typefieldreference (t):
- 'typefieldreference : AMPERSAND UCASE_IDENT'
- t[0] = t[2]
-
+# ucasefieldreference
# 7.5 Value field references
-
-def p_valuefieldreference (t):
- 'valuefieldreference : AMPERSAND LCASE_IDENT'
- t[0] = t[2]
+# lcasefieldreference
+# 7.6 Value set field references
+# ucasefieldreference
+# 7.7 Object field references
+# lcasefieldreference
+# 7.8 Object set field references
+# ucasefieldreference
+
+def p_ucasefieldreference (t):
+ 'ucasefieldreference : AMPERSAND UCASE_IDENT'
+ t[0] = '&' + t[2]
+
+def p_lcasefieldreference (t):
+ 'lcasefieldreference : AMPERSAND LCASE_IDENT'
+ t[0] = '&' + t[2]
# 8 Referencing definitions
@@ -6059,33 +6216,140 @@ def p_ObjectClassAssignment (t):
| UCASE_IDENT ASSIGNMENT ObjectClass'''
t[0] = t[3]
t[0].SetName(t[1])
+ if isinstance(t[0], ObjectClassDefn):
+ t[0].reg_types()
# 9.2
def p_ObjectClass (t):
- '''ObjectClass : ObjectClassDefn'''
+ '''ObjectClass : DefinedObjectClass
+ | ObjectClassDefn'''
t[0] = t[1]
# 9.3
def p_ObjectClassDefn (t):
- '''ObjectClassDefn : CLASS lbraceignore rbraceignore
- | CLASS lbraceignore rbraceignore WithSyntaxSpec'''
- t[0] = ObjectClass()
+ '''ObjectClassDefn : CLASS LBRACE FieldSpecs RBRACE
+ | CLASS LBRACE FieldSpecs RBRACE WithSyntaxSpec'''
+ t[0] = ObjectClassDefn(fields = t[3])
+
+def p_FieldSpecs_1 (t):
+ 'FieldSpecs : FieldSpec'
+ t[0] = [t[1]]
+
+def p_FieldSpecs_2 (t):
+ 'FieldSpecs : FieldSpecs COMMA FieldSpec'
+ t[0] = t[1] + [t[3]]
def p_WithSyntaxSpec (t):
'WithSyntaxSpec : WITH SYNTAX lbraceignore rbraceignore'
t[0] = None
-# 9.14
-def p_FieldName (t):
- '''FieldName : typefieldreference
- | valuefieldreference'''
+# 9.4
+def p_FieldSpec (t):
+ '''FieldSpec : TypeFieldSpec
+ | FixedTypeValueFieldSpec
+ | FixedTypeValueSetFieldSpec
+ | ObjectFieldSpec
+ | ObjectSetFieldSpec '''
+ t[0] = t[1]
+
+# 9.5
+def p_TypeFieldSpec (t):
+ '''TypeFieldSpec : ucasefieldreference
+ | ucasefieldreference TypeOptionalitySpec '''
+ t[0] = TypeFieldSpec()
+ t[0].SetName(t[1])
+
+def p_TypeOptionalitySpec_1 (t):
+ 'TypeOptionalitySpec ::= OPTIONAL'
+ pass
+
+def p_TypeOptionalitySpec_2 (t):
+ 'TypeOptionalitySpec ::= DEFAULT Type'
+ pass
+
+# 9.6
+def p_FixedTypeValueFieldSpec (t):
+ '''FixedTypeValueFieldSpec : lcasefieldreference Type
+ | lcasefieldreference Type UNIQUE
+ | lcasefieldreference Type ValueOptionalitySpec
+ | lcasefieldreference Type UNIQUE ValueOptionalitySpec '''
+ t[0] = FixedTypeValueFieldSpec(typ = t[2])
+ t[0].SetName(t[1])
+
+def p_ValueOptionalitySpec_1 (t):
+ 'ValueOptionalitySpec ::= OPTIONAL'
+ pass
+
+def p_ValueOptionalitySpec_2 (t):
+ 'ValueOptionalitySpec ::= DEFAULT Value'
+ pass
+
+# 9.9
+def p_FixedTypeValueSetFieldSpec (t):
+ '''FixedTypeValueSetFieldSpec : ucasefieldreference Type
+ | ucasefieldreference Type ValueSetOptionalitySpec '''
+ t[0] = FixedTypeValueSetFieldSpec()
+ t[0].SetName(t[1])
+
+def p_ValueSetOptionalitySpec_1 (t):
+ 'ValueSetOptionalitySpec ::= OPTIONAL'
+ pass
+
+def p_TypeOptionalitySpec_2 (t):
+ 'ValueSetOptionalitySpec ::= DEFAULT ValueSet'
+ pass
+
+# 9.11
+def p_ObjectFieldSpec (t):
+ '''ObjectFieldSpec : lcasefieldreference CLASS_IDENT
+ | lcasefieldreference CLASS_IDENT ObjectOptionalitySpec '''
+ t[0] = ObjectFieldSpec(cls=t[2])
+ t[0].SetName(t[1])
+
+def p_ObjectOptionalitySpec_1 (t):
+ 'ObjectOptionalitySpec ::= OPTIONAL'
+ pass
+
+def p_ObjectOptionalitySpec_2 (t):
+ 'ObjectOptionalitySpec ::= DEFAULT Object'
+ pass
+
+# 9.12
+def p_ObjectSetFieldSpec (t):
+ '''ObjectSetFieldSpec : ucasefieldreference CLASS_IDENT
+ | ucasefieldreference CLASS_IDENT ObjectSetOptionalitySpec '''
+ t[0] = ObjectSetFieldSpec(cls=t[2])
+ t[0].SetName(t[1])
+
+def p_ObjectSetOptionalitySpec_1 (t):
+ 'ObjectSetOptionalitySpec ::= OPTIONAL'
+ pass
+
+def p_ObjectSetOptionalitySpec_2 (t):
+ 'ObjectSetOptionalitySpec ::= DEFAULT ObjectSet'
+ pass
+
+# 9.13
+def p_PrimitiveFieldName (t):
+ '''PrimitiveFieldName : ucasefieldreference
+ | lcasefieldreference '''
t[0] = t[1]
+# 9.13
+def p_FieldName_1 (t):
+ 'FieldName : PrimitiveFieldName'
+ t[0] = t[1]
+
+def p_FieldName_2 (t):
+ 'FieldName : FieldName DOT PrimitiveFieldName'
+ t[0] = t[1] + '.' + t[3]
+
# 11 Information object definition and assignment
# 11.1
def p_ObjectAssignment (t):
- 'ObjectAssignment : objectreference CLASS_IDENT ASSIGNMENT Object'
+ '''ObjectAssignment : objectreference CLASS_IDENT ASSIGNMENT Object
+ | objectreference UsefulObjectClassReference ASSIGNMENT Object'''
t[0] = Node('ObjectAssignment', name=t[1], cls=t[2], val=t[4])
# 11.3
@@ -6103,7 +6367,7 @@ def p_ObjectDefn (t):
# 12.1
def p_ObjectSetAssignment (t):
- 'ObjectSetAssignment : objectsetreference CLASS_IDENT ASSIGNMENT ObjectSet'
+ 'ObjectSetAssignment : UCASE_IDENT CLASS_IDENT ASSIGNMENT ObjectSet'
t[0] = Node('ObjectSetAssignment', name=t[1], cls=t[2], val=t[4])
# 12.3
@@ -6118,21 +6382,32 @@ def p_ObjectClassFieldType (t):
'ObjectClassFieldType : DefinedObjectClass DOT FieldName'
t[0] = get_type_from_class(t[1], t[3])
+# 15 Information from objects
+
+# 15.1
+
+def p_ValueFromObject (t):
+ 'ValueFromObject : LCASE_IDENT DOT FieldName'
+ t[0] = t[1] + '.' + t[3]
+
useful_object_class_types = {
# Annex A
- 'TYPE-IDENTIFIER/id' : lambda : ObjectIdentifierType(),
- 'TYPE-IDENTIFIER/Type' : lambda : OpenType(),
+ 'TYPE-IDENTIFIER.&id' : lambda : ObjectIdentifierType(),
+ 'TYPE-IDENTIFIER.&Type' : lambda : OpenType(),
# Annex B
- 'ABSTRACT-SYNTAX/id' : lambda : ObjectIdentifierType(),
- 'ABSTRACT-SYNTAX/Type' : lambda : OpenType(),
- 'ABSTRACT-SYNTAX/property' : lambda : BitStringType(),
+ 'ABSTRACT-SYNTAX.&id' : lambda : ObjectIdentifierType(),
+ 'ABSTRACT-SYNTAX.&Type' : lambda : OpenType(),
+ 'ABSTRACT-SYNTAX.&property' : lambda : BitStringType(),
}
object_class_types = { }
object_class_typerefs = { }
+object_class_classrefs = { }
+
class_types_creator = {
+ 'BooleanType' : lambda : BooleanType(),
'IntegerType' : lambda : IntegerType(),
'ObjectIdentifierType' : lambda : ObjectIdentifierType(),
'OpenType' : lambda : OpenType(),
@@ -6147,10 +6422,14 @@ def add_class_ident(name):
class_names[name] = name
def get_type_from_class(cls, fld):
+ flds = fld.split('.')
if (isinstance(cls, Class_Ref)):
- key = cls.val + '/' + fld
+ key = cls.val + '.' + flds[0]
else:
- key = cls + '/' + fld
+ key = cls + '.' + flds[0]
+
+ if object_class_classrefs.has_key(key):
+ return get_type_from_class(object_class_classrefs[key], '.'.join(flds[1:]))
if object_class_typerefs.has_key(key):
return Type_Ref(val=object_class_typerefs[key])
@@ -6160,10 +6439,23 @@ def get_type_from_class(cls, fld):
creator = object_class_types.get(key, creator)
return creator()
-def set_type_to_class(cls, fld, typename, typeref = None):
- key = cls + '/' + fld
+def set_type_to_class(cls, fld, pars):
+ key = cls + '.' + fld
+ typename = 'OpenType'
+ if (len(pars) > 0):
+ typename = pars[0]
+ typeref = None
+ if (len(pars) > 1):
+ typeref = pars[1]
+
if object_class_types.has_key(key): return False
if object_class_typerefs.has_key(key): return False
+ if object_class_classrefs.has_key(key): return False
+
+ if (typename == 'ClassReference'):
+ if not typeref: return False
+ object_class_classrefs[key] = typeref
+ return True
if (typename == 'TypeReference'):
if not typeref: return False
@@ -6226,8 +6518,24 @@ def p_SimpleTableConstraint (t):
# 10.7
def p_ComponentRelationConstraint (t):
- 'ComponentRelationConstraint : LBRACE UCASE_IDENT RBRACE LBRACE AT LCASE_IDENT RBRACE'
- t[0] = t[2] + '@' + t[6]
+ 'ComponentRelationConstraint : LBRACE UCASE_IDENT RBRACE LBRACE AtNotation RBRACE'
+ t[0] = t[2] + t[5]
+
+def p_AtNotation_1 (t):
+ 'AtNotation : AT LCASE_IDENT'
+ t[0] = '@' + t[2]
+
+def p_AtNotation_2 (t):
+ 'AtNotation : AT DOT Level LCASE_IDENT'
+ t[0] = '@.' + t[3] + t[4]
+
+def p_Level_1 (t):
+ 'Level : DOT Level'
+ t[0] = '.' + t[2]
+
+def p_Level_2 (t):
+ 'Level : '
+ t[0] = ''
# 11 Contents constraints -----------------------------------------------------
@@ -6242,6 +6550,11 @@ def p_ContentsConstraint (t):
# 8 Parameterized assignments -------------------------------------------------
# 8.1
+def p_ParameterizedAssignment (t):
+ '''ParameterizedAssignment : ParameterizedTypeAssignment
+ | ParameterizedObjectAssignment
+ | ParameterizedObjectSetAssignment'''
+ t[0] = t[1]
# 8.2
def p_ParameterizedTypeAssignment (t):
@@ -6249,6 +6562,14 @@ def p_ParameterizedTypeAssignment (t):
t[0] = t[4]
t[0].SetName(t[1]) # t[0].SetName(t[1] + 'xxx')
+def p_ParameterizedObjectAssignment (t):
+ 'ParameterizedObjectAssignment : objectreference ParameterList CLASS_IDENT ASSIGNMENT Object'
+ t[0] = Node('ObjectAssignment', name=t[1], cls=t[3], val=t[5])
+
+def p_ParameterizedObjectSetAssignment (t):
+ 'ParameterizedObjectSetAssignment : UCASE_IDENT ParameterList CLASS_IDENT ASSIGNMENT ObjectSet'
+ t[0] = Node('ObjectSetAssignment', name=t[1], cls=t[3], val=t[5])
+
# 8.3
def p_ParameterList (t):
'ParameterList : lbraceignore rbraceignore'