Add support for PPI (the Per-Packet Information header), described at

http://www.cacetech.com/documents/PPI_Header_format_1.0.pdf .

svn path=/trunk/; revision=22094
This commit is contained in:
Gerald Combs 2007-06-13 22:36:58 +00:00
parent e3fc848842
commit d1a745f27b
7 changed files with 1222 additions and 21 deletions

View File

@ -572,6 +572,7 @@ CLEAN_DISSECTOR_SRC = \
packet-pop.c \ packet-pop.c \
packet-portmap.c \ packet-portmap.c \
packet-pgsql.c \ packet-pgsql.c \
packet-ppi.c \
packet-ppp.c \ packet-ppp.c \
packet-pppoe.c \ packet-pppoe.c \
packet-pptp.c \ packet-pptp.c \

View File

@ -79,7 +79,7 @@ static const value_string p2p_dirs[] = {
{ 0, NULL } { 0, NULL }
}; };
static dissector_table_t wtap_encap_dissector_table; dissector_table_t wtap_encap_dissector_table;
static GSList *frame_end_routines = NULL; static GSList *frame_end_routines = NULL;

View File

@ -36,7 +36,7 @@ void show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
void void
show_reported_bounds_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); show_reported_bounds_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* /*
* Routine used to register frame end routine. The routine should only * Routine used to register frame end routine. The routine should only
* be registred when the dissector is used in the frame, not in the * be registred when the dissector is used in the frame, not in the
* proto_register_XXX function. * proto_register_XXX function.
@ -50,8 +50,13 @@ register_frame_end_routine(void (*func)(void));
*/ */
extern int proto_malformed; extern int proto_malformed;
/* following variables are exported from libwireshark.dll. /*
* Thus we need a special declaration. * The frame dissector and the PPI dissector both use this
*/
extern dissector_table_t wtap_encap_dissector_table;
/* following variables are exported from libwireshark.dll.
* Thus we need a special declaration.
*/ */
WS_VAR_IMPORT int proto_frame; WS_VAR_IMPORT int proto_frame;
WS_VAR_IMPORT int hf_frame_arrival_time; WS_VAR_IMPORT int hf_frame_arrival_time;

1189
epan/dissectors/packet-ppi.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -310,7 +310,7 @@ static const struct {
/* /*
* Linux "cooked mode" captures, used by the current CVS version * Linux "cooked mode" captures, used by the current CVS version
* of libpcap * of libpcap
* OR * OR
* it could be a packet in Cisco's ERSPAN encapsulation which uses * it could be a packet in Cisco's ERSPAN encapsulation which uses
* this number as well (why can't people stick to protocols when it * this number as well (why can't people stick to protocols when it
@ -427,6 +427,8 @@ static const struct {
{ 188, WTAP_ENCAP_IEEE802_16_MAC_CPS }, { 188, WTAP_ENCAP_IEEE802_16_MAC_CPS },
/* USB packets with Linux-specified header */ /* USB packets with Linux-specified header */
{ 189, WTAP_ENCAP_USB_LINUX }, { 189, WTAP_ENCAP_USB_LINUX },
/* Per-Packet Information header */
{ 192, WTAP_ENCAP_PPI },
/* /*
* To repeat: * To repeat:

View File

@ -350,7 +350,7 @@ static struct encap_type_info encap_table_base[] = {
/* WTAP_ENCAP_JUNIPER_CHDLC */ /* WTAP_ENCAP_JUNIPER_CHDLC */
{ "Juniper C-HDLC", "juniper-chdlc" }, { "Juniper C-HDLC", "juniper-chdlc" },
/* WTAP_ENCAP_JUNIPER_GGSN */ /* WTAP_ENCAP_JUNIPER_GGSN */
{ "Juniper GGSN", "juniper-ggsn" }, { "Juniper GGSN", "juniper-ggsn" },
@ -377,6 +377,9 @@ static struct encap_type_info encap_table_base[] = {
/* WTAP_ENCAP_MPEG */ /* WTAP_ENCAP_MPEG */
{ "MPEG", "mpeg" }, { "MPEG", "mpeg" },
/* WTAP_ENCAP_PPI */
{ "Per-Packet Information header", "ppi" },
}; };
gint wtap_num_encap_types = sizeof(encap_table_base) / sizeof(struct encap_type_info); gint wtap_num_encap_types = sizeof(encap_table_base) / sizeof(struct encap_type_info);
@ -384,13 +387,13 @@ static GArray* encap_table_arr = NULL;
static const struct encap_type_info* encap_table = NULL; static const struct encap_type_info* encap_table = NULL;
static void wtap_init_encap_types(void) { static void wtap_init_encap_types(void) {
if (encap_table_arr) return; if (encap_table_arr) return;
encap_table_arr = g_array_new(FALSE,TRUE,sizeof(struct encap_type_info)); encap_table_arr = g_array_new(FALSE,TRUE,sizeof(struct encap_type_info));
g_array_append_vals(encap_table_arr,encap_table_base,wtap_num_encap_types); g_array_append_vals(encap_table_arr,encap_table_base,wtap_num_encap_types);
encap_table = (void*)encap_table_arr->data; encap_table = (void*)encap_table_arr->data;
} }
@ -403,10 +406,10 @@ int wtap_get_num_encap_types(void) {
int wtap_register_encap_type(char* name, char* short_name) { int wtap_register_encap_type(char* name, char* short_name) {
struct encap_type_info* e = g_malloc(sizeof(struct encap_type_info)); struct encap_type_info* e = g_malloc(sizeof(struct encap_type_info));
wtap_init_encap_types(); wtap_init_encap_types();
e->name = g_strdup(name); e->name = g_strdup(name);
e->short_name = g_strdup(short_name); e->short_name = g_strdup(short_name);
g_array_append_val(encap_table_arr,e); g_array_append_val(encap_table_arr,e);
encap_table = (void*)encap_table_arr->data; encap_table = (void*)encap_table_arr->data;

View File

@ -191,6 +191,7 @@ extern "C" {
#define WTAP_ENCAP_NETTL_RAW_TELNET 94 #define WTAP_ENCAP_NETTL_RAW_TELNET 94
#define WTAP_ENCAP_USB_LINUX 95 #define WTAP_ENCAP_USB_LINUX 95
#define WTAP_ENCAP_MPEG 96 #define WTAP_ENCAP_MPEG 96
#define WTAP_ENCAP_PPI 97
#define WTAP_NUM_ENCAP_TYPES wtap_get_num_encap_types() #define WTAP_NUM_ENCAP_TYPES wtap_get_num_encap_types()
@ -516,7 +517,7 @@ typedef union {
guint16 vc; guint16 vc;
guint16 cid; guint16 cid;
} atm; } atm;
guint32 ds0mask; guint32 ds0mask;
} k12_input_info_t; } k12_input_info_t;
@ -571,7 +572,7 @@ struct catapult_dct2000_phdr
#define URB_TRANSFER_IN 0x80 /* to host */ #define URB_TRANSFER_IN 0x80 /* to host */
/* /*
* USB setup header as defined in USB specification * USB setup header as defined in USB specification
*/ */
struct usb_request_hdr { struct usb_request_hdr {
gint8 bmRequestType; gint8 bmRequestType;
@ -604,7 +605,7 @@ struct linux_usb_phdr {
guint32 urb_len; /* whole len of urb this event refers to */ guint32 urb_len; /* whole len of urb this event refers to */
guint32 data_len; /* amount of urb data really present in this event*/ guint32 data_len; /* amount of urb data really present in this event*/
}; };
union wtap_pseudo_header { union wtap_pseudo_header {
struct eth_phdr eth; struct eth_phdr eth;
struct x25_phdr x25; struct x25_phdr x25;
@ -646,26 +647,26 @@ struct file_type_info {
/* the file type name */ /* the file type name */
/* should be NULL for all "pseudo" types that are only internally used and not read/writeable */ /* should be NULL for all "pseudo" types that are only internally used and not read/writeable */
const char *name; const char *name;
/* the file type short name, used as a shortcut for the command line tools */ /* the file type short name, used as a shortcut for the command line tools */
/* should be NULL for all "pseudo" types that are are only internally used and not read/writeable */ /* should be NULL for all "pseudo" types that are are only internally used and not read/writeable */
const char *short_name; const char *short_name;
/* the common file extensions for this type (seperated by semicolon) */ /* the common file extensions for this type (seperated by semicolon) */
/* should be *.* if no common extension is applicable */ /* should be *.* if no common extension is applicable */
const char *file_extensions; const char *file_extensions;
/* the default file extension, used to save this type */ /* the default file extension, used to save this type */
/* should be NULL if no default extension is known */ /* should be NULL if no default extension is known */
const char *file_extension_default; const char *file_extension_default;
/* can this type be compressed with gzip? */ /* can this type be compressed with gzip? */
gboolean can_compress; gboolean can_compress;
/* can this type write this encapsulation format? */ /* can this type write this encapsulation format? */
/* should be NULL is this file type don't have write support */ /* should be NULL is this file type don't have write support */
int (*can_write_encap)(int); int (*can_write_encap)(int);
/* the function to open the capture file for writing */ /* the function to open the capture file for writing */
/* should be NULL is this file type don't have write support */ /* should be NULL is this file type don't have write support */
int (*dump_open)(wtap_dumper *, gboolean, int *); int (*dump_open)(wtap_dumper *, gboolean, int *);