MPEG + DVB: Use a common tfs string for current/next indicator

Nine DVB and MPEG dissectors have a "Currently Applicable/
Not yet Applicable" bit, mostly using integers and separate
value strings, some hex and some decimal. Switch them all to
FT_BOOLEAN and use a common true_false_string in tfs.c
This commit is contained in:
John Thacker 2023-04-17 19:44:35 -04:00 committed by Alexis La Goutte
parent e9af2e5288
commit bce1becb8a
11 changed files with 11 additions and 78 deletions

View File

@ -56,13 +56,6 @@ static gint ett_dvb_bat_transport_stream = -1;
#define DVB_BAT_RESERVED4_MASK 0xF000
#define DVB_BAT_TRANSPORT_DESCRIPTORS_LENGTH_MASK 0x0FFF
static const value_string dvb_bat_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
};
#if 0
static const value_string dvb_bat_running_status_vals[] = {
{ 0, "Undefined" },
@ -178,7 +171,7 @@ proto_register_dvb_bat(void)
{ &hf_dvb_bat_current_next_indicator, {
"Current/Next Indicator", "dvb_bat.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_bat_cur_next_vals), DVB_BAT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
FT_BOOLEAN, 8, TFS(&tfs_current_not_yet), DVB_BAT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_section_number, {

View File

@ -59,15 +59,6 @@ static const value_string dvb_data_mpe_scrambling_vals[] = {
{ 0, NULL }
};
static const value_string dvb_rcs_cur_next_vals[] = {
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0, NULL },
};
static int
dissect_dvb_data_mpe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
@ -180,7 +171,7 @@ proto_register_dvb_data_mpe(void)
{ &hf_dvb_data_mpe_current_next_indicator, {
"Current/Next Indicator", "mpeg_sect.cur_next_ind",
FT_UINT8, BASE_HEX, VALS(dvb_rcs_cur_next_vals), DVB_DATA_MPE_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
FT_BOOLEAN, 8, TFS(&tfs_current_not_yet), DVB_DATA_MPE_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_section_number, {

View File

@ -50,13 +50,6 @@ static gint ett_dvb_eit_event = -1;
#define DVB_EIT_FREE_CA_MODE_MASK 0x1000
#define DVB_EIT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
static const value_string dvb_eit_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
};
static const value_string dvb_eit_running_status_vals[] = {
{ 0, "Undefined" },
{ 1, "Not Running" },
@ -199,7 +192,7 @@ proto_register_dvb_eit(void)
{ &hf_dvb_eit_current_next_indicator, {
"Current/Next Indicator", "dvb_eit.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_eit_cur_next_vals), DVB_EIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
FT_BOOLEAN, 8, TFS(&tfs_current_not_yet), DVB_EIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_section_number, {

View File

@ -51,14 +51,6 @@ static dissector_handle_t dvb_nit_handle;
#define DVB_NIT_RESERVED4_MASK 0xF000
#define DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK 0x0FFF
static const value_string dvb_nit_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
};
static int
dissect_dvb_nit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@ -156,7 +148,7 @@ proto_register_dvb_nit(void)
{ &hf_dvb_nit_current_next_indicator, {
"Current/Next Indicator", "dvb_nit.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_nit_cur_next_vals), DVB_NIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
FT_BOOLEAN, 8, TFS(&tfs_current_not_yet), DVB_NIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_section_number, {

View File

@ -52,14 +52,6 @@ static gint ett_dvb_sdt_service = -1;
#define DVB_SDT_FREE_CA_MODE_MASK 0x1000
#define DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
static const value_string dvb_sdt_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
};
static const value_string dvb_sdt_running_status_vals[] = {
{ 0, "Undefined" },
{ 1, "Not Running" },
@ -177,7 +169,7 @@ proto_register_dvb_sdt(void)
{ &hf_dvb_sdt_current_next_indicator, {
"Current/Next Indicator", "dvb_sdt.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_sdt_cur_next_vals), DVB_SDT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
FT_BOOLEAN, 8, TFS(&tfs_current_not_yet), DVB_SDT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_section_number, {

View File

@ -49,13 +49,6 @@ static gint ett_dvb_sit_service = -1;
#define DVB_SIT_RUNNING_STATUS_MASK 0x7000
#define DVB_SIT_SERVICE_DESCRIPTORS_LENGTH_MASK 0x0FFF
static const value_string dvb_sit_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
};
static const value_string dvb_sit_running_status_vals[] = {
{ 0, "Undefined" },
{ 1, "Not Running" },
@ -161,7 +154,7 @@ proto_register_dvb_sit(void)
{ &hf_dvb_sit_current_next_indicator, {
"Current/Next Indicator", "dvb_sit.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_sit_cur_next_vals), DVB_SIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
FT_BOOLEAN, 8, TFS(&tfs_current_not_yet), DVB_SIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_sit_section_number, {

View File

@ -31,14 +31,6 @@ static gint ett_mpeg_ca = -1;
#define MPEG_CA_VERSION_NUMBER_MASK 0x00003E
#define MPEG_CA_CURRENT_NEXT_INDICATOR_MASK 0x000001
static const value_string mpeg_ca_cur_next_vals[] = {
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0x0, NULL }
};
static int
dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
@ -99,7 +91,7 @@ proto_register_mpeg_ca(void)
{ &hf_mpeg_ca_current_next_indicator, {
"Current/Next Indicator", "mpeg_ca.cur_next_ind",
FT_UINT24, BASE_HEX, VALS(mpeg_ca_cur_next_vals), MPEG_CA_CURRENT_NEXT_INDICATOR_MASK,
FT_BOOLEAN, 24, TFS(&tfs_current_not_yet), MPEG_CA_CURRENT_NEXT_INDICATOR_MASK,
NULL, HFILL
} },

View File

@ -40,12 +40,6 @@ static gint ett_mpeg_pat_prog = -1;
#define MPEG_PAT_PROGRAM_RESERVED_MASK 0xE000
#define MPEG_PAT_PROGRAM_MAP_PID_MASK 0x1FFF
static const true_false_string mpeg_pat_cur_next_vals = {
"Currently applicable", "Not yet applicable"
};
static int
dissect_mpeg_pat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
@ -127,7 +121,7 @@ proto_register_mpeg_pat(void)
{ &hf_mpeg_pat_current_next_indicator, {
"Current/Next Indicator", "mpeg_pat.cur_next_ind",
FT_BOOLEAN, 8, TFS(&mpeg_pat_cur_next_vals), MPEG_PAT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
FT_BOOLEAN, 8, TFS(&tfs_current_not_yet), MPEG_PAT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_section_number, {

View File

@ -58,15 +58,6 @@ static dissector_handle_t mpeg_pmt_handle;
#define MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK 0x0FFF
static const value_string mpeg_pmt_cur_next_vals[] = {
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0x0, NULL }
};
static const value_string mpeg_pmt_stream_type_vals[] = {
{ 0x00, "ITU-T | ISO/IEC Reserved" },
{ 0x01, "ISO/IEC 11172 Video" },
@ -205,7 +196,7 @@ proto_register_mpeg_pmt(void)
{ &hf_mpeg_pmt_current_next_indicator, {
"Current/Next Indicator", "mpeg_pmt.cur_next_ind",
FT_UINT8, BASE_HEX, VALS(mpeg_pmt_cur_next_vals), MPEG_PMT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
FT_BOOLEAN, 8, TFS(&tfs_current_not_yet), MPEG_PMT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_section_number, {

View File

@ -113,6 +113,7 @@ const true_false_string tfs_add_drop = { "Add", "Drop" };
const true_false_string tfs_no_extension_extension = { "No Extension", "Extension" };
const true_false_string tfs_user_provider = { "User", "Provider" };
const true_false_string tfs_applicable_not_applicable = { "Applicable", "Not Applicable" };
const true_false_string tfs_current_not_yet = { "Currently Applicable", "Not yet Applicable" };
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html

View File

@ -128,6 +128,7 @@ WS_DLL_PUBLIC const true_false_string tfs_add_drop;
WS_DLL_PUBLIC const true_false_string tfs_no_extension_extension;
WS_DLL_PUBLIC const true_false_string tfs_user_provider;
WS_DLL_PUBLIC const true_false_string tfs_applicable_not_applicable;
WS_DLL_PUBLIC const true_false_string tfs_current_not_yet;
#ifdef __cplusplus
}