diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-04-13 20:39:38 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-04-13 20:39:38 +0000 |
commit | b218a8f5504f8bbc83f8e0ef9649cb7df9e109af (patch) | |
tree | 8a453940e94dc4accd5f61af0f2b789b4e0447a0 | |
parent | 6a1c248625b669b42b9cedb732f5d39938cd0b74 (diff) |
Consolidate flags in struct frame_data, and add "visited" flag. Use
it in SOCKS dissector.
(Okay, how many times am I going to modify packet.h today, forcing you
to re-compile everything? :-)
svn path=/trunk/; revision=1850
-rw-r--r-- | file.c | 25 | ||||
-rw-r--r-- | gtk/main.c | 6 | ||||
-rw-r--r-- | gtk/packet_win.c | 4 | ||||
-rw-r--r-- | packet-sna.c | 4 | ||||
-rw-r--r-- | packet-socks.c | 9 | ||||
-rw-r--r-- | packet.c | 4 | ||||
-rw-r--r-- | packet.h | 13 | ||||
-rw-r--r-- | print.c | 4 | ||||
-rw-r--r-- | summary.c | 4 | ||||
-rw-r--r-- | tethereal.c | 7 |
10 files changed, 41 insertions, 39 deletions
@@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.181 2000/04/07 08:00:34 guy Exp $ + * $Id: file.c,v 1.182 2000/04/13 20:39:12 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -543,9 +543,9 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, const u_char *buf protocol_tree = proto_tree_create_root(); dissect_packet(buf, fdata, protocol_tree); if (cf->dfcode != NULL) - fdata->passed_dfilter = dfilter_apply(cf->dfcode, protocol_tree, buf); + fdata->flags.passed_dfilter = dfilter_apply(cf->dfcode, protocol_tree, buf) ? 1 : 0; else - fdata->passed_dfilter = TRUE; + fdata->flags.passed_dfilter = 1; /* Apply color filters, if we have any. */ if (filter_list != NULL) { @@ -561,14 +561,14 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, const u_char *buf protocol_tree = proto_tree_create_root(); #endif dissect_packet(buf, fdata, protocol_tree); - fdata->passed_dfilter = TRUE; + fdata->flags.passed_dfilter = 1; #ifdef HAVE_PLUGINS if (protocol_tree) proto_tree_free(protocol_tree); #endif } - if (fdata->passed_dfilter) { + if (fdata->flags.passed_dfilter) { /* If we don't have the time stamp of the previous displayed packet, it's because this is the first displayed packet. Save the time stamp of this packet as the time stamp of the previous displayed @@ -679,7 +679,8 @@ wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr, int offset, fdata->lnk_t = phdr->pkt_encap; fdata->abs_secs = phdr->ts.tv_sec; fdata->abs_usecs = phdr->ts.tv_usec; - fdata->encoding = CHAR_ASCII; + fdata->flags.encoding = CHAR_ASCII; + fdata->flags.visited = 0; fdata->pseudo_header = phdr->pseudo_header; fdata->cinfo = NULL; @@ -970,7 +971,7 @@ print_packets(capture_file *cf, print_args_t *print_args) } count++; - if (fd->passed_dfilter) { + if (fd->flags.passed_dfilter) { wtap_seek_read (cf->cd_t, cf->fh, fd->file_off, cf->pd, fd->cap_len); if (print_args->print_summary) { /* Fill in the column information, but don't bother creating @@ -1027,7 +1028,7 @@ print_packets(capture_file *cf, print_args_t *print_args) if (print_args->print_hex) { /* Print the full packet data as hex. */ print_hex_data(cf->print_fh, print_args->format, cf->pd, - fd->cap_len, fd->encoding); + fd->cap_len, fd->flags.encoding); } /* Print a blank line if we print anything after this. */ @@ -1197,7 +1198,7 @@ find_packet(capture_file *cf, dfilter *sfcode) count++; /* Is this packet in the display? */ - if (fd->passed_dfilter) { + if (fd->flags.passed_dfilter) { /* Yes. Does it match the search filter? */ protocol_tree = proto_tree_create_root(); wtap_seek_read(cf->cd_t, cf->fh, fd->file_off, cf->pd, fd->cap_len); @@ -1255,7 +1256,7 @@ goto_frame(capture_file *cf, guint fnumber) if (fd == NULL) return NO_SUCH_FRAME; /* we didn't find that frame */ - if (!fd->passed_dfilter) + if (!fd->flags.passed_dfilter) return FRAME_NOT_DISPLAYED; /* the frame with that number isn't displayed */ /* We found that frame, and it's currently being displayed. @@ -1331,7 +1332,7 @@ select_packet(capture_file *cf, int row) clear_tree_and_hex_views(); proto_tree_draw(cf->protocol_tree, tree_view); packet_hex_print(GTK_TEXT(byte_view), cf->pd, cf->current_frame->cap_len, - -1, -1, cf->current_frame->encoding); + -1, -1, cf->current_frame->flags.encoding); /* A packet is selected. */ set_menus_for_selected_packet(TRUE); @@ -1538,7 +1539,7 @@ save_cap_file(char *fname, capture_file *cf, gboolean save_filtered, NetMon do? */ for (fd = cf->plist; fd != NULL; fd = fd->next) { /* XXX - do a progress bar */ - if (!save_filtered || fd->passed_dfilter) { + if (!save_filtered || fd->flags.passed_dfilter) { /* Either we're saving all frames, or we're saving filtered frames and this one passed the display filter - save it. */ hdr.ts.tv_sec = fd->abs_secs; diff --git a/gtk/main.c b/gtk/main.c index 2ed1fe57f3..4a792858d8 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.115 2000/04/04 07:03:07 guy Exp $ + * $Id: main.c,v 1.116 2000/04/13 20:39:36 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -863,7 +863,7 @@ tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user finfo_selected = finfo; packet_hex_print(GTK_TEXT(byte_view), cf.pd, cf.current_frame->cap_len, - finfo->start, finfo->length, cf.current_frame->encoding); + finfo->start, finfo->length, cf.current_frame->flags.encoding); } static void @@ -871,7 +871,7 @@ tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer us { finfo_selected = NULL; packet_hex_print(GTK_TEXT(byte_view), cf.pd, cf.current_frame->cap_len, - -1, -1, cf.current_frame->encoding); + -1, -1, cf.current_frame->flags.encoding); } void collapse_all_cb(GtkWidget *widget, gpointer data) { diff --git a/gtk/packet_win.c b/gtk/packet_win.c index 88b7a06214..da70569f35 100644 --- a/gtk/packet_win.c +++ b/gtk/packet_win.c @@ -3,7 +3,7 @@ * * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet_win.c,v 1.4 2000/03/08 06:48:01 guy Exp $ + * $Id: packet_win.c,v 1.5 2000/04/13 20:39:38 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -166,7 +166,7 @@ create_new_window ( char *Title, gint tv_size, gint bv_size){ DataPtr = (struct PacketWinData *) g_malloc(sizeof(struct PacketWinData)); DataPtr->cap_len = cf.current_frame->cap_len; - DataPtr->encoding = cf.current_frame->encoding; + DataPtr->encoding = cf.current_frame->flags.encoding; DataPtr->pd = g_malloc(DataPtr->cap_len); memcpy(DataPtr->pd, cf.pd, DataPtr->cap_len); DataPtr->protocol_tree = proto_tree_create_root(); diff --git a/packet-sna.c b/packet-sna.c index 8b738ba19a..26d1f05416 100644 --- a/packet-sna.c +++ b/packet-sna.c @@ -2,7 +2,7 @@ * Routines for SNA * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-sna.c,v 1.12 2000/03/12 04:47:49 gram Exp $ + * $Id: packet-sna.c,v 1.13 2000/04/13 20:39:14 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -310,7 +310,7 @@ dissect_sna(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { int sna_header_len = 0, th_header_len = 0; /* SNA data should be printed in EBCDIC, not ASCII */ - fd->encoding = CHAR_EBCDIC; + fd->flags.encoding = CHAR_EBCDIC; if (IS_DATA_IN_FRAME(offset)) { /* Transmission Header Format Identifier */ diff --git a/packet-socks.c b/packet-socks.c index c756a13f3a..ac753b1e10 100644 --- a/packet-socks.c +++ b/packet-socks.c @@ -2,7 +2,7 @@ * Routines for socks versions 4 &5 packet dissection * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet-socks.c,v 1.2 2000/04/13 11:11:38 gram Exp $ + * $Id: packet-socks.c,v 1.3 2000/04/13 20:39:15 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -214,8 +214,6 @@ static char *reply_table_v5[] = { static GMemChunk *socks_vals = NULL; -static guint32 last_row= 0; /* used to see if packet is new */ - /************************* Support routines ***************************/ @@ -1010,8 +1008,7 @@ dissect_socks(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* run state machine if needed */ - if ((hash_info->state != Done) && ( fd->num > last_row)){ - last_row = fd->num; + if ((hash_info->state != Done) && ( !fd->flags.visited)){ if ( hash_info->version == 4) state_machine_v4( hash_info, pd, offset, fd); @@ -1077,8 +1074,6 @@ static void socks_reinit( void){ /* performed. Reset the highest row seen counter and re-initialize the */ /* conversation memory chunks. */ - last_row = 0; - if (socks_vals) g_mem_chunk_destroy(socks_vals); @@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.75 2000/04/13 18:18:54 gram Exp $ + * $Id: packet.c,v 1.76 2000/04/13 20:39:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1173,6 +1173,8 @@ dissect_packet(const u_char *pd, frame_data *fd, proto_tree *tree) dissect_v120(pd, fd, tree); break; } + + fd->flags.visited = 1; } gint p_compare(gconstpointer a, gconstpointer b) @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.180 2000/04/13 18:18:54 gram Exp $ + * $Id: packet.h,v 1.181 2000/04/13 20:39:17 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -110,8 +110,8 @@ typedef struct _packet_counts { /* Types of character encodings */ typedef enum { - CHAR_ASCII, /* ASCII */ - CHAR_EBCDIC /* EBCDIC */ + CHAR_ASCII = 0, /* ASCII */ + CHAR_EBCDIC = 1 /* EBCDIC */ } char_enc; typedef struct _frame_proto_data { @@ -141,8 +141,11 @@ typedef struct _frame_data { long file_off; /* File offset */ column_info *cinfo; /* Column formatting information */ int lnk_t; /* Per-packet encapsulation/data-link type */ - gboolean passed_dfilter; /* TRUE = display, FALSE = no display */ - char_enc encoding; /* Character encoding (ASCII, EBCDIC...) */ + struct { + unsigned int passed_dfilter : 1; /* 1 = display, 0 = no display */ + unsigned int encoding : 2; /* Character encoding (ASCII, EBCDIC...) */ + unsigned int visited : 1; /* Has this packet been visited yet? 1=Yes,0=No*/ + } flags; union pseudo_header pseudo_header; /* "pseudo-header" from wiretap */ } frame_data; @@ -1,7 +1,7 @@ /* print.c * Routines for printing packet analysis trees. * - * $Id: print.c,v 1.28 2000/01/22 06:22:18 guy Exp $ + * $Id: print.c,v 1.29 2000/04/13 20:39:18 gram Exp $ * * Gilbert Ramirez <gram@xiexie.org> * @@ -105,7 +105,7 @@ void proto_tree_print(gboolean print_one_packet, print_args_t *print_args, data.level = 0; data.fh = fh; data.pd = pd; - data.encoding = fd->encoding; + data.encoding = fd->flags.encoding; data.print_all_levels = print_args->expand_all; data.print_hex_for_data = !print_args->print_hex; /* If we're printing the entire packet in hex, don't @@ -1,7 +1,7 @@ /* summary.c * Routines for capture file summary info * - * $Id: summary.c,v 1.16 1999/12/29 21:30:28 guy Exp $ + * $Id: summary.c,v 1.17 2000/04/13 20:39:18 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -53,7 +53,7 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally) sum_tally->stop_time = cur_time; } sum_tally->bytes += cur_frame->pkt_len; - if (cur_frame->passed_dfilter) + if (cur_frame->flags.passed_dfilter) sum_tally->filtered_count++; } diff --git a/tethereal.c b/tethereal.c index 115e14b94b..d5767f793f 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.24 2000/04/04 07:02:58 guy Exp $ + * $Id: tethereal.c,v 1.25 2000/04/13 20:39:19 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -759,7 +759,8 @@ fill_in_fdata(frame_data *fdata, capture_file *cf, fdata->lnk_t = phdr->pkt_encap; fdata->abs_secs = phdr->ts.tv_sec; fdata->abs_usecs = phdr->ts.tv_usec; - fdata->encoding = CHAR_ASCII; + fdata->flags.encoding = CHAR_ASCII; + fdata->flags.visited = 0; fdata->pseudo_header = phdr->pseudo_header; fdata->cinfo = NULL; @@ -904,7 +905,7 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr, int offset, } if (print_hex) { print_hex_data(stdout, print_args.format, buf, - fdata.cap_len, fdata.encoding); + fdata.cap_len, fdata.flags.encoding); printf("\n"); } fdata.cinfo = NULL; |