Dissect the FLUTE "data".

svn path=/trunk/; revision=24228
This commit is contained in:
Anders Broman 2008-01-30 22:34:17 +00:00
parent 8ba9f2d3a4
commit df0e82fa10
3 changed files with 35 additions and 10 deletions

View File

@ -64,6 +64,8 @@ static struct _alc_ett ett;
static gboolean preferences_initialized = FALSE;
static struct _alc_prefs preferences;
static struct _alc_prefs preferences_old;
dissector_handle_t xml_handle;
/* Preferences */
/* =========== */
@ -117,6 +119,10 @@ static void dissect_alc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
proto_tree *alc_tree;
/* Flute or not */
tvbuff_t *new_tvb;
gboolean is_flute = FALSE;
/* Structures and variables initialization */
offset = 0;
@ -169,7 +175,7 @@ static void dissect_alc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* LCT header dissection */
/* --------------------- */
lct_dissector(l, f, tvb, alc_tree, &offset);
is_flute = lct_dissector(l, f, tvb, alc_tree, &offset);
/* FEC header dissection */
/* --------------------- */
@ -181,8 +187,14 @@ static void dissect_alc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fec_dissector(f, tvb, alc_tree, &offset);
/* Add the Payload item */
if (tvb_length(tvb) > offset)
proto_tree_add_none_format(alc_tree, hf.payload, tvb, offset, -1, "Payload (%u bytes)", tvb_length(tvb) - offset);
if (tvb_length(tvb) > offset){
if(is_flute){
new_tvb = tvb_new_subset(tvb,offset,-1,-1);
call_dissector(xml_handle, new_tvb, pinfo, alc_tree);
}else{
proto_tree_add_none_format(alc_tree, hf.payload, tvb, offset, -1, "Payload (%u bytes)", tvb_length(tvb) - offset);
}
}
/* Complete entry in Info column on summary display */
/* ------------------------------------------------ */
@ -228,6 +240,8 @@ void proto_reg_handoff_alc(void)
dissector_add("udp.port", preferences.default_udp_port, handle);
alc_prefs_save(&preferences, &preferences_old);
xml_handle = find_dissector("xml");
}
void proto_register_alc(void)
@ -272,5 +286,6 @@ void proto_register_alc(void)
/* Register preferences */
module = prefs_register_protocol(proto, proto_reg_handoff_alc);
alc_prefs_register(&preferences, module);
alc_prefs_register(&preferences, module);
}

View File

@ -81,11 +81,12 @@ static void lct_timestamp_parse(guint32 t, nstime_t* s)
s->nsecs = (t % 1000) * 1000000;
}
void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f)
gboolean lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f)
{
guint32 buffer32;
proto_item *ti;
proto_tree *ext_tree;
gboolean is_flute = FALSE;
switch (e->het)
{
@ -180,6 +181,7 @@ void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, pro
proto_tree_add_text(ext_tree, tvb, e->offset+1, 3,
"FDT Instance ID: %u", buffer32 & 0x000FFFFF);
}
is_flute = TRUE;
break;
}
break;
@ -213,6 +215,7 @@ void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, pro
default:
rmt_ext_decode_default(e, tvb, tree, ett);
}
return is_flute;
}
/* LCT exported functions */
@ -252,12 +255,14 @@ void lct_info_column(struct _lct *lct, packet_info *pinfo)
* tree - tree where to add LCT header subtree
* offset - ptr to offset to use and update
*/
void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *offset)
gboolean lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *offset)
{
guint i;
guint offset_old;
guint offset_start;
guint16 buffer16;
gboolean is_flute_tmp =FALSE;
gboolean is_flute =FALSE;
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
@ -462,9 +467,14 @@ void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tr
lct_ext_tree = NULL;
/* Add the extensions to the subtree */
for (i = 0; i < l.lct->ext->len; i++)
lct_ext_decode(&g_array_index(l.lct->ext, struct _ext, i), l.prefs, tvb, lct_ext_tree, l.ett->ext_ext, f);
for (i = 0; i < l.lct->ext->len; i++){
is_flute_tmp = lct_ext_decode(&g_array_index(l.lct->ext, struct _ext, i), l.prefs, tvb, lct_ext_tree, l.ett->ext_ext, f);
if (is_flute_tmp == TRUE )
is_flute = TRUE;
}
}
return is_flute;
}
void lct_dissector_free(struct _lct *lct)

View File

@ -176,11 +176,11 @@ struct _lct_ptr
void lct_info_column(struct _lct *lct, packet_info *pinfo);
void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *offset);
gboolean lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *offset);
void lct_dissector_free(struct _lct *lct);
void lct_prefs_set_default(struct _lct_prefs *prefs);
void lct_prefs_register(struct _lct_prefs *prefs, module_t *module);
void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f);
gboolean lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f);
#endif