Skip to content

Commit

Permalink
Try to differentiate a non filled private_data (pointer set to NULL) …
Browse files Browse the repository at this point in the history
…from an enum with value = 0

svn path=/trunk/; revision=50837
  • Loading branch information
pquantin committed Jul 23, 2013
1 parent a74c353 commit 802e7be
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 80 deletions.
54 changes: 23 additions & 31 deletions asn1/lte-rrc/lte-rrc.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ SI-OrPSI-GERAN TYPE_PREFIX
#.FN_BODY RAT-Type VAL_PTR = &rat_type
guint32 rat_type;
%(DEFAULT_BODY)s
actx->private_data = GUINT_TO_POINTER(rat_type);
actx->private_data = GUINT_TO_POINTER(rat_type+1);

#RAT-Type ::= ENUMERATED {
# eutra, utra, geran-cs, geran-ps, cdma2000-1XRTT,
Expand Down Expand Up @@ -127,7 +127,7 @@ if(ue_cap_tvb){
guint8 byte;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_UE_CapabilityRAT_Container);
if (actx->private_data) {
switch(GPOINTER_TO_UINT(actx->private_data)){
switch(GPOINTER_TO_UINT(actx->private_data)-1){
case RAT_Type_eutra:
/* eutra */
dissect_lte_rrc_UE_EUTRA_Capability_PDU(ue_cap_tvb, actx->pinfo, subtree, NULL);
Expand Down Expand Up @@ -232,7 +232,7 @@ if(ue_cap_tvb){
#.FN_BODY Handover/targetRAT-Type VAL_PTR = &target_rat_type
guint32 target_rat_type;
%(DEFAULT_BODY)s
actx->private_data = GUINT_TO_POINTER(target_rat_type);
actx->private_data = GUINT_TO_POINTER(target_rat_type+1);

#.FN_BODY Handover/targetRAT-MessageContainer VAL_PTR = &target_rat_msg_cont_tvb
tvbuff_t *target_rat_msg_cont_tvb = NULL;
Expand All @@ -242,7 +242,7 @@ if(ue_cap_tvb){
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_targetRAT_MessageContainer);
if (actx->private_data) {
switch(GPOINTER_TO_UINT(actx->private_data)){
switch(GPOINTER_TO_UINT(actx->private_data)-1){
case T_targetRAT_Type_utra:
/* utra */
if (rrc_irat_ho_to_utran_cmd_handle)
Expand Down Expand Up @@ -301,10 +301,10 @@ if(ue_cap_tvb){
#.FN_BODY SI-OrPSI-GERAN VAL_PTR = &si_or_psi_geran
guint32 si_or_psi_geran;
%(DEFAULT_BODY)s
actx->private_data = GUINT_TO_POINTER(si_or_psi_geran);
actx->private_data = GUINT_TO_POINTER(si_or_psi_geran+1);

#.FN_BODY CellInfoGERAN-r9
actx->private_data = GUINT_TO_POINTER(SI_OrPSI_GERAN_si); /* SI message */
actx->private_data = GUINT_TO_POINTER(SI_OrPSI_GERAN_si+1); /* SI message */
%(DEFAULT_BODY)s

#.FN_BODY SystemInfoListGERAN/_item VAL_PTR = &sys_info_list_tvb
Expand All @@ -314,7 +314,7 @@ if(ue_cap_tvb){
if (sys_info_list_tvb) {
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_siPsiSibContainer);
if (actx->private_data) {
switch (GPOINTER_TO_UINT(actx->private_data)) {
switch (GPOINTER_TO_UINT(actx->private_data)-1) {
case SI_OrPSI_GERAN_si:
/* SI message */
if (gsm_a_dtap_handle) {
Expand Down Expand Up @@ -553,7 +553,7 @@ SystemInformationBlockType11/messageIdentifier TYPE=FT_UINT16 DISPLAY=BASE_DEC|B
#.FN_FTR SystemInformationBlockType11/serialNumber
if (serial_nb_tvb) {
proto_tree *subtree;
actx->private_data = GUINT_TO_POINTER((actx->private_data ? GPOINTER_TO_UINT(actx->private_data) : 0) | tvb_get_ntohs(serial_nb_tvb, 0));
actx->private_data = GUINT_TO_POINTER(GPOINTER_TO_UINT(actx->private_data) | tvb_get_ntohs(serial_nb_tvb, 0));
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_serialNumber);
proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_gs, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_msg_code, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN);
Expand All @@ -570,10 +570,8 @@ SystemInformationBlockType11/messageIdentifier TYPE=FT_UINT16 DISPLAY=BASE_DEC|B
guint32 dataCodingScheme;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme);
dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0);
if (actx->private_data) {
g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data,
GUINT_TO_POINTER(dataCodingScheme));
}
g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data,
GUINT_TO_POINTER(dataCodingScheme));
}

#.FN_BODY SystemInformationBlockType11/warningMessageSegment VAL_PTR=&warning_msg_seg_tvb
Expand All @@ -582,13 +580,11 @@ SystemInformationBlockType11/messageIdentifier TYPE=FT_UINT16 DISPLAY=BASE_DEC|B
%(DEFAULT_BODY)s

#.FN_FTR SystemInformationBlockType11/warningMessageSegment
if (actx->private_data) {
p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data);
if (warning_msg_seg_tvb && p_dcs) {
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}
p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data);
if (warning_msg_seg_tvb && p_dcs) {
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}

#.TYPE_ATTR
Expand All @@ -611,7 +607,7 @@ SystemInformationBlockType12-r9/messageIdentifier-r9 TYPE=FT_UINT16 DISPLAY=BASE
#.FN_FTR SystemInformationBlockType12-r9/serialNumber-r9
if (serial_nb_tvb) {
proto_tree *subtree;
actx->private_data = GUINT_TO_POINTER((actx->private_data ? GPOINTER_TO_UINT(actx->private_data) : 0) | tvb_get_ntohs(serial_nb_tvb, 0));
actx->private_data = GUINT_TO_POINTER(GPOINTER_TO_UINT(actx->private_data) | tvb_get_ntohs(serial_nb_tvb, 0));
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_serialNumber);
proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_gs, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_msg_code, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN);
Expand All @@ -628,10 +624,8 @@ SystemInformationBlockType12-r9/messageIdentifier-r9 TYPE=FT_UINT16 DISPLAY=BASE
guint32 dataCodingScheme;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme);
dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0);
if (actx->private_data) {
g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data,
GUINT_TO_POINTER(dataCodingScheme));
}
g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data,
GUINT_TO_POINTER(dataCodingScheme));
}

#.FN_BODY SystemInformationBlockType12-r9/warningMessageSegment-r9 VAL_PTR=&warning_msg_seg_tvb
Expand All @@ -640,13 +634,11 @@ SystemInformationBlockType12-r9/messageIdentifier-r9 TYPE=FT_UINT16 DISPLAY=BASE
%(DEFAULT_BODY)s

#.FN_FTR SystemInformationBlockType12-r9/warningMessageSegment-r9
if (actx->private_data) {
p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data);
if (warning_msg_seg_tvb && p_dcs) {
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}
p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data);
if (warning_msg_seg_tvb && p_dcs) {
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}

#.TYPE_ATTR
Expand Down
18 changes: 9 additions & 9 deletions asn1/rrc/rrc.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -657,22 +657,22 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
#.FN_BODY CN-DomainIdentity VAL_PTR = &nas_sys_info_gsm_map
guint32 nas_sys_info_gsm_map;
%(DEFAULT_BODY)s
actx->private_data = GUINT_TO_POINTER(nas_sys_info_gsm_map);
actx->private_data = GUINT_TO_POINTER(nas_sys_info_gsm_map+1);

#.FN_BODY CN-InformationInfo/cn-CommonGSM-MAP-NAS-SysInfo
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON);
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON+1);
%(DEFAULT_BODY)s

#.FN_BODY CN-InformationInfo-r6/cn-CommonGSM-MAP-NAS-SysInfo
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON);
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON+1);
%(DEFAULT_BODY)s

#.FN_BODY CN-InformationInfoFull/cn-CommonGSM-MAP-NAS-SysInfo
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON);
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON+1);
%(DEFAULT_BODY)s

#.FN_BODY SysInfoType1/cn-CommonGSM-MAP-NAS-SysInfo
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON);
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON+1);
%(DEFAULT_BODY)s

#.FN_BODY NAS-SystemInformationGSM-MAP VAL_PTR = &nas_sys_info_gsm_map_tvb
Expand All @@ -685,7 +685,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
length = tvb_length(nas_sys_info_gsm_map_tvb);
if (length) {
if (actx->private_data) {
switch (GPOINTER_TO_UINT(actx->private_data)) {
switch (GPOINTER_TO_UINT(actx->private_data)-1) {
case RRC_NAS_SYS_INFO_CN_COMMON:
item = proto_tree_add_text(tree, nas_sys_info_gsm_map_tvb, 0, length, "CN Common GSM-MAP NAS system information");
subtree = proto_item_add_subtree(item, ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo);
Expand Down Expand Up @@ -814,7 +814,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
}
/*Retrieve the start value for the two ciphering domains*/
if (actx->private_data) {
switch(GPOINTER_TO_UINT(actx->private_data)){
switch(GPOINTER_TO_UINT(actx->private_data)-1){
case RRC_NAS_SYS_INFO_CS:
/*
g_warning("Not implemented");
Expand Down Expand Up @@ -895,11 +895,11 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
%(DEFAULT_BODY)s

#.FN_BODY UE-SecurityInformation
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CS);
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CS+1);
%(DEFAULT_BODY)s

#.FN_BODY UE-SecurityInformation2
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_PS);
actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_PS+1);
%(DEFAULT_BODY)s

#.END
Expand Down
54 changes: 23 additions & 31 deletions epan/dissectors/packet-lte-rrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9216,7 +9216,7 @@ dissect_lte_rrc_T_serialNumber_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t

if (serial_nb_tvb) {
proto_tree *subtree;
actx->private_data = GUINT_TO_POINTER((actx->private_data ? GPOINTER_TO_UINT(actx->private_data) : 0) | tvb_get_ntohs(serial_nb_tvb, 0));
actx->private_data = GUINT_TO_POINTER(GPOINTER_TO_UINT(actx->private_data) | tvb_get_ntohs(serial_nb_tvb, 0));
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_serialNumber);
proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_gs, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_msg_code, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN);
Expand Down Expand Up @@ -9253,13 +9253,11 @@ dissect_lte_rrc_T_warningMessageSegment(tvbuff_t *tvb _U_, int offset _U_, asn1_



if (actx->private_data) {
p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data);
if (warning_msg_seg_tvb && p_dcs) {
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}
p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data);
if (warning_msg_seg_tvb && p_dcs) {
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}

return offset;
Expand All @@ -9280,10 +9278,8 @@ dissect_lte_rrc_T_dataCodingScheme(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
guint32 dataCodingScheme;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme);
dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0);
if (actx->private_data) {
g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data,
GUINT_TO_POINTER(dataCodingScheme));
}
g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data,
GUINT_TO_POINTER(dataCodingScheme));
}

return offset;
Expand Down Expand Up @@ -9342,7 +9338,7 @@ dissect_lte_rrc_T_serialNumber_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t

if (serial_nb_tvb) {
proto_tree *subtree;
actx->private_data = GUINT_TO_POINTER((actx->private_data ? GPOINTER_TO_UINT(actx->private_data) : 0) | tvb_get_ntohs(serial_nb_tvb, 0));
actx->private_data = GUINT_TO_POINTER(GPOINTER_TO_UINT(actx->private_data) | tvb_get_ntohs(serial_nb_tvb, 0));
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_serialNumber);
proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_gs, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_msg_code, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN);
Expand Down Expand Up @@ -9379,13 +9375,11 @@ dissect_lte_rrc_T_warningMessageSegment_r9(tvbuff_t *tvb _U_, int offset _U_, as



if (actx->private_data) {
p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data);
if (warning_msg_seg_tvb && p_dcs) {
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}
p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data);
if (warning_msg_seg_tvb && p_dcs) {
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}

return offset;
Expand All @@ -9406,10 +9400,8 @@ dissect_lte_rrc_T_dataCodingScheme_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ct
guint32 dataCodingScheme;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme);
dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0);
if (actx->private_data) {
g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data,
GUINT_TO_POINTER(dataCodingScheme));
}
g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data,
GUINT_TO_POINTER(dataCodingScheme));
}

return offset;
Expand Down Expand Up @@ -18866,7 +18858,7 @@ dissect_lte_rrc_T_targetRAT_Type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *
offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
8, &target_rat_type, TRUE, 0, NULL);

actx->private_data = GUINT_TO_POINTER(target_rat_type);
actx->private_data = GUINT_TO_POINTER(target_rat_type+1);


return offset;
Expand All @@ -18885,7 +18877,7 @@ dissect_lte_rrc_T_targetRAT_MessageContainer(tvbuff_t *tvb _U_, int offset _U_,
proto_tree *subtree;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_targetRAT_MessageContainer);
if (actx->private_data) {
switch(GPOINTER_TO_UINT(actx->private_data)){
switch(GPOINTER_TO_UINT(actx->private_data)-1){
case T_targetRAT_Type_utra:
/* utra */
if (rrc_irat_ho_to_utran_cmd_handle)
Expand Down Expand Up @@ -18954,7 +18946,7 @@ dissect_lte_rrc_SystemInfoListGERAN_item(tvbuff_t *tvb _U_, int offset _U_, asn1
if (sys_info_list_tvb) {
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_siPsiSibContainer);
if (actx->private_data) {
switch (GPOINTER_TO_UINT(actx->private_data)) {
switch (GPOINTER_TO_UINT(actx->private_data)-1) {
case SI_OrPSI_GERAN_si:
/* SI message */
if (gsm_a_dtap_handle) {
Expand Down Expand Up @@ -19012,7 +19004,7 @@ dissect_lte_rrc_SI_OrPSI_GERAN(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac
ett_lte_rrc_SI_OrPSI_GERAN, SI_OrPSI_GERAN_choice,
&si_or_psi_geran);

actx->private_data = GUINT_TO_POINTER(si_or_psi_geran);
actx->private_data = GUINT_TO_POINTER(si_or_psi_geran+1);


return offset;
Expand Down Expand Up @@ -23227,7 +23219,7 @@ static const per_sequence_t CellInfoGERAN_r9_sequence[] = {

static int
dissect_lte_rrc_CellInfoGERAN_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
actx->private_data = GUINT_TO_POINTER(SI_OrPSI_GERAN_si); /* SI message */
actx->private_data = GUINT_TO_POINTER(SI_OrPSI_GERAN_si+1); /* SI message */
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_lte_rrc_CellInfoGERAN_r9, CellInfoGERAN_r9_sequence);

Expand Down Expand Up @@ -23741,7 +23733,7 @@ dissect_lte_rrc_RAT_Type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_
offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
8, &rat_type, TRUE, 0, NULL);

actx->private_data = GUINT_TO_POINTER(rat_type);
actx->private_data = GUINT_TO_POINTER(rat_type+1);



Expand Down Expand Up @@ -27359,7 +27351,7 @@ if(ue_cap_tvb){
guint8 byte;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_UE_CapabilityRAT_Container);
if (actx->private_data) {
switch(GPOINTER_TO_UINT(actx->private_data)){
switch(GPOINTER_TO_UINT(actx->private_data)-1){
case RAT_Type_eutra:
/* eutra */
dissect_lte_rrc_UE_EUTRA_Capability_PDU(ue_cap_tvb, actx->pinfo, subtree, NULL);
Expand Down
Loading

0 comments on commit 802e7be

Please sign in to comment.