aboutsummaryrefslogtreecommitdiffstats
path: root/tethereal.c
AgeCommit message (Collapse)AuthorFilesLines
2002-08-20Add -S option to tethereal. It is the equivalent to Ethereals displayJörg Mayer1-7/+16
packets in real time feature. svn path=/trunk/; revision=6034
2002-08-02Replace the types from sys/types.h and netinet/in.h by their glib.hJörg Mayer1-23/+19
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-08-01Fix a few more memleaks found by valgrind (all derivingJörg Mayer1-2/+4
from the get_persconffile_path mess). svn path=/trunk/; revision=5927
2002-07-17Get rid of some "unused variable" and "unused static function" warnings,Guy Harris1-4/+18
and some compile errors in Tethereal, when compiling without libpcap. If libpcap is missing (whether that's detected at compile time or, as on Windows, at run time), don't call any of the "capture_prefs" routines - the routine to create the capture preferences page wasn't called, so the other routines can try to refer to non-existent widgets and other items and crash. Get rid of the stub routines in "capture_prefs()" used when compiling without libpcap, as they're no longer called. svn path=/trunk/; revision=5888
2002-07-16From Graeme Hewson:Guy Harris1-74/+131
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-07From Liviu Daia <Liviu.Daia[AT]imar.ro>: move "col_init()" call afterGuy Harris1-3/+3
the command-line options are processed, so that we don't crash if you've set the "column.format" preference from the command line. Fix a grammaro in a comment. svn path=/trunk/; revision=5838
2002-06-30From Graeme Hewson:Guy Harris1-13/+43
pass a non-zero count to "pcap_dispatch()" when possible; fix the check after "test_for_fifo()"; if there's a maximum file size, we're definitely saving to a file, so don't bother checking "ld.pdh", as it won't be null; if writing to a FIFO, flush after "pcap_dispatch()" returns, rather than after every packet, so we don't do as many writes to the FIFO. svn path=/trunk/; revision=5805
2002-06-28SIGINT is, at least as I read some Microsoft documentation, notGuy Harris1-6/+44
supported in Win32 applications; use the native Win32 mechanism for catching ^C (and other events that would terminate a program running in a console window). That mechanism (and the signal mechanism in the MSVC++ C run-time) cause the handler to be run in a separate thread, so it can't just do a longjmp. Fortunately, WinPcap's packet-dispatch loop, unlike the libpcap loop on some UNIX platforms, can be interrupted by ^C, so we don't have to do the longjmp there - we can just set "ld.go" to FALSE to terminate the capture loop. svn path=/trunk/; revision=5776
2002-06-27Update tethereal to handle the "<description> : <device ID>" interfaceGerald Combs1-4/+14
names that are generated under Windows. Note in pcap-util.c that we may want to separate interface device names and descriptions in the future. svn path=/trunk/; revision=5770
2002-06-23Count packets that pass the read filter, if we have a read filter, notGuy Harris1-15/+25
packets that we get from libpcap; if there's a read filter in effect, only packets that pass the read filter get saved or printed, so that's the number of packets that should be compared against the argument to any "-c" flag, and the number that should be printed when we print packet counts. svn path=/trunk/; revision=5747
2002-06-23Add a routine to "epan/filesystem.c" to test whether a file is a FIFO.Guy Harris1-49/+24
Use that in Tethereal rather than duplicating a pile of macros. Get rid of the remaining uses of "stat()" in Tethereal - none of them are necessary (they were just cut-and-pasted from Ethereal). svn path=/trunk/; revision=5746
2002-06-23From Graeme Hewson: flush the output after every frame if Tethereal isGuy Harris1-27/+86
writing a capture to a FIFO, and improve the error checking for ring buffers. svn path=/trunk/; revision=5745
2002-06-07Add a Wiretap routine to process packets captured via libpcap, possiblyGuy Harris1-9/+18
extracting a pseudo-header, for the use of SunATM captures. Add support for SunATM capture. svn path=/trunk/; revision=5652
2002-06-04Get rid of the "data_src" member of the "frame_data" structure; put itGuy Harris1-6/+3
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-22Command-line interface cleanups, from Graeme Hewson:Guy Harris1-9/+19
- Exit if an error is found in the options or arguments. - In print_usage(), improve the visibility of any getopt() error message by suppressing the version information when -h is not specified, and by adding an empty line. Ethereal: - If the -k option is specified, use the interface in the preferences file, if present. - Prevent the user from specifying any hidden options which are used internally in -S mode. Tethereal: - Fix a memory leak in the processing of the -f option. - In print_usage(), change "capture file type" to "output file type", which I think is clearer; move the -q flag from the non-libpcap case to the libpcap case. svn path=/trunk/; revision=5525
2002-05-14Use "-G fields" rather than "-G" in Makefiles.Guy Harris1-1/+6
Print an error and exit if an invalid option is given for the "-G" flag. svn path=/trunk/; revision=5466
2002-05-14Make the "-G" flag take an argument. If no arugment is specified, or ifGuy Harris1-7/+16
the argument is "fields", dump out a table of the fields, as we currently do; if the argument is "protocols", dump out a table of the protocols. svn path=/trunk/; revision=5462
2002-03-31From Joerg Mayer: get rid of unused arguments, and mark those that can'tGuy Harris1-7/+6
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-23Update from Diana Eichert to remove the comments with her login name.Guy Harris1-3/+1
svn path=/trunk/; revision=5006
2002-03-22From Diana Eichert: add a "-q" flag to Tethereal to suppress packetGuy Harris1-8/+22
count display. Update the Tethereal man page to reflect the new option. Update both the Ethereal and Tethereal man pages to use the same style to describe options, e.g. -Z Cause Ethereal to draw the mark of Zorro on the display. rather than -Z Causes Ethereal to draw the mark of Zorro on the display. (some were using the first and some were using the second). Update the Ethereal man page to do the same for menu items. Update both the Ethereal and Tethereal man pages to better describe the "-N" flag (by noting that any form of name resolution *not* specified in the flag is turned *off*). svn path=/trunk/; revision=5005
2002-03-12Get rid of the "--enable-snmp" option; instead, use "--with-ucdsnmp".Guy Harris1-5/+3
Make the directory option to "--with-ucdsnmp" optional. Handle "--with-ucdsnmp" similar to the way "--with-pcap" is handled. Get rid of unnecessary #defines in "packet-cops.c". Get rid of no-longer-necessary include of "dlfcn.h" in "packet-snmp.c". svn path=/trunk/; revision=4930
2002-03-10Remove code to show the presence, and version number, of the CMU SNMPGuy Harris1-14/+3
library, as we no longer support linking with that library. svn path=/trunk/; revision=4917
2002-03-06Don't say "without SNMP"; that can confuse people into thinking it meansGuy Harris1-2/+2
Ethereal doesn't dissect SNMP if not linked with an SNMP library (and *did* confuse at least one person into thinking that). Say "without SNMP MIB support", instead, as you only lose the ability to read SNMP MIBs and interpret OIDs and variable bindings according to those MIBs. svn path=/trunk/; revision=4894
2002-02-28In follow.c, initialize data_out_file to NULL, as it used toGilbert Ramirez1-2/+1
be initialized in gtk/follow_dlg.c In gtk/follow_dlg.c, declare data_out_file as 'extern'. In tethereal.c, no longer define 'data_out_file', as the storage for it is now in follow.c. svn path=/trunk/; revision=4830
2002-02-27From Joerg Mayer: remove unused variables and declarations ofGuy Harris1-3/+1
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-24Put all the capture options into a structure.Guy Harris1-46/+66
Move the ringbuffer capture options from the "capture_file" structure to the structure for capture options, as they're a property of an in-progress capture, not a property of a particular capture file. svn path=/trunk/; revision=4799
2002-02-24Get rid of "init_all_protocols()"; instead, have a routineGuy Harris1-24/+5
"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-24Have "get_positive_int()" really check for positive integers, not justGuy Harris1-10/+10
non-negative integers. Get rid of unused "get_positive_int()" routine in "gtk/capture_dlg.c". svn path=/trunk/; revision=4796
2002-02-24"autostop_filesize" and "autostop_duration" don't need to be in theGuy Harris1-18/+33
"capture_file" structure - they're a property of an in-progress capture, not a property of an open capture file. Make them just variables. The maximum number of packets to be captured should be a variable separate from the "count" field in the "capture_file" structure - the latter is a count of the packets in the capture file in question. Have Boolean variables indicating whether a maximum packet count, maximum capture file size, and maximum capture duration were specified. If an option isn't set, and we're doing an "update list of packets in real time" capture, don't pass the option to the child process with a command-line argument. Don't create "stop when the capture file reaches this size" or "stop when the capture's run for this long" conditions if a maximum capture file size or a maximum capture duration, respectively, haven't been specified. Don't test or free a condition if it wasn't created. Don't allow a 0 argument to the "-c" flag - the absence of a "-c" flag is the way you specify "no limit on the number of packets". Initialize the check boxes and spin buttons for the "maximum packets to capture", "maximum capture size", and "maximum capture duration" options to the values they had in the last capture. If an option wasn't specified, don't read its value from the dialog box and set the variable. svn path=/trunk/; revision=4795
2002-02-24From Peter Valchev: fix editcap to assign the result of "getopt()" to anGuy Harris1-2/+2
"int" and to check "getopt()"s return value with -1 rather than EOF. Fix other "getopt()" loops to check against -1 as well (EOF is -1 on most if not all platforms, but the Single UNIX Specification says "getopt()" returns -1, so we should check against -1, not EOF). svn path=/trunk/; revision=4793
2002-02-18Don't give tvbuffs names; instead, give data sources names, where aGuy Harris1-4/+3
"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-8/+22
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-29The ring buffer code only supports libpcap format captures; print anGuy Harris1-2/+7
error message and quit if the user tries to use ring buffering with another capture file format, and put a note about that in the Tethereal man page. svn path=/trunk/; revision=4615
2002-01-21Include files from the "epan" directory and subdirectories thereof withGuy Harris1-8/+8
"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-15Tethereal needs to allocate space for col_expr[] and col_expr_val[] too.Gilbert Ramirez1-1/+4
Capturing with non-verbose output being printed segfaulted w/o this. svn path=/trunk/; revision=4551
2002-01-13Add a preferences page for the name resolution flags.Guy Harris1-5/+8
Separate the preferences value for those flags and the name resolution code's value into separate variables; this means that the resolution code no longer depends on the preferences code, and may let us eventually have the current setting and the preference setting differ (so that a user can temporarily override the preference setting without causing subsequent saves of the preferences to save the temporary value). Add routines to create various types of widgets for preferences, and to fetch the values for "enumerated" preferences, and use them both in the code to handle hardwired preference pages and table-driven preference pages. svn path=/trunk/; revision=4536
2002-01-11Declare "capture()" appropriately.Guy Harris1-2/+2
svn path=/trunk/; revision=4527
2002-01-10Fix some problems with building Ethereal/Tethereal without libpcap.Guy Harris1-1/+7
Get rid of a #include I'd #if 0'ed out. svn path=/trunk/; revision=4513
2002-01-10Add a preferences page for capture preferences, so that the user canGuy Harris1-17/+23
directly edit the capture preferences, rather than only being able to set them implicitly from the values for the most recent capture. Add a preferences item for the interface on which to capture. Get rid of some unused variables. svn path=/trunk/; revision=4510
2002-01-03Make the "go" member of the "loop_data" structure in Ethereal aGuy Harris1-10/+18
"gboolean", as it's a Boolean value, and move it to the beginning of the structure in Tethereal, as it is in Ethereal. From Graeme Hewson: Check for "pcap_dispatch()" returning -1, meaning an error occurred; if it does, stop capturing, and report the error. If we get a signal in tethereal, stop the capture with a "longjmp()", rather than by clearning the "go" flag; "pcap_dispatch()", on many platforms, keeps reading rather than returning a captured packet count of 0 if the system call to read packets returns -1 with an errno of EINTR, so the "pcap_dispatch()" won't be broken out of if the signal handler returns. Fix a typo in an error message. svn path=/trunk/; revision=4471
2001-12-21Clean up the comments for the ring buffer checks.Guy Harris1-7/+6
svn path=/trunk/; revision=4438
2001-12-21There is no such thing as an optional parameter to a command-line flagGuy Harris1-8/+2
if you're using "getopt" - if a flag requires a parameter, not specifying the parameter is an error. svn path=/trunk/; revision=4437
2001-12-21If the user requested a ring buffer but didn't specify a capture file orGuy Harris1-16/+18
maximum capture file size, treat that as an error. svn path=/trunk/; revision=4436
2001-12-21Don't let the user specify a maximum capture file size if they're notGuy Harris1-2/+9
saving the capture to a file. svn path=/trunk/; revision=4435
2001-12-21It's not possible to check whether the capture file has reached itsGuy Harris1-3/+5
maximum size if there is no capture file; in fact, if you do, you get a core dump. Skip the capture file size test if not capturing to a file. svn path=/trunk/; revision=4434
2001-12-18Provide for per-protocol-tree data in the proto_tree code.Gilbert Ramirez1-6/+13
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-10/+7
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-10Don't fill in the columns if we're writing to a capture file.Guy Harris1-3/+5
Don't fill in the columns if we're in verbose mode. svn path=/trunk/; revision=4372
2001-12-10Move the pointer to the "column_info" structure in the "frame_data"Guy Harris1-12/+5
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-14/+7
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