forked from osmocom/wireshark
added start of tns dissector
svn path=/trunk/; revision=1155
This commit is contained in:
parent
172047e2c6
commit
117d23c3a1
1
AUTHORS
1
AUTHORS
|
@ -154,6 +154,7 @@ Nathan Neulinger <nneul@umr.edu> {
|
|||
Andrew File System protocol support
|
||||
802.1q VLAN support
|
||||
Misc. RPC program dissectors
|
||||
TNS/Oracle dissector
|
||||
}
|
||||
|
||||
Tomislav Vujec <tvujec@carnet.hr> {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.am
|
||||
# Automake file for Ethereal
|
||||
#
|
||||
# $Id: Makefile.am,v 1.118 1999/11/27 04:48:12 guy Exp $
|
||||
# $Id: Makefile.am,v 1.119 1999/11/29 19:43:23 nneul Exp $
|
||||
#
|
||||
# Ethereal - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@zing.org>
|
||||
|
@ -131,6 +131,8 @@ DISSECTOR_SOURCES = \
|
|||
packet-tcp.c \
|
||||
packet-telnet.c\
|
||||
packet-tftp.c \
|
||||
packet-tns.c \
|
||||
packet-tns.h \
|
||||
packet-tr.c \
|
||||
packet-trmac.c \
|
||||
packet-udp.c \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-tcp.c
|
||||
* Routines for TCP packet disassembly
|
||||
*
|
||||
* $Id: packet-tcp.c,v 1.47 1999/11/28 03:35:10 gerald Exp $
|
||||
* $Id: packet-tcp.c,v 1.48 1999/11/29 19:43:24 nneul Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -102,6 +102,7 @@ static gint ett_tcp_option_sack = -1;
|
|||
#define TCP_PORT_RTSP 554
|
||||
#define TCP_PORT_YHOO 5050
|
||||
#define TCP_PORT_MAPI 1065
|
||||
#define TCP_PORT_TNS 1521
|
||||
|
||||
/* TCP structs and definitions */
|
||||
|
||||
|
@ -525,6 +526,9 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
|||
} else if (PORT_IS(TCP_PORT_MAPI)) {
|
||||
pi.match_port = TCP_PORT_MAPI;
|
||||
dissect_mapi(pd, offset, fd, tree);
|
||||
} else if (PORT_IS(TCP_PORT_TNS)) {
|
||||
pi.match_port = TCP_PORT_TNS;
|
||||
dissect_tns(pd, offset, fd, tree);
|
||||
} else {
|
||||
/* check existence of high level protocols */
|
||||
|
||||
|
|
|
@ -0,0 +1,229 @@
|
|||
/* packet-tns.c
|
||||
* Routines for MSX tns packet dissection
|
||||
*
|
||||
* $Id: packet-tns.c,v 1.1 1999/11/29 19:43:26 nneul Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@unicom.net>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* Copied from packet-tftp.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"
|
||||
#include "packet-tns.h"
|
||||
|
||||
static int proto_tns = -1;
|
||||
static int hf_tns_request = -1;
|
||||
static int hf_tns_response = -1;
|
||||
static int hf_tns_length = -1;
|
||||
static int hf_tns_packet_checksum = -1;
|
||||
static int hf_tns_header_checksum = -1;
|
||||
static int hf_tns_packet_type = -1;
|
||||
static int hf_tns_reserved_byte = -1;
|
||||
|
||||
static gint ett_tns = -1;
|
||||
|
||||
static const value_string tns_type_vals[] = {
|
||||
{TNS_TYPE_CONNECT, "Connect" },
|
||||
{TNS_TYPE_ACCEPT, "Accept" },
|
||||
{TNS_TYPE_DATA, "Data" },
|
||||
{TNS_TYPE_RESEND, "Resend"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
/* Handy macro for checking for truncated packet */
|
||||
#define TRUNC(length) if ( ! BYTES_ARE_IN_FRAME(offset, length)) { \
|
||||
dissect_data(pd,offset,fd,tree); return; }
|
||||
|
||||
void dissect_tns_data(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree)
|
||||
{
|
||||
dissect_data(pd,offset,fd,tree);
|
||||
return;
|
||||
}
|
||||
|
||||
void dissect_tns_connect(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree)
|
||||
{
|
||||
dissect_data(pd,offset,fd,tree);
|
||||
return;
|
||||
}
|
||||
|
||||
void dissect_tns_accept(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree)
|
||||
{
|
||||
dissect_data(pd,offset,fd,tree);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dissect_tns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
||||
{
|
||||
proto_tree *tns_tree, *ti;
|
||||
guint16 length;
|
||||
guint16 type;
|
||||
|
||||
if (check_col(fd, COL_PROTOCOL))
|
||||
col_add_str(fd, COL_PROTOCOL, "TNS");
|
||||
|
||||
if (check_col(fd, COL_INFO))
|
||||
{
|
||||
col_add_fstr(fd, COL_INFO, "%s",
|
||||
(pi.match_port == pi.destport) ? "Request" : "Response");
|
||||
}
|
||||
|
||||
if (tree)
|
||||
{
|
||||
ti = proto_tree_add_item(tree, proto_tns, offset, END_OF_FRAME, NULL);
|
||||
tns_tree = proto_item_add_subtree(ti, ett_tns);
|
||||
|
||||
if (pi.match_port == pi.destport)
|
||||
{
|
||||
proto_tree_add_item_hidden(tns_tree, hf_tns_request,
|
||||
offset, END_OF_FRAME, TRUE);
|
||||
proto_tree_add_text(tns_tree, offset,
|
||||
END_OF_FRAME, "Request: <opaque data>" );
|
||||
}
|
||||
else
|
||||
{
|
||||
proto_tree_add_item_hidden(tns_tree, hf_tns_response,
|
||||
offset, END_OF_FRAME, TRUE);
|
||||
proto_tree_add_text(tns_tree, offset,
|
||||
END_OF_FRAME, "Response: <opaque data>");
|
||||
}
|
||||
}
|
||||
|
||||
/* check to make sure length is present */
|
||||
if ( ! BYTES_ARE_IN_FRAME(offset, 2)) return;
|
||||
|
||||
length = pntohs(&pd[offset]);
|
||||
if (tree)
|
||||
{
|
||||
proto_tree_add_item(tns_tree, hf_tns_length,
|
||||
offset, 2, length);
|
||||
}
|
||||
TRUNC(length);
|
||||
offset += 2;
|
||||
|
||||
TRUNC(2);
|
||||
if ( tree )
|
||||
{
|
||||
proto_tree_add_item(tns_tree, hf_tns_packet_checksum,
|
||||
offset, 2, pntohs(&pd[offset]));
|
||||
}
|
||||
offset += 2;
|
||||
|
||||
TRUNC(2);
|
||||
type = pd[offset];
|
||||
if ( tree )
|
||||
{
|
||||
proto_tree_add_item(tns_tree, hf_tns_packet_type,
|
||||
offset, 1, type);
|
||||
}
|
||||
offset += 1;
|
||||
|
||||
if ( check_col(fd, COL_INFO))
|
||||
{
|
||||
col_append_fstr(fd, COL_INFO, ", %s (%d)",
|
||||
val_to_str(type, tns_type_vals, "Unknown"), type);
|
||||
}
|
||||
|
||||
TRUNC(1);
|
||||
if ( tree )
|
||||
{
|
||||
proto_tree_add_item(tns_tree, hf_tns_reserved_byte,
|
||||
offset, 1, &pd[offset]);
|
||||
}
|
||||
offset += 1;
|
||||
|
||||
TRUNC(2);
|
||||
if ( tree )
|
||||
{
|
||||
proto_tree_add_item(tns_tree, hf_tns_header_checksum,
|
||||
offset, 2, pntohs(&pd[offset]));
|
||||
}
|
||||
offset += 2;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TNS_TYPE_CONNECT:
|
||||
dissect_tns_connect(pd,offset,fd,tree);
|
||||
break;
|
||||
case TNS_TYPE_ACCEPT:
|
||||
dissect_tns_accept(pd,offset,fd,tree);
|
||||
break;
|
||||
case TNS_TYPE_DATA:
|
||||
dissect_tns_data(pd,offset,fd,tree);
|
||||
break;
|
||||
default:
|
||||
dissect_data(pd,offset,fd,tree);
|
||||
}
|
||||
}
|
||||
|
||||
void proto_register_tns(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_tns_response, {
|
||||
"Response", "tns.response", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "TRUE if TNS response" }},
|
||||
{ &hf_tns_request, {
|
||||
"Request", "tns.request", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "TRUE if TNS request" }},
|
||||
{ &hf_tns_length, {
|
||||
"Packet Length", "tns.length", FT_UINT32, BASE_NONE,
|
||||
NULL, 0x0, "Length of TNS packet" }},
|
||||
{ &hf_tns_packet_checksum, {
|
||||
"Packet Checksum", "tns.packet_checksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0x0, "Checksum of Packet Data" }},
|
||||
{ &hf_tns_header_checksum, {
|
||||
"Header Checksum", "tns.header_checksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0x0, "Checksum of Header Data" }},
|
||||
{ &hf_tns_reserved_byte, {
|
||||
"Reserved Byte", "tns.reserved_byte", FT_BYTES, BASE_HEX,
|
||||
NULL, 0x0, "Reserved Byte" }},
|
||||
{ &hf_tns_packet_type, {
|
||||
"Packet Type", "tns.type", FT_UINT8, BASE_NONE,
|
||||
VALS(tns_type_vals), 0x0, "Type of TNS packet" }}
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_tns,
|
||||
};
|
||||
proto_tns = proto_register_protocol(
|
||||
"Transparent Network Substrate Protocol", "tns");
|
||||
proto_register_field_array(proto_tns, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
/* packet-tns.h */
|
||||
/* $Id: packet-tns.h,v 1.1 1999/11/29 19:43:26 nneul Exp $ */
|
||||
|
||||
#ifndef PACKET_TNS_H
|
||||
#define PACKET_TNS_H
|
||||
|
||||
/* Packet Types */
|
||||
#define TNS_TYPE_CONNECT 1
|
||||
#define TNS_TYPE_ACCEPT 2
|
||||
#define TNS_TYPE_DATA 6
|
||||
#define TNS_TYPE_RESEND 11
|
||||
|
||||
#endif
|
3
packet.h
3
packet.h
|
@ -1,7 +1,7 @@
|
|||
/* packet.h
|
||||
* Definitions for packet disassembly structures and routines
|
||||
*
|
||||
* $Id: packet.h,v 1.152 1999/11/27 04:48:14 guy Exp $
|
||||
* $Id: packet.h,v 1.153 1999/11/29 19:43:25 nneul Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -386,6 +386,7 @@ void dissect_sscop(const u_char *, int, frame_data *, proto_tree *);
|
|||
void dissect_tcp(const u_char *, int, frame_data *, proto_tree *);
|
||||
void dissect_telnet(const u_char *, int, frame_data *, proto_tree *);
|
||||
void dissect_tftp(const u_char *, int, frame_data *, proto_tree *);
|
||||
void dissect_tns(const u_char *, int, frame_data *, proto_tree *);
|
||||
void dissect_tr(const u_char *, int, frame_data *, proto_tree *);
|
||||
void dissect_trmac(const u_char *, int, frame_data *, proto_tree *);
|
||||
void dissect_udp(const u_char *, int, frame_data *, proto_tree *);
|
||||
|
|
Loading…
Reference in New Issue