2 * Routines for displaying an undissected media type (default case),
3 * based on the generic "data" dissector.
5 * (C) Olivier Biot, 2004
9 * Refer to the AUTHORS file or the AUTHORS section in the man page
10 * for contacting the author(s) of this file.
12 * Ethereal - Network traffic analyzer
13 * By Gerald Combs <gerald@ethereal.com>
14 * Copyright 1998 Gerald Combs
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include <epan/packet.h>
38 /* proto_media cannot be static because it's referenced in the
44 dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree)
48 /* Add media type to the INFO column if it is visible */
49 if (check_col(pinfo->cinfo, COL_INFO)) {
50 col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", pinfo->match_string);
54 bytes = tvb_length_remaining(tvb, 0);
56 if (pinfo->private_data) {
57 /* The media type has parameters */
58 proto_tree_add_protocol_format(tree, proto_media, tvb, 0, bytes,
59 "Media Type: %s; %s (%d byte%s)",
60 pinfo->match_string, (char *)pinfo->private_data,
61 bytes, plurality(bytes, "", "s"));
63 /* The media type has no parameters */
64 proto_tree_add_protocol_format(tree, proto_media, tvb, 0, bytes,
65 "Media Type: %s (%d byte%s)",
67 bytes, plurality(bytes, "", "s"));
74 proto_register_media(void)
76 proto_media = proto_register_protocol (
77 "Media Type", /* name */
78 "Media", /* short name */
81 register_dissector("media", dissect_media, proto_media);
84 * "Media" is used to dissect something whose normal dissector
85 * is disabled, so it cannot itself be disabled.
87 proto_set_cant_toggle(proto_media);