aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap.h
AgeCommit message (Collapse)AuthorFilesLines
2000-09-21Make sure to pass the sent/received direction from pppdump.c inGilbert Ramirez1-7/+9
pseudo_header. Use generic "p2p_phdr" instead of "lapd_phdr". Modify toshiba.c and packet-lapd.c to take that into account. Add frame.p2p_dir, a filterable field, 0=sent, 1=recvd Make p2p_dir available in packe_info, as I think it will be needed in VJ COMP and UNCOMP dissection. Rename WTAP_ENCAP_TR to WTAP_ENCAP_TOKEN_RING. Mention pppd-log support in man page. Mention atmsnoop in README. svn path=/trunk/; revision=2455
2000-09-19Add support for reading pppd log files in wiretap.Gilbert Ramirez1-2/+3
svn path=/trunk/; revision=2448
2000-09-15Code to read capture files from some version of tcpdump from some sortGuy Harris1-21/+22
of Nokia box (firewall) - yep, it's yet *another* mutant libpcap format that didn't change the magic number, sigh.... svn path=/trunk/; revision=2440
2000-09-07Change wtap_read() API so that the data offset is set via a pointer, andGilbert Ramirez1-3/+11
a "keep reading" boolean value is returned from the function. This avoids having to hack around the fact that some file formats truly do have records that start at offset 0. (i4btrace and csids have no file header. Neither does the pppdump-style file that I'm looking at right now). svn path=/trunk/; revision=2392
2000-08-11Miscellaneous code cleaningLaurent Deniel1-1/+3
- add <stdarg.h> or <varargs.h> in snprintf.h and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes - remove the check of multiple inclusions in source (.c) code (there is a bit loss of _cpp_ performance, but I prefer the gain of code reading and maintenance; and nowadays, disk caches and VM are correctly optimized ;-). - protect all (well almost) header files against multiple inclusions - add header (i.e. GPL license) in some include files - reorganize a bit the way header files are included: First: #include <system_include_files> #include <external_package_include_files (e.g. gtk, glib etc.)> Then #include "ethereal_include_files" with the correct HAVE_XXX or NEED_XXX protections. - add some HAVE_XXX checks before including some system header files - add the same HAVE_XXX in wiretap as in ethereal Please forgive me, if I break something (I've only compiled and regression tested on Linux). svn path=/trunk/; revision=2254
2000-08-08Added wiretap support to read the Cisco Secure Intrusion Detection System ↵Mike Hall1-2/+3
IPLog format. svn path=/trunk/; revision=2231
2000-07-26In the final scene of the horror movie, just when you think the monsterGuy Harris1-20/+21
is finally dead, and you're walking away, it springs up again and attacks. It appears that the ss990915 version of Alexey Kuznetzov's libpcap patch has some extra stuff in the per-packet header for some sort of SMP debugging, and that SuSE Linux 6.3 picked it up. Thus, even if a libpcap file has the modified magic number, we *still* have to go through the usual heuristic hell to figure out what type of file it is. svn path=/trunk/; revision=2164
2000-06-27Add routines to Wiretap to allow a client of Wiretap to get:Guy Harris1-1/+4
a pointer to the "wtap_pkthdr" structure for an open capture file; a pointer to the "wtap_pseudo_header" union for an open capture file; a pointer to the packet buffer for an open capture file; so that a program using "wtap_read()" in a loop can get at those items. Keep, in a "capture_file" structure, an indicator of whether: no file is open; a file is open, and being read; a file is open, and is being read, but the user tried to quit out of reading the file (e.g., by doing "File/Quit"); a file is open, and has been completely read. Abort if we try to close a capture that's being read if the user hasn't tried to quit out of the read. Have "File/Quit" check if a file is being read; if so, just set the state indicator to "user tried to quit out of it", so that the code reading the file can do what's appropriate to clean up, rather than closing the file out from under that code and causing crashes. Have "read_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, close the capture and return an indication that the read was aborted by the user. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have "continue_tail_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, quit the loop, and after the loop finishes (even if it read no packets), return an indication that the read was aborted by the user if that happened. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have "finish_tail_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, quit the loop, and after the loop finishes (even if it read no packets), close the capture and return an indication that the read was aborted by the user if that happened. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have their callers check whether the read was aborted or not and, if it was, bail out in the appropriate fashion (exit if it's reading a file specified by "-r" on the command line; exit the main loop if it's reading a file specified with File->Open; kill the capture child if it's "continue_tail_cap_file()"; exit the main loop if it's "finish_tail_cap_file()". svn path=/trunk/; revision=2095
2000-06-24Joerg Mayer's changes to add support for NetXRay file format versionGuy Harris1-2/+2
2.002, as used by release 3.50 of the Network Associates Sniffer for Windows; currently, we treat it just like the 2.001 version, so we rename the version #define WTAP_FILE_NETXRAY_2_001 to WTAP_FILE_NETXRAY_2_00x and use that for both 2.001 and 2.002. svn path=/trunk/; revision=2087
2000-05-25Support for reading compressed Sniffer files, from Tim Farley, JoergGuy Harris1-16/+23
Mayer, and yours truly. svn path=/trunk/; revision=2002
2000-05-19Add wtap-int.h. Move definitions relevant to the internal workins of wiretapGilbert Ramirez1-209/+9
to that file, leave public definitions in wtap.h. Rename "union pseudo_header" to "union wtap_pseudo_header". Make the wtap_pseudo_header pointer available in packet_info struct. svn path=/trunk/; revision=1989
2000-05-18Remove the "union pseudo_header" from the "frame_data" structure;Guy Harris1-9/+17
there's no need to keep it around in memory - when the frame data is read in when handing a frame, read in the information, if any, necessary to reconstruct the frame header, and reconstruct it. This saves some memory. This requires that the seek-and-read function be implemented inside Wiretap, and that the Wiretap handle remain open even after we've finished reading the file sequentially. This also points out that we can't really do X.25-over-Ethernet correctly, as we don't know where the direction (DTE->DCE or DCE->DTE) flag is stored; it's not clear how the Ethernet type 0x0805 for X.25 Layer 3 is supposed to be handled in any case. We eliminate X.25-over-Ethernet support (until we find out what we're supposed to do). svn path=/trunk/; revision=1975
2000-05-12Fix minor typo found by Alan Harrison.Guy Harris1-2/+2
svn path=/trunk/; revision=1951
2000-05-10Rename the "private" member of a "wtap_dumper" structure to "dump", asGuy Harris1-2/+2
per the "capture" member of a "wtap" structure, so that it doesn't collide with the C++ reserved word "private". svn path=/trunk/; revision=1936
2000-04-15Get rid of the "start" field in the private data for RADCOM, i4btrace,Guy Harris1-8/+2
and nettl captures - a "start" field is used for capture files where the time stamps on packets are relative to some initial time stamp, e.g. the time the capture started, but those file formats use absolute time stamps, so no "start" field is needed. Make the "this is an HP-UX 11.x nettl capture" flag a member of the private data structure for a nettl capture, rather than a global - it's per-capture-file state. Once the "start" field is removed from the RADCOM private data structure, there's nothing left, so eliminate the private data structure. svn path=/trunk/; revision=1863
2000-04-08Declare, in "wtap.h", Richard's new "wtap_read()" function.Guy Harris1-1/+2
svn path=/trunk/; revision=1820
2000-03-22In a Network Monitor capture file, get the starting offsets of framesGuy Harris1-2/+3
from the frame table - Network Monitor 2.x, at least, doesn't always write frame N+1 right after frame N. To do that, we need to mallocate a big array to hold the frame table, and free it when we close the capture file; this requires that we have capture-file-type-specific close routines as well as capture-file-type-specific read routines - we let it the pointer to that routine be null if it's not needed. Given that, we might as well get rid of the switch statement in "wtap_close()", in favor of using capture-file-type-specific close routines, as per the comment before that switch statement. svn path=/trunk/; revision=1740
2000-02-19Use WTAP_ERR_UNSUPPORTED_ENCAP for all attempts to open or read aGuy Harris1-2/+2
capture file for an unsupported link-layer encapsulation type (as the nettl reader does), and report it correctly if it occurs on an open or read attempt rather than a save attempt. svn path=/trunk/; revision=1647
2000-01-22Fix files that had Gilbert's old e-mail address or that didn't have myGuy Harris1-2/+2
forwarding e-mail address. svn path=/trunk/; revision=1522
1999-12-15Handle i4btrace captures if they're from a machine with the oppositeGuy Harris1-1/+12
byte order from the machine that's reading them. svn path=/trunk/; revision=1338
1999-12-15One field in the NetXRay header appears to be the number of frames inGuy Harris1-3/+3
the capture; set it to that when writing the capture. Support Token Ring and FDDI captures (as per the network type in the file header appearing to be either the NDIS network type, or the NDIS network type minus 1 - I forget whether Ethernet has an NDIS type of 0 or 1). Don't write the file header twice, keeping a static copy of it around, as Wiretap code isn't supposed to keep any static data around; instead, write it only when we're done writing out all the records (as we do on Network Monitor captures). Compute the time stamps when writing the file. Give Windows Sniffer 1.1-format a short name, so "editcap" doesn't dump core or print "(null)" in its usage message. WTAP_ENCAP_NULL isn't supported by NetMon; don't write it. svn path=/trunk/; revision=1336
1999-12-14more work on netxray, still not sniffer compatible thoughNathan Neulinger1-1/+2
svn path=/trunk/; revision=1333
1999-12-14Added support for writing netxray version 1.1 dumps.Nathan Neulinger1-1/+7
It's very basic, and doesn't write out the timestamps currently. It also only handles WTAP_ENCAP_ETHERNET, although it can probably do the others, but I don't have a good way to test them. This code has not yet been tested against a Sniffer Pro, although wiretap can read the files just fine. svn path=/trunk/; revision=1318
1999-12-12Added Bert Driehuis <driehuis@playbeing.org>'s I4B wiretap moduleGilbert Ramirez1-3/+11
and V.120 decoder. svn path=/trunk/; revision=1304
1999-12-11Put in a private data structure hanging off the "wtap_dumper" structureGuy Harris1-3/+9
the "this is the first frame" flag, and the time stamp of the first frame, used when writing Sniffer files, so that more than one could be open at a time (Wiretap doesn't forbid that) and so that they're initialized when you start writing a capture. svn path=/trunk/; revision=1292
1999-12-11Provide different file types for "modified" and Red Hat 6.1 "libpcap"Guy Harris1-16/+19
files (the former have a different per-packet header, and a different magic number, from the standard "libpcap"; the latter have the same per-packet header as "modified" "libpcap" files, but the same magic number as standard "libpcap" files, sigh). Support writing "libpcap" captures in all three formats (so that, for example, people running Ethereal on RH 6.1 can write out captures that the "tcpdump" that comes with RH 6.1 can read, although that's not the default format we save in - there's no way to tell whether you're running on RH 6.1, as far as I know; "uname()" just tells you, on Linux systems, that the kernel is Linux 2.x, and what "x" is, it doesn't say what the *rest* of the system is). Fix the table in "file.c" to use Olivier's code for writing Sniffer files. svn path=/trunk/; revision=1288
1999-12-05Provide a table of descriptive and short (command-line) names forGuy Harris1-1/+7
encapsulation types, and routines to translate encapsulation types to names and short names to encapsulation types, for the benefit of "editcap". svn path=/trunk/; revision=1212
1999-12-04Give those capture file formats we can write a "short name", to be usedGuy Harris1-1/+3
to, for example, specify on a command line the format that a program should write; provide a routine to translate a file type to its short name, and to translate a short name to the corresponding file type. svn path=/trunk/; revision=1207
1999-12-04More infrastructure changes for Ethereal - makeGuy Harris1-2/+2
"wtap_file_type_string()" take, as its argument, a file type, rather than a "wtap *". Fix some range checks of file types to check against WTAP_NUM_FILE_TYPES rather than WTAP_NUM_ENCAP_TYPES. svn path=/trunk/; revision=1201
1999-12-04Add some infrastructure for the use of Ethereal, so it can make a listGuy Harris1-1/+6
of all the file types in which a file can be saved. Giving each dumpable file type a routine that checks whether a file of a given file type and encapsulation can be written lets us hoist some checks into common code from out of the open routines. If the "dump close" routine for a dump stream is NULL, have that mean that there's no action that needs to be taken on a close by the code to handle that file type; some file types don't need that, as they can be written purely sequentially. svn path=/trunk/; revision=1200
1999-12-04Add support to Wiretap for writing Network Monitor 1.x-format captureGuy Harris1-5/+35
files. Make the return type of a number of routines that return 1 (for "true") on success and 0 (for "false") on failure to "gboolean", and make the 1's and 0's TRUEs and FALSEs. svn path=/trunk/; revision=1195
1999-11-26Support for iptrace 1.0 traces (AIX 3). Thanks to Florian LohoffGilbert Ramirez1-11/+12
<flo@rfc822.org> for the sample traces. It turns out that the iptrace 2.0 header is simply an extension to the iptrace 1.0 header. It also appears that iptrace 1.0 has only tv_sec, but not tv_usec, which explains why the fields are separated in the iptrace 2.0 header, but doesn't explain why the iptrace 2.0 header has tv_sec copied in two places. I changed iptrace.c to detect FDDI captures via if_type, even though I don't have a trace to substantiate this. If *should* work, given that loopback, ethernet, token-ring, and X.25 work. If it doesn't work, someone will let me know. svn path=/trunk/; revision=1117
1999-11-11Add LAPD support.Gilbert Ramirez1-5/+12
svn path=/trunk/; revision=1004
1999-11-06Add in a gross heuristic that attempts to detect files with the versionGuy Harris1-4/+5
of the "libpcap" patch that changes the per-packet header but not the magic number - it seems to work on at least one capture file I tried it on. Give the modified "libpcap" format a WTAP_FILE type of its own (so that, in the future, we could support writing captures out in that format, possibly). svn path=/trunk/; revision=987
1999-11-06Add support for capture files written by programs linked with AlexeyGuy Harris1-2/+3
Kuznetsov's modified "libpcap" *as long as you have the ss990915 or later patch*; the 990417 patch, alas, changes the per-packet header but *doesn't* change the magic number, so you can't just look at the magic number to see that it's Not Standard Libpcap. (Even more unfortunately, Red Hat appears to have picked up *that* patch for Red Hat 6.1; I've filed bug 6773 with Bugzilla on their site - hopefully, if I'm not misremembering the RH 6.1 code I've seen, and they really *did* pick up the older patch, they'll fix it ASAP to use the new magic number, and will make updates available.) svn path=/trunk/; revision=986
1999-10-31Add a module to wiretap to be able to read trace files from Toshiba'sGilbert Ramirez1-3/+3
line of ISDN routers. Much like the ascend reader, this module reads an ASCII hex dump of trace data. Rearranged the order in which wiretap tries trace files, to keep the ASCII-readers (ascend and toshiba) at the end, and put the binary-readers (everything else) at the front of the list. If a telnet session of and ascend trace or toshiba trace were captured near the beginning of another trace, wiretap might think the trace was ascend or toshiba if it tried that module first. Fixed the way wtap_seek_read() selects functions to call. It was using the encap type instead of the file type. We got lucky because WTAP_ENCAP_ASCEND == WTAP_FILE_ASCEND svn path=/trunk/; revision=952
1999-10-19A fix, from Olivier, to the previous patch.Guy Harris1-3/+3
svn path=/trunk/; revision=885
1999-10-18Olivier Abad's patches to add:Guy Harris1-2/+8
more display filters for X.25; no LCN in X.25 RESTART / DIAGNOSTIC / REGISTRATION packets; support for nettl file format (nettl is a trace tool for HP-UX). For now, it only supports traces for X.25 interfaces (tested with HP-UX 10.20). svn path=/trunk/; revision=879
1999-10-06Add "wtap_file_encap()", to return the encapsulation of packets in theGuy Harris1-1/+4
file (which could be WTAP_ENCAP_UNKNOWN, if we couldn't determine it, or WTAP_ENCAP_PER_PACKET, if we could determine the encapsulation of packets in the file, but they didn't all have the same encapsulation). This may be useful in the future, if we allow files to be saved in different capture file formats - we'd have to specify, when creating the capture file, the per-file encapsulation, for those formats that don't support per-packet encapsulations (we wouldn't be able to save a multi-encapsulation capture in those formats). Make the code to read "iptrace" files set the per-file packet encapsulation - set it to the type of the first packet seen, and, if any subsequent packets have a different encapsulation, set it to WTAP_ENCAP_PER_PACKET. svn path=/trunk/; revision=772
1999-10-05Better handle errors from zlib:Guy Harris1-1/+12
Assign a range of Wiretap errors for zlib errors, and have "wtap_strerror()" use "zError()" to get an error message for them. Have the internal "file_error()" routine return 0 for no error and a Wiretap error code for an error. svn path=/trunk/; revision=769
1999-09-24Fix it so that it builds with "--disable-zlib".Guy Harris1-3/+9
The "fh" member of a "wtap" structure points to something constructed from the "fd" member of that structure, so that closing the stream referred to by "fh" also closes the underlying file descriptor; get rid of an unnecessary close of "wth->fd". svn path=/trunk/; revision=720
1999-09-23Adds progress bar functionality back for loading files (it was changed toAshok Narayanan1-1/+3
bounce bar for compressed file support). Note that the progress bar may not grow smoothly for compressed files, but it should be reasonably accurate for files which are large enough to matter. svn path=/trunk/; revision=701
1999-09-22This commit contains support for reading capture files compressed usingAshok Narayanan1-3/+4
gzip. The zLib library is used for this purpose. If zLib is not available (or it's use is disabled by the --disable-zlib option to configure), you can still compile Ethereal but it will be unable to read compressed capture files. IMPORTANT: Now all file accesses to capture files should be done through special macros. Specifically, for any use of the following functions on capture files, replace them. The arguments for the right-side functions are exactly the same as for the original stdio functions. fopen file_open fdopen filed_open fread file_read fwrite file_write fseek file_seek fclose file_close ferror file_error svn path=/trunk/; revision=695
1999-09-13Added support for Lucent/Ascend "wdd" output.Gerald Combs1-6/+8
svn path=/trunk/; revision=675
1999-09-11Added Guy's patch to use the pseudo header facility to pass up the AscendGerald Combs1-1/+18
metadata. Also added filter items for the session and task number. svn path=/trunk/; revision=664
1999-09-11Added support for Lucent/Ascend packet traces. The MAX and Pipeline routerGerald Combs1-2/+13
family has a set of debug commands that allow you to log the traffic on a WAN or dialup connection as text, e.g. RECV-iguana:241:(task: B04E12C0, time: 1975358.50) 15 octets @ 8003D634 [0000]: FF 03 00 3D C0 06 C9 96 2D 04 C1 72 00 05 B8 Created wtap_seek_read() which parses the textual data for and Ascend trace, and does a normal fseek() and fread() for any other file type. The fseek()/fread() pairs in file.c were replaced with the new function. svn path=/trunk/; revision=652
1999-08-28Keep in the "wtap" structure the current offset into the file beingGuy Harris1-1/+3
read, and maintain it ourselves as we read through the file, rather than calling "ftell()" for every packet we read - "ftell()" may involve an "lseek()" call, which could add a noticeable CPU overhead when reading a large file. svn path=/trunk/; revision=596
1999-08-24Add a new Wiretap encapsulation type WTAP_ENCAP_FDDI_BITSWAPPED, meaningGuy Harris1-9/+25
"FDDI with the MAC addresses bit-swapped"; whether the MAC addresses are bit-swapped is a property of the machine on which the capture was taken, not of the machine on which the capture is being read - right now, none of the capture file formats we read indicate whether FDDI MAC addresses are bit-swapped, but this does let us treat non-"libpcap" captures as being bit-swapped or not bit-swapped independent of the machine on which they're being read (and of the machine on which they were captured, but I have the impression they're bit-swapped on most platforms), and allows us to, if, as, and when we implement packet capture in Wiretap, mark packets in a capture file written in Wiretap-native format based on the machine on which they are captured (assuming the rule "Ultrix, Alpha, and BSD/OS are the only platforms that don't bit-swap", or some other compile-time rule, gets the right answer, or that some platform has drivers that can tell us whether the addresses are bit-swapped). (NOTE: if, for any of the capture file formats used only on one platform, FDDI MAC addresses aren't bit-swapped, the code to read that capture file format should be fixed to flag them as not bit-swapped.) Use the encapsulation type to decide whether to bit-swap addresses in "dissect_fddi()". svn path=/trunk/; revision=557
1999-08-22Fix the pcap-encapsulation-to-wiretap-encapsulation mapping table.Guy Harris1-7/+10
Have the code that opens "libpcap" files for writing check to make sure that the Wiretap encapsulation can be written to a "libpcap" file, and return -1 and supply a new WTAP_ERR_UNSUPPORTED_ENCAP error code if it can't. Handle that new error code in "wtap_strerror()". svn path=/trunk/; revision=546
1999-08-22Add a "wtap_strerror()" routine, which takes as an argument an errorGuy Harris1-1/+2
code supplied by a Wiretap routine (whether a positive UNIX "errno" code or a negative Wiretap error code), and returns an error message corresponding to it. Use that to construct the message Ethereal put up in a message box for those errors for which we don't have Ethereal put up a message of its choice. svn path=/trunk/; revision=545