Added Nathan's patch for AFS and RX dissection.

svn path=/trunk/; revision=894
This commit is contained in:
Gilbert Ramirez 1999-10-20 16:41:20 +00:00
parent e5670af33d
commit 08292071f4
9 changed files with 2987 additions and 4 deletions

View File

@ -143,6 +143,8 @@ Christophe Tronche <ch.tronche@computer.org> {
Nathan Neulinger <nneul@umr.edu> {
Yahoo messenger and pager protocol support
NTP (Network Time Protocol) support
RX protocol support
Andrew File System protocol support
}
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.91 1999/10/20 06:28:28 guy Exp $
# $Id: Makefile.am,v 1.92 1999/10/20 16:41:16 gram Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@ -33,6 +33,8 @@ YFLAGS=-d -p dfilter_
DISSECTOR_SOURCES = \
packet-aarp.c \
packet-afs.c \
packet-afs.h \
packet-arp.c \
packet-ascend.c\
packet-atalk.c \
@ -92,6 +94,8 @@ DISSECTOR_SOURCES = \
packet-rsvp.c \
packet-rsvp.h \
packet-rtsp.c \
packet-rx.c \
packet-rx.h \
packet-sdp.c \
packet-smb.c \
packet-sna.c \

3
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.108 1999/10/12 05:00:47 guy Exp $
* $Id: file.c,v 1.109 1999/10/20 16:41:16 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -131,6 +131,7 @@ open_cap_file(char *fname, capture_file *cf) {
close_cap_file(cf, info_bar, file_ctx);
/* Initialize protocol-specific variables */
afs_init_protocol();
ncp_init_protocol();
smb_init_protocol();

2502
packet-afs.c Normal file

File diff suppressed because it is too large Load Diff

141
packet-afs.h Normal file
View File

@ -0,0 +1,141 @@
/* packet-afs.h
* Definitions for packet disassembly structures and routines
*
* $Id: packet-afs.h,v 1.1 1999/10/20 16:41:18 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* Copyright 1998 Gerald Combs
* Joerg Mayer <jmayer@telemation.de>
*
*
* 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.
*/
#ifndef PACKET_AFS_H
#define PACKET_AFS_H
#define AFS_PORT_FS 7000
#define AFS_PORT_CB 7001
#define AFS_PORT_PROT 7002
#define AFS_PORT_VLDB 7003
#define AFS_PORT_KAUTH 7004
#define AFS_PORT_VOL 7005
#define AFS_PORT_ERROR 7006 /* Doesn't seem to be used */
#define AFS_PORT_BOS 7007
#define AFS_PORT_UPDATE 7008
#define AFS_PORT_RMTSYS 7009
#define AFS_PORT_BACKUP 7021
#ifndef AFSNAMEMAX
#define AFSNAMEMAX 256
#endif
#ifndef AFSOPAQUEMAX
#define AFSOPAQUEMAX 1024
#endif
#define PRNAMEMAX 64
#define VLNAMEMAX 65
#define KANAMEMAX 64
#define BOSNAMEMAX 256
#define PRSFS_READ 1 /* Read files */
#define PRSFS_WRITE 2 /* Write files */
#define PRSFS_INSERT 4 /* Insert files into a directory */
#define PRSFS_LOOKUP 8 /* Lookup files into a directory */
#define PRSFS_DELETE 16 /* Delete files */
#define PRSFS_LOCK 32 /* Lock files */
#define PRSFS_ADMINISTER 64 /* Change ACL's */
#define CB_TYPE_EXCLUSIVE 1
#define CB_TYPE_SHARED 2
#define CB_TYPE_DROPPED 3
#define VOTE_LOW 10000
#define VOTE_HIGH 10005
#define DISK_LOW 20000
#define DISK_HIGH 20013
#define FILE_TYPE_FILE 1
#define FILE_TYPE_DIR 2
#define FILE_TYPE_LINK 3
struct afs_header {
guint32 opcode;
};
struct afs_volsync {
guint32 spare1;
guint32 spare2;
guint32 spare3;
guint32 spare4;
guint32 spare5;
guint32 spare6;
};
struct afs_status {
guint32 InterfaceVersion;
guint32 FileType;
guint32 LinkCount;
guint32 Length;
guint32 DataVersion;
guint32 Author;
guint32 Owner;
guint32 CallerAccess;
guint32 AnonymousAccess;
guint32 UnixModeBits;
guint32 ParentVnode;
guint32 ParentUnique;
guint32 SegSize;
guint32 ClientModTime;
guint32 ServerModTime;
guint32 Group;
guint32 SyncCount;
guint32 spare1;
guint32 spare2;
guint32 spare3;
guint32 spare4;
};
struct afs_volumeinfo {
guint32 Vid;
guint32 Type;
guint32 Type0;
guint32 Type1;
guint32 Type2;
guint32 Type3;
guint32 Type4;
guint32 ServerCount;
guint32 Server0;
guint32 Server1;
guint32 Server2;
guint32 Server3;
guint32 Server4;
guint32 Server5;
guint32 Server6;
guint32 Server7;
guint16 Part0;
guint16 Part1;
guint16 Part2;
guint16 Part3;
guint16 Part4;
guint16 Part5;
guint16 Part6;
guint16 Part7;
};
#endif

231
packet-rx.c Normal file
View File

@ -0,0 +1,231 @@
/* packet-rx.c
* Routines for RX packet dissection
* Copyright 1999, Nathan Neulinger <nneul@umr.edu>
* Based on routines from tcpdump patches by
* Ken Hornstein <kenh@cmf.nrl.navy.mil>
*
* $Id: packet-rx.c,v 1.1 1999/10/20 16:41:19 gram 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-rx.h"
#include "resolv.h"
static const value_string rx_types[] = {
{ RX_PACKET_TYPE_DATA, "data" },
{ RX_PACKET_TYPE_ACK, "ack" },
{ RX_PACKET_TYPE_BUSY, "busy" },
{ RX_PACKET_TYPE_ABORT, "abort" },
{ RX_PACKET_TYPE_ACKALL, "ackall" },
{ RX_PACKET_TYPE_CHALLENGE, "challenge" },
{ RX_PACKET_TYPE_RESPONSE, "response" },
{ RX_PACKET_TYPE_DEBUG, "debug" },
{ RX_PACKET_TYPE_PARAMS, "params" },
{ RX_PACKET_TYPE_VERSION, "version" },
{ 0, NULL },
};
static const value_string rx_flags[] = {
{ RX_CLIENT_INITIATED, "client-init" },
{ RX_REQUEST_ACK, "req-ack" },
{ RX_LAST_PACKET, "last-pckt" },
{ RX_MORE_PACKETS, "more-pckts" },
{ RX_FREE_PACKET, "free-pckt" }
};
static int proto_rx = -1;
static int hf_rx_epoch = -1;
static int hf_rx_cid = -1;
static int hf_rx_seq = -1;
static int hf_rx_serial = -1;
static int hf_rx_callnumber = -1;
static int hf_rx_type = -1;
static int hf_rx_flags = -1;
static int hf_rx_flags_clientinit = -1;
static int hf_rx_flags_request_ack = -1;
static int hf_rx_flags_last_packet = -1;
static int hf_rx_flags_more_packets = -1;
static int hf_rx_flags_free_packet = -1;
static int hf_rx_userstatus = -1;
static int hf_rx_securityindex = -1;
static int hf_rx_spare = -1;
static int hf_rx_serviceid = -1;
void
dissect_rx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
proto_tree *rx_tree, *rx_tree_flags, *rx_flags, *ti;
struct rx_header *rxh;
int reply;
rxh = (struct rx_header *) &pd[offset];
/* get at least a full packet structure */
if ( !BYTES_ARE_IN_FRAME(offset, sizeof(struct rx_header)) )
return;
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "RX");
if (tree) {
ti = proto_tree_add_item(tree, proto_rx, offset,
sizeof(struct rx_header), NULL);
rx_tree = proto_item_add_subtree(ti, ETT_RX);
proto_tree_add_item(rx_tree, hf_rx_epoch,
offset, 4, ntohl(rxh->epoch));
proto_tree_add_item(rx_tree, hf_rx_cid,
offset+4, 4, ntohl(rxh->cid));
proto_tree_add_item(rx_tree, hf_rx_callnumber,
offset+8, 4, ntohl(rxh->callNumber));
proto_tree_add_item(rx_tree, hf_rx_seq,
offset+12, 4, ntohl(rxh->seq));
proto_tree_add_item(rx_tree, hf_rx_serial,
offset+16, 4, ntohl(rxh->serial));
proto_tree_add_item(rx_tree, hf_rx_type,
offset+20, 1, rxh->type);
rx_flags = proto_tree_add_item(rx_tree, hf_rx_flags,
offset+21, 1, rxh->flags);
rx_tree_flags = proto_item_add_subtree(rx_flags, ETT_RX_FLAGS);
proto_tree_add_item(rx_tree_flags, hf_rx_flags_free_packet,
offset+21, 1, rxh->flags);
proto_tree_add_item(rx_tree_flags, hf_rx_flags_more_packets,
offset+21, 1, rxh->flags);
proto_tree_add_item(rx_tree_flags, hf_rx_flags_last_packet,
offset+21, 1, rxh->flags);
proto_tree_add_item(rx_tree_flags, hf_rx_flags_request_ack,
offset+21, 1, rxh->flags);
proto_tree_add_item(rx_tree_flags, hf_rx_flags_clientinit,
offset+21, 1, rxh->flags);
proto_tree_add_item(rx_tree, hf_rx_userstatus,
offset+22, 1, rxh->userStatus);
proto_tree_add_item(rx_tree, hf_rx_securityindex,
offset+23, 1, rxh->securityIndex);
proto_tree_add_item(rx_tree, hf_rx_spare,
offset+24, 2, ntohs(rxh->spare));
proto_tree_add_item(rx_tree, hf_rx_serviceid,
offset+26, 2, ntohs(rxh->serviceId));
//proto_tree_add_text(rx_tree, offset+28, END_OF_FRAME, "Data");
}
if (check_col(fd, COL_INFO))
col_add_fstr(fd, COL_INFO,
"Type: %s "
"Seq: %d "
"Call: %d "
"Source Port: %s "
"Destination Port: %s ",
val_to_str(rxh->type, rx_types, "%d"),
ntohl(rxh->seq),
ntohl(rxh->callNumber),
get_udp_port(pi.srcport),
get_udp_port(pi.destport)
);
reply = (rxh->flags & RX_CLIENT_INITIATED) == 0;
if ( (rxh->type == RX_PACKET_TYPE_ABORT && reply) ||
rxh->type == RX_PACKET_TYPE_DATA )
{
dissect_afs(pd,offset,fd,tree);
}
}
void
proto_register_rx(void)
{
static hf_register_info hf[] = {
{ &hf_rx_epoch, {
"Epoch", "rx.epoch", FT_UINT32, BASE_DEC,
NULL, 0, "Epoch" }},
{ &hf_rx_cid, {
"CID", "rx.cid", FT_UINT32, BASE_DEC,
NULL, 0, "CID" }},
{ &hf_rx_callnumber, {
"Call Number", "rx.callnumber", FT_UINT32, BASE_DEC,
NULL, 0, "Call Number" }},
{ &hf_rx_seq, {
"Sequence Number", "rx.seq", FT_UINT32, BASE_DEC,
NULL, 0, "Sequence Number" }},
{ &hf_rx_serial, {
"Serial", "rx.serial", FT_UINT32, BASE_DEC,
NULL, 0, "Serial" }},
{ &hf_rx_type, {
"Type", "rx.type", FT_UINT8, BASE_DEC,
VALS(rx_types), 0, "Type" }},
{ &hf_rx_flags, {
"Flags", "rx.flags", FT_UINT8, BASE_HEX,
NULL, 0, "Flags" }},
{ &hf_rx_flags_clientinit, {
"Client Initiated", "rx.flags.client_init", FT_UINT8, BASE_BIN,
NULL, RX_CLIENT_INITIATED, "Client Initiated" }},
{ &hf_rx_flags_request_ack, {
"Request Ack", "rx.flags.request_ack", FT_UINT8, BASE_BIN,
NULL, RX_REQUEST_ACK, "Request Ack" }},
{ &hf_rx_flags_last_packet, {
"Last Packet", "rx.flags.last_packet", FT_UINT8, BASE_BIN,
NULL, RX_LAST_PACKET, "Last Packet" }},
{ &hf_rx_flags_more_packets, {
"More Packets", "rx.flags.more_packets", FT_UINT8, BASE_BIN,
NULL, RX_MORE_PACKETS, "More Packets" }},
{ &hf_rx_flags_free_packet, {
"Free Packet", "rx.flags.free_packet", FT_UINT8, BASE_BIN,
NULL, RX_FREE_PACKET, "Free Packet" }},
{ &hf_rx_userstatus, {
"User Status", "rx.userstatus", FT_UINT32, BASE_DEC,
NULL, 0, "User Status" }},
{ &hf_rx_securityindex, {
"Security Index", "rx.securityindex", FT_UINT32, BASE_DEC,
NULL, 0, "Security Index" }},
{ &hf_rx_spare, {
"Spare/Checksum", "rx.spare", FT_UINT16, BASE_DEC,
NULL, 0, "Spare/Checksum" }},
{ &hf_rx_serviceid, {
"Service ID", "rx.serviceid", FT_UINT16, BASE_DEC,
NULL, 0, "Service ID" }},
};
proto_rx = proto_register_protocol("RX Protocol", "rx");
proto_register_field_array(proto_rx, hf, array_length(hf));
}

84
packet-rx.h Normal file
View File

@ -0,0 +1,84 @@
/* packet-rx.h
* Definitions for packet disassembly structures and routines
*
* $Id: packet-rx.h,v 1.1 1999/10/20 16:41:19 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* Copyright 1998 Gerald Combs
* Joerg Mayer <jmayer@telemation.de>
*
*
* 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.
*/
#ifndef PACKET_RX_H
#define PACKET_RX_H
struct rx_header {
guint32 epoch;
guint32 cid;
guint32 callNumber;
guint32 seq;
guint32 serial;
u_char type;
#define RX_PACKET_TYPE_DATA 1
#define RX_PACKET_TYPE_ACK 2
#define RX_PACKET_TYPE_BUSY 3
#define RX_PACKET_TYPE_ABORT 4
#define RX_PACKET_TYPE_ACKALL 5
#define RX_PACKET_TYPE_CHALLENGE 6
#define RX_PACKET_TYPE_RESPONSE 7
#define RX_PACKET_TYPE_DEBUG 8
#define RX_PACKET_TYPE_PARAMS 9
#define RX_PACKET_TYPE_VERSION 13
u_char flags;
#define RX_CLIENT_INITIATED 1
#define RX_REQUEST_ACK 2
#define RX_LAST_PACKET 4
#define RX_MORE_PACKETS 8
#define RX_FREE_PACKET 16
u_char userStatus;
u_char securityIndex;
guint16 spare; /* How clever: even though the AFS */
guint16 serviceId; /* header files indicate that the */
}; /* serviceId is first, it's really */
/* encoded _after_ the spare field */
/* I wasted a day figuring that out! */
struct rx_ack_header {
guint16 bufferspace; /* # of packet buffers available */
guint16 maxskew;
guint32 firstpacket; /* First packet in acks below */
guint32 prevpacket;
guint32 serial; /* Packet that prompted this one */
u_char reason; /* rx_ack_reason */
/* some other stuff I think */
};
#define RX_ACK_TYPE_NACK 0
#define RX_ACK_TYPE_ACK 1
#define RX_ACK_REQUESTED 1
#define RX_ACK_DUPLICATE 2
#define RX_ACK_OUT_OF_SEQUENCE 3
#define RX_ACK_EXEEDS_WINDOW 4
#define RX_ACK_NOSPACE 5
#define RX_ACK_PING 6
#define RX_ACK_PING_RESPONSE 7
#define RX_ACK_DELAY 8
#endif

View File

@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
* $Id: packet-udp.c,v 1.29 1999/10/15 18:33:44 guy Exp $
* $Id: packet-udp.c,v 1.30 1999/10/20 16:41:19 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -79,6 +79,9 @@ typedef struct _e_udphdr {
#define UDP_PORT_RADACCT 1646
#define UDP_PORT_RADACCT_NEW 1813
#define UDP_PORT_ICP 3130
#define UDP_PORT_RX_LOW 7000
#define UDP_PORT_RX_HIGH 7009
#define UDP_PORT_RX_AFS_BACKUPS 7021
struct hash_struct {
guint16 proto;
@ -246,6 +249,10 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
dissect_ntp(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_IPX)) /* RFC 1234 */
dissect_ipx(pd, offset, fd, tree);
else if ((uh_sport >= UDP_PORT_RX_LOW && uh_sport <= UDP_PORT_RX_HIGH) ||
(uh_dport >= UDP_PORT_RX_LOW && uh_dport <= UDP_PORT_RX_HIGH) ||
PORT_IS(UDP_PORT_RX_AFS_BACKUPS))
dissect_rx(pd, offset, fd, tree); /* transarc AFS's RX protocol */
#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
else if (PORT_IS(UDP_PORT_SNMP))
dissect_snmp(pd, offset, fd, tree);

View File

@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
* $Id: packet.h,v 1.114 1999/10/18 00:37:35 itojun Exp $
* $Id: packet.h,v 1.115 1999/10/20 16:41:20 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -279,6 +279,14 @@ enum {
ETT_SNMP,
ETT_NBSS,
ETT_NBSS_FLAGS,
ETT_RX,
ETT_RX_FLAGS,
ETT_AFS,
ETT_AFS_OP,
ETT_AFS_FID,
ETT_AFS_ACL,
ETT_AFS_CALLBACK,
ETT_AFS_UBIKVER,
ETT_SMB,
ETT_SMB_FLAGS,
ETT_SMB_FLAGS2,
@ -410,6 +418,7 @@ void col_add_str(frame_data *, gint, const gchar *);
void col_append_str(frame_data *, gint, gchar *);
void afs_init_protocol(void);
void smb_init_protocol(void);
void dissect_packet(const u_char *, frame_data *, proto_tree *);
@ -467,6 +476,7 @@ typedef void (*DissectFunc) (const u_char*, int, frame_data*, proto_tree*);
*/
int dissect_ah(const u_char *, int, frame_data *, proto_tree *);
void dissect_aarp(const u_char *, int, frame_data *, proto_tree *);
void dissect_afs(const u_char *, int, frame_data *, proto_tree *);
void dissect_arp(const u_char *, int, frame_data *, proto_tree *);
void dissect_bgp(const u_char *, int, frame_data *, proto_tree *);
void dissect_bootp(const u_char *, int, frame_data *, proto_tree *);
@ -516,6 +526,7 @@ void dissect_rip(const u_char *, int, frame_data *, proto_tree *);
void dissect_ripng(const u_char *, int, frame_data *, proto_tree *);
void dissect_rsvp(const u_char *, int, frame_data *, proto_tree *);
void dissect_rtsp(const u_char *, int, frame_data *, proto_tree *);
void dissect_rx(const u_char *, int, frame_data *, proto_tree *);
void dissect_sdp(const u_char *, int, frame_data *, proto_tree *);
void dissect_sna(const u_char *, int, frame_data *, proto_tree *);
void dissect_snmp(const u_char *, int, frame_data *, proto_tree *);