2004-02-03 18:57:26 +00:00
|
|
|
/* Routines for sipfrag packet disassembly (RFC 3420)
|
|
|
|
*
|
|
|
|
* Martin Mathieson
|
|
|
|
* Based on packet-sdp.c
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2004-02-03 18:57:26 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2004-02-03 18:57:26 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-02-03 18:57:26 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2004-02-03 18:57:26 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
|
|
|
/*
|
2006-08-07 17:10:59 +00:00
|
|
|
* Doesn't do a detailed dissection of the lines of the message, just treat as text.
|
2004-02-03 18:57:26 +00:00
|
|
|
*/
|
|
|
|
|
2013-12-11 19:46:38 +00:00
|
|
|
void proto_register_sipfrag(void);
|
2004-02-03 18:57:26 +00:00
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields. */
|
|
|
|
static int proto_sipfrag = -1;
|
2006-08-07 17:10:59 +00:00
|
|
|
static int hf_sipfrag_line = -1;
|
2004-02-03 18:57:26 +00:00
|
|
|
|
|
|
|
/* Protocol subtree. */
|
|
|
|
static int ett_sipfrag = -1;
|
|
|
|
|
2006-08-07 17:10:59 +00:00
|
|
|
void proto_reg_handoff_sipfrag(void);
|
|
|
|
static void dissect_sipfrag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
|
2004-02-03 18:57:26 +00:00
|
|
|
|
|
|
|
/* Main dissection function. */
|
2006-08-07 17:10:59 +00:00
|
|
|
static void dissect_sipfrag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
2004-02-03 18:57:26 +00:00
|
|
|
{
|
2006-08-07 17:10:59 +00:00
|
|
|
proto_tree *sipfrag_tree;
|
|
|
|
proto_item *ti;
|
2004-02-03 18:57:26 +00:00
|
|
|
gint offset = 0;
|
|
|
|
gint next_offset;
|
|
|
|
int linelen;
|
|
|
|
char *string;
|
|
|
|
gint lines = 0;
|
|
|
|
|
|
|
|
/* Append this protocol name rather than replace. */
|
2009-09-24 20:21:23 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_PROTOCOL, "/sipfrag");
|
2004-02-03 18:57:26 +00:00
|
|
|
|
|
|
|
/* Add mention of this protocol to info column */
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, ", with Sipfrag");
|
2004-02-03 18:57:26 +00:00
|
|
|
|
|
|
|
/* Create sipfrag tree. */
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_sipfrag, tvb, offset, -1, ENC_NA);
|
2004-02-03 18:57:26 +00:00
|
|
|
sipfrag_tree = proto_item_add_subtree(ti, ett_sipfrag);
|
|
|
|
|
|
|
|
/* Show the sipfrag message a line at a time. */
|
|
|
|
while (tvb_reported_length_remaining(tvb, offset) > 0)
|
|
|
|
{
|
|
|
|
/* Find the end of the line. */
|
|
|
|
linelen = tvb_find_line_end_unquoted(tvb, offset, -1, &next_offset);
|
|
|
|
|
|
|
|
/* For now, add all lines as unparsed strings */
|
|
|
|
|
|
|
|
/* Extract & add the string. */
|
2013-09-22 15:50:55 +00:00
|
|
|
string = (char*)tvb_get_string(wmem_packet_scope(), tvb, offset, linelen);
|
2006-08-07 17:10:59 +00:00
|
|
|
proto_tree_add_string_format(sipfrag_tree, hf_sipfrag_line,
|
2004-02-03 18:57:26 +00:00
|
|
|
tvb, offset,
|
|
|
|
linelen, string,
|
|
|
|
"%s", string);
|
|
|
|
lines++;
|
|
|
|
|
|
|
|
/* Show first line in info column */
|
2010-09-15 16:16:23 +00:00
|
|
|
if (lines == 1) {
|
2004-02-03 18:57:26 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, "(%s", string);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Move onto next line. */
|
|
|
|
offset = next_offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Close off summary of sipfrag in info column */
|
2010-09-15 16:16:23 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, (lines > 1) ? "...)" : ")");
|
2004-02-03 18:57:26 +00:00
|
|
|
}
|
|
|
|
|
2006-08-07 17:10:59 +00:00
|
|
|
void proto_register_sipfrag(void)
|
2004-02-03 18:57:26 +00:00
|
|
|
{
|
|
|
|
static hf_register_info hf[] =
|
|
|
|
{
|
2006-08-07 17:10:59 +00:00
|
|
|
{ &hf_sipfrag_line,
|
2004-02-03 18:57:26 +00:00
|
|
|
{ "Line",
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"sipfrag.line",FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL
|
2004-02-03 18:57:26 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] =
|
|
|
|
{
|
|
|
|
&ett_sipfrag
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register protocol. */
|
|
|
|
proto_sipfrag = proto_register_protocol("Sipfrag", "SIPFRAG", "sipfrag");
|
|
|
|
proto_register_field_array(proto_sipfrag, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
/* Allow other dissectors to find this one by name. */
|
|
|
|
register_dissector("sipfrag", dissect_sipfrag, proto_sipfrag);
|
|
|
|
}
|
|
|
|
|
2006-08-07 17:10:59 +00:00
|
|
|
void proto_reg_handoff_sipfrag(void)
|
2004-02-03 18:57:26 +00:00
|
|
|
{
|
|
|
|
dissector_handle_t sipfrag_handle = find_dissector("sipfrag");
|
|
|
|
dissector_add_string("media_type", "message/sipfrag", sipfrag_handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
|