diff --git a/epan/dissectors/packet-oran.c b/epan/dissectors/packet-oran.c index d6c4388df3..bedfa5ab48 100644 --- a/epan/dissectors/packet-oran.c +++ b/epan/dissectors/packet-oran.c @@ -167,6 +167,7 @@ static expert_field ei_oran_invalid_sample_bit_width = EI_INIT; static expert_field ei_oran_reserved_numBundPrb = EI_INIT; static expert_field ei_oran_extlen_wrong = EI_INIT; static expert_field ei_oran_extlen_zero = EI_INIT; +static expert_field ei_oran_invalid_eaxc_bit_width = EI_INIT; /* These are the message types handled by this dissector */ @@ -175,6 +176,11 @@ static expert_field ei_oran_extlen_zero = EI_INIT; /* Preference settings. */ +static guint pref_du_port_id_bits = 2; +static guint pref_bandsector_id_bits = 6; +static guint pref_cc_id_bits = 4; +static guint pref_ru_port_id_bits = 4; + static guint pref_sample_bit_width_uplink = 14; static guint pref_sample_bit_width_downlink = 14; @@ -486,23 +492,34 @@ addPcOrRtcid(tvbuff_t *tvb, proto_tree *tree, gint *offset, const char *name) /* Subtree */ proto_item *item; proto_tree *oran_pcid_tree = proto_tree_add_subtree(tree, tvb, *offset, 2, ett_oran_ecpri_pcid, &item, name); - guint32 duPortId, aCellId, ccId, ruPortId = 0; + guint64 duPortId, bandSectorId, ccId, ruPortId = 0; gint id_offset = *offset; - /* DU Port ID */ - proto_tree_add_item_ret_uint(oran_pcid_tree, hf_oran_du_port_id, tvb, *offset, 1, ENC_NA, &duPortId); - /* BandSector ID */ - proto_tree_add_item_ret_uint(oran_pcid_tree, hf_oran_bandsector_id, tvb, *offset, 1, ENC_NA, &aCellId); - *offset += 1; - /* CC ID */ - proto_tree_add_item_ret_uint(oran_pcid_tree, hf_oran_cc_id, tvb, *offset, 1, ENC_NA, &ccId); - /* RU Port ID */ - proto_tree_add_item_ret_uint(oran_pcid_tree, hf_oran_ru_port_id, tvb, *offset, 1, ENC_NA, &ruPortId); - *offset += 1; + if (!((pref_du_port_id_bits > 0) && (pref_bandsector_id_bits > 0) && (pref_cc_id_bits > 0) && (pref_ru_port_id_bits > 0) && ((pref_du_port_id_bits + pref_bandsector_id_bits + pref_cc_id_bits + pref_ru_port_id_bits) == 16))) { + expert_add_info(NULL, tree, &ei_oran_invalid_eaxc_bit_width); + *offset += 2; + return; + } - proto_item_append_text(item, " (DU_Port_ID: %d, A_Cell_ID: %d, CC_ID: %d, RU_Port_ID: %d)", duPortId, aCellId, ccId, ruPortId); + guint bit_offset = *offset * 8; + + /* DU Port ID */ + proto_tree_add_bits_ret_val(oran_pcid_tree, hf_oran_du_port_id, tvb, bit_offset, pref_du_port_id_bits, &duPortId, ENC_BIG_ENDIAN); + bit_offset += pref_du_port_id_bits; + /* BandSector ID */ + proto_tree_add_bits_ret_val(oran_pcid_tree, hf_oran_bandsector_id, tvb, bit_offset, pref_bandsector_id_bits, &bandSectorId, ENC_BIG_ENDIAN); + bit_offset += pref_bandsector_id_bits; + /* CC ID */ + proto_tree_add_bits_ret_val(oran_pcid_tree, hf_oran_cc_id, tvb, bit_offset, pref_cc_id_bits, &ccId, ENC_BIG_ENDIAN); + bit_offset += pref_cc_id_bits; + /* RU Port ID */ + proto_tree_add_bits_ret_val(oran_pcid_tree, hf_oran_ru_port_id, tvb, bit_offset, pref_ru_port_id_bits, &ruPortId, ENC_BIG_ENDIAN); + bit_offset += pref_ru_port_id_bits; + *offset += 2; + + proto_item_append_text(item, " (DU_Port_ID: %d, BandSector_ID: %d, CC_ID: %d, RU_Port_ID: %d)", (int)duPortId, (int)bandSectorId, (int)ccId, (int)ruPortId); char id[16]; - snprintf(id, 16, "%1x:%2.2x:%1x:%1x", duPortId, aCellId, ccId, ruPortId); + snprintf(id, 16, "%x:%x:%x:%x", (int)duPortId, (int)bandSectorId, (int)ccId, (int)ruPortId); proto_item *pi = proto_tree_add_string(oran_pcid_tree, hf_oran_c_eAxC_ID, tvb, id_offset, 2, id); proto_item_set_generated(pi); } @@ -1680,32 +1697,32 @@ proto_register_oran(void) /* Section 3.1.3.1.6 */ { &hf_oran_du_port_id, { "DU Port ID", "oran_fh_cus.du_port_id", - FT_UINT8, BASE_DEC, - NULL, 0xc0, + FT_UINT16, BASE_DEC, + NULL, 0x0, NULL, HFILL } }, /* Section 3.1.3.1.6 */ { &hf_oran_bandsector_id, { "BandSector ID", "oran_fh_cus.bandsector_id", - FT_UINT8, BASE_DEC, - NULL, 0x3f, + FT_UINT16, BASE_DEC, + NULL, 0x0, NULL, HFILL } }, /* Section 3.1.3.1.6 */ { &hf_oran_cc_id, { "CC ID", "oran_fh_cus.cc_id", - FT_UINT8, BASE_DEC, - NULL, 0xf0, + FT_UINT16, BASE_DEC, + NULL, 0x0, NULL, HFILL } }, /* Section 3.1.3.1.6 */ { &hf_oran_ru_port_id, { "RU Port ID", "oran_fh_cus.ru_port_id", - FT_UINT8, BASE_DEC, - NULL, 0x0f, + FT_UINT16, BASE_DEC, + NULL, 0x0, NULL, HFILL } }, @@ -2690,6 +2707,7 @@ proto_register_oran(void) { &ei_oran_invalid_sample_bit_width, { "oran_fh_cus.invalid_sample_bit_width", PI_UNDECODED, PI_ERROR, "Unsupported sample bit width", EXPFILL }}, { &ei_oran_reserved_numBundPrb, { "oran_fh_cus.reserved_numBundPrb", PI_MALFORMED, PI_ERROR, "Reserved value of numBundPrb", EXPFILL }}, { &ei_oran_extlen_wrong, { "oran_fh_cus.extlen_wrong", PI_MALFORMED, PI_ERROR, "extlen doesn't match number of dissected bytes", EXPFILL }}, + { &ei_oran_invalid_eaxc_bit_width, { "oran_fh_cus.invalid_exac_bit_width", PI_UNDECODED, PI_ERROR, "Inconsistent eAxC bit width", EXPFILL }}, { &ei_oran_extlen_zero, { "oran_fh_cus.extlen_zero", PI_MALFORMED, PI_ERROR, "extlen - zero is reserved value", EXPFILL }} }; @@ -2709,6 +2727,15 @@ proto_register_oran(void) module_t * oran_module = prefs_register_protocol(proto_oran, NULL); /* Register bit width/compression preferences separately by direction. */ + prefs_register_uint_preference(oran_module, "oran.du_port_id_bits", "DU Port ID bits [a]", + "The bit width of DU Port ID, sum of a,b,c&d must be 16", 10, &pref_du_port_id_bits); + prefs_register_uint_preference(oran_module, "oran.bandsector_id_bits", "BandSector ID bits [b]", + "The bit width of BandSector ID, sum of a,b,c&d must be 16", 10, &pref_bandsector_id_bits); + prefs_register_uint_preference(oran_module, "oran.cc_id_bits", "CC ID bits [c]", + "The bit width of CC ID, sum of a,b,c&d must be 16", 10, &pref_cc_id_bits); + prefs_register_uint_preference(oran_module, "oran.ru_port_id_bits", "RU Port ID bits [d]", + "The bit width of RU Port ID, sum of a,b,c&d must be 16", 10, &pref_ru_port_id_bits); + prefs_register_uint_preference(oran_module, "oran.iq_bitwidth_up", "IQ Bitwidth Uplink", "The bit width of a sample in the Uplink", 10, &pref_sample_bit_width_uplink); prefs_register_enum_preference(oran_module, "oran.ud_comp_up", "Uplink User Data Compression",