Commit Graph

110 Commits

Author SHA1 Message Date
Jaap Keuter bd9ac16336 From Jim Young:
The attached patch augments the epan/dissectors/packet-frame.c module to optionally generate MD5 hashes of each packet.  These MD5 hashes are calculated in the same 
manner as the MD5 hash used for duplicate packet removal by the editcap utility.  

The ability to generate the MD5 hashes can be enabled or disabled by a new boolean preferences option: frame.generate_md5_hash.  By default MD5 hash generation is disabled.

To help identify frames with matching MD5 hashes this patch also includes a new
display filter: frame.md5_hash.

svn path=/trunk/; revision=27150
2009-01-04 12:08:17 +00:00
Bill Meier c544c20956 Fix various typos and spelling errors (mostly in text strings)
svn path=/trunk/; revision=27050
2008-12-18 19:08:49 +00:00
Bill Meier 8afa208ffb Windows build: #include winsock2.h only when needed.
#include winsock2.h pulls in about 90 distinct .h files
and about 140 total .h files. 
Currently winsock2.h is (mostly unnecessarily) included
for each dissector via packet.h/wtap.h.
This patch removes #include winsock2.h from wtap.h and 
then includes winsock2.h (or windows.h) in the 
few specific places required. 
With this patch, my Windows Wireshark build takes 
about 30% less time.


svn path=/trunk/; revision=26535
2008-10-24 00:42:09 +00:00
Jeff Morriss a2ab3791f4 Fix http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2549 : make the frame dissector catch exceptions generated by post dissectors.
svn path=/trunk/; revision=25339
2008-05-21 14:18:37 +00:00
Stig Bjørlykke ef625890aa From Shane Kearns (bug 2237):
Added support for Symbian OS btsnoop.

The bluetooth HCI layer in Symbian OS can be configured to log all packets to a
file.  The log format, "btsnoop" is based on the RFC1761 "snoop" format - but
differences in the header make it incompatible.

The btsnoop format supports logging of these formats:
"H1" (raw HCI packets without framing)
"H4" (HCI UART packets including packet type header)
"H5" (HCI 3 wire UART packets including framing)
"BCSP" (HCI bluecore serial protocol including framing)

"H1" and "H4" are section numbers in the original v1 bluetooth specifications,
but still used colloquially - wireshark's existing support for Linux bluez HCI
logs uses the "H4" name.

In practice, the "H1" format is used for H5,BCSP and USB HCI logs, as the HCI
packet logs are mainly useful for debugging higher layers, bluetooth profiles
and bluetooth applications.

From me:
Deleted some unused prototypes.
Mark an unused parameter.

svn path=/trunk/; revision=24263
2008-02-03 21:11:53 +00:00
Jaap Keuter f37c29c2f5 Use proto functions i.s.o. manipulating node data directly.
svn path=/trunk/; revision=23940
2007-12-23 14:18:27 +00:00
Jeff Morriss 3fa633d626 When reassembly is off, catch ReportedBoundsError when calling a subdissector
on the first fragment of a fragmented message.  This allows us to continue
dissecting chunks even if one of the first chunks in the frame was fragmented.
(It's useful to keep doing this partial dissection just so we have some idea
what's in that chunk.)

(One could rightfully argue that you should only see a fragmented chunk
bundled with another chunk when retransmitting but, well, I'm staring at
traces of an implementation--to remain nameless to protect the guilty--which
is sometimes fragmenting and then bundling the fragments into one packet.)

svn path=/trunk/; revision=23471
2007-11-16 22:04:27 +00:00
Jeff Morriss 0f82a3e7e8 From Paolo Abeni via bug 1751:
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1751

The patch adds support to wiretap for a new libpcap DLT for bluetooth captures.
This DLT carries the direction information, which now can be displayed
correctly.
The hci H4 dissector is updated to handle also the newly introduced wtap encap.

svn path=/trunk/; revision=23208
2007-10-16 17:19:16 +00:00
Gerald Combs d1a745f27b 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
2007-06-13 22:36:58 +00:00
Guy Harris 230c951306 From Stephen Donnelly of Endace:
The code for reading ERF files has not been significantly
	updated since 2004.  This patch brings it up to date with a
	number of changes.

	1) Increase number of decodable ERF types from 7 to 12. This
	   covers newer DAG card models and firmware updates.

	2) Fix timestamp conversion. Was calculating only microsecond
	   precision, now displaying with nanosecond resolution.  Hardware
	   precision is 7.5 to 30 ns depending on model.

	3) Allow the user to specify HDLC encapsulation as 'chdlc',
	   'ppp_serial', 'frelay' or 'mtp2'.  This is needed because the
	   ERF HDLC capture formats do not include information on what
	   protocol is used at the next level.  This is currently done via
	   an environment variable 'ERF_HDLC_ENCAP' and is analagous to the
	   existing 'ERF_ATM_ENCAP' variable.

	   If the user does not specify an HDLC encapsulation it tries to
	   guess, and falls back to MTP2 for backwards compatibility with
	   Florent's existing behaviour.

	   I know environment variables are ugly, suggestions are welcome.

	4) When reading HDLC captures as MTP2, use
	   WTAP_ENCAP_MTP2_WITH_PHDR rather than WTAP_ENCAP_MTP2.  This
	   allows us to put the 'Multi-Channel ERF' record 'channel
	   number' field into the MTP2 pseudo header > 'link_number'
	   field.  This is then displayed in Frame information, and can
	   be filtered on.  (Would be nice if it could be made a display
	   column?)

	Because the ERF record does not specify whether Annex A is used
	or not, we pass MTP2_ANNEX_A_USED_UNKNOWN and allow the existing
	user preference to decide.

Move the MTP2_ANNEX_A_ definitions into Wiretap, make the annex_a_used
field a guint8, and change MTP2_ANNEX_A_USED_UNKNOWN to 2 so it fits in
a guint8.  (This means that if you can save an ERF MTP2 file as a
libpcap file, the pseudo-header will have MTP2_ANNEX_A_USED_UNKNOWN in
it.)

svn path=/trunk/; revision=22067
2007-06-08 17:06:13 +00:00
Guy Harris 5a43799a17 Use G_GINT64_MODIFIER, rather than the PRI[douxX]64 macros, for GLib
routines and routines using those routines.  GLib might use different
modifiers for 64-bit quantities than the platform's C library does.

svn path=/trunk/; revision=21990
2007-05-29 18:52:42 +00:00
Jaap Keuter b80cb43018 From bug 1492: Fortify layer name presentation.
Some code cleanups.

svn path=/trunk/; revision=21752
2007-05-12 19:54:55 +00:00
Jeff Morriss ab97c31bb2 Fix warnings of the form "long long unsigned int format, guint64 arg": use
the PRI macros instead of %llu, etc.

svn path=/trunk/; revision=21454
2007-04-17 10:11:41 +00:00
Jeff Morriss 00cf2ec89c Frame numbers are unsigned, print them as such
svn path=/trunk/; revision=21443
2007-04-16 04:52:51 +00:00
Stephen Fisher ab8f589336 Fix about 100 simple to fix warnings from gcc 4.0 in epan/dissectors
svn path=/trunk/; revision=21233
2007-03-27 22:50:11 +00:00
Stephen Fisher 6d8d2854c8 From Sake Blok:
Fix for bug #491: Unexpected frame.time_delta behavior

This patch ... fixes bug 491. It does this by changing the
behaviour of the frame.time_delta field so it reflects the delta
time between captured packets (tshark already did this).  To keep
the delta time between displayed packets, the field 
frame.time_delta_displayed is created.


svn path=/trunk/; revision=21154
2007-03-23 18:08:17 +00:00
Gerald Combs 5ddc9ab395 Clarify the description of frame.time_delta. This partially addresses
bug 491.

svn path=/trunk/; revision=20870
2007-02-20 01:32:14 +00:00
Ulf Lamping 5fef4e745b add STATUS_STACK_OVERFLOW to the possible Win32 exception codes - unfortunately, this exception seems to corrupt the stack at least in a way that the TRY / CATCH pair later causes an access violation ...
svn path=/trunk/; revision=20764
2007-02-10 10:28:59 +00:00
Stephen Fisher 597faab3c6 Change frame dissector to show "frame" instead of "packet" for all fields
for consistency.  The frame.pkt_len filter is now deprecated, but still
supported as a hidden field for an easy transition.  The new field name is
frame.len.


svn path=/trunk/; revision=20519
2007-01-21 23:02:07 +00:00
Ulf Lamping e3330fd922 instead of simply doing an assert when running out of memory in emem, throw a new OutOfMemoryError Exception, so file.c can show at least a better explanation to the user before Wireshark terminates
XXX - to prevent a busy wait, I need a portable way to wait for a short time period, like Sleep() for Windows

svn path=/trunk/; revision=20437
2007-01-15 05:16:13 +00:00
Ulf Lamping 59d6c8ea33 change all file offsets from long to gint64 so we can - theoretically - handle files > 2GB correct.
Please distclean Win32 builds!

svn path=/trunk/; revision=19814
2006-11-05 22:46:44 +00:00
Ulf Lamping 2ed2cdc39d I couldn't find the filter string to show only the marked frames until I had a look at the source code (the corresponding field was hidden) -> that's not very intuitive.
So make the field "frame.marked" visible and tag it as generated.

Move both "time reference" and "marked frame" fields towards the end of the "frame" protocol fields.

Should be copied over to trunk-1.0

svn path=/trunk/; revision=18435
2006-06-12 19:24:36 +00:00
Ronnie Sahlberg feab79e328 change a whole bunch of ethereal into wireshark
svn path=/trunk/; revision=18196
2006-05-21 04:49:01 +00:00
Guy Harris 1fddaf0211 The code to read hcidump files sets the p2p pseudo-header for
WTAP_ENCAP_BLUETOOTH_H4.

svn path=/trunk/; revision=17874
2006-04-16 10:54:32 +00:00
Ulf Lamping cb1f23eecc fix #865: if the timestamps fraction (m/u/nsec) of a packet is out of range (<0 or >1000000000) add a generated line to the protocol tree and a corresponding expert info entry
A special marker in the packet list would be too much effort to implement

svn path=/trunk/; revision=17865
2006-04-14 13:32:03 +00:00
Guy Harris 336cc54807 Pass the right tree argument to the DOCSIS dissector if "treat all
frames as DOCSIS" was selected.  Fixes bug 872.

svn path=/trunk/; revision=17856
2006-04-13 19:06:52 +00:00
Ronnie Sahlberg edcaaee164 SCSI is fairly unique among the ethereal protocols in that it is sometimes normal for a PDU we receive back froma device to be truncated.
(report luns with allocation length 8 for example)

Therefore it is a bit wrong to mark these packets as [malformed packets]
Since they are truncated by scsi   and this is NOTY an error condition.


Add a new exception type  :  ScsiBoundsError
If this exception is caught by packet-frame, then print an appropriate message
instead of [malformed packet]

For SCSI, add helper macros TRY_SCSI_SHORT_PACKET   and END_...


If the packet was not short in the normal sense (snaplen < packetlen) then intercept the exception for BoundsError and rethrow it as ScsiBoundsError instead.





svn path=/trunk/; revision=17611
2006-03-13 10:29:00 +00:00
Anders Broman 9951fc2cff from Daniele Orlandi:
The attached patch adds support for LAPD frames captured using vISDN thru 
libpcap. The support has already been included in libpcap.

The patch adds a new wiretap encapsulation, the necessary glue to decode 
SLL-encapsulated frames, and some minor change in the LAPD dissector in order 
to support the remote-to-remote frames captured on the ISDN E-Channel.

Please apply ethereal-encap-table.diff before, as it fixes a misalignment in 
the encapsulation names table.

svn path=/trunk/; revision=17451
2006-03-02 21:29:15 +00:00
Ronnie Sahlberg ae52099756 fix for bug 718
dont play games with lnk_t
If the preference is set to unconditionally dissect everything as docsis   just call the docsis handler directly.



svn path=/trunk/; revision=17377
2006-02-23 09:11:00 +00:00
Ulf Lamping 84794a9bc3 from Gisle Vanem:
This file uses SEH which AFAIK is only available for MS Visual-C.
I build using MingW/gcc, so the attached patch is needed. 

svn path=/trunk/; revision=17102
2006-01-25 21:34:04 +00:00
Luis Ontanon e469d2af12 Use the right tree
svn path=/trunk/; revision=17099
2006-01-25 20:48:37 +00:00
Luis Ontanon 1ff8c4272f Add register_postdissector() to the API.
Dissectors registered with register_postdissector() will be called after all other dissectors have been called.

Use it to register mate.


svn path=/trunk/; revision=17089
2006-01-24 00:26:57 +00:00
Ulf Lamping c73ed3c6d5 add Win32 Structured Exception Handling (SEH) at the same place we're already doing the Portable Exception Handling.
This way we (hopefully) can continue dissecting with the next packet, even if a more serious exception had occured, e.g. a memory access violation or a divide by zero exception.

Obviously, not all problems solved, as SEH won't protect us from other problems, e.g. endless loops and such

svn path=/trunk/; revision=17070
2006-01-22 02:22:14 +00:00
Ulf Lamping 864edeb5ac add matched coloring rule name and string to the frame dissector output (or nothing if no coloring rule matched or none was set)
svn path=/trunk/; revision=17068
2006-01-21 17:49:00 +00:00
Ronnie Sahlberg 163252a41c From Stig B
Patch for COTP reassembly.

There does not seem to be any reasonable or cleaner way to fix COTP 
reassembly than adding the frame.[ch] patch.


svn path=/trunk/; revision=16813
2005-12-16 00:32:12 +00:00
Guy Harris f6ef22c553 Have show_exception() take a "const char *" as its exception message,
and not free the string to which it points.  Pass to
REPORT_DISSECTOR_BUG() strings allocated with ep_strdup_printf(), so
that they're freed automatically.

svn path=/trunk/; revision=16039
2005-09-28 16:16:37 +00:00
Ulf Lamping bed8f51d98 show the same [Packet size limited during capture] message in the column info, instead of the former (unintuitive) [Short Frame]
svn path=/trunk/; revision=15979
2005-09-23 18:05:36 +00:00
Ulf Lamping 497478bc99 as discussed in the Users list: replace "Short Frame" by "Packet size limited during capture" message
svn path=/trunk/; revision=15855
2005-09-18 11:18:42 +00:00
Ulf Lamping 7cc57ec40c add to the protocol item a short description what a "Short Frame" is
svn path=/trunk/; revision=15786
2005-09-13 18:40:58 +00:00
Ulf Lamping de0d7959ca don't simply remove the expert_info output at BoundsError, but add the comment from Guy why this (usually) isn't a bug (because of a short snapshot length).
svn path=/trunk/; revision=15781
2005-09-13 08:03:16 +00:00
Guy Harris aba53424dd Move the definition of GNUC_FORMAT_CHECK() to its own header, use it in
column-utils.h, and add it to expert.h, so we check the arguments to
"expert_add_info_format()", at least if the format argument is a
constant string.

Fix some more calls to "expert_add_info_format()" to pass it a format
string.

Don't record BoundsError exceptions as expert events - they merely
reflect a capture done with a snapshot length too short to capture all
of the packet (any case where it's caused by something else is a bug).

svn path=/trunk/; revision=15776
2005-09-13 04:00:47 +00:00
Ulf Lamping 642467ad5c I'm adding the "Expert Info" prototype now, as it seems to be in a state where others might have a look and probably already find it useful :-). Anyway, we can easily disable it at one or two places in the code if it get's in our way of a new release.
Please see: http://wiki.ethereal.com/Development/ExpertInfo for a complete overview of the intended feature and it's current state of implementation.

While I'm working on this, I've also added some more status result codes to the DCE/RPC and DCOM dissectors.

svn path=/trunk/; revision=15754
2005-09-11 16:55:34 +00:00
Ulf Lamping 6f43fbb2f0 EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry!
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ...

What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere.

As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon.

Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way...

As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number...

svn path=/trunk/; revision=15520
2005-08-24 21:31:56 +00:00
Guy Harris 84cf5472e9 If a dissector writer directly throws DissectorError, don't punish the
user by crashing due to a null pointer dereference, punish the dissector
writer by saying he or she didn't bother providing an explanation of the
error.

The exception message isn't a const string any more; make the
"exception_message" argument to "show_exception()" a "char *", not a
"const char *".

svn path=/trunk/; revision=15251
2005-08-06 21:38:43 +00:00
Guy Harris f618b54d36 Support throwing an exception with a null message pointer, and have the
message not be const (as we generate messages with "g_strdup_sprintf()",
which means they need to be freed; using a null message means that we
don't have to use a special string for exceptions with no message, and
don't have to worry about not freeing that).

Have THROW() throw an exception with a null message pointer.  (This
means that you crash if you throw DissectorError with THROW().  Don't do
that - it means you don't get a more detailed explanation of the
dissector problem.  Use the DISSECTOR_ASSERT, etc. macros in
epan/proto.h instead.)

Free the exception message for DissectorError, as it's mallocated.

svn path=/trunk/; revision=15250
2005-08-06 19:58:45 +00:00
Gerald Combs b992c73391 In packet-frame.c, don't free static memory when we throw a
DissectorError.  In packet-kerberos.c, restore pinfo->private_data if
we throw an exception, which keeps the SMB dissector from throwing
a DissectorError.  Initialize variables in other places to squelch
valgrind warnings.

svn path=/trunk/; revision=15235
2005-08-06 03:43:42 +00:00
Gilbert Ramirez c8cd8f21a4 Exception handling fixes, and a fix to packet-frame.c,
from Richard van der Hoff.

svn path=/trunk/; revision=15205
2005-08-04 13:54:46 +00:00
Ronnie Sahlberg d9826d34d5 add a dummy variable frame_number to dissect_frame() and assign it the current frame number so that the crashdump that buildbot generates will show which frame the problem occured in.
this is useful since some bugs only trigger ia crash on some platforms.
example   bug 255 which does not trigger a crash on linux redhat 7.1



svn path=/trunk/; revision=14727
2005-06-22 08:41:58 +00:00
Ulf Lamping 76778cc78b mark some fields as generated and clarify some field descriptions
svn path=/trunk/; revision=14517
2005-06-01 21:28:40 +00:00
Gerald Combs 861dc4e340 More bug fixes from Steve Grubb. See bug 217 for details.
svn path=/trunk/; revision=14496
2005-05-30 20:58:20 +00:00
Michael Tüxen 23d022349d - Add support for libpcap files for MTP2 with a per packet header
indicating the direction, narrowband/broadband, and interface number.
- Add support to display the direction and interface number.
- Add support to packet-mtp2.c to use the broadband/narrowband indication.

svn path=/trunk/; revision=14265
2005-05-02 14:07:33 +00:00
Ronnie Sahlberg 2bc81b2a48 Major speed improvement for filtering and dissection.
It should not dump core as far as all my tests are concerned and Menu_Statistics/ProtocolHierStats work

It needs more testing and there might still be cases where it will crash that will need to be fixed  but I feel it will be worth it since it will decrease the time to filter very large capture files dramatically.

Real significant performance boost for very large captures.


(If we cant fix all the problems we can just revert this patch)



svn path=/trunk/; revision=14051
2005-04-11 08:43:51 +00:00
Guy Harris 3060dc91b6 Squelch some compiler warnings.
svn path=/trunk/; revision=13133
2005-01-20 07:58:23 +00:00
Gerald Combs 561fbc8b25 Add a field called "frame.protocols" which shows the protocols present
in the frame.   The filter "frame.protocols contains ip:icmp:ip" could
be used to find any ICMP packets containing IP headers.

Clean up whitespace.

svn path=/trunk/; revision=13118
2005-01-19 04:49:29 +00:00
Guy Harris 2bdef3c122 Rename the FieldError exception to DissectorError.
Add a DISSECTOR_ASSERT() macro, which is the usual type of assertion
macro, but throws a DissectorError exception with a message giving the
flien and line number and the failed test as a string.  Use that macro
in "alloc_field_info()".

Report that exception in the Info column and the protocol tree, as well
as logging the exception failure with g_warning().

svn path=/trunk/; revision=13078
2005-01-16 23:30:55 +00:00
Ulf Lamping 1c9781b4ec throw the new FieldError exception, if a dissector tries to add a field with invalid parameters
add a message parameter to the show_exception function

svn path=/trunk/; revision=13074
2005-01-16 16:06:15 +00:00
Anders Broman d607cdb1e4 From LEGO if Mate is pressent call it.
svn path=/trunk/; revision=12615
2004-11-28 20:52:52 +00:00
Guy Harris 6472876ab3 Move the tap infrastructure to the epan directory.
svn path=/trunk/; revision=12128
2004-09-29 00:06:36 +00:00
Guy Harris bbe7f89742 Move prefs.c and prefs.h into the epan subdirectory.
svn path=/trunk/; revision=12115
2004-09-27 22:55:15 +00:00
Gilbert Ramirez 669db206cb Move dissectors to epan/dissectors directory.
Also move ncp222.py, x11-fields, process-x11-fields.pl,
make-reg-dotc, and make-reg-dotc.py.

Adjust #include lines in files that include packet-*.h
files.

svn path=/trunk/; revision=11410
2004-07-18 18:06:47 +00:00