aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2013-12-12 19:48:46 +0000
committerBill Meier <wmeier@newsguy.com>2013-12-12 19:48:46 +0000
commit13cc753fd4723d775b1bf6a52d9a617dca68ff1f (patch)
tree5cfabf3017998b6f5126854df6023076584b1716 /epan
parent69dbd3fb2438f46b338d9f49458c5ef720296dd4 (diff)
Move proto_reg_handoff...() to file end as per convention;
Reformat various hf[] entries; #include params.h (not prefs.h); 'offset++' --> 'offset += 1' for consistency; Localize some variable defintions; Tabs --> spaces (to match editor modelines); Rework some whitespace; svn path=/trunk/; revision=53970
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-rmt-alc.c374
-rw-r--r--epan/dissectors/packet-rmt-fec.c462
-rw-r--r--epan/dissectors/packet-rmt-lct.c960
-rw-r--r--epan/dissectors/packet-rmt-norm.c1258
4 files changed, 1679 insertions, 1375 deletions
diff --git a/epan/dissectors/packet-rmt-alc.c b/epan/dissectors/packet-rmt-alc.c
index c53c895ec5..0ee976ee40 100644
--- a/epan/dissectors/packet-rmt-alc.c
+++ b/epan/dissectors/packet-rmt-alc.c
@@ -67,206 +67,206 @@ static dissector_handle_t xml_handle;
static dissector_handle_t rmt_lct_handle;
static dissector_handle_t rmt_fec_handle;
-static guint g_default_udp_port = 0; /* 4001 */
+static guint g_default_udp_port = 0; /* 4001 */
static gboolean g_codepoint_as_fec_encoding = TRUE;
-static gint g_ext_192 = LCT_PREFS_EXT_192_FLUTE;
-static gint g_ext_193 = LCT_PREFS_EXT_193_FLUTE;
+static gint g_ext_192 = LCT_PREFS_EXT_192_FLUTE;
+static gint g_ext_193 = LCT_PREFS_EXT_193_FLUTE;
/* Code to actually dissect the packets */
/* ==================================== */
static int
dissect_alc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- guint8 version;
- lct_data_exchange_t lct;
- fec_data_exchange_t fec;
- int len;
-
- /* Offset for subpacket dissection */
- guint offset = 0;
-
- /* Set up structures needed to add the protocol subtree and manage it */
- proto_item *ti;
- proto_tree *alc_tree;
-
- tvbuff_t *new_tvb;
-
- /* Make entries in Protocol column and Info column on summary display */
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "ALC");
- col_clear(pinfo->cinfo, COL_INFO);
-
- /* ALC header dissection */
- /* --------------------- */
-
- version = hi_nibble(tvb_get_guint8(tvb, offset));
-
- /* Create subtree for the ALC protocol */
- ti = proto_tree_add_item(tree, proto_rmt_alc, tvb, offset, -1, ENC_NA);
- alc_tree = proto_item_add_subtree(ti, ett_main);
-
- /* Fill the ALC subtree */
- ti = proto_tree_add_uint(alc_tree, hf_version, tvb, offset, 1, version);
-
- /* This dissector supports only ALCv1 packets.
- * If version > 1 print only version field and quit.
- */
- if (version != 1) {
- expert_add_info(pinfo, ti, &ei_version1_only);
-
- /* Complete entry in Info column on summary display */
- col_add_fstr(pinfo->cinfo, COL_INFO, "Version: %u (not supported)", version);
- return 0;
- }
-
- /* LCT header dissection */
- /* --------------------- */
- new_tvb = tvb_new_subset_remaining(tvb,offset);
-
- lct.ext_192 = g_ext_192;
- lct.ext_193 = g_ext_193;
- lct.codepoint = 0;
- lct.is_flute = FALSE;
- len = call_dissector_with_data(rmt_lct_handle, new_tvb, pinfo, alc_tree, &lct);
- if (len < 0)
- return offset;
-
- offset += len;
-
- /* FEC header dissection */
- /* --------------------- */
-
- /* Only if LCT dissector has determined FEC Encoding ID */
- /* FEC dissector needs to be called with encoding_id filled */
- if (g_codepoint_as_fec_encoding && tvb_reported_length(tvb) > offset)
- {
- fec.encoding_id = lct.codepoint;
-
- new_tvb = tvb_new_subset_remaining(tvb,offset);
- len = call_dissector_with_data(rmt_fec_handle, new_tvb, pinfo, alc_tree, &fec);
- if (len < 0)
- return offset;
-
- offset += len;
- }
-
- /* Add the Payload item */
- if (tvb_reported_length(tvb) > offset){
- if(lct.is_flute){
- new_tvb = tvb_new_subset_remaining(tvb,offset);
- call_dissector(xml_handle, new_tvb, pinfo, alc_tree);
- }else{
- proto_tree_add_item(alc_tree, hf_payload, tvb, offset, -1, ENC_NA);
- }
- }
-
- return tvb_reported_length(tvb);
+ guint8 version;
+ lct_data_exchange_t lct;
+ fec_data_exchange_t fec;
+ int len;
+
+ /* Offset for subpacket dissection */
+ guint offset = 0;
+
+ /* Set up structures needed to add the protocol subtree and manage it */
+ proto_item *ti;
+ proto_tree *alc_tree;
+
+ tvbuff_t *new_tvb;
+
+ /* Make entries in Protocol column and Info column on summary display */
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "ALC");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ /* ALC header dissection */
+ /* --------------------- */
+
+ version = hi_nibble(tvb_get_guint8(tvb, offset));
+
+ /* Create subtree for the ALC protocol */
+ ti = proto_tree_add_item(tree, proto_rmt_alc, tvb, offset, -1, ENC_NA);
+ alc_tree = proto_item_add_subtree(ti, ett_main);
+
+ /* Fill the ALC subtree */
+ ti = proto_tree_add_uint(alc_tree, hf_version, tvb, offset, 1, version);
+
+ /* This dissector supports only ALCv1 packets.
+ * If version > 1 print only version field and quit.
+ */
+ if (version != 1) {
+ expert_add_info(pinfo, ti, &ei_version1_only);
+
+ /* Complete entry in Info column on summary display */
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Version: %u (not supported)", version);
+ return 0;
+ }
+
+ /* LCT header dissection */
+ /* --------------------- */
+ new_tvb = tvb_new_subset_remaining(tvb,offset);
+
+ lct.ext_192 = g_ext_192;
+ lct.ext_193 = g_ext_193;
+ lct.codepoint = 0;
+ lct.is_flute = FALSE;
+ len = call_dissector_with_data(rmt_lct_handle, new_tvb, pinfo, alc_tree, &lct);
+ if (len < 0)
+ return offset;
+
+ offset += len;
+
+ /* FEC header dissection */
+ /* --------------------- */
+
+ /* Only if LCT dissector has determined FEC Encoding ID */
+ /* FEC dissector needs to be called with encoding_id filled */
+ if (g_codepoint_as_fec_encoding && tvb_reported_length(tvb) > offset)
+ {
+ fec.encoding_id = lct.codepoint;
+
+ new_tvb = tvb_new_subset_remaining(tvb,offset);
+ len = call_dissector_with_data(rmt_fec_handle, new_tvb, pinfo, alc_tree, &fec);
+ if (len < 0)
+ return offset;
+
+ offset += len;
+ }
+
+ /* Add the Payload item */
+ if (tvb_reported_length(tvb) > offset){
+ if(lct.is_flute){
+ new_tvb = tvb_new_subset_remaining(tvb,offset);
+ call_dissector(xml_handle, new_tvb, pinfo, alc_tree);
+ }else{
+ proto_tree_add_item(alc_tree, hf_payload, tvb, offset, -1, ENC_NA);
+ }
+ }
+
+ return tvb_reported_length(tvb);
}
-void proto_reg_handoff_alc(void)
+void proto_register_alc(void)
{
- static dissector_handle_t handle;
- static gboolean preferences_initialized = FALSE;
- static guint old_udp_port = 0;
-
- if (!preferences_initialized)
- {
- preferences_initialized = TRUE;
- handle = new_create_dissector_handle(dissect_alc, proto_rmt_alc);
- dissector_add_handle("udp.port", handle);
- xml_handle = find_dissector("xml");
- rmt_lct_handle = find_dissector("rmt-lct");
- rmt_fec_handle = find_dissector("rmt-fec");
- }
-
- /* Register UDP port for dissection */
- if(old_udp_port != 0 && old_udp_port != g_default_udp_port){
- dissector_delete_uint("udp.port", old_udp_port, handle);
- }
-
- if(g_default_udp_port != 0 && old_udp_port != g_default_udp_port) {
- dissector_add_uint("udp.port", g_default_udp_port, handle);
- }
-
- old_udp_port = g_default_udp_port;
+ /* Setup ALC header fields */
+ static hf_register_info hf_ptr[] = {
+
+ { &hf_version,
+ { "Version", "alc.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+
+ { &hf_payload,
+ { "Payload", "alc.payload", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}
+ };
+
+ /* Setup protocol subtree array */
+ static gint *ett_ptr[] = {
+ &ett_main,
+ };
+
+ static ei_register_info ei[] = {
+ { &ei_version1_only, { "alc.version1_only", PI_PROTOCOL, PI_WARN, "Sorry, this dissector supports ALC version 1 only", EXPFILL }},
+ };
+
+ module_t *module;
+ expert_module_t* expert_rmt_alc;
+
+ /* Register the protocol name and description */
+ proto_rmt_alc = proto_register_protocol("Asynchronous Layered Coding", "ALC", "alc");
+ new_register_dissector("alc", dissect_alc, proto_rmt_alc);
+
+ /* Register the header fields and subtrees used */
+ proto_register_field_array(proto_rmt_alc, hf_ptr, array_length(hf_ptr));
+ proto_register_subtree_array(ett_ptr, array_length(ett_ptr));
+ expert_rmt_alc = expert_register_protocol(proto_rmt_alc);
+ expert_register_field_array(expert_rmt_alc, ei, array_length(ei));
+
+ /* Register preferences */
+ module = prefs_register_protocol(proto_rmt_alc, proto_reg_handoff_alc);
+
+ prefs_register_obsolete_preference(module, "default.udp_port.enabled");
+
+ prefs_register_uint_preference(module,
+ "default.udp_port",
+ "UDP destination port",
+ "Specifies the UDP destination port for automatic dissection of ALC packets",
+ 10, &g_default_udp_port);
+
+ prefs_register_bool_preference(module,
+ "lct.codepoint_as_fec_id",
+ "LCT Codepoint as FEC Encoding ID",
+ "Whether the LCT header Codepoint field should be considered the FEC Encoding ID of carried object",
+ &g_codepoint_as_fec_encoding);
+
+ prefs_register_enum_preference(module,
+ "lct.ext.192",
+ "LCT header extension 192",
+ "How to decode LCT header extension 192",
+ &g_ext_192,
+ enum_lct_ext_192,
+ FALSE);
+
+ prefs_register_enum_preference(module,
+ "lct.ext.193",
+ "LCT header extension 193",
+ "How to decode LCT header extension 193",
+ &g_ext_193,
+ enum_lct_ext_193,
+ FALSE);
}
-void proto_register_alc(void)
+void proto_reg_handoff_alc(void)
{
- /* Setup ALC header fields */
- static hf_register_info hf_ptr[] = {
-
- { &hf_version,
- { "Version", "alc.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
-
- { &hf_payload,
- { "Payload", "alc.payload", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}
- };
-
- /* Setup protocol subtree array */
- static gint *ett_ptr[] = {
- &ett_main,
- };
-
- static ei_register_info ei[] = {
- { &ei_version1_only, { "alc.version1_only", PI_PROTOCOL, PI_WARN, "Sorry, this dissector supports ALC version 1 only", EXPFILL }},
- };
-
- module_t *module;
- expert_module_t* expert_rmt_alc;
-
- /* Register the protocol name and description */
- proto_rmt_alc = proto_register_protocol("Asynchronous Layered Coding", "ALC", "alc");
- new_register_dissector("alc", dissect_alc, proto_rmt_alc);
-
- /* Register the header fields and subtrees used */
- proto_register_field_array(proto_rmt_alc, hf_ptr, array_length(hf_ptr));
- proto_register_subtree_array(ett_ptr, array_length(ett_ptr));
- expert_rmt_alc = expert_register_protocol(proto_rmt_alc);
- expert_register_field_array(expert_rmt_alc, ei, array_length(ei));
-
- /* Register preferences */
- module = prefs_register_protocol(proto_rmt_alc, proto_reg_handoff_alc);
-
- prefs_register_obsolete_preference(module, "default.udp_port.enabled");
-
- prefs_register_uint_preference(module,
- "default.udp_port",
- "UDP destination port",
- "Specifies the UDP destination port for automatic dissection of ALC packets",
- 10, &g_default_udp_port);
-
- prefs_register_bool_preference(module,
- "lct.codepoint_as_fec_id",
- "LCT Codepoint as FEC Encoding ID",
- "Whether the LCT header Codepoint field should be considered the FEC Encoding ID of carried object",
- &g_codepoint_as_fec_encoding);
-
- prefs_register_enum_preference(module,
- "lct.ext.192",
- "LCT header extension 192",
- "How to decode LCT header extension 192",
- &g_ext_192,
- enum_lct_ext_192,
- FALSE);
-
- prefs_register_enum_preference(module,
- "lct.ext.193",
- "LCT header extension 193",
- "How to decode LCT header extension 193",
- &g_ext_193,
- enum_lct_ext_193,
- FALSE);
+ static dissector_handle_t handle;
+ static gboolean preferences_initialized = FALSE;
+ static guint old_udp_port = 0;
+
+ if (!preferences_initialized)
+ {
+ preferences_initialized = TRUE;
+ handle = new_create_dissector_handle(dissect_alc, proto_rmt_alc);
+ dissector_add_handle("udp.port", handle);
+ xml_handle = find_dissector("xml");
+ rmt_lct_handle = find_dissector("rmt-lct");
+ rmt_fec_handle = find_dissector("rmt-fec");
+ }
+
+ /* Register UDP port for dissection */
+ if(old_udp_port != 0 && old_udp_port != g_default_udp_port){
+ dissector_delete_uint("udp.port", old_udp_port, handle);
+ }
+
+ if(g_default_udp_port != 0 && old_udp_port != g_default_udp_port) {
+ dissector_add_uint("udp.port", g_default_udp_port, handle);
+ }
+
+ old_udp_port = g_default_udp_port;
}
/*
-* Editor modelines - http://www.wireshark.org/tools/modelines.html
-*
-* Local variables:
-* c-basic-offset: 4
-* tab-width: 8
-* indent-tabs-mode: nil
-* End:
-*
-* ex: set shiftwidth=4 tabstop=8 expandtab:
-* :indentSize=4:tabSize=8:noTabs=true:
-*/
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/epan/dissectors/packet-rmt-fec.c b/epan/dissectors/packet-rmt-fec.c
index ac70464f64..0bcc16d948 100644
--- a/epan/dissectors/packet-rmt-fec.c
+++ b/epan/dissectors/packet-rmt-fec.c
@@ -75,7 +75,7 @@ static expert_field ei_fec_encoding_id = EI_INIT;
typedef struct fec_packet_data
{
- guint8 instance_id;
+ guint8 instance_id;
} fec_packet_data_t;
@@ -83,19 +83,19 @@ typedef struct fec_packet_data
/* String tables */
const value_string string_fec_encoding_id[] =
{
- { 0, "Compact No-Code" },
- { 1, "Raptor" },
- { 2, "Reed-Solomon Codes over GF(2^^m)" },
- { 3, "LDPC Staircase Codes" },
- { 4, "LDPC Triangle Codes" },
- { 5, "Reed-Solomon Codes over GF(2^^8)" },
- { 6, "RaptorQ Code" },
- /* 7-127 Unassigned */
- { 128, "Small Block, Large Block and Expandable FEC Codes" },
- { 129, "Small Block Systematic FEC Codes" },
- { 130, "Compact FEC Codes" },
- /* 131-255 Unassigned */
- { 0, NULL }
+ { 0, "Compact No-Code" },
+ { 1, "Raptor" },
+ { 2, "Reed-Solomon Codes over GF(2^^m)" },
+ { 3, "LDPC Staircase Codes" },
+ { 4, "LDPC Triangle Codes" },
+ { 5, "Reed-Solomon Codes over GF(2^^8)" },
+ { 6, "RaptorQ Code" },
+ /* 7-127 Unassigned */
+ { 128, "Small Block, Large Block and Expandable FEC Codes" },
+ { 129, "Small Block Systematic FEC Codes" },
+ { 130, "Compact FEC Codes" },
+ /* 131-255 Unassigned */
+ { 0, NULL }
};
/* Dissection */
@@ -104,79 +104,79 @@ const value_string string_fec_encoding_id[] =
/* Decode an EXT_FTI extension and fill FEC array */
void fec_decode_ext_fti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint8 encoding_id)
{
- guint64 transfer_length;
- fec_packet_data_t* fec_data;
- guint8 instance_id = 0;
- proto_item* ti;
-
- if (encoding_id == 6){
- /* Raptor Q uses 40-bit transfer length */
- transfer_length = tvb_get_ntoh40(tvb, offset+2);
- }
- else {
- /* Decode 48-bit length field */
- transfer_length = tvb_get_ntoh48(tvb, offset+2);
- }
-
- if (encoding_id >= 128)
- {
- instance_id = (guint8) tvb_get_ntohs(tvb, offset+8);
-
- /* Decode FEC Instance ID */
- fec_data = wmem_new0(wmem_file_scope(), fec_packet_data_t);
- fec_data->instance_id = instance_id;
-
- p_add_proto_data(wmem_file_scope(), pinfo, proto_rmt_fec, 0, fec_data);
- }
-
- if (encoding_id == 6){
- /* Raptor Q uses 40-bit transfer length */
- proto_tree_add_uint64(tree, hf_fti_transfer_length, tvb, offset+2, 5, transfer_length);
- }
- else {
- proto_tree_add_uint64(tree, hf_fti_transfer_length, tvb, offset+2, 6, transfer_length);
- ti = proto_tree_add_item(tree, hf_instance_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
- if ((encoding_id < 128) && (instance_id != 0)) {
- expert_add_info(pinfo, ti, &ei_fec_encoding_id);
- }
- }
-
- switch (encoding_id)
- {
- case 1:
- proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+10, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_num_blocks, tvb, offset+12, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_num_subblocks, tvb, offset+14, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_alignment, tvb, offset+15, 1, ENC_BIG_ENDIAN);
- break;
-
- case 6:
- proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+8, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_num_blocks, tvb, offset+10, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_num_subblocks, tvb, offset+11, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_alignment, tvb, offset+13, 1, ENC_BIG_ENDIAN);
- break;
-
- case 0:
- case 2:
- case 128:
- case 130:
- proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+10, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_max_source_block_length, tvb, offset+12, 4, ENC_BIG_ENDIAN);
- break;
-
- case 129:
- proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+10, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_max_source_block_length, tvb, offset+12, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_max_number_encoding_symbols, tvb, offset+14, 2, ENC_BIG_ENDIAN);
- break;
-
- case 132:
- proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+10, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_max_source_block_length, tvb, offset+12, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_fti_max_number_encoding_symbols, tvb, offset+16, 4, ENC_BIG_ENDIAN);
- break;
- }
+ guint64 transfer_length;
+ fec_packet_data_t *fec_data;
+ guint8 instance_id = 0;
+ proto_item *ti;
+
+ if (encoding_id == 6){
+ /* Raptor Q uses 40-bit transfer length */
+ transfer_length = tvb_get_ntoh40(tvb, offset+2);
+ }
+ else {
+ /* Decode 48-bit length field */
+ transfer_length = tvb_get_ntoh48(tvb, offset+2);
+ }
+
+ if (encoding_id >= 128)
+ {
+ instance_id = (guint8) tvb_get_ntohs(tvb, offset+8);
+
+ /* Decode FEC Instance ID */
+ fec_data = wmem_new0(wmem_file_scope(), fec_packet_data_t);
+ fec_data->instance_id = instance_id;
+
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rmt_fec, 0, fec_data);
+ }
+
+ if (encoding_id == 6){
+ /* Raptor Q uses 40-bit transfer length */
+ proto_tree_add_uint64(tree, hf_fti_transfer_length, tvb, offset+2, 5, transfer_length);
+ }
+ else {
+ proto_tree_add_uint64(tree, hf_fti_transfer_length, tvb, offset+2, 6, transfer_length);
+ ti = proto_tree_add_item(tree, hf_instance_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
+ if ((encoding_id < 128) && (instance_id != 0)) {
+ expert_add_info(pinfo, ti, &ei_fec_encoding_id);
+ }
+ }
+
+ switch (encoding_id)
+ {
+ case 1:
+ proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+10, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_num_blocks, tvb, offset+12, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_num_subblocks, tvb, offset+14, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_alignment, tvb, offset+15, 1, ENC_BIG_ENDIAN);
+ break;
+
+ case 6:
+ proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+8, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_num_blocks, tvb, offset+10, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_num_subblocks, tvb, offset+11, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_alignment, tvb, offset+13, 1, ENC_BIG_ENDIAN);
+ break;
+
+ case 0:
+ case 2:
+ case 128:
+ case 130:
+ proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+10, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_max_source_block_length, tvb, offset+12, 4, ENC_BIG_ENDIAN);
+ break;
+
+ case 129:
+ proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+10, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_max_source_block_length, tvb, offset+12, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_max_number_encoding_symbols, tvb, offset+14, 2, ENC_BIG_ENDIAN);
+ break;
+
+ case 132:
+ proto_tree_add_item(tree, hf_fti_encoding_symbol_length, tvb, offset+10, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_max_source_block_length, tvb, offset+12, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_fti_max_number_encoding_symbols, tvb, offset+16, 4, ENC_BIG_ENDIAN);
+ break;
+ }
}
/* Dissect a FEC header:
@@ -192,153 +192,195 @@ void fec_decode_ext_fti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
static int
dissect_fec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- proto_item *ti;
- proto_tree *fec_tree;
- guint offset = 0;
- fec_data_exchange_t* fec = (fec_data_exchange_t*)data;
- guint8 encoding_id = 0;
- fec_packet_data_t* packet_data = (fec_packet_data_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_rmt_fec, 0);
+ proto_item *ti;
+ proto_tree *fec_tree;
+ guint offset = 0;
+ fec_data_exchange_t *fec = (fec_data_exchange_t*)data;
+ guint8 encoding_id = 0;
+ fec_packet_data_t *packet_data = (fec_packet_data_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_rmt_fec, 0);
- if (fec != NULL)
- {
- encoding_id = fec->encoding_id;
- }
+ if (fec != NULL)
+ {
+ encoding_id = fec->encoding_id;
+ }
- /* Create the FEC subtree */
- ti = proto_tree_add_item(tree, proto_rmt_fec, tvb, offset, -1, ENC_NA);
- fec_tree = proto_item_add_subtree(ti, ett_main);
+ /* Create the FEC subtree */
+ ti = proto_tree_add_item(tree, proto_rmt_fec, tvb, offset, -1, ENC_NA);
+ fec_tree = proto_item_add_subtree(ti, ett_main);
- proto_tree_add_uint(fec_tree, hf_encoding_id, tvb, offset, 0, encoding_id);
+ proto_tree_add_uint(fec_tree, hf_encoding_id, tvb, offset, 0, encoding_id);
- if (encoding_id >= 128 && (packet_data != NULL))
- proto_tree_add_uint(fec_tree, hf_instance_id, tvb, offset, 0, packet_data->instance_id);
+ if (encoding_id >= 128 && (packet_data != NULL))
+ proto_tree_add_uint(fec_tree, hf_instance_id, tvb, offset, 0, packet_data->instance_id);
- switch (encoding_id)
- {
- case 0:
- case 1:
- case 130:
- proto_tree_add_item(fec_tree, hf_sbn, tvb, offset, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(fec_tree, hf_esi, tvb, offset+2, 2, ENC_BIG_ENDIAN);
+ switch (encoding_id)
+ {
+ case 0:
+ case 1:
+ case 130:
+ proto_tree_add_item(fec_tree, hf_sbn, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(fec_tree, hf_esi, tvb, offset+2, 2, ENC_BIG_ENDIAN);
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_ntohs(tvb, offset));
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntohs(tvb, offset+2));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_ntohs(tvb, offset));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntohs(tvb, offset+2));
- offset += 4;
- break;
+ offset += 4;
+ break;
- case 2:
- case 128:
- case 132:
- proto_tree_add_item(fec_tree, hf_sbn, tvb, offset, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(fec_tree, hf_esi, tvb, offset+4, 4, ENC_BIG_ENDIAN);
+ case 2:
+ case 128:
+ case 132:
+ proto_tree_add_item(fec_tree, hf_sbn, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(fec_tree, hf_esi, tvb, offset+4, 4, ENC_BIG_ENDIAN);
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_ntohl(tvb, offset));
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntohl(tvb, offset+4));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_ntohl(tvb, offset));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntohl(tvb, offset+4));
- offset += 8;
- break;
+ offset += 8;
+ break;
- case 3:
- case 4:
- proto_tree_add_item(fec_tree, hf_sbn_with_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(fec_tree, hf_esi_with_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
+ case 3:
+ case 4:
+ proto_tree_add_item(fec_tree, hf_sbn_with_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(fec_tree, hf_esi_with_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_ntohl(tvb, offset) >> 20);
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntohl(tvb, offset) & 0xfffff);
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_ntohl(tvb, offset) >> 20);
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntohl(tvb, offset) & 0xfffff);
- offset += 4;
- break;
+ offset += 4;
+ break;
- case 6:
- proto_tree_add_item(fec_tree, hf_sbn, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(fec_tree, hf_esi, tvb, offset+1, 3, ENC_BIG_ENDIAN);
+ case 6:
+ proto_tree_add_item(fec_tree, hf_sbn, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(fec_tree, hf_esi, tvb, offset+1, 3, ENC_BIG_ENDIAN);
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_guint8(tvb, offset));
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntoh24(tvb, offset+1));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_guint8(tvb, offset));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntoh24(tvb, offset+1));
- offset += 4;
- break;
+ offset += 4;
+ break;
- case 129:
- proto_tree_add_item(fec_tree, hf_sbn, tvb, offset, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(fec_tree, hf_sbl, tvb, offset+4, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(fec_tree, hf_esi, tvb, offset+6, 2, ENC_BIG_ENDIAN);
+ case 129:
+ proto_tree_add_item(fec_tree, hf_sbn, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(fec_tree, hf_sbl, tvb, offset+4, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(fec_tree, hf_esi, tvb, offset+6, 2, ENC_BIG_ENDIAN);
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_ntohl(tvb, offset));
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntohs(tvb, offset+6));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", tvb_get_ntohl(tvb, offset));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", tvb_get_ntohs(tvb, offset+6));
- offset += 8;
- break;
- }
+ offset += 8;
+ break;
+ }
- return offset;
+ return offset;
}
void proto_register_rmt_fec(void)
{
- static hf_register_info hf[] = {
- { &hf_encoding_id,
- { "FEC Encoding ID", "rmt-fec.encoding_id", FT_UINT8, BASE_DEC, VALS(string_fec_encoding_id), 0x0, NULL, HFILL }},
- { &hf_instance_id,
- { "FEC Instance ID", "rmt-fec.instance_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_sbn,
- { "Source Block Number", "rmt-fec.sbn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_sbn_with_mask,
- { "Source Block Number", "rmt-fec.sbn", FT_UINT32, BASE_DEC, NULL, 0xFFF00000, NULL, HFILL }},
- { &hf_sbl,
- { "Source Block Length", "rmt-fec.sbl", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_esi,
- { "Encoding Symbol ID", "rmt-fec.esi", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
- { &hf_esi_with_mask,
- { "Encoding Symbol ID", "rmt-fec.esi", FT_UINT32, BASE_HEX, NULL, 0x000FFFFF, NULL, HFILL }},
- { &hf_fti_transfer_length,
- { "Transfer Length", "rmt-fec.fti.transfer_length", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_fti_encoding_symbol_length,
- { "Encoding Symbol Length", "rmt-fec.fti.encoding_symbol_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_fti_max_source_block_length,
- { "Maximum Source Block Length", "rmt-fec.fti.max_source_block_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_fti_max_number_encoding_symbols,
- { "Maximum Number of Encoding Symbols", "rmt-fec.fti.max_number_encoding_symbols", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_fti_num_blocks,
- { "Number of Source Blocks", "rmt-fec.fti.num_blocks", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_fti_num_subblocks,
- { "Number of Sub-Blocks", "rmt-fec.fti.num_subblocks", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_fti_alignment,
- { "Symbol Alignment", "rmt-fec.fti.alignment", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}
- };
-
- /* Setup protocol subtree array */
- static gint *ett[] = {
- &ett_main,
- };
-
- static ei_register_info ei[] = {
- { &ei_fec_encoding_id, { "rmt-fec.encoding_id.not0", PI_PROTOCOL, PI_WARN, "FEC Encoding ID < 128, should be zero", EXPFILL }},
- };
-
- expert_module_t* expert_rmt_fec;
-
- /* Register the protocol name and description */
- proto_rmt_fec = proto_register_protocol("Forward Error Correction (FEC)", "RMT-FEC", "rmt-fec");
- new_register_dissector("rmt-fec", dissect_fec, proto_rmt_fec);
-
- /* Required function calls to register the header fields and subtrees used */
- proto_register_field_array(proto_rmt_fec, hf, array_length(hf));
- proto_register_subtree_array(ett, array_length(ett));
- expert_rmt_fec = expert_register_protocol(proto_rmt_fec);
- expert_register_field_array(expert_rmt_fec, ei, array_length(ei));
+ static hf_register_info hf[] = {
+ { &hf_encoding_id,
+ { "FEC Encoding ID", "rmt-fec.encoding_id",
+ FT_UINT8, BASE_DEC, VALS(string_fec_encoding_id), 0x0,
+ NULL, HFILL }
+ },
+ { &hf_instance_id,
+ { "FEC Instance ID", "rmt-fec.instance_id",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_sbn,
+ { "Source Block Number", "rmt-fec.sbn",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_sbn_with_mask,
+ { "Source Block Number", "rmt-fec.sbn",
+ FT_UINT32, BASE_DEC, NULL, 0xFFF00000,
+ NULL, HFILL }
+ },
+ { &hf_sbl,
+ { "Source Block Length", "rmt-fec.sbl",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_esi,
+ { "Encoding Symbol ID", "rmt-fec.esi",
+ FT_UINT32, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_esi_with_mask,
+ { "Encoding Symbol ID", "rmt-fec.esi",
+ FT_UINT32, BASE_HEX, NULL, 0x000FFFFF,
+ NULL, HFILL }
+ },
+ { &hf_fti_transfer_length,
+ { "Transfer Length", "rmt-fec.fti.transfer_length",
+ FT_UINT64, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fti_encoding_symbol_length,
+ { "Encoding Symbol Length", "rmt-fec.fti.encoding_symbol_length",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fti_max_source_block_length,
+ { "Maximum Source Block Length", "rmt-fec.fti.max_source_block_length",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fti_max_number_encoding_symbols,
+ { "Maximum Number of Encoding Symbols", "rmt-fec.fti.max_number_encoding_symbols",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fti_num_blocks,
+ { "Number of Source Blocks", "rmt-fec.fti.num_blocks",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fti_num_subblocks,
+ { "Number of Sub-Blocks", "rmt-fec.fti.num_subblocks",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fti_alignment,
+ { "Symbol Alignment", "rmt-fec.fti.alignment",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ }
+ };
+
+ /* Setup protocol subtree array */
+ static gint *ett[] = {
+ &ett_main,
+ };
+
+ static ei_register_info ei[] = {
+ { &ei_fec_encoding_id, { "rmt-fec.encoding_id.not0", PI_PROTOCOL, PI_WARN, "FEC Encoding ID < 128, should be zero", EXPFILL }},
+ };
+
+ expert_module_t* expert_rmt_fec;
+
+ /* Register the protocol name and description */
+ proto_rmt_fec = proto_register_protocol("Forward Error Correction (FEC)", "RMT-FEC", "rmt-fec");
+ new_register_dissector("rmt-fec", dissect_fec, proto_rmt_fec);
+
+ /* Required function calls to register the header fields and subtrees used */
+ proto_register_field_array(proto_rmt_fec, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ expert_rmt_fec = expert_register_protocol(proto_rmt_fec);
+ expert_register_field_array(expert_rmt_fec, ei, array_length(ei));
}
/*
-* Editor modelines - http://www.wireshark.org/tools/modelines.html
-*
-* Local variables:
-* c-basic-offset: 4
-* tab-width: 8
-* indent-tabs-mode: nil
-* End:
-*
-* ex: set shiftwidth=4 tabstop=8 expandtab:
-* :indentSize=4:tabSize=8:noTabs=true:
-*/
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/epan/dissectors/packet-rmt-lct.c b/epan/dissectors/packet-rmt-lct.c
index c1e8882e95..98bd48096a 100644
--- a/epan/dissectors/packet-rmt-lct.c
+++ b/epan/dissectors/packet-rmt-lct.c
@@ -43,17 +43,17 @@
#include <glib.h>
#include <epan/packet.h>
-#include <epan/prefs.h>
+#include <epan/params.h>
#include <epan/strutil.h>
#include <math.h>
#include "packet-rmt-common.h"
-#define LCT_SCT_FLAG 0x0008
-#define LCT_ERT_FLAG 0x0004
+#define LCT_SCT_FLAG 0x0008
+#define LCT_ERT_FLAG 0x0004
#define LCT_CLOSE_SESSION_FLAG 0x0002
-#define LCT_CLOSE_OBJECT_FLAG 0x0001
+#define LCT_CLOSE_OBJECT_FLAG 0x0001
void proto_register_rmt_lct(void);
@@ -102,28 +102,28 @@ static int ett_ext_ext = -1;
/* Enumerated data types for LCT preferences */
const enum_val_t enum_lct_ext_192[] =
{
- { "none", "Don't decode", LCT_PREFS_EXT_192_NONE },
- { "flute", "Decode as FLUTE extension (EXT_FDT)", LCT_PREFS_EXT_192_FLUTE },
- { NULL, NULL, 0 }
+ { "none", "Don't decode", LCT_PREFS_EXT_192_NONE },
+ { "flute", "Decode as FLUTE extension (EXT_FDT)", LCT_PREFS_EXT_192_FLUTE },
+ { NULL, NULL, 0 }
};
const enum_val_t enum_lct_ext_193[] =
{
- { "none", "Don't decode", LCT_PREFS_EXT_193_NONE },
- { "flute", "Decode as FLUTE extension (EXT_CENC)", LCT_PREFS_EXT_193_FLUTE },
- { NULL, NULL, 0 }
+ { "none", "Don't decode", LCT_PREFS_EXT_193_NONE },
+ { "flute", "Decode as FLUTE extension (EXT_CENC)", LCT_PREFS_EXT_193_FLUTE },
+ { NULL, NULL, 0 }
};
static const value_string hec_type_vals[] = {
- { 0, "EXT_NOP, No-Operation" },
- { 1, "EXT_AUTH, Packet authentication" },
- { 2, "EXT_CC, Congestion Control Feedback" },
- { 64, "EXT_FTI, FEC Object Transmission Information" },
- { 128, "EXT_RATE, Send Rate" },
- { 192, "EXT_FDT, FDT Instance Header" },
- { 193, "EXT_CENC, FDT Instance Content Encoding" },
-
- { 0, NULL }
+ { 0, "EXT_NOP, No-Operation" },
+ { 1, "EXT_AUTH, Packet authentication" },
+ { 2, "EXT_CC, Congestion Control Feedback" },
+ { 64, "EXT_FTI, FEC Object Transmission Information" },
+ { 128, "EXT_RATE, Send Rate" },
+ { 192, "EXT_FDT, FDT Instance Header" },
+ { 193, "EXT_CENC, FDT Instance Content Encoding" },
+
+ { 0, NULL }
};
/* LCT helper functions */
@@ -131,130 +131,130 @@ static const value_string hec_type_vals[] = {
static void lct_timestamp_parse(guint32 t, nstime_t* s)
{
- s->secs = t / 1000;
- s->nsecs = (t % 1000) * 1000000;
+ s->secs = t / 1000;
+ s->nsecs = (t % 1000) * 1000000;
}
double rmt_decode_send_rate(guint16 send_rate )
{
- double value;
+ double value;
- value = (send_rate >> 4) * 10.0 / 4096.0 * pow(10.0, (send_rate & 0xf));
- return value;
+ value = (send_rate >> 4) * 10.0 / 4096.0 * pow(10.0, (send_rate & 0xf));
+ return value;
}
int lct_ext_decode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint offset, guint offset_max, lct_data_exchange_t *data_exchange,
int hfext, int ettext)
{
- guint8 het;
- guint i, count = 0;
- guint length,
- tmp_offset = offset,
- start_offset = offset;
- proto_item* ti;
- proto_tree *hec_tree, *ext_tree;
-
- /* Figure out the extention count */
- while (tmp_offset < offset_max)
- {
- het = tvb_get_guint8(tvb, tmp_offset);
- if (het <= 127)
- {
- length = tvb_get_guint8(tvb, tmp_offset+1)*4;
- }
- else
- {
- length = 4;
- }
-
- /* Prevents infinite loops */
- if (length == 0)
- break;
-
- tmp_offset += length;
- count++;
- }
-
- if (count == 0)
- return 0;
-
- ti = proto_tree_add_uint(tree, hfext, tvb, offset, tmp_offset - offset, count);
- hec_tree = proto_item_add_subtree(ti, ettext);
-
- for (i = 0; i < count; i++)
- {
- het = tvb_get_guint8(tvb, offset);
- if (het <= 127)
- {
- length = tvb_get_guint8(tvb, offset+1)*4;
- }
- else
- {
- length = 4;
- }
-
- ti = proto_tree_add_item(hec_tree, hf_hec_type, tvb, offset, 1, ENC_BIG_ENDIAN);
- ext_tree = proto_item_add_subtree(ti, ett_ext_ext);
- proto_item_set_len(ti, length);
-
- if (het <= 127)
- {
- proto_tree_add_item(ext_tree, hf_hec_len, tvb, offset+1, 1, ENC_BIG_ENDIAN);
- }
-
- switch (het)
- {
- case 0: /* EXT_NOP */
- case 1: /* EXT_AUTH */
- default:
- proto_tree_add_item(ext_tree, hf_hec_data, tvb, offset+2, length-2, ENC_NA);
- break;
-
- case 3: /* EXT_CC RATE */
- proto_tree_add_text(ext_tree, tvb, offset+2, 2,
- "CC Sequence: %u", tvb_get_ntohs(tvb, offset+2));
- proto_tree_add_text(ext_tree, tvb, offset+4, 1,
- "CC Flags: 0x%x", tvb_get_guint8(tvb, offset+4));
- proto_tree_add_text(ext_tree, tvb, offset+5, 1,
- "CC RTT: %u", tvb_get_guint8(tvb, offset+5));
- proto_tree_add_text(ext_tree, tvb, offset+6, 2,
- "CC Loss: %g", tvb_get_ntohs(tvb, offset+6)/65535.0);
- proto_tree_add_text(ext_tree, tvb, offset+8, 2,
- "CC Rate: %u", tvb_get_ntohs(tvb, offset+8));
- break;
-
- case 64: /* EXT_FTI */
- fec_decode_ext_fti(tvb, pinfo, ext_tree, offset,
- (data_exchange == NULL) ? 0 : data_exchange->codepoint);
- break;
-
- case 128: /* EXT_RATE */
- proto_tree_add_double(ext_tree, hf_send_rate, tvb, offset+2, 2,
- rmt_decode_send_rate(tvb_get_ntohs(tvb, offset+2)));
- break;
-
- case 192: /* EXT_FDT */
- if ((data_exchange != NULL) && (data_exchange->ext_192 == LCT_PREFS_EXT_192_FLUTE))
- {
- proto_tree_add_item(ext_tree, hf_flute_version, tvb, offset, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(ext_tree, hf_fdt_instance_id, tvb, offset, 4, ENC_BIG_ENDIAN);
- data_exchange->is_flute = TRUE;
- }
- break;
-
- case 193: /* EXT_CENC */
- if ((data_exchange != NULL) && (data_exchange->ext_193 == LCT_PREFS_EXT_193_FLUTE))
- {
- proto_tree_add_item(ext_tree, hf_cenc, tvb, offset+3, 1, ENC_BIG_ENDIAN);
- }
- break;
- }
-
- offset += length;
- }
-
- return offset-start_offset;
+ guint8 het;
+ guint i, count = 0;
+ guint length,
+ tmp_offset = offset,
+ start_offset = offset;
+ proto_item *ti;
+ proto_tree *hec_tree, *ext_tree;
+
+ /* Figure out the extention count */
+ while (tmp_offset < offset_max)
+ {
+ het = tvb_get_guint8(tvb, tmp_offset);
+ if (het <= 127)
+ {
+ length = tvb_get_guint8(tvb, tmp_offset+1)*4;
+ }
+ else
+ {
+ length = 4;
+ }
+
+ /* Prevents infinite loops */
+ if (length == 0)
+ break;
+
+ tmp_offset += length;
+ count++;
+ }
+
+ if (count == 0)
+ return 0;
+
+ ti = proto_tree_add_uint(tree, hfext, tvb, offset, tmp_offset - offset, count);
+ hec_tree = proto_item_add_subtree(ti, ettext);
+
+ for (i = 0; i < count; i++)
+ {
+ het = tvb_get_guint8(tvb, offset);
+ if (het <= 127)
+ {
+ length = tvb_get_guint8(tvb, offset+1)*4;
+ }
+ else
+ {
+ length = 4;
+ }
+
+ ti = proto_tree_add_item(hec_tree, hf_hec_type, tvb, offset, 1, ENC_BIG_ENDIAN);
+ ext_tree = proto_item_add_subtree(ti, ett_ext_ext);
+ proto_item_set_len(ti, length);
+
+ if (het <= 127)
+ {
+ proto_tree_add_item(ext_tree, hf_hec_len, tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ }
+
+ switch (het)
+ {
+ case 0: /* EXT_NOP */
+ case 1: /* EXT_AUTH */
+ default:
+ proto_tree_add_item(ext_tree, hf_hec_data, tvb, offset+2, length-2, ENC_NA);
+ break;
+
+ case 3: /* EXT_CC RATE */
+ proto_tree_add_text(ext_tree, tvb, offset+2, 2,
+ "CC Sequence: %u", tvb_get_ntohs(tvb, offset+2));
+ proto_tree_add_text(ext_tree, tvb, offset+4, 1,
+ "CC Flags: 0x%x", tvb_get_guint8(tvb, offset+4));
+ proto_tree_add_text(ext_tree, tvb, offset+5, 1,
+ "CC RTT: %u", tvb_get_guint8(tvb, offset+5));
+ proto_tree_add_text(ext_tree, tvb, offset+6, 2,
+ "CC Loss: %g", tvb_get_ntohs(tvb, offset+6)/65535.0);
+ proto_tree_add_text(ext_tree, tvb, offset+8, 2,
+ "CC Rate: %u", tvb_get_ntohs(tvb, offset+8));
+ break;
+
+ case 64: /* EXT_FTI */
+ fec_decode_ext_fti(tvb, pinfo, ext_tree, offset,
+ (data_exchange == NULL) ? 0 : data_exchange->codepoint);
+ break;
+
+ case 128: /* EXT_RATE */
+ proto_tree_add_double(ext_tree, hf_send_rate, tvb, offset+2, 2,
+ rmt_decode_send_rate(tvb_get_ntohs(tvb, offset+2)));
+ break;
+
+ case 192: /* EXT_FDT */
+ if ((data_exchange != NULL) && (data_exchange->ext_192 == LCT_PREFS_EXT_192_FLUTE))
+ {
+ proto_tree_add_item(ext_tree, hf_flute_version, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(ext_tree, hf_fdt_instance_id, tvb, offset, 4, ENC_BIG_ENDIAN);
+ data_exchange->is_flute = TRUE;
+ }
+ break;
+
+ case 193: /* EXT_CENC */
+ if ((data_exchange != NULL) && (data_exchange->ext_193 == LCT_PREFS_EXT_193_FLUTE))
+ {
+ proto_tree_add_item(ext_tree, hf_cenc, tvb, offset+3, 1, ENC_BIG_ENDIAN);
+ }
+ break;
+ }
+
+ offset += length;
+ }
+
+ return offset-start_offset;
}
/* LCT exported functions */
@@ -273,322 +273,422 @@ int lct_ext_decode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint of
*/
/*
- 0 1 2 3
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | V | C | r |S| O |H|T|R|A|B| HDR_LEN | Codepoint (CP)|
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Congestion Control Information (CCI, length = 32*(C+1) bits) |
- | ... |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Transport Session Identifier (TSI, length = 32*S+16*H bits) |
- | ... |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Transport Object Identifier (TOI, length = 32*O+16*H bits) |
- | ... |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Sender Current Time (SCT, if T = 1) |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Expected Residual Time (ERT, if R = 1) |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Header Extensions (if applicable) |
- | ... |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
- Figure 1 - Default LCT header format
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | V | C | r |S| O |H|T|R|A|B| HDR_LEN | Codepoint (CP)|
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Congestion Control Information (CCI, length = 32*(C+1) bits) |
+ | ... |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Transport Session Identifier (TSI, length = 32*S+16*H bits) |
+ | ... |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Transport Object Identifier (TOI, length = 32*O+16*H bits) |
+ | ... |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Sender Current Time (SCT, if T = 1) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Expected Residual Time (ERT, if R = 1) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Header Extensions (if applicable) |
+ | ... |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ Figure 1 - Default LCT header format
*/
static int
dissect_lct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- int offset = 0;
- guint16 buffer16;
- lct_data_exchange_t *data_exchange = (lct_data_exchange_t*)data;
-
- guint8 cci_size;
- guint8 tsi_size;
- guint8 toi_size;
- guint64 tsi;
- guint64 toi = 0;
- guint16 hlen;
- nstime_t tmp_time;
-
- /* Set up structures needed to add the protocol subtree and manage it */
- proto_item *ti;
- proto_tree *lct_tree = tree, *lct_fsize_tree, *lct_flags_tree;
-
- /* LCT fixed-size fields dissection */
- /* -------------------------------- */
- buffer16 = tvb_get_ntohs(tvb, offset);
-
- cci_size = ((buffer16 & 0x0C00) >> 10) * 4 + 4;
- tsi_size = ((buffer16 & 0x0080) >> 7) * 4 + ((buffer16 & 0x0010) >> 4) * 2;
- toi_size = ((buffer16 & 0x0060) >> 5) * 4 + ((buffer16 & 0x0010) >> 4) * 2;
-
- hlen = tvb_get_guint8(tvb, offset+2) * 4;
-
- if (data_exchange != NULL)
- {
- data_exchange->codepoint = tvb_get_guint8(tvb, offset+3);
- data_exchange->is_flute = FALSE;
- }
-
- if (tree)
- {
- /* Create the LCT subtree */
- ti = proto_tree_add_item(tree, proto_rmt_lct, tvb, offset, hlen, ENC_NA);
- lct_tree = proto_item_add_subtree(ti, ett_main);
-
- /* Fill the LCT subtree */
- proto_tree_add_item(lct_tree, hf_version, tvb, offset, 2, ENC_BIG_ENDIAN);
-
- ti = proto_tree_add_item(lct_tree, hf_fsize_header, tvb, offset, 2, ENC_BIG_ENDIAN);
- lct_fsize_tree = proto_item_add_subtree(ti, ett_fsize);
-
- /* Fill the LCT fsize subtree */
- proto_tree_add_uint(lct_fsize_tree, hf_fsize_cci, tvb, offset, 2, cci_size);
- proto_tree_add_uint(lct_fsize_tree, hf_fsize_tsi, tvb, offset, 2, tsi_size);
- proto_tree_add_uint(lct_fsize_tree, hf_fsize_toi, tvb, offset, 2, toi_size);
-
- ti = proto_tree_add_item(lct_tree, hf_flags_header, tvb, offset, 2, ENC_BIG_ENDIAN);
- lct_flags_tree = proto_item_add_subtree(ti, ett_flags);
-
- /* Fill the LCT flags subtree */
- proto_tree_add_item(lct_flags_tree, hf_flags_sct_present, tvb, offset, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(lct_flags_tree, hf_flags_ert_present, tvb, offset, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(lct_flags_tree, hf_flags_close_session, tvb, offset, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(lct_flags_tree, hf_flags_close_object, tvb, offset, 2, ENC_BIG_ENDIAN);
-
- proto_tree_add_uint(lct_tree, hf_hlen, tvb, offset+2, 1, hlen);
- proto_tree_add_item(lct_tree, hf_codepoint, tvb, offset+3, 1, ENC_BIG_ENDIAN);
-
- }
-
- offset += 4;
-
- /* LCT variable-size and optional fields dissection */
- /* ------------------------------------------------ */
-
- /* Congestion Control Information (CCI) */
- if (cci_size > 0) {
- proto_tree_add_item(lct_tree, hf_cci, tvb, offset, cci_size, ENC_NA);
- offset += cci_size;
- }
-
- /* Transmission Session Identifier (TSI) */
- if (tsi_size > 0) {
-
- switch (tsi_size)
- {
- case 0:
- proto_tree_add_uint(lct_tree, hf_tsi, tvb, offset, tsi_size, 0);
- tsi = 0;
- break;
-
- case 2:
- proto_tree_add_item(lct_tree, hf_tsi16, tvb, offset, tsi_size, ENC_BIG_ENDIAN);
- tsi = tvb_get_ntohs(tvb, offset);
- break;
-
- case 4:
- proto_tree_add_item(lct_tree, hf_tsi32, tvb, offset, tsi_size, ENC_BIG_ENDIAN);
- tsi = tvb_get_ntohl(tvb, offset);
- break;
-
- case 6:
- proto_tree_add_item(lct_tree, hf_tsi48, tvb, offset, tsi_size, ENC_BIG_ENDIAN);
- tsi = tvb_get_ntoh64(tvb, offset) & G_GINT64_CONSTANT(0x0000FFFFFFFFFFFFU);
- break;
- default:
- tsi = 0;
- break;
- }
-
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "TSI: %" G_GINT64_MODIFIER "u", tsi);
- offset += tsi_size;
- }
-
- /* Transmission Object Identifier (TOI) */
- if (toi_size > 0) {
-
- switch (toi_size)
- {
- case 0:
- proto_tree_add_uint(lct_tree, hf_toi, tvb, offset, toi_size, 0);
- toi = 0;
- break;
-
- case 2:
- proto_tree_add_item(lct_tree, hf_toi16, tvb, offset, toi_size, ENC_BIG_ENDIAN);
- toi = tvb_get_ntohs(tvb, offset);
- break;
-
- case 4:
- proto_tree_add_item(lct_tree, hf_toi32, tvb, offset, toi_size, ENC_BIG_ENDIAN);
- toi = tvb_get_ntohl(tvb, offset);
- break;
-
- case 6:
- proto_tree_add_item(lct_tree, hf_toi48, tvb, offset, toi_size, ENC_BIG_ENDIAN);
- toi = tvb_get_ntoh64(tvb, offset) & G_GINT64_CONSTANT(0x0000FFFFFFFFFFFFU);
- break;
-
- case 8:
- proto_tree_add_item(lct_tree, hf_toi64, tvb, offset, toi_size, ENC_BIG_ENDIAN);
- toi = tvb_get_ntoh64(tvb, offset);
- break;
-
- case 10:
- proto_tree_add_item(lct_tree, hf_toi64, tvb, offset+2, 8, ENC_BIG_ENDIAN);
- proto_tree_add_item(lct_tree, hf_toi_extended, tvb, offset, 2, ENC_BIG_ENDIAN);
- break;
-
- case 12:
- proto_tree_add_item(lct_tree, hf_toi64, tvb, offset+4, 8, ENC_BIG_ENDIAN);
- proto_tree_add_item(lct_tree, hf_toi_extended, tvb, offset, 4, ENC_BIG_ENDIAN);
- break;
-
- case 14:
- proto_tree_add_item(lct_tree, hf_toi64, tvb, offset+6, 8, ENC_BIG_ENDIAN);
- proto_tree_add_item(lct_tree, hf_toi_extended, tvb, offset, 6, ENC_BIG_ENDIAN);
- break;
- default:
- break;
- }
-
- if (toi_size <= 8)
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "TOI: %" G_GINT64_MODIFIER "u", toi);
- else
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "TOI: 0x%s", tvb_bytes_to_str(tvb, offset, toi_size));
- offset += toi_size;
- }
-
- if (buffer16 & LCT_CLOSE_SESSION_FLAG)
- col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "Close session");
-
- if (buffer16 & LCT_CLOSE_OBJECT_FLAG)
- col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "Close object");
-
- /* Sender Current Time (SCT) */
- if (buffer16 & LCT_SCT_FLAG) {
- lct_timestamp_parse(tvb_get_ntohl(tvb, offset), &tmp_time);
- proto_tree_add_time(lct_tree, hf_sct, tvb, offset, 4, &tmp_time);
- offset += 4;
- }
-
- /* Expected Residual Time (ERT) */
- if (buffer16 & LCT_ERT_FLAG) {
- lct_timestamp_parse(tvb_get_ntohl(tvb, offset), &tmp_time);
- proto_tree_add_time(lct_tree, hf_ert, tvb, offset, 4, &tmp_time);
- offset += 4;
- }
-
- /* LCT header extensions, if applicable */
- /* ------------------------------------ */
- lct_ext_decode(lct_tree, tvb, pinfo, offset, hlen, data_exchange, hf_ext, ett_ext);
-
- return hlen;
+ int offset = 0;
+ guint16 buffer16;
+
+ guint8 cci_size;
+ guint8 tsi_size;
+ guint8 toi_size;
+ guint64 tsi;
+ guint64 toi = 0;
+ guint16 hlen;
+ nstime_t tmp_time;
+
+ /* Set up structures needed to add the protocol subtree and manage it */
+ proto_item *ti;
+ proto_tree *lct_tree = tree, *lct_fsize_tree, *lct_flags_tree;
+
+ lct_data_exchange_t *data_exchange = (lct_data_exchange_t *)data;
+
+ /* LCT fixed-size fields dissection */
+ /* -------------------------------- */
+ buffer16 = tvb_get_ntohs(tvb, offset);
+
+ cci_size = ((buffer16 & 0x0C00) >> 10) * 4 + 4;
+ tsi_size = ((buffer16 & 0x0080) >> 7) * 4 + ((buffer16 & 0x0010) >> 4) * 2;
+ toi_size = ((buffer16 & 0x0060) >> 5) * 4 + ((buffer16 & 0x0010) >> 4) * 2;
+
+ hlen = tvb_get_guint8(tvb, offset+2) * 4;
+
+ if (data_exchange != NULL)
+ {
+ data_exchange->codepoint = tvb_get_guint8(tvb, offset+3);
+ data_exchange->is_flute = FALSE;
+ }
+
+ if (tree)
+ {
+ /* Create the LCT subtree */
+ ti = proto_tree_add_item(tree, proto_rmt_lct, tvb, offset, hlen, ENC_NA);
+ lct_tree = proto_item_add_subtree(ti, ett_main);
+
+ /* Fill the LCT subtree */
+ proto_tree_add_item(lct_tree, hf_version, tvb, offset, 2, ENC_BIG_ENDIAN);
+
+ ti = proto_tree_add_item(lct_tree, hf_fsize_header, tvb, offset, 2, ENC_BIG_ENDIAN);
+ lct_fsize_tree = proto_item_add_subtree(ti, ett_fsize);
+
+ /* Fill the LCT fsize subtree */
+ proto_tree_add_uint(lct_fsize_tree, hf_fsize_cci, tvb, offset, 2, cci_size);
+ proto_tree_add_uint(lct_fsize_tree, hf_fsize_tsi, tvb, offset, 2, tsi_size);
+ proto_tree_add_uint(lct_fsize_tree, hf_fsize_toi, tvb, offset, 2, toi_size);
+
+ ti = proto_tree_add_item(lct_tree, hf_flags_header, tvb, offset, 2, ENC_BIG_ENDIAN);
+ lct_flags_tree = proto_item_add_subtree(ti, ett_flags);
+
+ /* Fill the LCT flags subtree */
+ proto_tree_add_item(lct_flags_tree, hf_flags_sct_present, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(lct_flags_tree, hf_flags_ert_present, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(lct_flags_tree, hf_flags_close_session, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(lct_flags_tree, hf_flags_close_object, tvb, offset, 2, ENC_BIG_ENDIAN);
+
+ proto_tree_add_uint(lct_tree, hf_hlen, tvb, offset+2, 1, hlen);
+ proto_tree_add_item(lct_tree, hf_codepoint, tvb, offset+3, 1, ENC_BIG_ENDIAN);
+
+ }
+
+ offset += 4;
+
+ /* LCT variable-size and optional fields dissection */
+ /* ------------------------------------------------ */
+
+ /* Congestion Control Information (CCI) */
+ if (cci_size > 0) {
+ proto_tree_add_item(lct_tree, hf_cci, tvb, offset, cci_size, ENC_NA);
+ offset += cci_size;
+ }
+
+ /* Transmission Session Identifier (TSI) */
+ if (tsi_size > 0) {
+
+ switch (tsi_size)
+ {
+ case 0:
+ proto_tree_add_uint(lct_tree, hf_tsi, tvb, offset, tsi_size, 0);
+ tsi = 0;
+ break;
+
+ case 2:
+ proto_tree_add_item(lct_tree, hf_tsi16, tvb, offset, tsi_size, ENC_BIG_ENDIAN);
+ tsi = tvb_get_ntohs(tvb, offset);
+ break;
+
+ case 4:
+ proto_tree_add_item(lct_tree, hf_tsi32, tvb, offset, tsi_size, ENC_BIG_ENDIAN);
+ tsi = tvb_get_ntohl(tvb, offset);
+ break;
+
+ case 6:
+ proto_tree_add_item(lct_tree, hf_tsi48, tvb, offset, tsi_size, ENC_BIG_ENDIAN);
+ tsi = tvb_get_ntoh64(tvb, offset) & G_GINT64_CONSTANT(0x0000FFFFFFFFFFFFU);
+ break;
+ default:
+ tsi = 0;
+ break;
+ }
+
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "TSI: %" G_GINT64_MODIFIER "u", tsi);
+ offset += tsi_size;
+ }
+
+ /* Transmission Object Identifier (TOI) */
+ if (toi_size > 0) {
+
+ switch (toi_size)
+ {
+ case 0:
+ proto_tree_add_uint(lct_tree, hf_toi, tvb, offset, toi_size, 0);
+ toi = 0;
+ break;
+
+ case 2:
+ proto_tree_add_item(lct_tree, hf_toi16, tvb, offset, toi_size, ENC_BIG_ENDIAN);
+ toi = tvb_get_ntohs(tvb, offset);
+ break;
+
+ case 4:
+ proto_tree_add_item(lct_tree, hf_toi32, tvb, offset, toi_size, ENC_BIG_ENDIAN);
+ toi = tvb_get_ntohl(tvb, offset);
+ break;
+
+ case 6:
+ proto_tree_add_item(lct_tree, hf_toi48, tvb, offset, toi_size, ENC_BIG_ENDIAN);
+ toi = tvb_get_ntoh64(tvb, offset) & G_GINT64_CONSTANT(0x0000FFFFFFFFFFFFU);
+ break;
+
+ case 8:
+ proto_tree_add_item(lct_tree, hf_toi64, tvb, offset, toi_size, ENC_BIG_ENDIAN);
+ toi = tvb_get_ntoh64(tvb, offset);
+ break;
+
+ case 10:
+ proto_tree_add_item(lct_tree, hf_toi64, tvb, offset+2, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(lct_tree, hf_toi_extended, tvb, offset, 2, ENC_BIG_ENDIAN);
+ break;
+
+ case 12:
+ proto_tree_add_item(lct_tree, hf_toi64, tvb, offset+4, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(lct_tree, hf_toi_extended, tvb, offset, 4, ENC_BIG_ENDIAN);
+ break;
+
+ case 14:
+ proto_tree_add_item(lct_tree, hf_toi64, tvb, offset+6, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(lct_tree, hf_toi_extended, tvb, offset, 6, ENC_BIG_ENDIAN);
+ break;
+ default:
+ break;
+ }
+
+ if (toi_size <= 8)
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "TOI: %" G_GINT64_MODIFIER "u", toi);
+ else
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "TOI: 0x%s", tvb_bytes_to_str(tvb, offset, toi_size));
+ offset += toi_size;
+ }
+
+ if (buffer16 & LCT_CLOSE_SESSION_FLAG)
+ col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "Close session");
+
+ if (buffer16 & LCT_CLOSE_OBJECT_FLAG)
+ col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "Close object");
+
+ /* Sender Current Time (SCT) */
+ if (buffer16 & LCT_SCT_FLAG) {
+ lct_timestamp_parse(tvb_get_ntohl(tvb, offset), &tmp_time);
+ proto_tree_add_time(lct_tree, hf_sct, tvb, offset, 4, &tmp_time);
+ offset += 4;
+ }
+
+ /* Expected Residual Time (ERT) */
+ if (buffer16 & LCT_ERT_FLAG) {
+ lct_timestamp_parse(tvb_get_ntohl(tvb, offset), &tmp_time);
+ proto_tree_add_time(lct_tree, hf_ert, tvb, offset, 4, &tmp_time);
+ offset += 4;
+ }
+
+ /* LCT header extensions, if applicable */
+ /* ------------------------------------ */
+ lct_ext_decode(lct_tree, tvb, pinfo, offset, hlen, data_exchange, hf_ext, ett_ext);
+
+ return hlen;
}
void
proto_register_rmt_lct(void)
{
static hf_register_info hf[] = {
- { &hf_version,
- { "Version", "rmt-lct.version", FT_UINT16, BASE_DEC, NULL, 0xF000, NULL, HFILL }},
- { &hf_fsize_header,
- { "Field size flags", "rmt-lct.fsize", FT_UINT16, BASE_HEX, NULL, 0x0FD0, NULL, HFILL }},
- { &hf_fsize_cci,
- { "Congestion Control Information field size", "rmt-lct.fsize.cci", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_fsize_tsi,
- { "Transport Session Identifier field size", "rmt-lct.fsize.tsi", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_fsize_toi,
- { "Transport Object Identifier field size", "rmt-lct.fsize.toi", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_flags_header,
- { "Flags", "rmt-lct.flags", FT_UINT16, BASE_HEX, NULL, 0x001F, NULL, HFILL }},
- { &hf_flags_sct_present,
- { "Sender Current Time present flag", "rmt-lct.flags.sct_present", FT_BOOLEAN, 16, TFS(&tfs_set_notset), LCT_SCT_FLAG, NULL, HFILL }},
- { &hf_flags_ert_present,
- { "Expected Residual Time present flag", "rmt-lct.flags.ert_present", FT_BOOLEAN, 16, TFS(&tfs_set_notset), LCT_ERT_FLAG, NULL, HFILL }},
- { &hf_flags_close_session,
- { "Close Session flag", "rmt-lct.flags.close_session", FT_BOOLEAN, 16, TFS(&tfs_set_notset), LCT_CLOSE_SESSION_FLAG, NULL, HFILL }},
- { &hf_flags_close_object,
- { "Close Object flag", "rmt-lct.flags.close_object", FT_BOOLEAN, 16, TFS(&tfs_set_notset), LCT_CLOSE_OBJECT_FLAG, NULL, HFILL }},
- { &hf_hlen,
- { "Header length", "rmt-lct.hlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_codepoint,
- { "Codepoint", "rmt-lct.codepoint", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_cci,
- { "Congestion Control Information", "rmt-lct.cci", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_tsi,
- { "Transport Session Identifier", "rmt-lct.tsi", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_tsi16,
- { "Transport Session Identifier", "rmt-lct.tsi", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_tsi32,
- { "Transport Session Identifier", "rmt-lct.tsi", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_tsi48,
- { "Transport Session Identifier", "rmt-lct.tsi", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_toi,
- { "Transport Object Identifier", "rmt-lct.toi", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_toi16,
- { "Transport Object Identifier", "rmt-lct.toi", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_toi32,
- { "Transport Object Identifier", "rmt-lct.toi", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_toi48,
- { "Transport Object Identifier", "rmt-lct.toi", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_toi64,
- { "Transport Object Identifier (up to 64 bits)", "rmt-lct.toi", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_toi_extended,
- { "Transport Object Identifier (bits 64-112)", "rmt-lct.toi_extended", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_sct,
- { "Sender Current Time", "rmt-lct.sct", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_ert,
- { "Expected Residual Time", "rmt-lct.ert", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_ext,
- { "Extension count", "rmt-lct.ext", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_hec_type,
- { "Header Extension Type (HET)", "rmt-lct.hec.type", FT_UINT8, BASE_DEC, VALS(hec_type_vals), 0x0, NULL, HFILL }},
- { &hf_hec_len,
- { "Header Extension Length (HEL)", "rmt-lct.hec.len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_hec_data,
- { "Header Extension Data", "rmt-lct.hec.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_send_rate,
- { "Send Rate", "rmt-lct.send_rate", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_cenc,
- { "Content Encoding Algorithm (CENC)", "rmt-lct.cenc", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_flute_version,
- { "FLUTE version (V)", "rmt-lct.flute_version", FT_UINT32, BASE_DEC, NULL, 0x00F00000, NULL, HFILL }},
- { &hf_fdt_instance_id,
- { "FDT Instance ID", "rmt-lct.fdt_instance_id", FT_UINT32, BASE_DEC, NULL, 0x000FFFFF, NULL, HFILL }},
+ { &hf_version,
+ { "Version", "rmt-lct.version",
+ FT_UINT16, BASE_DEC, NULL, 0xF000,
+ NULL, HFILL }
+ },
+ { &hf_fsize_header,
+ { "Field size flags", "rmt-lct.fsize",
+ FT_UINT16, BASE_HEX, NULL, 0x0FD0,
+ NULL, HFILL }
+ },
+ { &hf_fsize_cci,
+ { "Congestion Control Information field size", "rmt-lct.fsize.cci",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fsize_tsi,
+ { "Transport Session Identifier field size", "rmt-lct.fsize.tsi",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fsize_toi,
+ { "Transport Object Identifier field size", "rmt-lct.fsize.toi",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_flags_header,
+ { "Flags", "rmt-lct.flags",
+ FT_UINT16, BASE_HEX, NULL, 0x001F,
+ NULL, HFILL }
+ },
+ { &hf_flags_sct_present,
+ { "Sender Current Time present flag", "rmt-lct.flags.sct_present",
+ FT_BOOLEAN, 16, TFS(&tfs_set_notset), LCT_SCT_FLAG,
+ NULL, HFILL }
+ },
+ { &hf_flags_ert_present,
+ { "Expected Residual Time present flag", "rmt-lct.flags.ert_present",
+ FT_BOOLEAN, 16, TFS(&tfs_set_notset), LCT_ERT_FLAG,
+ NULL, HFILL }
+ },
+ { &hf_flags_close_session,
+ { "Close Session flag", "rmt-lct.flags.close_session",
+ FT_BOOLEAN, 16, TFS(&tfs_set_notset), LCT_CLOSE_SESSION_FLAG,
+ NULL, HFILL }
+ },
+ { &hf_flags_close_object,
+ { "Close Object flag", "rmt-lct.flags.close_object",
+ FT_BOOLEAN, 16, TFS(&tfs_set_notset), LCT_CLOSE_OBJECT_FLAG,
+ NULL, HFILL }
+ },
+ { &hf_hlen,
+ { "Header length", "rmt-lct.hlen",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_codepoint,
+ { "Codepoint", "rmt-lct.codepoint",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_cci,
+ { "Congestion Control Information", "rmt-lct.cci",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_tsi,
+ { "Transport Session Identifier", "rmt-lct.tsi",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_tsi16,
+ { "Transport Session Identifier", "rmt-lct.tsi",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_tsi32,
+ { "Transport Session Identifier", "rmt-lct.tsi",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_tsi48,
+ { "Transport Session Identifier", "rmt-lct.tsi",
+ FT_UINT64, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_toi,
+ { "Transport Object Identifier", "rmt-lct.toi",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_toi16,
+ { "Transport Object Identifier", "rmt-lct.toi",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_toi32,
+ { "Transport Object Identifier", "rmt-lct.toi",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_toi48,
+ { "Transport Object Identifier", "rmt-lct.toi",
+ FT_UINT64, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_toi64,
+ { "Transport Object Identifier (up to 64 bits)", "rmt-lct.toi",
+ FT_UINT64, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_toi_extended,
+ { "Transport Object Identifier (bits 64-112)", "rmt-lct.toi_extended",
+ FT_UINT64, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_sct,
+ { "Sender Current Time", "rmt-lct.sct",
+ FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_ert,
+ { "Expected Residual Time", "rmt-lct.ert",
+ FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_ext,
+ { "Extension count", "rmt-lct.ext",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_hec_type,
+ { "Header Extension Type (HET)", "rmt-lct.hec.type",
+ FT_UINT8, BASE_DEC, VALS(hec_type_vals), 0x0,
+ NULL, HFILL }
+ },
+ { &hf_hec_len,
+ { "Header Extension Length (HEL)", "rmt-lct.hec.len",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_hec_data,
+ { "Header Extension Data", "rmt-lct.hec.data",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_send_rate,
+ { "Send Rate", "rmt-lct.send_rate",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_cenc,
+ { "Content Encoding Algorithm (CENC)", "rmt-lct.cenc",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_flute_version,
+ { "FLUTE version (V)", "rmt-lct.flute_version",
+ FT_UINT32, BASE_DEC, NULL, 0x00F00000,
+ NULL, HFILL }
+ },
+ { &hf_fdt_instance_id,
+ { "FDT Instance ID", "rmt-lct.fdt_instance_id",
+ FT_UINT32, BASE_DEC, NULL, 0x000FFFFF,
+ NULL, HFILL }
+ },
};
/* Setup protocol subtree array */
static gint *ett[] = {
- &ett_main,
- &ett_fsize,
- &ett_flags,
- &ett_ext,
- &ett_ext_ext
+ &ett_main,
+ &ett_fsize,
+ &ett_flags,
+ &ett_ext,
+ &ett_ext_ext
};
- /* Register the protocol name and description */
- proto_rmt_lct = proto_register_protocol("Layered Coding Transport", "RMT-LCT", "rmt-lct");
- new_register_dissector("rmt-lct", dissect_lct, proto_rmt_lct);
+ /* Register the protocol name and description */
+ proto_rmt_lct = proto_register_protocol("Layered Coding Transport", "RMT-LCT", "rmt-lct");
+ new_register_dissector("rmt-lct", dissect_lct, proto_rmt_lct);
- /* Required function calls to register the header fields and subtrees used */
- proto_register_field_array(proto_rmt_lct, hf, array_length(hf));
- proto_register_subtree_array(ett, array_length(ett));
+ /* Required function calls to register the header fields and subtrees used */
+ proto_register_field_array(proto_rmt_lct, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
}
/*
-* Editor modelines - http://www.wireshark.org/tools/modelines.html
-*
-* Local variables:
-* c-basic-offset: 4
-* tab-width: 8
-* indent-tabs-mode: nil
-* End:
-*
-* ex: set shiftwidth=4 tabstop=8 expandtab:
-* :indentSize=4:tabSize=8:noTabs=true:
-*/
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/epan/dissectors/packet-rmt-norm.c b/epan/dissectors/packet-rmt-norm.c
index b5d0b553ce..579f9286d0 100644
--- a/epan/dissectors/packet-rmt-norm.c
+++ b/epan/dissectors/packet-rmt-norm.c
@@ -65,13 +65,13 @@ void proto_reg_handoff_rmt_norm(void);
static const value_string string_norm_type[] =
{
- { NORM_INFO, "INFO" },
- { NORM_DATA, "DATA" },
- { NORM_CMD, "CMD" },
- { NORM_NACK, "NACK" },
- { NORM_ACK, "ACK" },
- { NORM_REPORT, "REPORT" },
- { 0, NULL }
+ { NORM_INFO, "INFO" },
+ { NORM_DATA, "DATA" },
+ { NORM_CMD, "CMD" },
+ { NORM_NACK, "NACK" },
+ { NORM_ACK, "ACK" },
+ { NORM_REPORT, "REPORT" },
+ { 0, NULL }
};
#define NORM_CMD_FLUSH 1
@@ -84,14 +84,14 @@ static const value_string string_norm_type[] =
static const value_string string_norm_cmd_type[] =
{
- { NORM_CMD_FLUSH, "FLUSH" },
- { NORM_CMD_EOT, "EOT" },
- { NORM_CMD_SQUELCH, "SQUELCH" },
- { NORM_CMD_CC, "CC" },
- { NORM_CMD_REPAIR_ADV, "REPAIR_ADV" },
- { NORM_CMD_ACK_REQ, "ACK_REQ" },
- { NORM_CMD_APPLICATION, "APPLICATION" },
- { 0, NULL }
+ { NORM_CMD_FLUSH, "FLUSH" },
+ { NORM_CMD_EOT, "EOT" },
+ { NORM_CMD_SQUELCH, "SQUELCH" },
+ { NORM_CMD_CC, "CC" },
+ { NORM_CMD_REPAIR_ADV, "REPAIR_ADV" },
+ { NORM_CMD_ACK_REQ, "ACK_REQ" },
+ { NORM_CMD_APPLICATION, "APPLICATION" },
+ { 0, NULL }
};
#define NORM_ACK_CC 1
@@ -99,9 +99,9 @@ static const value_string string_norm_cmd_type[] =
static const value_string string_norm_ack_type[] =
{
- { NORM_ACK_CC, "ACK CC" },
- { NORM_ACK_FLUSH, "ACK FLUSH" },
- { 0, NULL }
+ { NORM_ACK_CC, "ACK CC" },
+ { NORM_ACK_FLUSH, "ACK FLUSH" },
+ { 0, NULL }
};
#define NORM_NACK_ITEMS 1
@@ -110,10 +110,10 @@ static const value_string string_norm_ack_type[] =
static const value_string string_norm_nack_form[] =
{
- { NORM_NACK_ITEMS, "Items" },
- { NORM_NACK_RANGES, "Ranges" },
- { NORM_NACK_ERASURES, "Erasures" },
- { 0, NULL }
+ { NORM_NACK_ITEMS, "Items" },
+ { NORM_NACK_RANGES, "Ranges" },
+ { NORM_NACK_ERASURES, "Erasures" },
+ { 0, NULL }
};
#define NORM_FLAG_REPAIR 0x01
@@ -141,7 +141,7 @@ static gboolean global_norm_heur = FALSE;
typedef struct norm_packet_data
{
- guint8 encoding_id;
+ guint8 encoding_id;
} norm_packet_data_t;
/* Initialize the protocol and registered fields */
@@ -218,348 +218,351 @@ static const double RTT_MAX = 1000;
static double UnquantizeRtt(unsigned char qrtt)
{
- return ((qrtt <= 31) ? (((double)(qrtt+1))*(double)RTT_MIN) :
- (RTT_MAX/exp(((double)(255-qrtt))/(double)13.0)));
+ return ((qrtt <= 31) ? (((double)(qrtt+1))*(double)RTT_MIN) :
+ (RTT_MAX/exp(((double)(255-qrtt))/(double)13.0)));
}
static double UnquantizeGSize(guint8 gsizex)
{
- guint mant = (gsizex & 0x8) ? 5 : 1;
- guint exponent = gsizex & 0x7;
- exponent ++;
- return mant * pow(10, exponent);
+ guint mant = (gsizex & 0x8) ? 5 : 1;
+ guint exponent = gsizex & 0x7;
+
+ exponent += 1;
+ return mant * pow(10, exponent);
}
/* code to dissect fairly common sequence in NORM packets */
static guint dissect_grrtetc(proto_tree *tree, tvbuff_t *tvb, guint offset)
{
- guint8 backoff;
- double gsizex;
- double grtt;
- proto_tree_add_item(tree, hf_instance_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
- grtt = UnquantizeRtt(tvb_get_guint8(tvb, offset));
- proto_tree_add_double(tree, hf_grtt, tvb, offset, 1, grtt); offset++;
- backoff = hi_nibble(tvb_get_guint8(tvb, offset));
- gsizex = UnquantizeGSize((guint8)lo_nibble(tvb_get_guint8(tvb, offset)));
- proto_tree_add_uint(tree, hf_backoff, tvb, offset, 1, backoff);
- proto_tree_add_double(tree, hf_gsize, tvb, offset, 1, gsizex);
- offset++;
- return offset;
+ guint8 backoff;
+ double gsizex;
+ double grtt;
+
+ proto_tree_add_item(tree, hf_instance_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+ grtt = UnquantizeRtt(tvb_get_guint8(tvb, offset));
+ proto_tree_add_double(tree, hf_grtt, tvb, offset, 1, grtt); offset += 1;
+ backoff = hi_nibble(tvb_get_guint8(tvb, offset));
+ gsizex = UnquantizeGSize((guint8)lo_nibble(tvb_get_guint8(tvb, offset)));
+ proto_tree_add_uint(tree, hf_backoff, tvb, offset, 1, backoff);
+ proto_tree_add_double(tree, hf_gsize, tvb, offset, 1, gsizex);
+ offset += 1;
+ return offset;
}
/* split out some common FEC handling */
static guint dissect_feccode(proto_tree *tree, tvbuff_t *tvb, guint offset,
- packet_info *pinfo, gint reserved)
+ packet_info *pinfo, gint reserved)
{
- norm_packet_data_t* norm_data;
- guint8 encoding_id = tvb_get_guint8(tvb, offset);
+ norm_packet_data_t *norm_data;
+ guint8 encoding_id = tvb_get_guint8(tvb, offset);
- /* Save encoding ID */
- norm_data = wmem_new0(wmem_file_scope(), norm_packet_data_t);
- norm_data->encoding_id = encoding_id;
+ /* Save encoding ID */
+ norm_data = wmem_new0(wmem_file_scope(), norm_packet_data_t);
+ norm_data->encoding_id = encoding_id;
- p_add_proto_data(wmem_file_scope(), pinfo, proto_rmt_norm, 0, norm_data);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rmt_norm, 0, norm_data);
- proto_tree_add_item(tree, hf_fec_encoding_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++;
- if (reserved) {
- proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_NA); offset++;
- }
- proto_tree_add_item(tree, hf_object_transport_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+ proto_tree_add_item(tree, hf_fec_encoding_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+ if (reserved) {
+ proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_NA); offset += 1;
+ }
+ proto_tree_add_item(tree, hf_object_transport_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
- if (tvb_reported_length_remaining(tvb, offset) > 0) {
- fec_data_exchange_t fec;
- tvbuff_t *new_tvb;
- int len;
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
+ fec_data_exchange_t fec;
+ tvbuff_t *new_tvb;
+ int len;
- new_tvb = tvb_new_subset_remaining(tvb, offset);
+ new_tvb = tvb_new_subset_remaining(tvb, offset);
- fec.encoding_id = encoding_id;
- len = call_dissector_with_data(rmt_fec_handle, new_tvb, pinfo, tree, &fec);
- if (len > 0)
- offset += len;
- }
+ fec.encoding_id = encoding_id;
+ len = call_dissector_with_data(rmt_fec_handle, new_tvb, pinfo, tree, &fec);
+ if (len > 0)
+ offset += len;
+ }
- return offset;
+ return offset;
}
static guint dissect_norm_hdrext(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset, guint8 hlen)
+ tvbuff_t *tvb, guint offset, guint8 hlen)
{
- lct_data_exchange_t data_exchange;
- norm_packet_data_t* packet_data = (norm_packet_data_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_rmt_norm, 0);
+ lct_data_exchange_t data_exchange;
+ norm_packet_data_t *packet_data = (norm_packet_data_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rmt_norm, 0);
- memset(&data_exchange, 0, sizeof(data_exchange));
+ memset(&data_exchange, 0, sizeof(data_exchange));
- if (packet_data != NULL)
- data_exchange.codepoint = packet_data->encoding_id;
+ if (packet_data != NULL)
+ data_exchange.codepoint = packet_data->encoding_id;
- offset += lct_ext_decode(tree, tvb, pinfo, offset, hdrlen2bytes(hlen), &data_exchange,
- hf_extension, ett_hdrext);
+ offset += lct_ext_decode(tree, tvb, pinfo, offset, hdrlen2bytes(hlen), &data_exchange,
+ hf_extension, ett_hdrext);
- return offset;
+ return offset;
}
static guint dissect_nack_data(proto_tree *tree, tvbuff_t *tvb, guint offset,
- packet_info *pinfo)
+ packet_info *pinfo)
{
- proto_item *ti, *tif;
- proto_tree *nack_tree, *flag_tree;
- guint16 len;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "NACK Data");
- nack_tree = proto_item_add_subtree(ti, ett_nackdata);
- proto_tree_add_item(nack_tree, hf_nack_form, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
-
- tif = proto_tree_add_item(nack_tree, hf_nack_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
- flag_tree = proto_item_add_subtree(tif, ett_flags);
- proto_tree_add_item(flag_tree, hf_nack_flags_segment, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_nack_flags_block, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_nack_flags_info, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_nack_flags_object, tvb, offset, 1, ENC_BIG_ENDIAN);
- offset += 1;
- len = tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(nack_tree, hf_nack_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
- proto_item_set_len(ti, 4+len);
- if (len > 4) {
- dissect_feccode(nack_tree, tvb, offset, pinfo, 1);
- }
- offset += len;
- return offset;
+ proto_item *ti, *tif;
+ proto_tree *nack_tree, *flag_tree;
+ guint16 len;
+
+ ti = proto_tree_add_text(tree, tvb, offset, -1, "NACK Data");
+ nack_tree = proto_item_add_subtree(ti, ett_nackdata);
+ proto_tree_add_item(nack_tree, hf_nack_form, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+
+ tif = proto_tree_add_item(nack_tree, hf_nack_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
+ flag_tree = proto_item_add_subtree(tif, ett_flags);
+ proto_tree_add_item(flag_tree, hf_nack_flags_segment, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_nack_flags_block, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_nack_flags_info, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_nack_flags_object, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ len = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_item(nack_tree, hf_nack_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+ proto_item_set_len(ti, 4+len);
+ if (len > 4) {
+ dissect_feccode(nack_tree, tvb, offset, pinfo, 1);
+ }
+ offset += len;
+ return offset;
}
/* code to dissect NORM data packets */
static void dissect_norm_data(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset, guint8 hlen)
+ tvbuff_t *tvb, guint offset, guint8 hlen)
{
- guint8 flags;
- proto_item *ti;
- proto_tree *flag_tree;
-
- offset = dissect_grrtetc(tree, tvb, offset);
-
- ti = proto_tree_add_item(tree, hf_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
- flags = tvb_get_guint8(tvb, offset);
- flag_tree = proto_item_add_subtree(ti, ett_flags);
- proto_tree_add_item(flag_tree, hf_flag_repair, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_norm_explicit, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_info, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_unreliable, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_file, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_stream, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_msgstart, tvb, offset, 1, ENC_BIG_ENDIAN);
- offset++;
-
- offset = dissect_feccode(tree, tvb, offset, pinfo, 0);
-
- if (offset < hdrlen2bytes(hlen)) {
- offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
- }
- if (flags & NORM_FLAG_STREAM) {
- ti = proto_tree_add_text(tree, tvb, offset, 8, "Stream Data");
- flag_tree = proto_item_add_subtree(ti, ett_streampayload);
- proto_tree_add_item(flag_tree, hf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
- proto_tree_add_item(flag_tree, hf_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
- proto_tree_add_item(flag_tree, hf_payload_offset, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
-
- }
- if (tvb_reported_length_remaining(tvb, offset) > 0)
- proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
+ guint8 flags;
+ proto_item *ti;
+ proto_tree *flag_tree;
+
+ offset = dissect_grrtetc(tree, tvb, offset);
+
+ ti = proto_tree_add_item(tree, hf_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
+ flags = tvb_get_guint8(tvb, offset);
+ flag_tree = proto_item_add_subtree(ti, ett_flags);
+ proto_tree_add_item(flag_tree, hf_flag_repair, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_norm_explicit, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_info, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_unreliable, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_file, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_stream, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_msgstart, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+
+ offset = dissect_feccode(tree, tvb, offset, pinfo, 0);
+
+ if (offset < hdrlen2bytes(hlen)) {
+ offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
+ }
+ if (flags & NORM_FLAG_STREAM) {
+ ti = proto_tree_add_text(tree, tvb, offset, 8, "Stream Data");
+ flag_tree = proto_item_add_subtree(ti, ett_streampayload);
+ proto_tree_add_item(flag_tree, hf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+ proto_tree_add_item(flag_tree, hf_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+ proto_tree_add_item(flag_tree, hf_payload_offset, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+
+ }
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
+ proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
}
/* code to dissect NORM info packets */
static void dissect_norm_info(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint8 hlen)
{
- proto_item *ti;
- proto_tree *flag_tree;
- norm_packet_data_t* norm_data;
-
- offset = dissect_grrtetc(tree, tvb, offset);
-
- ti = proto_tree_add_item(tree, hf_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
- flag_tree = proto_item_add_subtree(ti, ett_flags);
- proto_tree_add_item(flag_tree, hf_flag_repair, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_norm_explicit, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_info, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_unreliable, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_file, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_stream, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_flag_msgstart, tvb, offset, 1, ENC_BIG_ENDIAN);
- offset++;
-
- /* Save encoding ID */
- norm_data = wmem_new0(wmem_file_scope(), norm_packet_data_t);
- norm_data->encoding_id = tvb_get_guint8(tvb, offset);
-
- p_add_proto_data(wmem_file_scope(), pinfo, proto_rmt_norm, 0, norm_data);
-
- proto_tree_add_item(tree, hf_fec_encoding_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++;
- proto_tree_add_item(tree, hf_object_transport_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
-
- if (offset < hdrlen2bytes(hlen)) {
- offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
- }
- if (tvb_reported_length_remaining(tvb, offset) > 0)
- proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
+ proto_item *ti;
+ proto_tree *flag_tree;
+ norm_packet_data_t *norm_data;
+
+ offset = dissect_grrtetc(tree, tvb, offset);
+
+ ti = proto_tree_add_item(tree, hf_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
+ flag_tree = proto_item_add_subtree(ti, ett_flags);
+ proto_tree_add_item(flag_tree, hf_flag_repair, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_norm_explicit, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_info, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_unreliable, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_file, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_stream, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_flag_msgstart, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+
+ /* Save encoding ID */
+ norm_data = wmem_new0(wmem_file_scope(), norm_packet_data_t);
+ norm_data->encoding_id = tvb_get_guint8(tvb, offset);
+
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rmt_norm, 0, norm_data);
+
+ proto_tree_add_item(tree, hf_fec_encoding_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+ proto_tree_add_item(tree, hf_object_transport_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+
+ if (offset < hdrlen2bytes(hlen)) {
+ offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
+ }
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
+ proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
}
/* code to dissect NORM cmd(flush) packets */
static guint dissect_norm_cmd_flush(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset, guint8 hlen)
+ tvbuff_t *tvb, guint offset, guint8 hlen)
{
- offset = dissect_feccode(tree, tvb, offset, pinfo, 0);
- if (offset < hdrlen2bytes(hlen)) {
- offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
- }
- return offset;
+ offset = dissect_feccode(tree, tvb, offset, pinfo, 0);
+ if (offset < hdrlen2bytes(hlen)) {
+ offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
+ }
+ return offset;
}
/* code to dissect NORM cmd(flush) packets */
static guint dissect_norm_cmd_repairadv(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset, guint8 hlen)
+ tvbuff_t *tvb, guint offset, guint8 hlen)
{
- proto_tree_add_item(tree, hf_flags, tvb, offset, 1, ENC_BIG_ENDIAN); offset ++;
- proto_tree_add_item(tree, hf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); offset +=2;
-
- if (offset < hdrlen2bytes(hlen)) {
- offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
- }
- while (tvb_reported_length_remaining(tvb, offset) > 0) {
- offset = dissect_nack_data(tree, tvb, offset, pinfo);
- }
- return offset;
+ proto_tree_add_item(tree, hf_flags, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+ proto_tree_add_item(tree, hf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); offset +=2;
+
+ if (offset < hdrlen2bytes(hlen)) {
+ offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
+ }
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ offset = dissect_nack_data(tree, tvb, offset, pinfo);
+ }
+ return offset;
}
/* code to dissect NORM cmd(cc) packets */
static guint dissect_norm_cmd_cc(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset, guint8 hlen)
+ tvbuff_t *tvb, guint offset, guint8 hlen)
{
- proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_NA); offset ++;
- proto_tree_add_item(tree, hf_cc_sequence, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
-
- proto_tree_add_item(tree, hf_cc_sts, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- proto_tree_add_item(tree, hf_cc_stus, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- if (offset < hdrlen2bytes(hlen)) {
- offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
- }
- while (offset < hdrlen2bytes(hlen)) {
- proto_item *ti, *tif;
- proto_tree *cc_tree, *flag_tree;
- double grtt;
- ti = proto_tree_add_text(tree, tvb, offset, 8, "Congestion Control");
- cc_tree = proto_item_add_subtree(ti, ett_congestioncontrol);
- proto_tree_add_item(cc_tree, hf_cc_node_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- tif = proto_tree_add_item(cc_tree, hf_cc_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
- flag_tree = proto_item_add_subtree(tif, ett_flags);
- proto_tree_add_item(flag_tree, hf_cc_flags_clr, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_cc_flags_plr, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_cc_flags_rtt, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_cc_flags_start, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(flag_tree, hf_cc_flags_leave, tvb, offset, 1, ENC_BIG_ENDIAN);
- offset += 1;
- grtt = UnquantizeRtt(tvb_get_guint8(tvb, offset));
- proto_tree_add_double(cc_tree, hf_cc_rtt, tvb, offset, 1, grtt); offset += 1;
- grtt = rmt_decode_send_rate(tvb_get_ntohs(tvb, offset));
- proto_tree_add_double(cc_tree, hf_cc_rate, tvb, offset, 2, grtt); offset += 2;
- }
- return offset;
+ proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_NA); offset += 1;
+ proto_tree_add_item(tree, hf_cc_sequence, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+
+ proto_tree_add_item(tree, hf_cc_sts, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ proto_tree_add_item(tree, hf_cc_stus, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ if (offset < hdrlen2bytes(hlen)) {
+ offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
+ }
+ while (offset < hdrlen2bytes(hlen)) {
+ proto_item *ti, *tif;
+ proto_tree *cc_tree, *flag_tree;
+ double grtt;
+ ti = proto_tree_add_text(tree, tvb, offset, 8, "Congestion Control");
+ cc_tree = proto_item_add_subtree(ti, ett_congestioncontrol);
+ proto_tree_add_item(cc_tree, hf_cc_node_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ tif = proto_tree_add_item(cc_tree, hf_cc_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
+ flag_tree = proto_item_add_subtree(tif, ett_flags);
+ proto_tree_add_item(flag_tree, hf_cc_flags_clr, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_cc_flags_plr, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_cc_flags_rtt, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_cc_flags_start, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(flag_tree, hf_cc_flags_leave, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ grtt = UnquantizeRtt(tvb_get_guint8(tvb, offset));
+ proto_tree_add_double(cc_tree, hf_cc_rtt, tvb, offset, 1, grtt); offset += 1;
+ grtt = rmt_decode_send_rate(tvb_get_ntohs(tvb, offset));
+ proto_tree_add_double(cc_tree, hf_cc_rate, tvb, offset, 2, grtt); offset += 2;
+ }
+ return offset;
}
/* code to dissect NORM cmd(squelch) packets */
static guint dissect_norm_cmd_squelch(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset)
+ tvbuff_t *tvb, guint offset)
{
- offset = dissect_feccode(tree, tvb, offset, pinfo, 0);
+ offset = dissect_feccode(tree, tvb, offset, pinfo, 0);
- while (tvb_reported_length_remaining(tvb, offset) > 0) {
- proto_tree_add_item(tree, hf_cc_transport_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 2;
- }
- return offset;
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ proto_tree_add_item(tree, hf_cc_transport_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 2;
+ }
+ return offset;
}
/* code to dissect NORM cmd(squelch) packets */
static guint dissect_norm_cmd_ackreq(proto_tree *tree, packet_info *pinfo _U_,
- tvbuff_t *tvb, guint offset)
+ tvbuff_t *tvb, guint offset)
{
- proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_NA); offset ++;
- proto_tree_add_item(tree, hf_ack_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
- proto_tree_add_item(tree, hf_ack_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
- return offset;
+ proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_NA); offset += 1;
+ proto_tree_add_item(tree, hf_ack_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+ proto_tree_add_item(tree, hf_ack_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+ return offset;
}
/* code to dissect NORM cmd packets */
static void dissect_norm_cmd(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset, guint8 hlen)
+ tvbuff_t *tvb, guint offset, guint8 hlen)
{
- guint8 flavor;
-
- offset = dissect_grrtetc(tree, tvb, offset);
- flavor = tvb_get_guint8(tvb, offset);
-
- col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
- val_to_str(flavor, string_norm_cmd_type, "Unknown Cmd Type (0x%04x)"));
- proto_tree_add_item(tree, hf_cmd_flavor, tvb, offset, 1, ENC_BIG_ENDIAN); offset ++;
- switch(flavor) {
- case NORM_CMD_CC:
- offset = dissect_norm_cmd_cc(tree, pinfo, tvb, offset, hlen);
- break;
- case NORM_CMD_FLUSH:
- offset = dissect_norm_cmd_flush(tree, pinfo, tvb, offset, hlen);
- break;
- case NORM_CMD_SQUELCH:
- offset = dissect_norm_cmd_squelch(tree, pinfo, tvb, offset);
- break;
- case NORM_CMD_REPAIR_ADV:
- offset = dissect_norm_cmd_repairadv(tree, pinfo, tvb, offset, hlen);
- break;
- case NORM_CMD_ACK_REQ:
- offset = dissect_norm_cmd_ackreq(tree, pinfo, tvb, offset);
- break;
- }
- if (tvb_reported_length_remaining(tvb, offset) > 0)
- proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
+ guint8 flavor;
+
+ offset = dissect_grrtetc(tree, tvb, offset);
+ flavor = tvb_get_guint8(tvb, offset);
+
+ col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
+ val_to_str(flavor, string_norm_cmd_type, "Unknown Cmd Type (0x%04x)"));
+ proto_tree_add_item(tree, hf_cmd_flavor, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+ switch(flavor) {
+ case NORM_CMD_CC:
+ offset = dissect_norm_cmd_cc(tree, pinfo, tvb, offset, hlen);
+ break;
+ case NORM_CMD_FLUSH:
+ offset = dissect_norm_cmd_flush(tree, pinfo, tvb, offset, hlen);
+ break;
+ case NORM_CMD_SQUELCH:
+ offset = dissect_norm_cmd_squelch(tree, pinfo, tvb, offset);
+ break;
+ case NORM_CMD_REPAIR_ADV:
+ offset = dissect_norm_cmd_repairadv(tree, pinfo, tvb, offset, hlen);
+ break;
+ case NORM_CMD_ACK_REQ:
+ offset = dissect_norm_cmd_ackreq(tree, pinfo, tvb, offset);
+ break;
+ }
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
+ proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
}
/* code to dissect NORM ack packets */
static void dissect_norm_ack(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset, guint8 hlen)
+ tvbuff_t *tvb, guint offset, guint8 hlen)
{
- guint8 acktype;
-
- proto_tree_add_item(tree, hf_ack_source, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- proto_tree_add_item(tree, hf_instance_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
- acktype = tvb_get_guint8(tvb, offset);
-
- col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
- val_to_str(acktype, string_norm_ack_type, "Unknown Ack Type (0x%04x)"));
- proto_tree_add_item(tree, hf_ack_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
- proto_tree_add_item(tree, hf_ack_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
- proto_tree_add_item(tree, hf_ack_grtt_sec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- proto_tree_add_item(tree, hf_ack_grtt_usec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- if (offset < hdrlen2bytes(hlen)) {
- offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
- }
-
- if (tvb_reported_length_remaining(tvb, offset) > 0)
- proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
+ guint8 acktype;
+
+ proto_tree_add_item(tree, hf_ack_source, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ proto_tree_add_item(tree, hf_instance_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+ acktype = tvb_get_guint8(tvb, offset);
+
+ col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
+ val_to_str(acktype, string_norm_ack_type, "Unknown Ack Type (0x%04x)"));
+ proto_tree_add_item(tree, hf_ack_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+ proto_tree_add_item(tree, hf_ack_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
+ proto_tree_add_item(tree, hf_ack_grtt_sec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ proto_tree_add_item(tree, hf_ack_grtt_usec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ if (offset < hdrlen2bytes(hlen)) {
+ offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
+ }
+
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
+ proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
}
/* code to dissect NORM nack packets */
static void dissect_norm_nack(proto_tree *tree, packet_info *pinfo,
- tvbuff_t *tvb, guint offset, guint8 hlen)
+ tvbuff_t *tvb, guint offset, guint8 hlen)
{
- proto_tree_add_item(tree, hf_nack_server, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- proto_tree_add_item(tree, hf_instance_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
- proto_tree_add_item(tree, hf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
- proto_tree_add_item(tree, hf_nack_grtt_sec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- proto_tree_add_item(tree, hf_nack_grtt_usec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
- if (offset < hdrlen2bytes(hlen)) {
- offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
- }
-
- while (tvb_reported_length_remaining(tvb, offset) > 0) {
- offset = dissect_nack_data(tree, tvb, offset, pinfo);
- }
- if (tvb_reported_length_remaining(tvb, offset) > 0)
- proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
+ proto_tree_add_item(tree, hf_nack_server, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ proto_tree_add_item(tree, hf_instance_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+ proto_tree_add_item(tree, hf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+ proto_tree_add_item(tree, hf_nack_grtt_sec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ proto_tree_add_item(tree, hf_nack_grtt_usec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
+ if (offset < hdrlen2bytes(hlen)) {
+ offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen);
+ }
+
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ offset = dissect_nack_data(tree, tvb, offset, pinfo);
+ }
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
+ proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA);
}
/* Code to actually dissect the packets */
@@ -567,287 +570,446 @@ static void dissect_norm_nack(proto_tree *tree, packet_info *pinfo,
static int
dissect_norm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- /* Logical packet representation */
- guint8 version;
- guint8 type;
- guint8 hlen;
-
- /* Offset for subpacket dissection */
- guint offset = 0;
-
- /* Set up structures needed to add the protocol subtree and manage it */
- proto_item *ti;
- proto_tree *norm_tree;
-
- /* Make entries in Protocol column and Info column on summary display */
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "NORM");
- col_clear(pinfo->cinfo, COL_INFO);
-
- /* NORM header dissection, part 1 */
- /* ------------------------------ */
-
- version = hi_nibble(tvb_get_guint8(tvb, offset));
-
- /* Create subtree for the NORM protocol */
- ti = proto_tree_add_item(tree, proto_rmt_norm, tvb, offset, -1, ENC_NA);
- norm_tree = proto_item_add_subtree(ti, ett_main);
-
- /* Fill the NORM subtree */
- proto_tree_add_uint(norm_tree, hf_version, tvb, offset, 1, version);
-
- /* This dissector supports only NORMv1 packets.
- * If version > 1 print only version field and quit.
- */
- if (version != 1) {
- expert_add_info(pinfo, ti, &ei_version1_only);
-
- /* Complete entry in Info column on summary display */
- col_add_fstr(pinfo->cinfo, COL_INFO, "Version: %u (not supported)", version);
- return 0;
- }
-
- /* NORM header dissection, part 2 */
- /* ------------------------------ */
-
- type = lo_nibble(tvb_get_guint8(tvb, offset));
- hlen = tvb_get_guint8(tvb, offset+1);
-
- if (tree) {
- proto_tree_add_uint(norm_tree, hf_type, tvb, offset, 1, type);
- proto_tree_add_item(norm_tree, hf_hlen, tvb, offset+1, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(norm_tree, hf_sequence, tvb, offset+2, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(norm_tree, hf_source_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
- }
-
- offset += 8;
-
-
- /* Complete entry in Info column on summary display */
- /* ------------------------------------------------ */
- col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
- val_to_str(type, string_norm_type, "Unknown Type (0x%04x)"));
-
-
- switch(type) {
- case NORM_INFO:
- dissect_norm_info(norm_tree, pinfo, tvb, offset, hlen);
- break;
- case NORM_DATA:
- dissect_norm_data(norm_tree, pinfo, tvb, offset, hlen);
- break;
- case NORM_CMD:
- dissect_norm_cmd(norm_tree, pinfo, tvb, offset, hlen);
- break;
- case NORM_ACK:
- dissect_norm_ack(norm_tree, pinfo, tvb, offset, hlen);
- break;
- case NORM_NACK:
- dissect_norm_nack(norm_tree, pinfo, tvb, offset, hlen);
- break;
- default:
- /* Add the Payload item */
- if (tvb_reported_length_remaining(tvb, offset) > 0)
- proto_tree_add_item(norm_tree, hf_payload, tvb, offset, -1, ENC_NA);
- break;
- }
-
- return tvb_reported_length(tvb);
+ /* Logical packet representation */
+ guint8 version;
+ guint8 type;
+ guint8 hlen;
+
+ /* Offset for subpacket dissection */
+ guint offset = 0;
+
+ /* Set up structures needed to add the protocol subtree and manage it */
+ proto_item *ti;
+ proto_tree *norm_tree;
+
+ /* Make entries in Protocol column and Info column on summary display */
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NORM");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ /* NORM header dissection, part 1 */
+ /* ------------------------------ */
+
+ version = hi_nibble(tvb_get_guint8(tvb, offset));
+
+ /* Create subtree for the NORM protocol */
+ ti = proto_tree_add_item(tree, proto_rmt_norm, tvb, offset, -1, ENC_NA);
+ norm_tree = proto_item_add_subtree(ti, ett_main);
+
+ /* Fill the NORM subtree */
+ proto_tree_add_uint(norm_tree, hf_version, tvb, offset, 1, version);
+
+ /* This dissector supports only NORMv1 packets.
+ * If version > 1 print only version field and quit.
+ */
+ if (version != 1) {
+ expert_add_info(pinfo, ti, &ei_version1_only);
+
+ /* Complete entry in Info column on summary display */
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Version: %u (not supported)", version);
+ return 0;
+ }
+
+ /* NORM header dissection, part 2 */
+ /* ------------------------------ */
+
+ type = lo_nibble(tvb_get_guint8(tvb, offset));
+ hlen = tvb_get_guint8(tvb, offset+1);
+
+ if (tree) {
+ proto_tree_add_uint(norm_tree, hf_type, tvb, offset, 1, type);
+ proto_tree_add_item(norm_tree, hf_hlen, tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(norm_tree, hf_sequence, tvb, offset+2, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(norm_tree, hf_source_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
+ }
+
+ offset += 8;
+
+
+ /* Complete entry in Info column on summary display */
+ /* ------------------------------------------------ */
+ col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
+ val_to_str(type, string_norm_type, "Unknown Type (0x%04x)"));
+
+
+ switch(type) {
+ case NORM_INFO:
+ dissect_norm_info(norm_tree, pinfo, tvb, offset, hlen);
+ break;
+ case NORM_DATA:
+ dissect_norm_data(norm_tree, pinfo, tvb, offset, hlen);
+ break;
+ case NORM_CMD:
+ dissect_norm_cmd(norm_tree, pinfo, tvb, offset, hlen);
+ break;
+ case NORM_ACK:
+ dissect_norm_ack(norm_tree, pinfo, tvb, offset, hlen);
+ break;
+ case NORM_NACK:
+ dissect_norm_nack(norm_tree, pinfo, tvb, offset, hlen);
+ break;
+ default:
+ /* Add the Payload item */
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
+ proto_tree_add_item(norm_tree, hf_payload, tvb, offset, -1, ENC_NA);
+ break;
+ }
+
+ return tvb_reported_length(tvb);
}
static gboolean
dissect_norm_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- guint8 byte1;
+ guint8 byte1;
- if (!global_norm_heur)
- return FALSE;
- if (tvb_reported_length(tvb) < 12)
- return FALSE; /* not enough to check */
- byte1 = tvb_get_guint8(tvb, 0);
+ if (!global_norm_heur)
+ return FALSE;
+ if (tvb_reported_length(tvb) < 12)
+ return FALSE; /* not enough to check */
+ byte1 = tvb_get_guint8(tvb, 0);
- if (hi_nibble(byte1) != 1) return FALSE;
- if (lo_nibble(byte1) < 1 || lo_nibble(byte1) > 6) return FALSE;
- if (tvb_get_guint8(tvb, 1) > 20) return FALSE;
+ if (hi_nibble(byte1) != 1) return FALSE;
+ if (lo_nibble(byte1) < 1 || lo_nibble(byte1) > 6) return FALSE;
+ if (tvb_get_guint8(tvb, 1) > 20) return FALSE;
- dissect_norm(tvb, pinfo, tree, data);
- return TRUE; /* appears to be a NORM packet */
+ dissect_norm(tvb, pinfo, tree, data);
+ return TRUE; /* appears to be a NORM packet */
}
-void proto_reg_handoff_norm(void)
+void proto_register_norm(void)
{
- static gboolean preferences_initialized = FALSE;
- static dissector_handle_t handle;
-
- if (!preferences_initialized) {
- preferences_initialized = TRUE;
- handle = new_create_dissector_handle(dissect_norm, proto_rmt_norm);
- dissector_add_handle("udp.port", handle);
- heur_dissector_add("udp", dissect_norm_heur, proto_rmt_norm);
-
- rmt_fec_handle = find_dissector("rmt-fec");
- }
+ /* Setup NORM header fields */
+ static hf_register_info hf[] = {
+
+ { &hf_version,
+ { "Version", "norm.version",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_type,
+ { "Message Type", "norm.type",
+ FT_UINT8, BASE_DEC, VALS(string_norm_type), 0x0,
+ NULL, HFILL }
+ },
+ { &hf_hlen,
+ { "Header length", "norm.hlen",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_sequence,
+ { "Sequence", "norm.sequence",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_source_id,
+ { "Source ID", "norm.source_id",
+ FT_IPv4, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_instance_id,
+ { "Instance", "norm.instance_id",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_grtt,
+ { "grtt", "norm.grtt",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_backoff,
+ { "Backoff", "norm.backoff",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_gsize,
+ { "Group Size", "norm.gsize",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_flags,
+ { "Flags", "norm.flags",
+ FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_flag_repair,
+ { "Repair Flag", "norm.flag.repair",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_REPAIR,
+ NULL, HFILL }
+ },
+ { &hf_flag_norm_explicit,
+ { "Explicit Flag", "norm.flag.explicit",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_EXPLICIT,
+ NULL, HFILL }
+ },
+ { &hf_flag_info,
+ { "Info Flag", "norm.flag.info",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_INFO,
+ NULL, HFILL }
+ },
+ { &hf_flag_unreliable,
+ { "Unreliable Flag", "norm.flag.unreliable",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_UNRELIABLE,
+ NULL, HFILL }
+ },
+ { &hf_flag_file,
+ { "File Flag", "norm.flag.file",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_FILE,
+ NULL, HFILL }
+ },
+ { &hf_flag_stream,
+ { "Stream Flag", "norm.flag.stream",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_STREAM,
+ NULL, HFILL }
+ },
+ { &hf_flag_msgstart,
+ { "Msg Start Flag", "norm.flag.msgstart",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_MSG_START,
+ NULL, HFILL }
+ },
+ { &hf_object_transport_id,
+ { "Object Transport ID", "norm.object_transport_id",
+ FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_extension,
+ { "Hdr Extension", "norm.hexext",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_reserved,
+ { "Reserved", "norm.reserved",
+ FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_payload_len,
+ { "Payload Len", "norm.payload.len",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_payload_offset,
+ { "Payload Offset", "norm.payload.offset",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+
+ { &hf_cmd_flavor,
+ { "Flavor", "norm.flavor",
+ FT_UINT8, BASE_DEC, VALS(string_norm_cmd_type), 0x0,
+ NULL, HFILL}
+ },
+ { &hf_cc_sequence,
+ { "CC Sequence", "norm.ccsequence",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_cc_sts,
+ { "Send Time secs", "norm.cc_sts",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_cc_stus,
+ { "Send Time usecs", "norm.cc_stus",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_cc_node_id,
+ { "CC Node ID", "norm.cc_node_id",
+ FT_IPv4, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_cc_flags,
+ { "CC Flags", "norm.cc_flags",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_cc_flags_clr,
+ { "CLR", "norm.cc_flags.clr",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_CLR,
+ NULL, HFILL}
+ },
+ { &hf_cc_flags_plr,
+ { "PLR", "norm.cc_flags.plr",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_PLR,
+ NULL, HFILL}
+ },
+ { &hf_cc_flags_rtt,
+ { "RTT", "norm.cc_flags.rtt",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_RTT,
+ NULL, HFILL}
+ },
+ { &hf_cc_flags_start,
+ { "Start", "norm.cc_flags.start",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_START,
+ NULL, HFILL}
+ },
+ { &hf_cc_flags_leave,
+ { "Leave", "norm.cc_flags.leave",
+ FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_LEAVE,
+ NULL, HFILL}
+ },
+ { &hf_cc_rtt,
+ { "CC RTT", "norm.cc_rtt",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_cc_rate,
+ { "CC Rate", "norm.cc_rate",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_cc_transport_id,
+ { "CC Transport ID", "norm.cc_transport_id",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+
+ { &hf_ack_source,
+ { "Ack Source", "norm.ack.source",
+ FT_IPv4, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_ack_type,
+ { "Ack Type", "norm.ack.type",
+ FT_UINT8, BASE_DEC, VALS(string_norm_ack_type), 0x0,
+ NULL, HFILL}
+ },
+ { &hf_ack_id,
+ { "Ack ID", "norm.ack.id",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_ack_grtt_sec,
+ { "Ack GRTT Sec", "norm.ack.grtt_sec",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_ack_grtt_usec,
+ { "Ack GRTT usec", "norm.ack.grtt_usec",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+
+ { &hf_nack_server,
+ { "NAck Server", "norm.nack.server",
+ FT_IPv4, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_nack_grtt_sec,
+ { "NAck GRTT Sec", "norm.nack.grtt_sec",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_nack_grtt_usec,
+ { "NAck GRTT usec", "norm.nack.grtt_usec",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_nack_form,
+ { "NAck FORM", "norm.nack.form",
+ FT_UINT8, BASE_DEC, VALS(string_norm_nack_form), 0x0,
+ NULL, HFILL}
+ },
+ { &hf_nack_flags,
+ { "NAck Flags", "norm.nack.flags",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_nack_flags_segment,
+ { "Segment", "norm.nack.flags.segment",
+ FT_BOOLEAN, 8, NULL, NORM_NACK_SEGMENT,
+ NULL, HFILL}
+ },
+ { &hf_nack_flags_block,
+ { "Block", "norm.nack.flags.block",
+ FT_BOOLEAN, 8, NULL, NORM_NACK_BLOCK,
+ NULL, HFILL}
+ },
+ { &hf_nack_flags_info,
+ { "Info", "norm.nack.flags.info",
+ FT_BOOLEAN, 8, NULL, NORM_NACK_INFO,
+ NULL, HFILL}
+ },
+ { &hf_nack_flags_object,
+ { "Object", "norm.nack.flags.object",
+ FT_BOOLEAN, 8, NULL, NORM_NACK_OBJECT,
+ NULL, HFILL}
+ },
+ { &hf_nack_length,
+ { "NAck Length", "norm.nack.length",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_payload,
+ { "Payload", "norm.payload",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_fec_encoding_id,
+ { "FEC Encoding ID", "norm.fec_encoding_id",
+ FT_UINT8, BASE_DEC, VALS(string_fec_encoding_id), 0x0,
+ NULL, HFILL}
+ }
+ };
+
+ /* Setup protocol subtree array */
+ static gint *ett[] = {
+ &ett_main,
+ &ett_hdrext,
+ &ett_flags,
+ &ett_streampayload,
+ &ett_congestioncontrol,
+ &ett_nackdata
+ };
+
+ static ei_register_info ei[] = {
+ { &ei_version1_only, { "alc.version1_only", PI_PROTOCOL, PI_WARN, "Sorry, this dissector supports ALC version 1 only", EXPFILL }}
+ };
+
+ module_t *module;
+ expert_module_t* expert_rmt_norm;
+
+ /* Register the protocol name and description */
+ proto_rmt_norm = proto_register_protocol("Negative-acknowledgment Oriented Reliable Multicast", "NORM", "norm");
+
+ /* Register the header fields and subtrees used */
+ proto_register_field_array(proto_rmt_norm, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ expert_rmt_norm = expert_register_protocol(proto_rmt_norm);
+ expert_register_field_array(expert_rmt_norm, ei, array_length(ei));
+
+
+ /* Register preferences */
+ module = prefs_register_protocol(proto_rmt_norm, proto_reg_handoff_norm);
+ prefs_register_bool_preference(module, "heuristic_norm",
+ "Try to decode UDP packets as NORM packets",
+ "Check this to decode NORM traffic between clients",
+ &global_norm_heur);
}
-void proto_register_norm(void)
+void proto_reg_handoff_norm(void)
{
- /* Setup NORM header fields */
- static hf_register_info hf[] = {
-
- { &hf_version,
- { "Version", "norm.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_type,
- { "Message Type", "norm.type", FT_UINT8, BASE_DEC, VALS(string_norm_type), 0x0, NULL, HFILL }},
- { &hf_hlen,
- { "Header length", "norm.hlen", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_sequence,
- { "Sequence", "norm.sequence", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
- { &hf_source_id,
- { "Source ID", "norm.source_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_instance_id,
- { "Instance", "norm.instance_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_grtt,
- { "grtt", "norm.grtt", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
- { &hf_backoff,
- { "Backoff", "norm.backoff", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_gsize,
- { "Group Size", "norm.gsize", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
- { &hf_flags,
- { "Flags", "norm.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
- { &hf_flag_repair,
- { "Repair Flag", "norm.flag.repair", FT_BOOLEAN, 8, NULL, NORM_FLAG_REPAIR, NULL, HFILL }},
- { &hf_flag_norm_explicit,
- { "Explicit Flag", "norm.flag.explicit", FT_BOOLEAN, 8, NULL, NORM_FLAG_EXPLICIT, NULL, HFILL }},
- { &hf_flag_info,
- { "Info Flag", "norm.flag.info", FT_BOOLEAN, 8, NULL, NORM_FLAG_INFO, NULL, HFILL }},
- { &hf_flag_unreliable,
- { "Unreliable Flag", "norm.flag.unreliable", FT_BOOLEAN, 8, NULL, NORM_FLAG_UNRELIABLE, NULL, HFILL }},
- { &hf_flag_file,
- { "File Flag", "norm.flag.file", FT_BOOLEAN, 8, NULL, NORM_FLAG_FILE, NULL, HFILL }},
- { &hf_flag_stream,
- { "Stream Flag", "norm.flag.stream", FT_BOOLEAN, 8, NULL, NORM_FLAG_STREAM, NULL, HFILL }},
- { &hf_flag_msgstart,
- { "Msg Start Flag", "norm.flag.msgstart", FT_BOOLEAN, 8, NULL, NORM_FLAG_MSG_START, NULL, HFILL }},
- { &hf_object_transport_id,
- { "Object Transport ID", "norm.object_transport_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
- { &hf_extension,
- { "Hdr Extension", "norm.hexext", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_reserved,
- { "Reserved", "norm.reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
- { &hf_payload_len,
- { "Payload Len", "norm.payload.len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_payload_offset,
- { "Payload Offset", "norm.payload.offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
-
- { &hf_cmd_flavor,
- { "Flavor", "norm.flavor", FT_UINT8, BASE_DEC, VALS(string_norm_cmd_type), 0x0, NULL, HFILL}},
- { &hf_cc_sequence,
- { "CC Sequence", "norm.ccsequence", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_cc_sts,
- { "Send Time secs", "norm.cc_sts", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_cc_stus,
- { "Send Time usecs", "norm.cc_stus", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_cc_node_id,
- { "CC Node ID", "norm.cc_node_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL}},
- { &hf_cc_flags,
- { "CC Flags", "norm.cc_flags", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_cc_flags_clr,
- { "CLR", "norm.cc_flags.clr", FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_CLR, NULL, HFILL}},
- { &hf_cc_flags_plr,
- { "PLR", "norm.cc_flags.plr", FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_PLR, NULL, HFILL}},
- { &hf_cc_flags_rtt,
- { "RTT", "norm.cc_flags.rtt", FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_RTT, NULL, HFILL}},
- { &hf_cc_flags_start,
- { "Start", "norm.cc_flags.start", FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_START, NULL, HFILL}},
- { &hf_cc_flags_leave,
- { "Leave", "norm.cc_flags.leave", FT_BOOLEAN, 8, NULL, NORM_FLAG_CC_LEAVE, NULL, HFILL}},
- { &hf_cc_rtt,
- { "CC RTT", "norm.cc_rtt", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
- { &hf_cc_rate,
- { "CC Rate", "norm.cc_rate", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
- { &hf_cc_transport_id,
- { "CC Transport ID", "norm.cc_transport_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
-
- { &hf_ack_source,
- { "Ack Source", "norm.ack.source", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL}},
- { &hf_ack_type,
- { "Ack Type", "norm.ack.type", FT_UINT8, BASE_DEC, VALS(string_norm_ack_type), 0x0, NULL, HFILL}},
- { &hf_ack_id,
- { "Ack ID", "norm.ack.id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_ack_grtt_sec,
- { "Ack GRTT Sec", "norm.ack.grtt_sec", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_ack_grtt_usec,
- { "Ack GRTT usec", "norm.ack.grtt_usec", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
-
- { &hf_nack_server,
- { "NAck Server", "norm.nack.server", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL}},
- { &hf_nack_grtt_sec,
- { "NAck GRTT Sec", "norm.nack.grtt_sec", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_nack_grtt_usec,
- { "NAck GRTT usec", "norm.nack.grtt_usec", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_nack_form,
- { "NAck FORM", "norm.nack.form", FT_UINT8, BASE_DEC, VALS(string_norm_nack_form), 0x0, NULL, HFILL}},
- { &hf_nack_flags,
- { "NAck Flags", "norm.nack.flags", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_nack_flags_segment,
- { "Segment", "norm.nack.flags.segment", FT_BOOLEAN, 8, NULL, NORM_NACK_SEGMENT, NULL, HFILL}},
- { &hf_nack_flags_block,
- { "Block", "norm.nack.flags.block", FT_BOOLEAN, 8, NULL, NORM_NACK_BLOCK, NULL, HFILL}},
- { &hf_nack_flags_info,
- { "Info", "norm.nack.flags.info", FT_BOOLEAN, 8, NULL, NORM_NACK_INFO, NULL, HFILL}},
- { &hf_nack_flags_object,
- { "Object", "norm.nack.flags.object", FT_BOOLEAN, 8, NULL, NORM_NACK_OBJECT, NULL, HFILL}},
- { &hf_nack_length,
- { "NAck Length", "norm.nack.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
- { &hf_payload,
- { "Payload", "norm.payload", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_fec_encoding_id,
- { "FEC Encoding ID", "norm.fec_encoding_id", FT_UINT8, BASE_DEC, VALS(string_fec_encoding_id), 0x0, NULL, HFILL}}
- };
-
- /* Setup protocol subtree array */
- static gint *ett[] = {
- &ett_main,
- &ett_hdrext,
- &ett_flags,
- &ett_streampayload,
- &ett_congestioncontrol,
- &ett_nackdata
- };
-
- static ei_register_info ei[] = {
- { &ei_version1_only, { "alc.version1_only", PI_PROTOCOL, PI_WARN, "Sorry, this dissector supports ALC version 1 only", EXPFILL }}
- };
-
- module_t *module;
- expert_module_t* expert_rmt_norm;
-
- /* Register the protocol name and description */
- proto_rmt_norm = proto_register_protocol("Negative-acknowledgment Oriented Reliable Multicast", "NORM", "norm");
-
- /* Register the header fields and subtrees used */
- proto_register_field_array(proto_rmt_norm, hf, array_length(hf));
- proto_register_subtree_array(ett, array_length(ett));
- expert_rmt_norm = expert_register_protocol(proto_rmt_norm);
- expert_register_field_array(expert_rmt_norm, ei, array_length(ei));
-
-
- /* Register preferences */
- module = prefs_register_protocol(proto_rmt_norm, proto_reg_handoff_norm);
- prefs_register_bool_preference(module, "heuristic_norm",
- "Try to decode UDP packets as NORM packets",
- "Check this to decode NORM traffic between clients",
- &global_norm_heur);
+ static gboolean preferences_initialized = FALSE;
+ static dissector_handle_t handle;
+
+ if (!preferences_initialized) {
+ preferences_initialized = TRUE;
+ handle = new_create_dissector_handle(dissect_norm, proto_rmt_norm);
+ dissector_add_handle("udp.port", handle);
+ heur_dissector_add("udp", dissect_norm_heur, proto_rmt_norm);
+
+ rmt_fec_handle = find_dissector("rmt-fec");
+ }
}
/*
-* Editor modelines - http://www.wireshark.org/tools/modelines.html
-*
-* Local variables:
-* c-basic-offset: 4
-* tab-width: 8
-* indent-tabs-mode: nil
-* End:
-*
-* ex: set shiftwidth=4 tabstop=8 expandtab:
-* :indentSize=4:tabSize=8:noTabs=true:
-*/
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */