diff options
author | Guy Harris <guy@alum.mit.edu> | 2006-06-09 23:06:38 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2006-06-09 23:06:38 +0000 |
commit | a85199af18276446c0af8ba04c3db65d34ee03a9 (patch) | |
tree | 79dac14f4e411c8a81c234689d6e8600017c065e /epan/dissectors/packet-tivoconnect.c | |
parent | 54bc6ca3580a10c3ba5350717c23e73cb15b4dd3 (diff) |
Make dissect_tivoconnect() a proper "new-style" dissector, and register
it as such.
Use "tvb_strncaseeql()" to do the check for "tivoconnect" at the
beginning of the packet.
svn path=/trunk/; revision=18415
Diffstat (limited to 'epan/dissectors/packet-tivoconnect.c')
-rw-r--r-- | epan/dissectors/packet-tivoconnect.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/epan/dissectors/packet-tivoconnect.c b/epan/dissectors/packet-tivoconnect.c index b77178bec4..670c7acbf4 100644 --- a/epan/dissectors/packet-tivoconnect.c +++ b/epan/dissectors/packet-tivoconnect.c @@ -68,7 +68,7 @@ static int hf_tivoconnect_version = -1; static gint ett_tivoconnect = -1; /* Code to actually dissect the packets */ -static gboolean +static int dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* parsing variables */ @@ -80,11 +80,8 @@ dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gchar * packet_machine = NULL; /* validate that we have a tivoconnect packet */ - length = tvb->length; - if ( length < 11 || - !(string = (gchar*)tvb_get_ephemeral_string(tvb, 0, length)) || - strncasecmp(string,"tivoconnect",11) != 0) { - return FALSE; + if ( tvb_strncaseeql(tvb, 0, "tivoconnect", 11) != 0) { + return 0; } /* Make entries in Protocol column and Info column on summary display */ @@ -198,7 +195,7 @@ dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* If this protocol has a sub-dissector call it here, see section 1.8 */ - return TRUE; + return tvb_length(tvb); } @@ -267,7 +264,7 @@ proto_reg_handoff_tivoconnect(void) dissector_handle_t tivoconnect_handle; - tivoconnect_handle = create_dissector_handle(dissect_tivoconnect, + tivoconnect_handle = new_create_dissector_handle(dissect_tivoconnect, proto_tivoconnect); dissector_add("udp.port", 2190, tivoconnect_handle); dissector_add("tcp.port", 2190, tivoconnect_handle); @@ -275,4 +272,3 @@ proto_reg_handoff_tivoconnect(void) inited = TRUE; } } - |