diff options
author | kukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-08-09 08:00:06 +0000 |
---|---|---|
committer | kukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-08-09 08:00:06 +0000 |
commit | d251072f1721ec93fc56472c2af4335df9fe8db3 (patch) | |
tree | a7cdc8658f0e8e2dd434ae8db85bd43abc25e1ce | |
parent | e377092f530d5281f4b67d4fb02ff857a3d873a9 (diff) |
Support for Extension Addition Group in PER encoding
Fix for bug 6196 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6199
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@38421 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | epan/dissectors/packet-lte-rrc.c | 265 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 52 | ||||
-rw-r--r-- | epan/dissectors/packet-per.h | 1 | ||||
-rw-r--r-- | epan/libwireshark.def | 1 | ||||
-rwxr-xr-x | tools/asn2wrs.py | 139 |
5 files changed, 397 insertions, 61 deletions
diff --git a/epan/dissectors/packet-lte-rrc.c b/epan/dissectors/packet-lte-rrc.c index 97380b2db1..070b1a904d 100644 --- a/epan/dissectors/packet-lte-rrc.c +++ b/epan/dissectors/packet-lte-rrc.c @@ -1367,6 +1367,7 @@ static int hf_lte_rrc_additionalReestabInfoList = -1; /* AdditionalReestabInfoL static int hf_lte_rrc_AdditionalReestabInfoList_item = -1; /* AdditionalReestabInfo */ static int hf_lte_rrc_key_eNodeB_Star = -1; /* Key_eNodeB_Star */ static int hf_lte_rrc_ue_InactiveTime = -1; /* T_ue_InactiveTime */ +static int hf_lte_rrc_dummy_eag_field = -1; /* never registered */ /*--- End of included file: packet-lte-rrc-hf.c ---*/ #line 58 "../../asn1/lte-rrc/packet-lte-rrc-template.c" @@ -3764,6 +3765,20 @@ dissect_lte_rrc_OCTET_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx } +static const per_sequence_t SystemInformationBlockType2_eag_1_sequence[] = { + { &hf_lte_rrc_ssac_BarringForMMTEL_Voice_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_AC_BarringConfig }, + { &hf_lte_rrc_ssac_BarringForMMTEL_Video_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_AC_BarringConfig }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_SystemInformationBlockType2_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, SystemInformationBlockType2_eag_1_sequence); + + return offset; +} + + static const per_sequence_t SystemInformationBlockType2_sequence[] = { { &hf_lte_rrc_ac_BarringInfo, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_ac_BarringInfo }, { &hf_lte_rrc_radioResourceConfigCommon, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_RadioResourceConfigCommonSIB }, @@ -3772,8 +3787,7 @@ static const per_sequence_t SystemInformationBlockType2_sequence[] = { { &hf_lte_rrc_mbsfn_SubframeConfigList, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_MBSFN_SubframeConfigList }, { &hf_lte_rrc_timeAlignmentTimerCommon, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_TimeAlignmentTimer }, { &hf_lte_rrc_lateNonCriticalExtension, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_OCTET_STRING }, - { &hf_lte_rrc_ssac_BarringForMMTEL_Voice_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_AC_BarringConfig }, - { &hf_lte_rrc_ssac_BarringForMMTEL_Video_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_AC_BarringConfig }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_SystemInformationBlockType2_eag_1 }, { NULL, 0, 0, NULL } }; @@ -4195,15 +4209,28 @@ dissect_lte_rrc_Q_QualMin_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx } +static const per_sequence_t SystemInformationBlockType3_eag_1_sequence[] = { + { &hf_lte_rrc_s_IntraSearch_v920, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_s_IntraSearch_v920 }, + { &hf_lte_rrc_s_NonIntraSearch_v920, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_s_NonIntraSearch_v920 }, + { &hf_lte_rrc_q_QualMin_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_Q_QualMin_r9 }, + { &hf_lte_rrc_threshServingLowQ_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_ReselectionThresholdQ_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_SystemInformationBlockType3_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, SystemInformationBlockType3_eag_1_sequence); + + return offset; +} + + static const per_sequence_t SystemInformationBlockType3_sequence[] = { { &hf_lte_rrc_cellReselectionInfoCommon, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_cellReselectionInfoCommon }, { &hf_lte_rrc_cellReselectionServingFreqInfo, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_cellReselectionServingFreqInfo }, { &hf_lte_rrc_intraFreqCellReselectionInfo, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_intraFreqCellReselectionInfo }, { &hf_lte_rrc_lateNonCriticalExtension, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_OCTET_STRING }, - { &hf_lte_rrc_s_IntraSearch_v920, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_s_IntraSearch_v920 }, - { &hf_lte_rrc_s_NonIntraSearch_v920, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_s_NonIntraSearch_v920 }, - { &hf_lte_rrc_q_QualMin_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_Q_QualMin_r9 }, - { &hf_lte_rrc_threshServingLowQ_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_ReselectionThresholdQ_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_SystemInformationBlockType3_eag_1 }, { NULL, 0, 0, NULL } }; @@ -4434,6 +4461,20 @@ dissect_lte_rrc_T_threshX_Q_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac } +static const per_sequence_t InterFreqCarrierFreqInfo_eag_1_sequence[] = { + { &hf_lte_rrc_q_QualMin_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_Q_QualMin_r9 }, + { &hf_lte_rrc_threshX_Q_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_threshX_Q_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_InterFreqCarrierFreqInfo_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, InterFreqCarrierFreqInfo_eag_1_sequence); + + return offset; +} + + static const per_sequence_t InterFreqCarrierFreqInfo_sequence[] = { { &hf_lte_rrc_dl_CarrierFreq, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_ARFCN_ValueEUTRA }, { &hf_lte_rrc_q_RxLevMin , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_Q_RxLevMin }, @@ -4449,8 +4490,7 @@ static const per_sequence_t InterFreqCarrierFreqInfo_sequence[] = { { &hf_lte_rrc_q_OffsetFreq, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_Q_OffsetRange }, { &hf_lte_rrc_interFreqNeighCellList, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_InterFreqNeighCellList }, { &hf_lte_rrc_interFreqBlackCellList, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_InterFreqBlackCellList }, - { &hf_lte_rrc_q_QualMin_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_Q_QualMin_r9 }, - { &hf_lte_rrc_threshX_Q_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_threshX_Q_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_InterFreqCarrierFreqInfo_eag_1 }, { NULL, 0, 0, NULL } }; @@ -4547,6 +4587,19 @@ dissect_lte_rrc_T_threshX_Q_r9_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t } +static const per_sequence_t CarrierFreqUTRA_FDD_eag_1_sequence[] = { + { &hf_lte_rrc_threshX_Q_r9_01, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_threshX_Q_r9_01 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_CarrierFreqUTRA_FDD_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, CarrierFreqUTRA_FDD_eag_1_sequence); + + return offset; +} + + static const per_sequence_t CarrierFreqUTRA_FDD_sequence[] = { { &hf_lte_rrc_carrierFreq_02, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_ARFCN_ValueUTRA }, { &hf_lte_rrc_cellReselectionPriority, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_CellReselectionPriority }, @@ -4555,7 +4608,7 @@ static const per_sequence_t CarrierFreqUTRA_FDD_sequence[] = { { &hf_lte_rrc_q_RxLevMin_01, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_INTEGER_M60_M13 }, { &hf_lte_rrc_p_MaxUTRA , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_INTEGER_M50_33 }, { &hf_lte_rrc_q_QualMin , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_INTEGER_M24_0 }, - { &hf_lte_rrc_threshX_Q_r9_01, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_threshX_Q_r9_01 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_CarrierFreqUTRA_FDD_eag_1 }, { NULL, 0, 0, NULL } }; @@ -5369,17 +5422,30 @@ dissect_lte_rrc_AC_BarringConfig1XRTT_r9(tvbuff_t *tvb _U_, int offset _U_, asn1 } +static const per_sequence_t SystemInformationBlockType8_eag_1_sequence[] = { + { &hf_lte_rrc_csfb_SupportForDualRxUEs_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_BOOLEAN }, + { &hf_lte_rrc_cellReselectionParametersHRPD_v920, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_CellReselectionParametersCDMA2000_v920 }, + { &hf_lte_rrc_cellReselectionParameters1XRTT_v920, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_CellReselectionParametersCDMA2000_v920 }, + { &hf_lte_rrc_csfb_RegistrationParam1XRTT_v920, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_CSFB_RegistrationParam1XRTT_v920 }, + { &hf_lte_rrc_ac_BarringConfig1XRTT_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_AC_BarringConfig1XRTT_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_SystemInformationBlockType8_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, SystemInformationBlockType8_eag_1_sequence); + + return offset; +} + + static const per_sequence_t SystemInformationBlockType8_sequence[] = { { &hf_lte_rrc_systemTimeInfo, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_SystemTimeInfoCDMA2000 }, { &hf_lte_rrc_searchWindowSize, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_INTEGER_0_15 }, { &hf_lte_rrc_parametersHRPD, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_parametersHRPD }, { &hf_lte_rrc_parameters1XRTT, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_parameters1XRTT }, { &hf_lte_rrc_lateNonCriticalExtension, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_OCTET_STRING }, - { &hf_lte_rrc_csfb_SupportForDualRxUEs_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_BOOLEAN }, - { &hf_lte_rrc_cellReselectionParametersHRPD_v920, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_CellReselectionParametersCDMA2000_v920 }, - { &hf_lte_rrc_cellReselectionParameters1XRTT_v920, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_CellReselectionParametersCDMA2000_v920 }, - { &hf_lte_rrc_csfb_RegistrationParam1XRTT_v920, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_CSFB_RegistrationParam1XRTT_v920 }, - { &hf_lte_rrc_ac_BarringConfig1XRTT_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_AC_BarringConfig1XRTT_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_SystemInformationBlockType8_eag_1 }, { NULL, 0, 0, NULL } }; @@ -7624,9 +7690,22 @@ dissect_lte_rrc_T_logicalChannelSR_Mask_r9(tvbuff_t *tvb _U_, int offset _U_, as } +static const per_sequence_t LogicalChannelConfig_eag_1_sequence[] = { + { &hf_lte_rrc_logicalChannelSR_Mask_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_logicalChannelSR_Mask_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_LogicalChannelConfig_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, LogicalChannelConfig_eag_1_sequence); + + return offset; +} + + static const per_sequence_t LogicalChannelConfig_sequence[] = { { &hf_lte_rrc_ul_SpecificParameters, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_ul_SpecificParameters }, - { &hf_lte_rrc_logicalChannelSR_Mask_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_logicalChannelSR_Mask_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_LogicalChannelConfig_eag_1 }, { NULL, 0, 0, NULL } }; @@ -8452,12 +8531,25 @@ dissect_lte_rrc_T_phr_Config(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx } +static const per_sequence_t MAC_MainConfig_eag_1_sequence[] = { + { &hf_lte_rrc_sr_ProhibitTimer_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_INTEGER_0_7 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_MAC_MainConfig_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, MAC_MainConfig_eag_1_sequence); + + return offset; +} + + static const per_sequence_t MAC_MainConfig_sequence[] = { { &hf_lte_rrc_ul_SCH_Config, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_ul_SCH_Config }, { &hf_lte_rrc_drx_Config , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_DRX_Config }, { &hf_lte_rrc_timeAlignmentTimerDedicated, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_TimeAlignmentTimer }, { &hf_lte_rrc_phr_Config , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_phr_Config }, - { &hf_lte_rrc_sr_ProhibitTimer_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_INTEGER_0_7 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_MAC_MainConfig_eag_1 }, { NULL, 0, 0, NULL } }; @@ -9566,6 +9658,20 @@ dissect_lte_rrc_AntennaInfoDedicated_v920(tvbuff_t *tvb _U_, int offset _U_, asn } +static const per_sequence_t PhysicalConfigDedicated_eag_1_sequence[] = { + { &hf_lte_rrc_cqi_ReportConfig_v920, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_CQI_ReportConfig_v920 }, + { &hf_lte_rrc_antennaInfo_v920, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_AntennaInfoDedicated_v920 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_PhysicalConfigDedicated_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, PhysicalConfigDedicated_eag_1_sequence); + + return offset; +} + + static const per_sequence_t PhysicalConfigDedicated_sequence[] = { { &hf_lte_rrc_pdsch_ConfigDedicated, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_PDSCH_ConfigDedicated }, { &hf_lte_rrc_pucch_ConfigDedicated, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_PUCCH_ConfigDedicated }, @@ -9577,8 +9683,7 @@ static const per_sequence_t PhysicalConfigDedicated_sequence[] = { { &hf_lte_rrc_soundingRS_UL_ConfigDedicated, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_SoundingRS_UL_ConfigDedicated }, { &hf_lte_rrc_antennaInfo , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_antennaInfo }, { &hf_lte_rrc_schedulingRequestConfig, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_SchedulingRequestConfig }, - { &hf_lte_rrc_cqi_ReportConfig_v920, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_CQI_ReportConfig_v920 }, - { &hf_lte_rrc_antennaInfo_v920, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_AntennaInfoDedicated_v920 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_PhysicalConfigDedicated_eag_1 }, { NULL, 0, 0, NULL } }; @@ -9739,6 +9844,19 @@ dissect_lte_rrc_RLF_TimersAndConstants_r9(tvbuff_t *tvb _U_, int offset _U_, asn } +static const per_sequence_t RadioResourceConfigDedicated_eag_1_sequence[] = { + { &hf_lte_rrc_rlf_TimersAndConstants_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_RLF_TimersAndConstants_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_RadioResourceConfigDedicated_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, RadioResourceConfigDedicated_eag_1_sequence); + + return offset; +} + + static const per_sequence_t RadioResourceConfigDedicated_sequence[] = { { &hf_lte_rrc_srb_ToAddModList, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_SRB_ToAddModList }, { &hf_lte_rrc_drb_ToAddModList, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_DRB_ToAddModList }, @@ -9746,7 +9864,7 @@ static const per_sequence_t RadioResourceConfigDedicated_sequence[] = { { &hf_lte_rrc_mac_MainConfig, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_mac_MainConfig }, { &hf_lte_rrc_sps_Config , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_SPS_Config }, { &hf_lte_rrc_physicalConfigDedicated, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_PhysicalConfigDedicated }, - { &hf_lte_rrc_rlf_TimersAndConstants_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_RLF_TimersAndConstants_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_RadioResourceConfigDedicated_eag_1 }, { NULL, 0, 0, NULL } }; @@ -11570,13 +11688,26 @@ dissect_lte_rrc_CSG_AllowedReportingCells_r9(tvbuff_t *tvb _U_, int offset _U_, } +static const per_sequence_t MeasObjectUTRA_eag_1_sequence[] = { + { &hf_lte_rrc_csg_allowedReportingCells_v930, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_CSG_AllowedReportingCells_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_MeasObjectUTRA_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, MeasObjectUTRA_eag_1_sequence); + + return offset; +} + + static const per_sequence_t MeasObjectUTRA_sequence[] = { { &hf_lte_rrc_carrierFreq_02, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_ARFCN_ValueUTRA }, { &hf_lte_rrc_offsetFreq , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_Q_OffsetRangeInterRAT }, { &hf_lte_rrc_cellsToRemoveList, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_CellIndexList }, { &hf_lte_rrc_cellsToAddModList_02, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_cellsToAddModList }, { &hf_lte_rrc_cellForWhichToReportCGI_03, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_cellForWhichToReportCGI }, - { &hf_lte_rrc_csg_allowedReportingCells_v930, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_CSG_AllowedReportingCells_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_MeasObjectUTRA_eag_1 }, { NULL, 0, 0, NULL } }; @@ -12118,6 +12249,20 @@ dissect_lte_rrc_T_ue_RxTxTimeDiffPeriodical_r9(tvbuff_t *tvb _U_, int offset _U_ } +static const per_sequence_t ReportConfigEUTRA_eag_1_sequence[] = { + { &hf_lte_rrc_si_RequestForHO_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_si_RequestForHO_r9 }, + { &hf_lte_rrc_ue_RxTxTimeDiffPeriodical_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_ue_RxTxTimeDiffPeriodical_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_ReportConfigEUTRA_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, ReportConfigEUTRA_eag_1_sequence); + + return offset; +} + + static const per_sequence_t ReportConfigEUTRA_sequence[] = { { &hf_lte_rrc_triggerType , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_triggerType }, { &hf_lte_rrc_triggerQuantity, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_triggerQuantity }, @@ -12125,8 +12270,7 @@ static const per_sequence_t ReportConfigEUTRA_sequence[] = { { &hf_lte_rrc_maxReportCells, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_INTEGER_1_maxCellReport }, { &hf_lte_rrc_reportInterval, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_ReportInterval }, { &hf_lte_rrc_reportAmount, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_reportAmount }, - { &hf_lte_rrc_si_RequestForHO_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_si_RequestForHO_r9 }, - { &hf_lte_rrc_ue_RxTxTimeDiffPeriodical_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_ue_RxTxTimeDiffPeriodical_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_ReportConfigEUTRA_eag_1 }, { NULL, 0, 0, NULL } }; @@ -12406,12 +12550,25 @@ dissect_lte_rrc_T_si_RequestForHO_r9_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ } +static const per_sequence_t ReportConfigInterRAT_eag_1_sequence[] = { + { &hf_lte_rrc_si_RequestForHO_r9_01, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_si_RequestForHO_r9_01 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_ReportConfigInterRAT_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, ReportConfigInterRAT_eag_1_sequence); + + return offset; +} + + static const per_sequence_t ReportConfigInterRAT_sequence[] = { { &hf_lte_rrc_triggerType_01, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_triggerType_01 }, { &hf_lte_rrc_maxReportCells, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_INTEGER_1_maxCellReport }, { &hf_lte_rrc_reportInterval, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_ReportInterval }, { &hf_lte_rrc_reportAmount_01, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_reportAmount_01 }, - { &hf_lte_rrc_si_RequestForHO_r9_01, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_si_RequestForHO_r9_01 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_ReportConfigInterRAT_eag_1 }, { NULL, 0, 0, NULL } }; @@ -15078,10 +15235,23 @@ dissect_lte_rrc_AdditionalSI_Info_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx } +static const per_sequence_t T_eag_1_sequence[] = { + { &hf_lte_rrc_additionalSI_Info_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_AdditionalSI_Info_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_T_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, T_eag_1_sequence); + + return offset; +} + + static const per_sequence_t T_measResult_sequence[] = { { &hf_lte_rrc_rsrpResult , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_RSRP_Range }, { &hf_lte_rrc_rsrqResult , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_RSRQ_Range }, - { &hf_lte_rrc_additionalSI_Info_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_AdditionalSI_Info_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_eag_1 }, { NULL, 0, 0, NULL } }; @@ -15188,10 +15358,23 @@ dissect_lte_rrc_T_cgi_Info_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act } +static const per_sequence_t T_eag_1_01_sequence[] = { + { &hf_lte_rrc_additionalSI_Info_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_AdditionalSI_Info_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_T_eag_1_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, T_eag_1_01_sequence); + + return offset; +} + + static const per_sequence_t T_measResult_01_sequence[] = { { &hf_lte_rrc_utra_RSCP , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_INTEGER_M5_91 }, { &hf_lte_rrc_utra_EcN0 , ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_INTEGER_0_49 }, - { &hf_lte_rrc_additionalSI_Info_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_AdditionalSI_Info_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_eag_1_01 }, { NULL, 0, 0, NULL } }; @@ -15473,11 +15656,24 @@ dissect_lte_rrc_MeasResultForECID_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx } +static const per_sequence_t MeasResults_eag_1_sequence[] = { + { &hf_lte_rrc_measResultForECID_r9, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_MeasResultForECID_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_MeasResults_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, MeasResults_eag_1_sequence); + + return offset; +} + + static const per_sequence_t MeasResults_sequence[] = { { &hf_lte_rrc_measId , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_MeasId }, { &hf_lte_rrc_measResultServCell, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_T_measResultServCell }, { &hf_lte_rrc_measResultNeighCells, ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_lte_rrc_T_measResultNeighCells }, - { &hf_lte_rrc_measResultForECID_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_MeasResultForECID_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_MeasResults_eag_1 }, { NULL, 0, 0, NULL } }; @@ -18754,6 +18950,20 @@ dissect_lte_rrc_T_sourceSystemInformationBlockType1Ext(tvbuff_t *tvb _U_, int of } +static const per_sequence_t AS_Config_eag_1_sequence[] = { + { &hf_lte_rrc_sourceSystemInformationBlockType1Ext, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_lte_rrc_T_sourceSystemInformationBlockType1Ext }, + { &hf_lte_rrc_sourceOtherConfig_r9, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_lte_rrc_OtherConfig_r9 }, + { NULL, 0, 0, NULL } +}; + +static int +dissect_lte_rrc_AS_Config_eag_1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + offset = dissect_per_sequence_eag(tvb, offset, actx, tree, AS_Config_eag_1_sequence); + + return offset; +} + + static const per_sequence_t AS_Config_sequence[] = { { &hf_lte_rrc_sourceMeasConfig, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_MeasConfig }, { &hf_lte_rrc_sourceRadioResourceConfig, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_RadioResourceConfigDedicated }, @@ -18764,8 +18974,7 @@ static const per_sequence_t AS_Config_sequence[] = { { &hf_lte_rrc_sourceSystemInformationBlockType2, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_SystemInformationBlockType2 }, { &hf_lte_rrc_antennaInfoCommon, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_AntennaInfoCommon }, { &hf_lte_rrc_sourceDl_CarrierFreq, ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_lte_rrc_ARFCN_ValueEUTRA }, - { &hf_lte_rrc_sourceSystemInformationBlockType1Ext, ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_lte_rrc_T_sourceSystemInformationBlockType1Ext }, - { &hf_lte_rrc_sourceOtherConfig_r9, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_OtherConfig_r9 }, + { &hf_lte_rrc_dummy_eag_field, ASN1_NOT_EXTENSION_ROOT, ASN1_NOT_OPTIONAL, dissect_lte_rrc_AS_Config_eag_1 }, { NULL, 0, 0, NULL } }; diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 4751f33648..d264d3a817 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -1802,6 +1802,7 @@ index_get_extension_name(const per_sequence_t *sequence, int idx) for(i=0;sequence[i].p_id;i++){ if(sequence[i].extension==ASN1_NOT_EXTENSION_ROOT){ if (idx == 0) { + if (*sequence[i].p_id == -1) return "extension addition group"; hfi = proto_registrar_get_nth(*sequence[i].p_id); return (hfi) ? hfi->name : "<unknown filed>"; } @@ -2011,6 +2012,57 @@ DEBUG_ENTRY("dissect_per_sequence"); return offset; } +guint32 +dissect_per_sequence_eag(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, const per_sequence_t *sequence) +{ + gboolean optional_field_flag; + guint32 i, num_opts; + guint32 optional_mask; + +DEBUG_ENTRY("dissect_per_sequence_eag"); + + num_opts=0; + for(i=0;sequence[i].p_id;i++){ + if(sequence[i].optional==ASN1_OPTIONAL){ + num_opts++; + } + } + + optional_mask=0; + for(i=0;i<num_opts;i++){ + offset=dissect_per_boolean(tvb, offset, actx, tree, hf_per_optional_field_bit, &optional_field_flag); + if (tree) { + proto_item_append_text(actx->created_item, " (%s %s present)", + index_get_optional_name(sequence, i), optional_field_flag?"is":"is NOT"); + } + if (!display_internal_per_fields) PROTO_ITEM_SET_HIDDEN(actx->created_item); + optional_mask<<=1; + if(optional_field_flag){ + optional_mask|=0x01; + } + } + + for(i=0;sequence[i].p_id;i++){ + if(sequence[i].optional==ASN1_OPTIONAL){ + gboolean is_present; + if (num_opts == 0){ + continue; + } + is_present=(1<<(num_opts-1))&optional_mask; + num_opts--; + if(!is_present){ + continue; + } + } + if(sequence[i].func){ + offset=sequence[i].func(tvb, offset, actx, tree, *sequence[i].p_id); + } else { + PER_NOT_DECODED_YET(index_get_field_name(sequence, i)); + } + } + + return offset; +} /* 15 Encoding the bitstring type diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h index 557f261a65..9bf5fb547c 100644 --- a/epan/dissectors/packet-per.h +++ b/epan/dissectors/packet-per.h @@ -107,6 +107,7 @@ extern guint32 dissect_per_real(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, extern guint32 dissect_per_choice(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gint ett_index, const per_choice_t *choice, gint *value); extern guint32 dissect_per_sequence(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *parent_tree, int hf_index, gint ett_index, const per_sequence_t *sequence); +extern guint32 dissect_per_sequence_eag(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, const per_sequence_t *sequence); extern guint32 dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, tvbuff_t **value_tvb); extern guint32 dissect_per_octet_string_containing_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, dissector_t type_cb); diff --git a/epan/libwireshark.def b/epan/libwireshark.def index a83a6f0cba..6529c77270 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -293,6 +293,7 @@ dissect_per_real dissect_per_restricted_character_string dissect_per_sequence_of dissect_per_sequence +dissect_per_sequence_eag dissect_per_set_of dissect_per_VisibleString dissect_q931_bearer_capability_ie diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py index 265c2e4e7f..362aacb529 100755 --- a/tools/asn2wrs.py +++ b/tools/asn2wrs.py @@ -142,6 +142,9 @@ oid_names = { '2/upu' : 40, } +ITEM_FIELD_NAME = '_item' +UNTAG_TYPE_NAME = '_untag' + def asn2c(id): return id.replace('-', '_').replace('.', '_').replace('&', '_') @@ -676,7 +679,7 @@ class EthCtx: ttype = type while (val.type == 'TaggedType'): val = val.val - ttype += '/_untag' + ttype += '/' + UNTAG_TYPE_NAME if (val.type != 'Type_Ref'): if (type != ttype): types.append(ttype) @@ -921,6 +924,7 @@ class EthCtx: self.type_imp.remove(ident) else: raise DuplicateError("type", ident) + val.ident = ident self.type[ident] = { 'val' : val, 'import' : None } self.type[ident]['module'] = self.Module() self.type[ident]['proto'] = self.proto @@ -1001,7 +1005,7 @@ class EthCtx: if self.remove_prefix and name.startswith(self.remove_prefix): name = name[len(self.remove_prefix):] - if len(ident.split('/')) > 1 and name == '_item': # Sequence/Set of type + if len(ident.split('/')) > 1 and name == ITEM_FIELD_NAME: # Sequence/Set of type if len(self.field[ident]['type'].split('/')) > 1: self.field[ident]['attr']['NAME'] = '"%s item"' % ident.split('/')[-2] self.field[ident]['attr']['ABBREV'] = asn2c(ident.split('/')[-2] + name) @@ -1022,6 +1026,10 @@ class EthCtx: if parent: self.eth_dep_add(parent, type) + def eth_dummy_eag_field_required(self): + if (not self.dummy_eag_field): + self.dummy_eag_field = 'dummy_eag_field' + #--- eth_clean -------------------------------------------------------------- def eth_clean(self): self.proto = self.proto_opt; @@ -1071,6 +1079,7 @@ class EthCtx: self.eth_hf_ord = [] self.eth_hfpdu_ord = [] self.eth_hf_dupl = {} + self.dummy_eag_field = None #--- type dependencies ------------------- self.eth_type_ord1 = [] self.eth_dep_cycle = [] @@ -1157,13 +1166,13 @@ class EthCtx: if ((nm.find('#') >= 0) or ((len(t.split('/'))>1) and (self.conform.get_fn_presence(t) or self.conform.check_item('FN_PARS', t) or - self.conform.get_fn_presence('/'.join((t,'_item'))) or self.conform.check_item('FN_PARS', '/'.join((t,'_item')))) and + self.conform.get_fn_presence('/'.join((t,ITEM_FIELD_NAME))) or self.conform.check_item('FN_PARS', '/'.join((t,ITEM_FIELD_NAME)))) and not self.conform.check_item('TYPE_RENAME', t))): - if len(t.split('/')) == 2 and t.split('/')[1] == '_item': # Sequence of type at the 1st level + if len(t.split('/')) == 2 and t.split('/')[1] == ITEM_FIELD_NAME: # Sequence of type at the 1st level nm = t.split('/')[0] + t.split('/')[1] - elif t.split('/')[-1] == '_item': # Sequence/Set of type at next levels + elif t.split('/')[-1] == ITEM_FIELD_NAME: # Sequence/Set of type at next levels nm = 'T_' + self.conform.use_item('FIELD_RENAME', '/'.join(t.split('/')[0:-1]), val_dflt=t.split('/')[-2]) + t.split('/')[-1] - elif t.split('/')[-1] == '_untag': # Untagged type + elif t.split('/')[-1] == UNTAG_TYPE_NAME: # Untagged type nm = self.type['/'.join(t.split('/')[0:-1])]['ethname'] + '_U' else: nm = 'T_' + self.conform.use_item('FIELD_RENAME', t, val_dflt=t.split('/')[-1]) @@ -1258,7 +1267,7 @@ class EthCtx: #--- fields ------------------------- for f in (self.pdu_ord + self.field_ord): - if len(f.split('/')) > 1 and f.split('/')[-1] == '_item': # Sequence/Set of type + if len(f.split('/')) > 1 and f.split('/')[-1] == ITEM_FIELD_NAME: # Sequence/Set of type nm = self.conform.use_item('FIELD_RENAME', '/'.join(f.split('/')[0:-1]), val_dflt=f.split('/')[-2]) + f.split('/')[-1] else: nm = f.split('/')[-1] @@ -1313,6 +1322,8 @@ class EthCtx: 'attr' : attr.copy(), 'ref' : [f]} self.field[f]['ethname'] = nm + if (self.dummy_eag_field): + self.dummy_eag_field = 'hf_%s_%s' % (self.eproto, self.dummy_eag_field) #--- type dependencies ------------------- (self.eth_type_ord1, self.eth_dep_cycle) = dependency_compute(self.type_ord, self.type_dep, map_fn = lambda t: self.type[t]['ethname'], ignore_fn = lambda t: self.type[t]['import']) i = 0 @@ -1544,6 +1555,8 @@ class EthCtx: fx.write('/* named bits */\n') for nb in self.named_bit: fx.write("static int %s = -1;\n" % (nb['ethname'])) + if (self.dummy_eag_field): + fx.write("static int %s = -1; /* never registered */ \n" % (self.dummy_eag_field)) self.output.file_close(fx) #--- eth_output_hf_arr ------------------------------------------------------ @@ -3101,6 +3114,9 @@ class Type (Node): def eth_strings(self): return 'NULL' + def eth_omit_field(self): + return False + def eth_need_tree(self): return False @@ -3181,7 +3197,7 @@ class Type (Node): self.eth_reg_sub(vnm, ectx) if parent and (ectx.type[parent]['val'].type == 'TaggedType'): ectx.type[parent]['val'].eth_set_val_name(parent, trnm, ectx) - if ident and not tagflag: + if ident and not tagflag and not self.eth_omit_field(): ectx.eth_reg_field(nm, trnm, idx=idx, parent=parent, impl=self.HasImplicitTag(ectx)) if ectx.conform.check_item('SET_TYPE', nm): virtual_tr.eth_reg_sub(nm, ectx) @@ -3782,7 +3798,7 @@ class TaggedType (Type): ectx.eth_dep_add(ident, self.val_name) def eth_reg_sub(self, ident, ectx): - self.val_name = ident + '/' + '_untag' + self.val_name = ident + '/' + UNTAG_TYPE_NAME self.val.eth_reg(self.val_name, ectx, tstrip=self.tstrip+1, tagflag=True, parent=ident) def GetTTag(self, ectx): @@ -3817,11 +3833,13 @@ class TaggedType (Type): #--- SqType ----------------------------------------------------------- class SqType (Type): def out_item(self, f, val, optional, ext, ectx): - ef = ectx.field[f]['ethname'] - t = ectx.eth_hf[ef]['ethtype'] - efd = ef - if (ectx.Ber() and ectx.field[f]['impl']): - efd += '_impl' + if (val.eth_omit_field()): + t = ectx.type[val.ident]['ethname'] + fullname = ectx.dummy_eag_field + else: + ef = ectx.field[f]['ethname'] + t = ectx.eth_hf[ef]['ethtype'] + fullname = ectx.eth_hf[ef]['fullname'] if (ectx.Ber()): #print "optional=%s, e.val.HasOwnTag()=%s, e.val.IndetermTag()=%s" % (str(e.optional), str(e.val.HasOwnTag()), str(e.val.IndetermTag(ectx))) #print val.str_depth(1) @@ -3846,10 +3864,10 @@ class SqType (Type): if (ectx.Ber()): (tc, tn) = val.GetTag(ectx) out = ' { %-24s, %-13s, %s, %s, dissect_%s_%s },\n' \ - % ('&'+ectx.eth_hf[ef]['fullname'], tc, tn, opt, ectx.eth_type[t]['proto'], t) + % ('&'+fullname, tc, tn, opt, ectx.eth_type[t]['proto'], t) elif (ectx.Per()): out = ' { %-24s, %-23s, %-17s, dissect_%s_%s },\n' \ - % ('&'+ectx.eth_hf[ef]['fullname'], ext, opt, ectx.eth_type[t]['proto'], t) + % ('&'+fullname, ext, opt, ectx.eth_type[t]['proto'], t) else: out = '' return out @@ -3913,6 +3931,27 @@ class SeqType (SqType): else: ectx.eth_comp_req(ident) return + # extension addition groups + if hasattr(self, 'ext_list'): + if (ectx.Per()): # add names + eag_num = 1 + for e in (self.ext_list): + if isinstance(e.val, ExtensionAdditionGroup): + e.val.parent_ident = ident + e.val.parent_tname = ectx.type[ident]['tname'] + if (e.val.ver): + e.val.SetName("eag_v%s" % (e.val.ver)) + else: + e.val.SetName("eag_%d" % (eag_num)) + eag_num += 1; + else: # expand + new_ext_list = [] + for e in (self.ext_list): + if isinstance(e.val, ExtensionAdditionGroup): + new_ext_list.extend(e.val.elt_list) + else: + new_ext_list.append(e) + self.ext_list = new_ext_list # do autotag if autotag: atag = 0 @@ -3927,14 +3966,15 @@ class SeqType (SqType): for e in (self.ext_list): e.val.AddTag(Tag(cls = 'CONTEXT', num = str(atag), mode = 'IMPLICIT')) atag += 1 + # register components for e in (self.elt_list): - e.val.eth_reg(ident, ectx, tstrip=1, parent=ident) + e.val.eth_reg(ident, ectx, tstrip=1, parent=ident) if hasattr(self, 'ext_list'): - for e in (self.ext_list): - e.val.eth_reg(ident, ectx, tstrip=1, parent=ident) + 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) + for e in (self.elt_list2): + e.val.eth_reg(ident, ectx, tstrip=1, parent=ident) def eth_type_default_table(self, ectx, tname): #print "eth_type_default_table(tname='%s')" % (tname) @@ -3972,7 +4012,7 @@ class SeqOfType (SqType): if self.val.IsNamed (): f = fname + '/' + self.val.name else: - f = fname + '/' + '_item' + f = fname + '/' + ITEM_FIELD_NAME table = "static const %(ER)s_sequence_t %(TABLE)s[1] = {\n" table += self.out_item(f, self.val, False, 'ASN1_NO_EXTENSIONS', ectx) table += "};\n" @@ -3993,7 +4033,7 @@ class SequenceOfType (SeqOfType): def eth_reg_sub(self, ident, ectx): itmnm = ident if not self.val.IsNamed (): - itmnm += '/' + '_item' + itmnm += '/' + ITEM_FIELD_NAME self.val.eth_reg(itmnm, ectx, tstrip=1, idx='[##]', parent=ident) def eth_tname(self): @@ -4050,7 +4090,7 @@ class SetOfType (SeqOfType): def eth_reg_sub(self, ident, ectx): itmnm = ident if not self.val.IsNamed (): - itmnm += '/' + '_item' + itmnm += '/' + ITEM_FIELD_NAME self.val.eth_reg(itmnm, ectx, tstrip=1, idx='(##)', parent=ident) def eth_tname(self): @@ -4180,8 +4220,43 @@ class SequenceType (SeqType): body = '#error Can not decode %s' % (tname) return body +#--- ExtensionAdditionGroup --------------------------------------------------- +class ExtensionAdditionGroup (SeqType): + def __init__(self,*args, **kw) : + self.parent_ident = None + self.parent_tname = None + SeqType.__init__ (self,*args, **kw) + + def eth_omit_field(self): + return True + + def eth_tname(self): + if (self.parent_tname and self.IsNamed()): + return self.parent_tname + "_" + self.name + else: + return SeqType.eth_tname(self) + + def eth_reg_sub(self, ident, ectx): + ectx.eth_dummy_eag_field_required() + ectx.eth_dep_add(self.parent_ident, ident) + SeqType.eth_reg_sub(self, ident, ectx) + + def eth_type_default_pars(self, ectx, tname): + pars = Type.eth_type_default_pars(self, ectx, tname) + pars['TABLE'] = '%(PROTOP)s%(TNAME)s_sequence' + return pars + + def eth_type_default_body(self, ectx, tname): + if (ectx.Per()): + body = ectx.eth_fn_call('dissect_%(ER)s_sequence_eag', ret='offset', + par=(('%(TVB)s', '%(OFFSET)s', '%(ACTX)s', '%(TREE)s', '%(TABLE)s',),)) + else: + body = '#error Can not decode %s' % (tname) + return body + + #--- SetType ------------------------------------------------------------------ -class SetType(SeqType): +class SetType (SeqType): def eth_need_tree(self): return True @@ -4410,9 +4485,6 @@ class ChoiceType (Type): f = fname + '/' + e.name ef = ectx.field[f]['ethname'] t = ectx.eth_hf[ef]['ethtype'] - efd = ef - if (ectx.field[f]['impl']): - efd += '_impl' if (ectx.Ber()): opt = '' if (not e.HasOwnTag()): @@ -6065,29 +6137,30 @@ def p_ExtensionEndMarker (t): def p_ExtensionAdditionList_1 (t): 'ExtensionAdditionList : COMMA ExtensionAddition' - t[0] = t[2] + t[0] = [t[2]] def p_ExtensionAdditionList_2 (t): 'ExtensionAdditionList : ExtensionAdditionList COMMA ExtensionAddition' - t[0] = t[1] + t[3] + t[0] = t[1] + [t[3]] def p_ExtensionAddition_1 (t): 'ExtensionAddition : ExtensionAdditionGroup' - t[0] = t[1] + t[0] = Node ('elt_type', val = t[1], optional = 0) def p_ExtensionAddition_2 (t): 'ExtensionAddition : ComponentType' - t[0] = [t[1]] + t[0] = t[1] def p_ExtensionAdditionGroup (t): 'ExtensionAdditionGroup : LVERBRACK VersionNumber ComponentTypeList RVERBRACK' - t[0] = t[3] + t[0] = ExtensionAdditionGroup (ver = t[2], elt_list = t[3]) def p_VersionNumber_1 (t): 'VersionNumber : ' def p_VersionNumber_2 (t): 'VersionNumber : NUMBER COLON' + t[0] = t[1] def p_ComponentTypeList_1 (t): 'ComponentTypeList : ComponentType' |