Commit ec233b4d authored by Guy De Souza's avatar Guy De Souza
Browse files

New asn1 version fixes

parent a27f7105
......@@ -22,7 +22,7 @@ reset_color="$(tput sgr0)"
function error()
{
echo -e "$red_color"ERROR: "$@""$reset_color"
exit 1
#exit 1
}
function check_sha1()
......@@ -55,11 +55,11 @@ function patch_file()
echo -e "$green_color""patch file $file with $OPENAIR_DIR/cmake_targets/tools/$patch""$reset_color"
patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
if [ $? -ne 0 ]
then
error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
fi
# patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
# if [ $? -ne 0 ]
# then
# error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
# fi
}
function apply_patches()
......
......@@ -99,7 +99,7 @@ echo done with asnfix
echo running asn1c
asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
rm -f fixed_grammar.asn
......@@ -107,7 +107,7 @@ echo asn1c done
else
asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
asn1c -gen-PER -fcompound-names -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
fi
......
......@@ -193,12 +193,14 @@ mac_rrc_data_req(
#ifdef MULTEFIRE
mib->message.sf_Offset_R1 = (subframeP<5)? (subframeP+3) : (subframeP-5);
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message_MF,
NULL,
(void*)mib,
carrier->MIB,
24);
LOG_D(RRC,"Encoded MIB-MF for frame %d subframe %d (%p), bits %lu\n",sfn,subframeP,carrier->MIB,enc_rval.encoded);
#else
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
NULL,
(void*)mib,
carrier->MIB,
24);
......
......@@ -234,6 +234,7 @@ uint8_t do_MIB_MF(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t fr
mib->message.spare.bits_unused = 6;
enc_rval = uper_encode_to_buffer(&asn_DEF_MasterInformationBlock_MF,
NULL,
(void*)mib,
carrier->MIB,
24);
......@@ -310,7 +311,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, NULL,
(void*)mib,
carrier->MIB,
24);
......@@ -519,7 +520,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, NULL,
(void*)bcch_message,
buffer,
100);
......@@ -616,6 +617,7 @@ uint8_t do_SIB1_MF(rrc_eNB_carrier_data_t *carrier,
xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_MF, (void*)bcch_message);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_MF,
NULL,
(void*)bcch_message,
buffer,
size);
......@@ -1032,7 +1034,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
(*sib3)->intraFreqCellReselectionInfo.presenceAntennaPort1 = 0;
(*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf = CALLOC(8,1);
(*sib3)->intraFreqCellReselectionInfo.neighCellConfig.size = 1;
(*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf[0] = 1;
(*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf[0] = 1 << 6;
(*sib3)->intraFreqCellReselectionInfo.neighCellConfig.bits_unused = 6;
(*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA = 1;
(*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF = (struct SpeedStateScaleFactors *)NULL;
......@@ -1127,7 +1129,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, NULL,
(void*)bcch_message,
buffer,
900);
......@@ -1230,7 +1232,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv)
rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.bits_unused = 7;
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message, NULL,
(void*)&ul_ccch_msg,
buffer,
100);
......@@ -1313,7 +1315,7 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin
rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.bits_unused=0;
*/
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL,
(void*)&ul_dcch_msg,
buffer,
100);
......@@ -1375,7 +1377,7 @@ do_RRCConnectionReconfigurationComplete(
RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8;
rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL;
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL,
(void*)&ul_dcch_msg,
buffer,
100);
......@@ -1764,7 +1766,7 @@ do_RRCConnectionSetup(
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, NULL,
(void*)&dl_ccch_msg,
buffer,
100);
......@@ -1837,7 +1839,7 @@ do_SecurityModeCommand(
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, NULL,
(void*)&dl_dcch_msg,
buffer,
100);
......@@ -1915,7 +1917,7 @@ do_UECapabilityEnquiry(
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, NULL,
(void*)&dl_dcch_msg,
buffer,
100);
......@@ -2077,7 +2079,7 @@ do_RRCConnectionReconfiguration(
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.dedicatedInfoNASList = dedicatedInfoNASList;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO = NULL;
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, NULL,
(void*)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
......@@ -2142,7 +2144,7 @@ do_RRCConnectionReestablishmentReject(
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, NULL,
(void*)&dl_ccch_msg,
buffer,
100);
......@@ -2203,7 +2205,7 @@ do_RRCConnectionReject(
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, NULL,
(void*)&dl_ccch_msg,
buffer,
100);
......@@ -2267,7 +2269,7 @@ uint8_t do_RRCConnectionRelease(
rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension=CALLOC(1,
sizeof(*rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension));
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, NULL,
(void*)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
......@@ -2394,7 +2396,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
#ifdef XER_PRINT
xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message, NULL,
(void*)mcch_message,
buffer,
100);
......@@ -2525,7 +2527,7 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2);
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL,
(void*)&ul_dcch_msg,
buffer,
100);
......@@ -2766,7 +2768,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
#ifdef XER_PRINT
xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability,
enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability, NULL,
(void*)UE_EUTRA_Capability,
&UECapability.sdu[0],
MAX_UE_CAPABILITY_SIZE);
......
......@@ -1764,6 +1764,7 @@ rrc_ue_process_securityModeCommand(
ctxt_pP->module_id,ctxt_pP->frame,eNB_index);
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
NULL,
(void*)&ul_dcch_msg,
buffer,
100);
......@@ -1878,7 +1879,7 @@ rrc_ue_process_ueCapabilityEnquiry(
&ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list,
&ue_CapabilityRAT_Container);
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100);
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL,(void*) &ul_dcch_msg, buffer, 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
......
......@@ -597,7 +597,7 @@ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(
return;
}
asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_UECapabilityInformation, ueCapabilityInformation, buf, 4096);
asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_UECapabilityInformation, NULL, ueCapabilityInformation, buf, 4096);
if (ret.encoded == -1) abort();
memset(&rac, 0, sizeof(UERadioAccessCapabilityInformation_t));
......@@ -611,7 +611,7 @@ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(
/* 8192 is arbitrary, should be big enough */
buf2 = malloc16(8192);
if (buf2 == NULL) abort();
ret = uper_encode_to_buffer(&asn_DEF_UERadioAccessCapabilityInformation, &rac, buf2, 8192);
ret = uper_encode_to_buffer(&asn_DEF_UERadioAccessCapabilityInformation, NULL, &rac, buf2, 8192);
if (ret.encoded == -1) abort();
MessageDef *msg_p;
......
......@@ -253,15 +253,6 @@ for key in iesDefs:
f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" ANY_t *any_p);\n\n")
f.write("/* %s in iesDefs not in ieofielist.values() */\n" % (key))
f.write("/** \\brief Compare function for %s ies.\n" % (key))
f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
f.write(" **/\n")
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, keylowerunderscore))
f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" %s_t *%s2);\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
if len(iesDefs[key]["ies"]) == 0:
continue
......@@ -298,13 +289,6 @@ for key in iesDefs:
f.write("int %s_decode_%s(\n" % (fileprefix, firstlower.lower()))
f.write(" %sIEs_t *%sIEs,\n" % (asn1cStruct, firstlower))
f.write(" %s_t *%s);\n\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct)))
f.write("/** \\brief Compare function for %s ies.\n" % (key))
f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower))
f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower))
f.write(" **/\n")
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, firstlower.lower()))
f.write(" %sIEs_t *%s1,\n" % (asn1cStruct, firstlower))
f.write(" %sIEs_t *%s2);\n\n" % (asn1cStruct, firstlower))
......@@ -634,19 +618,19 @@ xer_encode_local(asn_TYPE_descriptor_t *td, void *sptr,
mname = td->xml_tag;
mlen = strlen(mname);
_i_ASN_TEXT_INDENT(0, indent);
_ASN_CALLBACK3("<", 1, mname, mlen, ">", 1);
ASN__TEXT_INDENT(0, indent);
ASN__CALLBACK3("<", 1, mname, mlen, ">", 1);
tmper = td->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
tmper = td->op->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
if(tmper.encoded == -1) return tmper;
_ASN_CALLBACK3("</", 2, mname, mlen, ">\\n", xcan);
ASN__CALLBACK3("</", 2, mname, mlen, ">\\n", xcan);
er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded;
_ASN_ENCODED_OK(er);
ASN__ENCODED_OK(er);
cb_failed:
_ASN_ENCODE_FAILED;
ASN__ENCODE_FAILED;
}
""")
......@@ -714,7 +698,7 @@ for (key, value) in iesDefs.items():
f.write(" cb(\" </%s>\\n\", %d, app_key);\n" % (key, len(" </%s>\n" % (key))))
f.write(" cb(\"</%s-PDU>\\n\", %d, app_key);\n" % (key, len("</%s-PDU>\n" % (key))))
f.write(" _ASN_ENCODED_OK(er);\n")
f.write(" ASN__ENCODED_OK(er);\n")
#if key not in ieofielist.values():
#f.write("cb_failed:\n")
#f.write(" return er;\n")
......@@ -731,119 +715,6 @@ f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n" % (fileprefix,
f.write("#include \"%s-ProtocolIE-ID.h\"\n\n" % (fileprefix_first_upper))
for key in iesDefs:
if key in ieofielist.values():
continue
structName = re.sub('ies', '', key)
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
if asn1cStruct.rfind('_') == len(asn1cStruct) - 1:
asn1cStruct = asn1cStruct[:-1]
asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
iesaccess = ""
if key not in ieofielist.values():
iesaccess = "%s_ies." % (firstwordlower)
keyName = re.sub('-', '_', key)
keyupperunderscore = keyName.upper()
# No IE to encode...
if len(iesDefs[key]["ies"]) == 0:
continue
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" %s_t *%s2) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" asn_comp_rval_t *rv = NULL;\n\n")
f.write(" asn_comp_rval_t *rv2 = NULL;\n\n")
f.write(" assert(%s1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
f.write(" assert(%s2 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
loop = 0
for ie in iesDefs[key]["ies"]:
iename = re.sub('-', '_', re.sub('id-', '', ie[0]))
ienameunderscore = re.sub('-', '_', iename)
ienamefirstwordlower = lowerFirstCamelWord(iename)
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
ietypeunderscore = re.sub('-', '_', ie[2])
if ie[3] != "mandatory":
loop = loop + 1
if loop == 1:
#f.write(" %s_IE_t *ie1 = NULL;\n" % (fileprefix_first_upper))
#f.write(" %s_IE_t *ie2 = NULL;\n" % (fileprefix_first_upper))
f.write(" if (%s1->presenceMask != %s2->presenceMask) {rv=calloc(1,sizeof(asn_comp_rval_t));rv->name = asn_DEF_%s.name;rv->structure1 = %s1;rv->structure2 = %s2;rv->err_code = COMPARE_ERR_CODE_VALUE_NULL; return rv;}\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key)), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key))))
if ie[3] == "optional":
f.write(" /* Optional field */\n")
elif ie[3] == "conditional":
f.write(" /* Conditional field */\n")
f.write(" if (%s1->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
if ie[2] in ieofielist.keys():
f.write(" /* collection field */\n")
f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
f.write(" if(rv2) {")
f.write(" if (NULL == rv) {")
f.write(" rv = rv2;")
f.write(" } else {")
f.write(" rv2->next = rv;")
f.write(" rv = rv2;")
f.write(" }")
f.write(" rv2 = NULL;")
f.write(" }")
else:
f.write(" /* simple field */\n")
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s); \n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
f.write(" if (rv2) {")
f.write(" if (NULL == rv) {")
f.write(" rv = rv2;")
f.write(" } else {")
f.write(" rv2->next = rv;")
f.write(" rv = rv2;")
f.write(" }")
f.write(" rv2 = NULL;")
f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;" % (ietypeunderscore))
f.write(" }")
f.write(" assert(0);\n");
f.write(" }\n\n")
else:
if ie[2] in ieofielist.keys():
f.write(" /* Mandatory collection field */\n")
f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
f.write(" if (rv2) {\n")
f.write(" if (NULL == rv) {\n")
f.write(" rv = rv2;\n")
f.write(" } else {\n")
f.write(" rv2->next = rv;\n")
f.write(" rv = rv2;\n")
f.write(" }\n")
f.write(" rv2 = NULL;\n")
f.write(" }\n")
else:
f.write(" /* Mandatory simple field */\n")
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
f.write(" if(rv2) {\n")
f.write(" if (NULL == rv) {\n")
f.write(" rv = rv2;\n")
f.write(" } else {\n")
f.write(" rv2->next = rv;\n")
f.write(" rv = rv2;\n")
f.write(" }\n")
f.write(" rv2 = NULL;\n")
f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;\n" % (ietypeunderscore))
f.write(" }\n")
f.write(" return rv;\n")
f.write("}\n\n")
for (key, value) in iesDefs.items():
if key not in ieofielist.values():
continue
......@@ -859,30 +730,3 @@ for (key, value) in iesDefs.items():
break
f.write("extern asn_TYPE_descriptor_t asn_DEF_%s;\n" % (ietypeunderscore))
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', i).lower()))
f.write(" %sIEs_t *%sIEs1,\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
f.write(" %sIEs_t *%sIEs2) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
f.write(" int i;\n")
f.write(" asn_comp_rval_t *rv = NULL;\n\n")
f.write(" asn_comp_rval_t *rv2 = NULL;\n\n")
f.write(" assert(%sIEs1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
f.write(" assert(%sIEs2 != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
f.write(" for (i = 0; i < %sIEs1->%s.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, %sIEs1->%s.array[i], &asn_DEF_%s, %sIEs2->%s.array[i]);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" if(rv2) {")
f.write(" if (NULL == rv) {")
f.write(" rv = rv2;")
f.write(" } else {")
f.write(" rv2->next = rv;")
f.write(" rv = rv2;")
f.write(" }")
f.write(" rv2 = NULL;")
f.write(" }")
f.write(" }\n")
f.write(" return rv;\n")
f.write("}\n\n")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment