improve DVB-SI string handling
new function dvb_add_chartbl() adds a tree entry for an encoding use FT_BTYES as type for encoding hfs string hfs for DVB-SI strings must have STR_UNICODE, not BASE_NONE make dvb_string_encoding_vals[] internal to dvb_chartbl.c svn path=/trunk/; revision=54128
This commit is contained in:
parent
9ce9b10645
commit
9f22d3a558
|
@ -2223,8 +2223,7 @@ dissect_si_string(tvbuff_t *tvb, gint offset, gint str_len,
|
|||
return;
|
||||
|
||||
enc_len = dvb_analyze_string_charset(tvb, offset, str_len, &encoding);
|
||||
proto_tree_add_uint(tree, hf_dvbci_mmi_char_tbl,
|
||||
tvb, offset, enc_len, encoding);
|
||||
dvb_add_chartbl(tree, hf_dvbci_mmi_char_tbl, tvb, offset, enc_len, encoding);
|
||||
|
||||
offset += enc_len;
|
||||
str_len -= enc_len;
|
||||
|
@ -2899,7 +2898,7 @@ dissect_dvbci_payload_mmi(guint32 tag, gint len_field,
|
|||
&ei_dvbci_invalid_char_tbl, tvb, offset, msg_len);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_uint(tree, hf_dvbci_mmi_char_tbl,
|
||||
dvb_add_chartbl(tree, hf_dvbci_mmi_char_tbl,
|
||||
tvb, offset, enc_len, encoding);
|
||||
offset += enc_len;
|
||||
}
|
||||
|
@ -3720,7 +3719,7 @@ dissect_dvbci_payload_opp(guint32 tag, gint len_field _U_,
|
|||
tvb_reported_length_remaining(tvb, offset));
|
||||
break;
|
||||
}
|
||||
proto_tree_add_uint(tree, hf_dvbci_opp_char_tbl,
|
||||
dvb_add_chartbl(tree, hf_dvbci_opp_char_tbl,
|
||||
tvb, offset, enc_len, encoding);
|
||||
offset += enc_len;
|
||||
|
||||
|
@ -5283,7 +5282,7 @@ proto_register_dvbci(void)
|
|||
},
|
||||
{ &hf_dvbci_mmi_char_tbl,
|
||||
{ "Character table", "dvb-ci.mmi.char_tbl",
|
||||
FT_UINT32, BASE_HEX, VALS(dvb_string_encoding_vals), 0, NULL, HFILL}
|
||||
FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}
|
||||
},
|
||||
{ &hf_dvbci_blind_ans,
|
||||
{ "Blind answer flag", "dvb-ci.mmi.blind_ans",
|
||||
|
@ -5654,7 +5653,7 @@ proto_register_dvbci(void)
|
|||
},
|
||||
{ &hf_dvbci_opp_char_tbl,
|
||||
{ "Character table", "dvb-ci.opp.char_tbl",
|
||||
FT_UINT32, BASE_HEX, VALS(dvb_string_encoding_vals), 0, NULL, HFILL}
|
||||
FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}
|
||||
},
|
||||
{ &hf_dvbci_sdt_rst_trusted,
|
||||
{ "SDT running status trusted", "dvb-ci.opp.sdt_rst_trusted",
|
||||
|
|
|
@ -1212,7 +1212,7 @@ proto_mpeg_descriptor_dissect_short_event(tvbuff_t *tvb, guint offset, proto_tre
|
|||
|
||||
if (name_len>0) {
|
||||
enc_len = dvb_analyze_string_charset(tvb, offset, name_len, &encoding);
|
||||
proto_tree_add_uint(tree, hf_mpeg_descr_short_event_name_encoding, tvb, offset, enc_len, encoding);
|
||||
dvb_add_chartbl(tree, hf_mpeg_descr_short_event_name_encoding, tvb, offset, enc_len, encoding);
|
||||
proto_tree_add_item(tree, hf_mpeg_descr_short_event_name,
|
||||
tvb, offset+enc_len, name_len-enc_len, dvb_enc_to_item_enc(encoding));
|
||||
}
|
||||
|
@ -3515,12 +3515,12 @@ proto_register_mpeg_descriptor(void)
|
|||
|
||||
{ &hf_mpeg_descr_short_event_name_encoding, {
|
||||
"Event Name Encoding", "mpeg_descr.short_evt.name_enc",
|
||||
FT_UINT32, BASE_HEX, VALS(dvb_string_encoding_vals), 0, NULL, HFILL
|
||||
FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
|
||||
} },
|
||||
|
||||
{ &hf_mpeg_descr_short_event_name, {
|
||||
"Event Name", "mpeg_descr.short_evt.name",
|
||||
FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
|
||||
FT_STRING, STR_UNICODE, NULL, 0, NULL, HFILL
|
||||
} },
|
||||
|
||||
{ &hf_mpeg_descr_short_event_text_length, {
|
||||
|
|
|
@ -33,6 +33,43 @@
|
|||
#include "dvb_chartbl.h"
|
||||
|
||||
|
||||
static const value_string dvb_string_encoding_vals[] = {
|
||||
{ DVB_ENCODING_INVALID, "Incorrect length for encoding" },
|
||||
{ DVB_ENCODING_RESERVED, "Reserved for future use" },
|
||||
{ DVB_ENCODING_UNKNOWN, "Value not specified by spec" },
|
||||
|
||||
{ DVB_ENCODING_LATIN, "Latin (default table)" },
|
||||
|
||||
{ DVB_ENCODING_ISO_8859_5, "ISO/IEC 8859-5 (Latin/Cyrillic)" },
|
||||
{ DVB_ENCODING_ISO_8859_6, "ISO/IEC 8859-6 (Latin/Arabic)" },
|
||||
{ DVB_ENCODING_ISO_8859_7, "ISO/IEC 8859-7 (Latin/Greek)" },
|
||||
{ DVB_ENCODING_ISO_8859_8, "ISO/IEC 8859-8 (Latin/Hebrew)" },
|
||||
{ DVB_ENCODING_ISO_8859_9, "ISO/IEC 8859-9 (West European & Turkish)" },
|
||||
{ DVB_ENCODING_ISO_8859_10, "ISO/IEC 8859-10 (North European)" },
|
||||
{ DVB_ENCODING_ISO_8859_11, "ISO/IEC 8859-11 (Thai)" },
|
||||
{ DVB_ENCODING_ISO_8859_13, "ISO/IEC 8859-13 (Baltic)" },
|
||||
{ DVB_ENCODING_ISO_8859_14, "ISO/IEC 8859-14 (Celtic)" },
|
||||
{ DVB_ENCODING_ISO_8859_15, "ISO/IEC 8859-15 (West European)" },
|
||||
|
||||
{ DVB_ENCODING_EXT_ISO_8859_1, "ISO/IEC 8859-1 (West European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_2, "ISO/IEC 8859-2 (East European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_3, "ISO/IEC 8859-3 (South European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_4, "ISO/IEC 8859-4 (North and North-East European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_5, "ISO/IEC 8859-5 (Latin/Cyrillic)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_6, "ISO/IEC 8859-6 (Latin/Arabic)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_7, "ISO/IEC 8859-7 (Latin/Greek)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_8, "ISO/IEC 8859-8 (Latin/Hebrew)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_9, "ISO/IEC 8859-9 (West European & Turkish)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_10, "ISO/IEC 8859-10 (North European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_11, "ISO/IEC 8859-11 (Thai)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_13, "ISO/IEC 8859-13 (Baltic)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_14, "ISO/IEC 8859-14 (Celtic)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_15, "ISO/IEC 8859-15 (West European)" },
|
||||
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
static dvb_encoding_e
|
||||
dvb_analyze_string_charset0(guint8 byte0)
|
||||
{
|
||||
|
@ -67,6 +104,7 @@ dvb_analyze_string_charset0(guint8 byte0)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static dvb_encoding_e
|
||||
dvb_analyze_string_charset0_10(guint16 byte12)
|
||||
{
|
||||
|
@ -109,6 +147,7 @@ dvb_analyze_string_charset0_10(guint16 byte12)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static dvb_encoding_e
|
||||
dvb_analyze_string_charset0_1F(guint8 byte1)
|
||||
{
|
||||
|
@ -195,41 +234,25 @@ dvb_enc_to_item_enc(dvb_encoding_e encoding)
|
|||
}
|
||||
|
||||
|
||||
const value_string dvb_string_encoding_vals[] = {
|
||||
{ DVB_ENCODING_INVALID, "Incorrect length for encoding" },
|
||||
{ DVB_ENCODING_RESERVED, "Reserved for future use" },
|
||||
{ DVB_ENCODING_UNKNOWN, "Value not specified by spec" },
|
||||
void
|
||||
dvb_add_chartbl(proto_tree *tree, int hf,
|
||||
tvbuff_t *tvb, gint offset, gint length, dvb_encoding_e encoding)
|
||||
{
|
||||
proto_item *pi;
|
||||
|
||||
{ DVB_ENCODING_LATIN, "Latin (default table)" },
|
||||
pi = proto_tree_add_bytes_format_value(tree, hf,
|
||||
tvb, offset, length, NULL, "%s",
|
||||
val_to_str_const(encoding, dvb_string_encoding_vals, "Unknown"));
|
||||
|
||||
{ DVB_ENCODING_ISO_8859_5, "ISO/IEC 8859-5 (Latin/Cyrillic)" },
|
||||
{ DVB_ENCODING_ISO_8859_6, "ISO/IEC 8859-6 (Latin/Arabic)" },
|
||||
{ DVB_ENCODING_ISO_8859_7, "ISO/IEC 8859-7 (Latin/Greek)" },
|
||||
{ DVB_ENCODING_ISO_8859_8, "ISO/IEC 8859-8 (Latin/Hebrew)" },
|
||||
{ DVB_ENCODING_ISO_8859_9, "ISO/IEC 8859-9 (West European & Turkish)" },
|
||||
{ DVB_ENCODING_ISO_8859_10, "ISO/IEC 8859-10 (North European)" },
|
||||
{ DVB_ENCODING_ISO_8859_11, "ISO/IEC 8859-11 (Thai)" },
|
||||
{ DVB_ENCODING_ISO_8859_13, "ISO/IEC 8859-13 (Baltic)" },
|
||||
{ DVB_ENCODING_ISO_8859_14, "ISO/IEC 8859-14 (Celtic)" },
|
||||
{ DVB_ENCODING_ISO_8859_15, "ISO/IEC 8859-15 (West European)" },
|
||||
|
||||
{ DVB_ENCODING_EXT_ISO_8859_1, "ISO/IEC 8859-1 (West European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_2, "ISO/IEC 8859-2 (East European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_3, "ISO/IEC 8859-3 (South European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_4, "ISO/IEC 8859-4 (North and North-East European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_5, "ISO/IEC 8859-5 (Latin/Cyrillic)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_6, "ISO/IEC 8859-6 (Latin/Arabic)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_7, "ISO/IEC 8859-7 (Latin/Greek)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_8, "ISO/IEC 8859-8 (Latin/Hebrew)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_9, "ISO/IEC 8859-9 (West European & Turkish)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_10, "ISO/IEC 8859-10 (North European)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_11, "ISO/IEC 8859-11 (Thai)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_13, "ISO/IEC 8859-13 (Baltic)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_14, "ISO/IEC 8859-14 (Celtic)" },
|
||||
{ DVB_ENCODING_EXT_ISO_8859_15, "ISO/IEC 8859-15 (West European)" },
|
||||
|
||||
{ 0, NULL }
|
||||
};
|
||||
if (length==0) {
|
||||
PROTO_ITEM_SET_GENERATED(pi);
|
||||
}
|
||||
else {
|
||||
proto_item_append_text(pi, " (%s)",
|
||||
bytes_to_str_punct(
|
||||
tvb_get_ptr(tvb, offset, length), length, ' '));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "ws_symbol_export.h"
|
||||
|
||||
#include <epan/proto.h>
|
||||
#include <epan/to_str.h>
|
||||
#include <epan/tvbuff.h>
|
||||
#include <epan/value_string.h>
|
||||
|
||||
|
@ -72,8 +74,6 @@ typedef enum {
|
|||
DVB_ENCODING_UNKNOWN = G_MAXUINT32-1, /* not defined by spec */
|
||||
} dvb_encoding_e;
|
||||
|
||||
extern const value_string dvb_string_encoding_vals[];
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
guint dvb_analyze_string_charset(tvbuff_t *tvb, int offset, int length,
|
||||
dvb_encoding_e *encoding);
|
||||
|
@ -81,6 +81,11 @@ guint dvb_analyze_string_charset(tvbuff_t *tvb, int offset, int length,
|
|||
WS_DLL_PUBLIC
|
||||
guint dvb_enc_to_item_enc(dvb_encoding_e encoding);
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
void dvb_add_chartbl(proto_tree *tree, int hf,
|
||||
tvbuff_t *tvb, gint offset, gint length,
|
||||
dvb_encoding_e encoding);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
Loading…
Reference in New Issue