forked from osmocom/wireshark
Add in a notion of "circuits", which are for virtual circuit-oriented
protocols (where there's a virtual circuit ID of some sort in packets) what conversations are for protocols ultimately running atop connectionless network layers. Have circuit type and ID values in the "packet_info" structure. Have the Frame Relay dissector set the circuit type and ID values, and have the Wellfleet compression protocol set up circuit information and store compression information with the circuit. svn path=/trunk/; revision=6469
This commit is contained in:
parent
6ba1ee899b
commit
28c1a65e85
|
@ -2,12 +2,11 @@
|
|||
# Automake file for the EPAN library
|
||||
# (Ethereal Protocol ANalyzer Library)
|
||||
#
|
||||
# $Id: Makefile.am,v 1.30 2001/12/18 19:09:03 gram Exp $
|
||||
# $Id: Makefile.am,v 1.31 2002/10/22 08:22:05 guy Exp $
|
||||
#
|
||||
# Ethereal - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@zing.org>
|
||||
# By Gerald Combs <gerald@ethereal.com>
|
||||
# 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
|
||||
|
@ -39,6 +38,8 @@ libethereal_a_SOURCES = \
|
|||
atalk-utils.h \
|
||||
bitswap.c \
|
||||
bitswap.h \
|
||||
circuit.c \
|
||||
circuit.h \
|
||||
column_info.h \
|
||||
conversation.c \
|
||||
conversation.h \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## Makefile for building ethereal.exe with Microsoft C and nmake
|
||||
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
|
||||
#
|
||||
# $Id: Makefile.nmake,v 1.22 2002/02/27 09:42:39 guy Exp $
|
||||
# $Id: Makefile.nmake,v 1.23 2002/10/22 08:22:05 guy Exp $
|
||||
|
||||
include ..\config.nmake
|
||||
|
||||
|
@ -25,6 +25,7 @@ libethereal_LIBS = \
|
|||
|
||||
OBJECTS=atalk-utils.obj \
|
||||
bitswap.obj \
|
||||
circuit.obj \
|
||||
column-utils.obj \
|
||||
conversation.obj \
|
||||
epan.obj \
|
||||
|
|
10
epan/epan.c
10
epan/epan.c
|
@ -1,6 +1,6 @@
|
|||
/* epan.h
|
||||
*
|
||||
* $Id: epan.c,v 1.21 2002/09/09 21:04:06 guy Exp $
|
||||
* $Id: epan.c,v 1.22 2002/10/22 08:22:05 guy Exp $
|
||||
*
|
||||
* Ethereal Protocol Analyzer Library
|
||||
*/
|
||||
|
@ -14,6 +14,7 @@
|
|||
#include "epan_dissect.h"
|
||||
|
||||
#include "conversation.h"
|
||||
#include "circuit.h"
|
||||
#include "except.h"
|
||||
#include "packet.h"
|
||||
#include "column-utils.h"
|
||||
|
@ -65,14 +66,17 @@ epan_cleanup(void)
|
|||
except_deinit();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
epan_conversation_init(void)
|
||||
{
|
||||
conversation_init();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
epan_circuit_init(void)
|
||||
{
|
||||
circuit_init();
|
||||
}
|
||||
|
||||
epan_dissect_t*
|
||||
epan_dissect_new(gboolean create_proto_tree, gboolean proto_tree_visible)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet.c
|
||||
* Routines for packet disassembly
|
||||
*
|
||||
* $Id: packet.c,v 1.78 2002/08/28 20:40:44 jmayer Exp $
|
||||
* $Id: packet.c,v 1.79 2002/10/22 08:22:05 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -127,6 +127,9 @@ init_dissection(void)
|
|||
/* Initialize the table of conversations. */
|
||||
epan_conversation_init();
|
||||
|
||||
/* Initialize the table of circuits. */
|
||||
epan_circuit_init();
|
||||
|
||||
/* Initialize protocol-specific variables. */
|
||||
g_slist_foreach(init_routines, &call_init_routine, NULL);
|
||||
|
||||
|
@ -276,6 +279,8 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header,
|
|||
edt->pi.ethertype = 0;
|
||||
edt->pi.ipproto = 0;
|
||||
edt->pi.ipxptype = 0;
|
||||
edt->pi.ctype = CT_NONE;
|
||||
edt->pi.circuit_id = 0;
|
||||
edt->pi.fragmented = FALSE;
|
||||
edt->pi.in_error_pkt = FALSE;
|
||||
edt->pi.ptype = PT_NONE;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet_info.h
|
||||
* Definitions for packet info structures and routines
|
||||
*
|
||||
* $Id: packet_info.h,v 1.22 2002/10/19 00:40:05 guy Exp $
|
||||
* $Id: packet_info.h,v 1.23 2002/10/22 08:22:07 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -99,6 +99,13 @@ typedef enum {
|
|||
PT_DDP /* DDP AppleTalk connection */
|
||||
} port_type;
|
||||
|
||||
/* Types of circuit IDs Ethereal knows about. */
|
||||
typedef enum {
|
||||
CT_NONE, /* no port number */
|
||||
CT_DLCI /* Frame Relay DLCI */
|
||||
/* Could also have X.25 logical channel and ATM VPI/VCI pairs */
|
||||
} circuit_type;
|
||||
|
||||
#define P2P_DIR_UNKNOWN -1
|
||||
#define P2P_DIR_SENT 0
|
||||
#define P2P_DIR_RECV 1
|
||||
|
@ -118,6 +125,8 @@ typedef struct _packet_info {
|
|||
guint32 ethertype; /* Ethernet Type Code, if this is an Ethernet packet */
|
||||
guint32 ipproto; /* IP protocol, if this is an IP packet */
|
||||
guint32 ipxptype; /* IPX packet type, if this is an IPX packet */
|
||||
circuit_type ctype; /* type of circuit, for protocols with a VC identifier */
|
||||
guint32 circuit_id; /* circuit ID, for protocols with a VC identifier */
|
||||
gboolean fragmented; /* TRUE if the protocol is only a fragment */
|
||||
gboolean in_error_pkt; /* TRUE if we're inside an {ICMP,CLNP,...} error packet */
|
||||
port_type ptype; /* type of the following two port numbers */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright 2001, Paul Ionescu <paul@acorp.ro>
|
||||
*
|
||||
* $Id: packet-fr.c,v 1.31 2002/10/19 00:40:03 guy Exp $
|
||||
* $Id: packet-fr.c,v 1.32 2002/10/22 08:22:02 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -168,6 +168,8 @@ static void dissect_fr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
fr_header = tvb_get_ntohs(tvb, 0);
|
||||
fr_ctrl = tvb_get_guint8( tvb, 2);
|
||||
address = EXTRACT_DLCI(fr_header);
|
||||
pinfo->ctype = CT_DLCI;
|
||||
pinfo->circuit_id = address;
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO))
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "DLCI %u", address);
|
||||
|
|
56
packet-wcp.c
56
packet-wcp.c
|
@ -2,7 +2,7 @@
|
|||
* Routines for Wellfleet Compression frame disassembly
|
||||
* Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
|
||||
*
|
||||
* $Id: packet-wcp.c,v 1.28 2002/08/28 21:00:37 jmayer Exp $
|
||||
* $Id: packet-wcp.c,v 1.29 2002/10/22 08:22:02 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -105,7 +105,7 @@
|
|||
#include <string.h>
|
||||
#include <epan/packet.h>
|
||||
#include "packet-frame.h"
|
||||
#include <epan/conversation.h>
|
||||
#include <epan/circuit.h>
|
||||
#include "etypes.h"
|
||||
#include "nlpid.h"
|
||||
|
||||
|
@ -120,6 +120,11 @@ typedef struct {
|
|||
|
||||
}wcp_window_t;
|
||||
|
||||
typedef struct {
|
||||
wcp_window_t recv;
|
||||
wcp_window_t send;
|
||||
} wcp_circuit_data_t;
|
||||
|
||||
/*XXX do I really want the length in here */
|
||||
typedef struct {
|
||||
|
||||
|
@ -132,10 +137,10 @@ typedef struct {
|
|||
#define wcp_win_init_count 4
|
||||
#define wcp_packet_init_count 10
|
||||
|
||||
#define wcp_win_length (sizeof(wcp_window_t))
|
||||
#define wcp_circuit_length (sizeof(wcp_circuit_data_t))
|
||||
#define wcp_packet_length (sizeof(wcp_pdata_t))
|
||||
|
||||
static GMemChunk *wcp_window = NULL;
|
||||
static GMemChunk *wcp_circuit = NULL;
|
||||
static GMemChunk *wcp_pdata = NULL;
|
||||
|
||||
static int proto_wcp = -1;
|
||||
|
@ -446,29 +451,28 @@ static guint8 *decompressed_entry( guint8 *src, guint8 *dst, int *len, guint8 *
|
|||
static
|
||||
wcp_window_t *get_wcp_window_ptr( packet_info *pinfo){
|
||||
|
||||
/* find the conversation for this side of the DLCI, create one if needed */
|
||||
/* find the circuit for this DLCI, create one if needed */
|
||||
/* and return the wcp_window data structure pointer */
|
||||
/* for the direction of this packet */
|
||||
|
||||
conversation_t *conv;
|
||||
wcp_window_t *wcp_win_data;
|
||||
circuit_t *circuit;
|
||||
wcp_circuit_data_t *wcp_circuit_data;
|
||||
|
||||
conv = find_conversation( &pinfo->dl_src, &pinfo->dl_src, PT_NONE,
|
||||
((pinfo->pseudo_header->x25.flags & FROM_DCE)? 1:0),
|
||||
((pinfo->pseudo_header->x25.flags & FROM_DCE)? 1:0), 0);
|
||||
if ( !conv){
|
||||
conv = conversation_new( &pinfo->dl_src, &pinfo->dl_src, PT_NONE,
|
||||
((pinfo->pseudo_header->x25.flags & FROM_DCE)? 1:0),
|
||||
((pinfo->pseudo_header->x25.flags & FROM_DCE)? 1:0),
|
||||
0);
|
||||
circuit = find_circuit( pinfo->ctype, pinfo->circuit_id);
|
||||
if ( !circuit){
|
||||
circuit = circuit_new( pinfo->ctype, pinfo->circuit_id);
|
||||
}
|
||||
wcp_win_data = conversation_get_proto_data(conv, proto_wcp);
|
||||
if ( !wcp_win_data){
|
||||
wcp_win_data = g_mem_chunk_alloc( wcp_window);
|
||||
wcp_win_data->buf_cur = wcp_win_data->buffer;
|
||||
conversation_add_proto_data(conv, proto_wcp, wcp_win_data);
|
||||
wcp_circuit_data = circuit_get_proto_data(circuit, proto_wcp);
|
||||
if ( !wcp_circuit_data){
|
||||
wcp_circuit_data = g_mem_chunk_alloc( wcp_circuit);
|
||||
wcp_circuit_data->recv.buf_cur = wcp_circuit_data->recv.buffer;
|
||||
wcp_circuit_data->send.buf_cur = wcp_circuit_data->send.buffer;
|
||||
circuit_add_proto_data(circuit, proto_wcp, wcp_circuit_data);
|
||||
}
|
||||
|
||||
return wcp_win_data;
|
||||
if (pinfo->pseudo_header->x25.flags & FROM_DCE)
|
||||
return &wcp_circuit_data->recv;
|
||||
else
|
||||
return &wcp_circuit_data->send;
|
||||
}
|
||||
|
||||
|
||||
|
@ -617,11 +621,11 @@ static void wcp_reinit( void){
|
|||
/* Do the cleanup work when a new pass through the packet list is */
|
||||
/* performed. re-initialize the memory chunks. */
|
||||
|
||||
if (wcp_window)
|
||||
g_mem_chunk_destroy(wcp_window);
|
||||
if (wcp_circuit)
|
||||
g_mem_chunk_destroy(wcp_circuit);
|
||||
|
||||
wcp_window = g_mem_chunk_new("wcp_window", wcp_win_length,
|
||||
wcp_win_init_count * wcp_win_length,
|
||||
wcp_circuit = g_mem_chunk_new("wcp_circuit", wcp_circuit_length,
|
||||
wcp_win_init_count * wcp_circuit_length,
|
||||
G_ALLOC_AND_FREE);
|
||||
|
||||
if (wcp_pdata)
|
||||
|
|
Loading…
Reference in New Issue