aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)AuthorFilesLines
2003-03-02The frame number passed to "goto_frame()" wasn't necessarily explicitlyGuy Harris1-4/+4
specified by the user, so if the frame with that frame number isn't being displayed, just refer to it as "That frame", not "The frame with that frame number". (That's even OK if they *did* specify it.) (If there's no such frame, that "shouldn't happen" in cases where it was implicitly specified, e.g. by getting it from a list of fragments, or a "{request,reply} is in frame XXX" field, or clicking on a point in a TCP graph.) svn path=/trunk/; revision=7258
2003-03-02Have "goto_frame()" put up error dialog boxes itself, rather than havingGuy Harris1-7/+16
its callers put up the same error dialog boxes. Have it just return a success vs. failure Boolean. svn path=/trunk/; revision=7254
2002-12-01The previous change caused the delta time to be the delta between aGuy Harris1-4/+7
frame and the previous frame in the capture - a frame that might not be displayed, so you don't know what it was - rather than the previous frame in the display, as is intended. Fix that. svn path=/trunk/; revision=6708
2002-11-29calculate delta and rel time earlier and unconditionally of whether the ↵Ronnie Sahlberg1-30/+30
packet passed the displayfilter or not. there may be tap listeners that want to examine this field. svn path=/trunk/; revision=6702
2002-11-23From Tomas Kukosa: adjust the pointer into the line buffer if the lineGuy Harris1-1/+6
buffer gets reallocated. svn path=/trunk/; revision=6665
2002-10-17From Ronnie Sahlberg: don't have the tap code do a dissection, leaveGuy Harris1-4/+7
that up to its callers, so only one dissection need be done when reading a capture file. svn path=/trunk/; revision=6442
2002-10-14Another problem found by valgrind :Olivier Abad1-1/+3
in continue_tail_cap_file, the following test : else if (*err != 0) sometimes reads uninitialized memory (so the test might be incorrect). We now set *err to 0 at the beginning of the function. svn path=/trunk/; revision=6418
2002-09-23Change to color filters :Olivier Abad1-20/+4
- moved color_filter_t in color.h - change color_filter_t to use color_t instead of GdkColor This changed allowed to remove the last gtk includes in file.c. It is now completely free of any gtk related code. svn path=/trunk/; revision=6324
2002-09-21Removed all gtk calls in file.c :Olivier Abad1-101/+47
- created a few packet_list_xxx functions (ui_util.h gtk/packet_list.c gtk2/packet_list.c) ; - removed almost all "gtk/xxx" and "gtk2/xxx" includes in file.c The only remaining includes are related to color filters. We have to make color_filter_t GUI independent by replacing GdkColor with color_t. I'll work on this later. svn path=/trunk/; revision=6311
2002-09-04Enable the tap feature for ethereal as well. (will only update in real time ↵Ronnie Sahlberg1-2/+6
for the gtk2 port though) svn path=/trunk/; revision=6182
2002-08-31GTK+ v2 port.Olivier Abad1-1/+23
All the deprecated widgets have not been replaced yet : GtkList and GtkCList ==> GtkTreeView conversion : - color_dlg.c - column_prefs.c - decode_as_dlg.c : done - dfilter_expr_dialog - filter_prefs.c - main.c - plugins_dlg.c : done GtkCTree ==> GtkTreeView conversion : done GtkText ==> GtkTextView conversion : done Remaining problems : - gtk_font_selection_dialog_set_filter doesn't exist anymore (but hasn't been removed from the documentation). I don't know how to filter the font selection dialog to get only fixed width fonts ; - we have to remove GUI prefs which are not usefule anymore : tree line style and tree expander style. svn path=/trunk/; revision=6153
2002-08-28Removed trailing whitespaces from .h and .c files using theJörg Mayer1-17/+17
winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6117
2002-08-28From Ulf Lamping: extend the progress dialog box to give more progressGuy Harris1-28/+60
information. Fix the types of some variables (make the file position in "read_cap_file()" a "long", as Wiretap supports "long" offsets, and make processed-packet counts in packet-processing loops "int"s, as the total packet count in a "capture_file" structure is an "int"). svn path=/trunk/; revision=6112
2002-08-02Replace the types from sys/types.h and netinet/in.h by their glib.hJörg Mayer1-11/+3
equivalents for the toplevel directory. The removal of winsock2.h will hopefully not cause any problems under MSVC++, as those files using struct timeval still include wtap.h, which still includes winsock2.h. svn path=/trunk/; revision=5932
2002-07-30From Graeme Hewson:Guy Harris1-76/+112
Ethereal sometimes creates a progress dialog bar and then, if the processing is fast, quickly destroys it. The resulting "flash" can be disconcerting. This set of patches ensures a progress bar is either not created or is displayed for a minimum time. svn path=/trunk/; revision=5916
2002-07-21Fix the problems WRT overwriting a capture file. From Joerg Mayer.Richard Sharpe1-2/+10
svn path=/trunk/; revision=5898
2002-07-16From Graeme Hewson:Guy Harris1-7/+16
Allow "-" as the output file name in Wiretap, referring to the standard error. Optimize the capture loop. Fix some of the error-message printing code in Ethereal and Tethereal. Have Wiretap check whether it can seek on a file descriptor, and pass the results of that test to the file-type-specific "open for output" routine. Have the "open for output" routines for files where we need to seek when writing the file return an error if seeks don't work. svn path=/trunk/; revision=5884
2002-07-15This seems to fix the problem of trying to save over the top of an existingRichard Sharpe1-9/+12
capture on some occassions. svn path=/trunk/; revision=5872
2002-06-29Have "print_line()" take an indentation argument, and do blankGuy Harris1-4/+4
padding when printing text and use "putline" when printing PostScript. Eliminate "hexdump", as it's just a special case of "putline". Have "proto_tree_print_node()" just call "print_line()". Get rid of "print_ps_hex()" - the font used for the hex dump and the protocol tree are the same, so there's no need to switch fonts. svn path=/trunk/; revision=5798
2002-06-22Get rid of trailing newline in lines passed to "print_line()".Guy Harris1-9/+5
svn path=/trunk/; revision=5732
2002-06-22Get rid of separate "print_hex_data_text()" and "print_hex_data_ps()"Guy Harris1-2/+2
routines; instead, rename "print_hex_data_common()" to "print_hex_data_buffer()" as it prints a buffer in hex and ASCII (or EBCDIC), and have it take the print format as an argument. Have it use "print_line()" to print lines, and fix "print_line()" so that it prints a buffer *without* a newline at the end, printing the newline itself. svn path=/trunk/; revision=5729
2002-06-07Add a new error for attempts to open a pipe or FIFO for random access.Guy Harris1-1/+6
Have "wtap_open_offline()", if asked to open a FIFO, return that error if it was asked to open the file for random access. svn path=/trunk/; revision=5643
2002-06-04Get rid of the "data_src" member of the "frame_data" structure; put itGuy Harris1-9/+4
in the "packet_info" structure instead, as we don't need a pointer for every single frame in the capture file, just for each frame for which we currently have an open "epan_dissect_t". svn path=/trunk/; revision=5614
2002-05-23Clean up the file saving code a bit.Guy Harris1-59/+51
svn path=/trunk/; revision=5531
2002-05-23Make "save_cap_file()" return a Boolean (TRUE on success, FALSE onGuy Harris1-11/+23
failure) - and don't use "err" to determine success or failure, as it's not set in some failure cases. svn path=/trunk/; revision=5528
2002-05-23The "fname" argument to "save_cap_file()", and "cf->filename" - and thusGuy Harris1-13/+12
"from_filename" - are both null-terminated strings; compare them with "strcmp", not "strncmp()". ("cf->filename" is a "char *", so "sizeof(cf->filename)" is not the right third argument to "strncmp()" in any case, as it's the size of a pointer, which is probably either 4 or 8 bytes.) Make the dialog box for "Can't save over current capture file" an ESD_TYPE_CRIT dialog box, as it's a fatal error. svn path=/trunk/; revision=5526
2002-05-03From Didieer Gautheron:Guy Harris1-7/+19
Don't show progress bar for quick "Find Frame" searches Add "Find Next" and "Find Previous" to repeat searches Add documentation for "Find Next" and "Find Previous". svn path=/trunk/; revision=5378
2002-05-03Clean up the handling of filter strings:Guy Harris1-2/+4
have "filter_packets()" make a copy of the filter string handed to it, as it may save the filter string in the "capture_file" structure, and the caller of "filter_packets()" shouldn't have to worry about the string it passed to "filter_packets()" being stashed away somewhere so that it can't just free that string or change it; have callers of "filter_packets()" free up the string they handed to it, if the string was allocated and they're done with it; plug some memory leaks in "match_selected_cb_do()". Check for an illegal "action" argument being passed to "match_selected_cb_do()". Move some keys out of "keys.h" into "gtk/main.c", as they're only used in "gtk/main.c". Make the pointer to the filter list a data item for the combo box, as it's a copy of the list of strings for the combo box, rather than attaching it to the widgets that activate the filter (a pointer to the combo box *itself* is a data item for those widgets). In "filter_activate_cb()", make a copy of the text from the text entry field as soon as we fetch it, and use that copy. Free that copy if we didn't add the filter to the filter list. Don't make a copy of the entire filter list and use that to set the combo box's list of items - just use the list itself. Also, when the list is changed, make the new value the data for the combo box (the list pointer will actually not be changed, because we happen to be using "g_list_append()", but let's not rely on that). svn path=/trunk/; revision=5368
2002-04-24If the progress fraction when reading in a file becomes > 1, assume thatGuy Harris1-11/+28
the file grew while we were reading it, and re-fetch the size and try again; if it's still > 1, give up and clamp it at 1 so that the GTK+ progress bar code doesn't complain. svn path=/trunk/; revision=5232
2002-04-22Make sure that when we save a file, we don't overwrite our capture fileRichard Sharpe1-2/+12
with an empty file. svn path=/trunk/; revision=5225
2002-04-20Don't prime the display filter unless we're re-applying it; otherwise,Guy Harris1-2/+2
we aren't building a protocol tree, and we can't prime the filter against the tree. svn path=/trunk/; revision=5206
2002-03-31From Joerg Mayer: get rid of unused arguments, and mark those that can'tGuy Harris1-2/+2
be eliminated (because the function is called through a pointer, and other functions called through the same pointer *do* use the argument) as unused. svn path=/trunk/; revision=5050
2002-03-05Make "wtap_seek_read()" return TRUE on success and FALSE on error, likeGuy Harris1-3/+3
"wtap_read()". Add some additional error checks to the Sniffer file reader. svn path=/trunk/; revision=4875
2002-03-05Have "wtap_seek_read()" return 0 on success and -1 on failure, and takeGuy Harris1-7/+20
an "err" argument that points to an "int" into which to put an error code if it fails. Check for errors in one call to it, and note that we should do so in other places. In the "wtap_seek_read()" call in the TCP graphing code, don't overwrite "cfile.pseudo_header", and make the buffer into which we read the data WTAP_MAX_PACKET_SIZE bytes, as it should be. In some of the file readers for text files, check for errors from the "parse the record header" and "parse the hex dump" routines when reading sequentially. In "csids_seek_read()", fix some calls to "file_error()" to check the error on the random stream (that being what we're reading). svn path=/trunk/; revision=4874
2002-02-27From Joerg Mayer: remove unused variables and declarations ofGuy Harris1-2/+2
non-existent functions. Remove the "filetype" argument from the "can_write_encap" functions for particular capture file types - the argument value is implicit, in that the routine being called is the routine for that particular file type. svn path=/trunk/; revision=4823
2002-02-24Get rid of "init_all_protocols()"; instead, have a routineGuy Harris1-25/+6
"init_dissection()" which calls "epan_conversation_init()", does the work that "init_all_protocols()" did, and then calls "reassemble_init()", so that the standard sequence of dissection initialization is done in one place, rather than having multiple places call the same sequence of routines. svn path=/trunk/; revision=4797
2002-02-19Update a comment.Guy Harris1-3/+3
svn path=/trunk/; revision=4757
2002-02-18Don't give tvbuffs names; instead, give data sources names, where aGuy Harris1-12/+5
"data source" has a name and a top-level tvbuff, and frames can have a list of data sources associated with them. Use the tvbuff pointer to determine which data source is the data source for a given field; this means we don't have to worry about multiple data sources with the same name - the only thing the name does is label the notebook tab for the display of the data source, and label the hex dump of the data source in print/Tethereal output. Clean up a bunch of things discovered in the process of doing the above. svn path=/trunk/; revision=4749
2002-02-08Have Wiretap set the snapshot length to 0 if it can't be derived fromGuy Harris1-1/+7
reading the capture file. Have callers of "wtap_snapshot_length()" treat a value of 0 as "unknown", and default to WTAP_MAX_PACKET_SIZE (so that, when writing a capture file in a format that *does* store the snapshot length, we can at least put *something* in the file). If we don't know the snapshot length of the current capture file, don't display a value in the summary window. Don't use "cfile.snap" as the snapshot length option when capturing - doing so causes Ethereal to default, when capturing, to the snapshot length of the last capture file that you read in, rather than to the snapshot length of the last capture you did (or the initial default of "no snapshot length"). Redo the "Capture Options" dialog box to group options into sections with frames around them, and add units to the snapshot length, maximum file size, and capture duration options, as per a suggestion by Ulf Lamping. Also add units to the capture count option. Make the snapshot length, capture count, maximum file size, and capture duration options into a combination of a check box and a spin button. If the check box is not checked, the limit in question is inactive (snapshot length of 65535, no max packet count, no max file size, no max capture duration); if it's checked, the spinbox specifies the limit. Default all of the check boxes to "not checked" and all of the spin boxes to small values. Use "gtk_toggle_button_get_active()" rather than directly fetching the state of a check box. svn path=/trunk/; revision=4709
2002-01-21Include files from the "epan" directory and subdirectories thereof withGuy Harris1-7/+7
"epan/..." pathnames, so as to avoid collisions with header files in any of the directories in which we look (e.g., "proto.h", as some other package has its own "proto.h" file which it installs in the top-level include directory). Don't add "-I" flags to search "epan", as that's no longer necessary (and we want includes of "epan" headers to fail if the "epan/" is left out, so that we don't re-introduce includes lacking "epan/"). svn path=/trunk/; revision=4586
2002-01-10Separate the promiscuous mode, "Update list of packets in real time",Guy Harris1-3/+7
and "Automatic scrolling in live capture" options from the preference settings for them, so that the preference settings affect the initial values of those options, but changing those values in a capture don't affect the preferences, and don't automatically get saved when you save the preferences. If we're building without libpcap, don't have an "Automatic scrolling in live capture" option anywhere. svn path=/trunk/; revision=4514
2002-01-05Long NCP traces can easily have many packets whose "uniqueness"Gilbert Ramirez1-1/+9
variables wrap-around. Since the request/reply packets are related via a hash based on these uniqueness variables, long NCP traces can have mis-matches reqeust/reply records. Thus, only do the hash-lookup for the reply packet during the first sequential scan of the trace file. Once the pertinent info is found, store it in the packet's private data area. Since the memory allocated for the hash and for the structures that make up the keys are no longer needed after the first sequential run through the trace file, arrange to free that memory after the first sequential run. Similar to the register_init_routine() that allows dissectors to register callbacks for calling *before* a capture file is loaded, set up a register_postseq_cleanup_routine() function that allows dissectors to register callbacks for calling *after* the first sequential run-through of the trace file is made. This is not a *final* cleanup callback, since Ethereal will still have that trace file open for random-access reading. I didn't have tethereal call postseq_cleanup_all_protocols() since tethereal doesn't keep the trace file open for random-access reading. I could easily be swayed to make tethereal call that function, however. svn path=/trunk/; revision=4484
2002-01-03In "change_time_formats()" we can now check at the beginning whetherGuy Harris1-17/+21
there are any columns whose time formats will change, and just return if there aren't. We also, however, need to set the "writable" flag on the columns before doing that check, as "check_col()" checks whether the column in question is writable; in this context, all columns are writable. svn path=/trunk/; revision=4472
2001-12-18Provide for per-protocol-tree data in the proto_tree code.Gilbert Ramirez1-15/+28
Put a hash-table of "interesting" fields in the per-proto-tree data. The dfilter code records which fields/protocols are "interesting" (by which I mean, their value or existence is checked). Thus, the proto_tree routines can create special arrays of field_info*'s that are ready for the dfilter engine to use during a filter operation. Also store the "proto_tree_is_visible" boolean, renamed "visible", in the per-proto-tree data. Move epan_dissect_t to its own header file to make #include dependencies easier to handle. Provide epan_dissect_fill_in_columns(), which accepts just the epan_dissect_t* as an argument. epan_dissect_new() needs to be followed by epan_dissect_run() for the dissection to actually take place. Between those two calls, epan_dissect_prime_dfilter() can be run 0, 1, or multiple times in order to prime the empty proto_tree with the "intersesting" fields from the dfilter_t. svn path=/trunk/; revision=4422
2001-12-16Add an extra argument to "epan_dissect_new()" that indicates whether theGuy Harris1-18/+12
display representation should be put into protocol tree items if a protocol tree is to be constructed; have it set "proto_tree_is_visible" from that argument. svn path=/trunk/; revision=4408
2001-12-10Add some additional comments.Guy Harris1-2/+4
svn path=/trunk/; revision=4375
2001-12-10Move the pointer to the "column_info" structure in the "frame_data"Guy Harris1-26/+17
structure to the "packet_info" structure; only stuff that's permanently stored with each frame should be in the "frame_data" structure, and the "column_info" structure is not guaranteed to hold the column values for that frame at all times - it was only in the "frame_data" structure so that it could be passed to dissectors, and, as all dissectors are now passed a pointer to a "packet_info" structure, it could just as well be put in the "packet_info" structure. That saves memory, by shrinking the "frame_data" structure (there's one of those per frame), and also lets us clean up the code a bit. svn path=/trunk/; revision=4370
2001-12-06Remove proto_tree from capture_file and PacketWinData, since theyGilbert Ramirez1-36/+13
already contain a pointer to an epan_dissect_t, which contains the proto_tree. Routines calling epan_dissect_new() do not create their own proto_tree via proto_tree_create_root(); instead, they pass a boolean to epan_dissect_new() telling it whether it should create the root proto_tree. svn path=/trunk/; revision=4343
2001-12-06Make the "Save only marked frames" button in the "Save As..." dialog boxGuy Harris1-1/+22
sensitive only if there *are* marked frames. svn path=/trunk/; revision=4341
2001-12-04In the NetMon capture file reading code, if we get a short read whenGuy Harris1-2/+2
trying to read the frame table, return -1 with "*err" set to WTAP_ERR_SHORT_READ, don't return 0 - we've already decided that the file is a NetMon file, so we shouldn't return a "this isn't a NetMon file" indication, we should return a "this file is too short" error, as that's what the problem is. Fix up the error messages for WTAP_ERR_SHORT_READ to indicate that the read might have gotten cut short in the middle of data other than a packet. svn path=/trunk/; revision=4331