1999-08-18 00:57:54 +00:00
|
|
|
/* packet-telnet.c
|
1999-04-05 21:54:41 +00:00
|
|
|
* Routines for telnet packet dissection
|
|
|
|
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
|
|
|
|
*
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
* $Id: packet-telnet.c,v 1.15 2000/08/13 14:08:44 deniel Exp $
|
1999-04-05 21:54:41 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2000-01-07 22:05:43 +00:00
|
|
|
* By Gerald Combs <gerald@zing.org>
|
1999-04-05 21:54:41 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-pop.c
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
# include <netinet/in.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include "packet.h"
|
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_telnet = -1;
|
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_telnet = -1;
|
|
|
|
static gint ett_telnet_subopt = -1;
|
|
|
|
|
1999-04-05 21:54:41 +00:00
|
|
|
/* Some defines for Telnet */
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
#define TCP_PORT_TELNET 23
|
|
|
|
|
1999-04-05 21:54:41 +00:00
|
|
|
#define TN_IAC 255
|
|
|
|
#define TN_DONT 254
|
|
|
|
#define TN_DO 253
|
|
|
|
#define TN_WONT 252
|
|
|
|
#define TN_WILL 251
|
|
|
|
#define TN_SB 250
|
|
|
|
#define TN_GA 249
|
|
|
|
#define TN_EL 248
|
|
|
|
#define TN_EC 247
|
|
|
|
#define TN_AYT 246
|
|
|
|
#define TN_AO 245
|
|
|
|
#define TN_IP 244
|
|
|
|
#define TN_BRK 243
|
|
|
|
#define TN_DM 242
|
|
|
|
#define TN_NOP 241
|
|
|
|
#define TN_SE 240
|
|
|
|
#define TN_EOR 239
|
|
|
|
#define TN_ABORT 238
|
|
|
|
#define TN_SUSP 237
|
|
|
|
#define TN_EOF 236
|
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
static const char *options[] = {
|
1999-04-05 21:54:41 +00:00
|
|
|
"Binary Transmission",
|
|
|
|
"Echo",
|
|
|
|
"Reconnection",
|
|
|
|
"Suppress Go Ahead",
|
|
|
|
"Approx Message Size Negotiation",
|
|
|
|
"Status",
|
|
|
|
"Timing Mark",
|
|
|
|
"Remote Controlled Trans and Echo",
|
|
|
|
"Output Line Width",
|
|
|
|
"Output Page Size",
|
|
|
|
"Output Carriage-Return Disposition",
|
|
|
|
"Output Horizontal Tab Stops",
|
|
|
|
"Output Horizontal Tab Disposition",
|
|
|
|
"Output Formfeed Disposition",
|
|
|
|
"Output Vertical Tabstops",
|
|
|
|
"Output Vertical Tab Disposition",
|
|
|
|
"Output Linefeed Disposition",
|
|
|
|
"Extended ASCII",
|
|
|
|
"Logout",
|
|
|
|
"Byte Macro",
|
|
|
|
"Data Entry Terminal",
|
|
|
|
"SUPDUP",
|
|
|
|
"SUPDUP Output",
|
|
|
|
"Send Location",
|
|
|
|
"Terminal Type",
|
|
|
|
"End of Record",
|
|
|
|
"TACACS User Identification",
|
|
|
|
"Output Marking",
|
|
|
|
"Terminal Location Number",
|
|
|
|
"Telnet 3270 Regime",
|
|
|
|
"X.3 PAD",
|
|
|
|
"Negotiate About Window Size",
|
|
|
|
"Terminal Speed",
|
|
|
|
"Remote Flow Control",
|
|
|
|
"Linemode",
|
|
|
|
"X Display Location",
|
|
|
|
"Environment Option",
|
|
|
|
"Authentication Option",
|
|
|
|
"Encryption Option",
|
|
|
|
"New Environment Option",
|
|
|
|
"TN3270E"
|
|
|
|
};
|
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
#define NOPTIONS (sizeof options / sizeof options[0])
|
|
|
|
|
|
|
|
static int
|
|
|
|
telnet_sub_option(proto_tree *telnet_tree, const u_char *pd,
|
|
|
|
int start_offset)
|
1999-04-05 21:54:41 +00:00
|
|
|
{
|
|
|
|
proto_tree *ti, *option_tree;
|
2000-03-23 10:25:38 +00:00
|
|
|
int offset = start_offset;
|
|
|
|
int subneg_len, req;
|
|
|
|
gboolean not_found = TRUE;
|
|
|
|
const u_char *opt;
|
1999-04-05 21:54:41 +00:00
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
offset += 2; /* skip IAC and SB */
|
1999-04-05 21:54:41 +00:00
|
|
|
|
|
|
|
/* Figure out the option and type */
|
2000-03-23 10:25:38 +00:00
|
|
|
if (pd[offset] > NOPTIONS)
|
|
|
|
opt = "<unknown option>";
|
|
|
|
else
|
|
|
|
opt = options[pd[offset]];
|
|
|
|
offset++;
|
|
|
|
req = pd[offset];
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
while (offset < pi.captured_len && not_found) {
|
|
|
|
if (pd[offset] == TN_IAC)
|
|
|
|
not_found = FALSE;
|
1999-04-05 21:54:41 +00:00
|
|
|
else
|
2000-03-23 10:25:38 +00:00
|
|
|
offset++;
|
1999-04-05 21:54:41 +00:00
|
|
|
}
|
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
subneg_len = offset - start_offset;
|
1999-04-05 21:54:41 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(telnet_tree, NullTVB, start_offset, subneg_len,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Suboption Begin: %s", opt);
|
1999-04-05 21:54:41 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
option_tree = proto_item_add_subtree(ti, ett_telnet_subopt);
|
1999-04-05 21:54:41 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(option_tree, NullTVB, start_offset + 2, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"%s %s", (req ? "Send your" : "Here's my"), opt);
|
1999-04-05 21:54:41 +00:00
|
|
|
|
|
|
|
if (req == 0) { /* Add the value */
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(option_tree, NullTVB, start_offset + 4, subneg_len - 4,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Value: %s", format_text(&pd[start_offset + 4], subneg_len - 4));
|
1999-04-05 21:54:41 +00:00
|
|
|
}
|
2000-03-23 10:25:38 +00:00
|
|
|
return offset;
|
|
|
|
}
|
1999-04-05 21:54:41 +00:00
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
static int
|
|
|
|
telnet_will_wont_do_dont(proto_tree *telnet_tree, const u_char *pd,
|
|
|
|
int start_offset, char *type)
|
|
|
|
{
|
|
|
|
int offset = start_offset;
|
|
|
|
const char *opt;
|
|
|
|
|
|
|
|
offset += 2; /* skip IAC and WILL,WONT,DO,DONT} */
|
|
|
|
if (pd[offset] > NOPTIONS)
|
|
|
|
opt = "<unknown option>";
|
|
|
|
else
|
|
|
|
opt = options[pd[offset]];
|
|
|
|
offset++;
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 3,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: %s %s", type, opt);
|
|
|
|
return offset;
|
1999-04-05 21:54:41 +00:00
|
|
|
}
|
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
static int
|
2000-03-23 10:49:33 +00:00
|
|
|
telnet_command(proto_tree *telnet_tree, const u_char *pd, int start_offset)
|
1999-04-05 21:54:41 +00:00
|
|
|
{
|
2000-03-23 10:25:38 +00:00
|
|
|
int offset = start_offset;
|
|
|
|
u_char optcode;
|
1999-04-05 21:54:41 +00:00
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
offset += 1; /* skip IAC */
|
|
|
|
optcode = pd[offset];
|
|
|
|
offset++;
|
|
|
|
switch(optcode) {
|
1999-04-05 21:54:41 +00:00
|
|
|
|
|
|
|
case TN_EOF:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: End of File");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_SUSP:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Suspend Current Process");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_ABORT:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Abort Process");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_EOR:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: End of Record");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_SE:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Suboption End");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_NOP:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: No Operation");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_DM:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Data Mark");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_BRK:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Break");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_IP:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Interrupt Process");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_AO:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Abort Output");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_AYT:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Are You There?");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_EC:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Escape Character");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_EL:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Erase Line");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_GA:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, start_offset, 2,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Command: Go Ahead");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_SB:
|
2000-03-23 10:25:38 +00:00
|
|
|
offset = telnet_sub_option(telnet_tree, pd, start_offset);
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_WILL:
|
2000-03-23 10:25:38 +00:00
|
|
|
offset = telnet_will_wont_do_dont(telnet_tree, pd, start_offset,
|
|
|
|
"Will");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_WONT:
|
2000-03-23 10:25:38 +00:00
|
|
|
offset = telnet_will_wont_do_dont(telnet_tree, pd, start_offset,
|
|
|
|
"Won't");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_DO:
|
2000-03-23 10:25:38 +00:00
|
|
|
offset = telnet_will_wont_do_dont(telnet_tree, pd, start_offset,
|
|
|
|
"Do");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TN_DONT:
|
2000-03-23 10:25:38 +00:00
|
|
|
offset = telnet_will_wont_do_dont(telnet_tree, pd, start_offset,
|
|
|
|
"Don't");
|
1999-04-05 21:54:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
return offset;
|
1999-04-05 21:54:41 +00:00
|
|
|
}
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
static void
|
1999-08-18 00:57:54 +00:00
|
|
|
dissect_telnet(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
1999-04-05 21:54:41 +00:00
|
|
|
{
|
|
|
|
proto_tree *telnet_tree, *ti;
|
|
|
|
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
OLD_CHECK_DISPLAY_AS_DATA(proto_telnet, pd, offset, fd, tree);
|
|
|
|
|
1999-04-05 21:54:41 +00:00
|
|
|
if (check_col(fd, COL_PROTOCOL))
|
|
|
|
col_add_str(fd, COL_PROTOCOL, "TELNET");
|
|
|
|
|
2000-03-23 10:49:33 +00:00
|
|
|
if (check_col(fd, COL_INFO))
|
1999-04-05 21:54:41 +00:00
|
|
|
col_add_fstr(fd, COL_INFO, "Telnet Data ...");
|
|
|
|
|
|
|
|
if (tree) {
|
2000-03-23 10:25:38 +00:00
|
|
|
int data_offset;
|
|
|
|
int data_len;
|
1999-04-05 21:54:41 +00:00
|
|
|
|
2000-05-31 05:09:07 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_telnet, NullTVB, offset, END_OF_FRAME, FALSE);
|
1999-11-16 11:44:20 +00:00
|
|
|
telnet_tree = proto_item_add_subtree(ti, ett_telnet);
|
1999-04-05 21:54:41 +00:00
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
data_offset = offset;
|
|
|
|
data_len = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Scan through the buffer looking for an IAC byte.
|
|
|
|
*/
|
|
|
|
while (offset < pi.captured_len) {
|
|
|
|
if (pd[offset] == TN_IAC) {
|
|
|
|
/*
|
|
|
|
* We found an IAC byte.
|
|
|
|
* If there's any data before it, add that data to the
|
|
|
|
* tree.
|
|
|
|
*/
|
|
|
|
if (data_len > 0) {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, data_offset, data_len,
|
2000-03-23 10:25:38 +00:00
|
|
|
"Data: %s", format_text(&pd[data_offset], data_len));
|
|
|
|
data_len = 0;
|
|
|
|
data_offset = offset;
|
1999-04-05 21:54:41 +00:00
|
|
|
}
|
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
/*
|
|
|
|
* Now interpret the command.
|
|
|
|
*/
|
2000-03-23 10:49:33 +00:00
|
|
|
offset = telnet_command(telnet_tree, pd, offset);
|
2000-03-23 10:25:38 +00:00
|
|
|
data_offset = offset;
|
1999-04-05 21:54:41 +00:00
|
|
|
}
|
|
|
|
else {
|
2000-03-23 10:25:38 +00:00
|
|
|
data_len++;
|
|
|
|
offset++;
|
1999-04-05 21:54:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-03-23 10:25:38 +00:00
|
|
|
/*
|
|
|
|
* We've reached the end of the buffer.
|
|
|
|
* If there's any data left, add it to the tree.
|
|
|
|
*/
|
|
|
|
if (data_len > 0) {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(telnet_tree, NullTVB, data_offset, data_len, "Data: %s",
|
2000-03-23 10:25:38 +00:00
|
|
|
format_text(&pd[data_offset], data_len));
|
1999-04-05 21:54:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
void
|
|
|
|
proto_register_telnet(void)
|
|
|
|
{
|
|
|
|
/* static hf_register_info hf[] = {
|
|
|
|
{ &variable,
|
|
|
|
{ "Name", "telnet.abbreviation", TYPE, VALS_POINTER }},
|
|
|
|
};*/
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_telnet,
|
|
|
|
&ett_telnet_subopt,
|
|
|
|
};
|
1999-04-05 21:54:41 +00:00
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
proto_telnet = proto_register_protocol("Telnet", "telnet");
|
|
|
|
/* proto_register_field_array(proto_telnet, hf, array_length(hf));*/
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
1999-07-29 05:47:07 +00:00
|
|
|
}
|
2000-04-08 07:07:42 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_telnet(void)
|
|
|
|
{
|
Allow either old-style (pre-tvbuff) or new-style (tvbuffified)
dissectors to be registered as dissectors for particular ports,
registered as heuristic dissectors, and registered as dissectors for
conversations, and have routines to be used both by old-style and
new-style dissectors to call registered dissectors.
Have the code that calls those dissectors translate the arguments as
necessary. (For conversation dissectors, replace
"find_conversation_dissector()", which just returns a pointer to the
dissector, with "old_try_conversation_dissector()" and
"try_conversation_dissector()", which actually call the dissector, so
that there's a single place at which we can do that translation. Also
make "dissector_lookup()" static and, instead of calling it and, if it
returns a non-null pointer, calling that dissector, just use
"old_dissector_try_port()" or "dissector_try_port()", for the same
reason.)
This allows some dissectors that took old-style arguments and
immediately translated them to new-style arguments to just take
new-style arguments; make them do so. It also allows some new-style
dissectors not to have to translate arguments before calling routines to
look up and call dissectors; make them not do so.
Get rid of checks for too-short frames in new-style dissectors - the
tvbuff code does those checks for you.
Give the routines to register old-style dissectors, and to call
dissectors from old-style dissectors, names beginning with "old_", with
the routines for new-style dissectors not having the "old_". Update the
dissectors that use those routines appropriately.
Rename "dissect_data()" to "old_dissect_data()", and
"dissect_data_tvb()" to "dissect_data()".
svn path=/trunk/; revision=2218
2000-08-07 03:21:25 +00:00
|
|
|
old_dissector_add("tcp.port", TCP_PORT_TELNET, dissect_telnet);
|
2000-04-08 07:07:42 +00:00
|
|
|
}
|