From 68ba60774f8e055da60352cb710e02817546ca52 Mon Sep 17 00:00:00 2001 From: John Thacker Date: Tue, 30 Mar 2021 21:39:49 -0400 Subject: Prettify and standardize LAC, RAC, SAC, TAC in several ASN.1 dissectors The LAC, RAC, SAC, and TAC tend to be defined in ASN.1 as OCTET STRINGS of lengths 1, 2, or 3. It generally makes sense to dissect them as FT_UINT[8,16,24], as appropriate, with BASE_DEC_HEX instead of as FT_BYTES, so standardize on that. See commit d6f91a7ca421caa7787c1539bca61f943923fa9c for similar work for S1AP. --- epan/dissectors/packet-rnsap.c | 57 ++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 13 deletions(-) (limited to 'epan/dissectors/packet-rnsap.c') diff --git a/epan/dissectors/packet-rnsap.c b/epan/dissectors/packet-rnsap.c index 7cdea464f1..b44238d141 100644 --- a/epan/dissectors/packet-rnsap.c +++ b/epan/dissectors/packet-rnsap.c @@ -7887,7 +7887,6 @@ dissect_rnsap_TransportLayerAddress(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_ - return offset; } @@ -9691,8 +9690,16 @@ dissect_rnsap_RNC_ID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, pr static int dissect_rnsap_LAC(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - 2, 2, FALSE, NULL); +#line 217 "./asn1/rnsap/rnsap.cnf" + tvbuff_t *parameter_tvb = NULL; + offset = dissect_per_octet_string(tvb, offset, actx, tree, -1, + 2, 2, FALSE, ¶meter_tvb); + + if (parameter_tvb) { + actx->created_item = proto_tree_add_item(tree, hf_index, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + + return offset; } @@ -9701,8 +9708,16 @@ dissect_rnsap_LAC(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto static int dissect_rnsap_RAC(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - 1, 1, FALSE, NULL); +#line 226 "./asn1/rnsap/rnsap.cnf" + tvbuff_t *parameter_tvb = NULL; + offset = dissect_per_octet_string(tvb, offset, actx, tree, -1, + 1, 1, FALSE, ¶meter_tvb); + + if (parameter_tvb) { + actx->created_item = proto_tree_add_item(tree, hf_index, parameter_tvb, 0, 1, ENC_BIG_ENDIAN); + } + + return offset; } @@ -28942,8 +28957,16 @@ dissect_rnsap_Rx_Timing_Deviation_Value_768(tvbuff_t *tvb _U_, int offset _U_, a static int dissect_rnsap_SAC(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - 2, 2, FALSE, NULL); +#line 235 "./asn1/rnsap/rnsap.cnf" + tvbuff_t *parameter_tvb = NULL; + offset = dissect_per_octet_string(tvb, offset, actx, tree, -1, + 2, 2, FALSE, ¶meter_tvb); + + if (parameter_tvb) { + actx->created_item = proto_tree_add_item(tree, hf_index, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + + return offset; } @@ -29914,8 +29937,16 @@ dissect_rnsap_SYNC_UL_ProcParameters(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx static int dissect_rnsap_TAC(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - 2, 2, FALSE, NULL); +#line 244 "./asn1/rnsap/rnsap.cnf" + tvbuff_t *parameter_tvb = NULL; + offset = dissect_per_octet_string(tvb, offset, actx, tree, -1, + 2, 2, FALSE, ¶meter_tvb); + + if (parameter_tvb) { + actx->created_item = proto_tree_add_item(tree, hf_index, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + + return offset; } @@ -50939,7 +50970,7 @@ void proto_register_rnsap(void) { NULL, HFILL }}, { &hf_rnsap_TAC_PDU, { "TAC", "rnsap.TAC", - FT_BYTES, BASE_NONE, NULL, 0, + FT_UINT16, BASE_DEC_HEX, NULL, 0, NULL, HFILL }}, { &hf_rnsap_TargetID_PDU, { "TargetID", "rnsap.TargetID_element", @@ -53187,11 +53218,11 @@ void proto_register_rnsap(void) { NULL, HFILL }}, { &hf_rnsap_lAC, { "lAC", "rnsap.lAC", - FT_BYTES, BASE_NONE, NULL, 0, + FT_UINT16, BASE_DEC_HEX, NULL, 0, NULL, HFILL }}, { &hf_rnsap_rAC, { "rAC", "rnsap.rAC", - FT_BYTES, BASE_NONE, NULL, 0, + FT_UINT8, BASE_DEC_HEX, NULL, 0, NULL, HFILL }}, { &hf_rnsap_aNR_FDD_CellInformation, { "aNR-FDD-CellInformation", "rnsap.aNR_FDD_CellInformation_element", @@ -58643,7 +58674,7 @@ void proto_register_rnsap(void) { "INTEGER_0_100", HFILL }}, { &hf_rnsap_sAC, { "sAC", "rnsap.sAC", - FT_BYTES, BASE_NONE, NULL, 0, + FT_UINT16, BASE_DEC_HEX, NULL, 0, NULL, HFILL }}, { &hf_rnsap_SecondaryServingCells_item, { "SecondaryServingCellsItem", "rnsap.SecondaryServingCellsItem_element", -- cgit v1.2.3