aboutsummaryrefslogtreecommitdiffstats
path: root/epan/epan.c
AgeCommit message (Collapse)AuthorFilesLines
2014-06-16More Python-bindings removal.Jeff Morriss1-14/+0
Change-Id: I4d82175781e65c73179f4c8e737a7900cb050bce Reviewed-on: https://code.wireshark.org/review/2283 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-05-25Add support for dissecting non-packet records.Guy Harris1-6/+8
Add a dissector table indexed by the file type, and, for the file-type-specific records, have the frame dissector skip the usual pseudo-header processing, as the pseudo-header has a file-type-specific record subtype in it, and call the dissector for that file type's records. Change-Id: Ibe97cf6340ffb0dabc08f355891bc346391b91f9 Reviewed-on: https://code.wireshark.org/review/1782 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-24Allow wtap_read() and wtap_seek_read() to return records other than packets.Guy Harris1-2/+2
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be REC_TYPE_PACKET, for a record containing a packet, or REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific data. Modify code that reads packets to be able to handle non-packet records, even if that just means ignoring them. Rename some routines to indicate that they handle more than just packets. We don't yet have any libwiretap code that supplies records other than REC_TYPE_PACKET or that supporting writing records other than REC_TYPE_PACKET, or any code to support plugins for handling REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug 8590. Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813 Reviewed-on: https://code.wireshark.org/review/1773 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-02wmem: add new simple block allocator, use it in packet-scope.Jakub Zawadzki1-1/+1
For packet-scope allocation, there's no need to support realloc(), free() cause memory will be garbage collected after packet dissection. (and this allocator is much faster than full block allocator). Change-Id: I73fdf708c3077f48f55bdcc71f4fa859e4ac2335 Reviewed-on: https://code.wireshark.org/review/1428 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-04Remember to destroy the pinfo pool cacheEvan Huus1-0/+6
Otherwise a library reinitialization leaks at least one large 8MB chunk. Change-Id: I5336fef5925eb54e88a72f1a16fc0ddf77ae6c10 Reviewed-on: https://code.wireshark.org/review/945 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-20Revert "Allow pcapng interface options to be available to dissectors."Anders Broman1-9/+0
This patch causes Wireshark/tshark to segfault if the file is reread(open a file and press reload). The test suite also fails on 2.1.1 Step: Exit status for existing file: "/home/wireshark/builders/trunk/sol10sparc/build/test/captures/dhcp.pcap" must be 0/home/wireshark/builders/trunk/sol10sparc/build/test/suite-clopts.sh: line 149: 6646 Segmentation Fault (core dumped) $TSHARK -r "${CAPTURE_DIR}dhcp.pcap" > ./testout.txt 2>&1 OSX build bot chokes on pcapng.c: In function 'pcapng_destroy_option_value': pcapng.c:377: warning: implicit declaration of function 'g_byte_array_unref' pcapng.c:379: warning: implicit declaration of function 'g_array_unref' pcapng.c: In function 'pcapng_collect_block_option': pcapng.c:419: warning: implicit declaration of function 'g_byte_array_new_take' pcapng.c:419: warning: initialization makes pointer from integer without a cast these functions are glib 2.22 This reverts commit 7b13a3b0f6a5617e0e352f87cc5a20afea226aa8. Change-Id: Ia82fdb2d08287bc2cd2841e1e941ae68cbc2e009 Reviewed-on: https://code.wireshark.org/review/749 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-20Allow pcapng interface options to be available to dissectors.Christopher Kilgour1-0/+9
Interface options[1], and more generally pcapng options[2], are useful information that can provide improved dissector output. Prior to this change, only certain pcapng interface options were interpreted and made available to dissectors, e.g. the interface name or description. This change augments the situation by providing epan_get_interface_option( ), which returns an array of byte arrays if the option code exists (otherwise NULL). Each element of the array is a byte buffer containing the raw data of the option. An array-of-buffers is used because pcapng allows for multiple instances of the same option to be present in the file. All interface options found in a pcapng file are thus made available to the dissector. The implementation also provides infrastructure to collect options from other pcapng blocks such as the section header. Currently these options are discarded, but could be retained in the future to support more features. [1] http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#sectionidb [2] http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#sectionopt Change-Id: I944b6f0f03dde9b8e7d1348b76acde6f9d312f37 Reviewed-on: https://code.wireshark.org/review/331 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-25Fix bug 6357: Lua all_field_infos() broken within tap/listenerHadriel Kaplan1-1/+16
The current API for Lua provides a global function "all_field_infos()" which returns all the populated field_info nodes in the current proto_tree. By default all_field_infos() "works", in the literal sense: it returns exactly the fields the previous dissectors of the packet have populated at that instant of time. But of course dissectors don't populate all the applicable fields most of the time, because of the TRY_TO_FAKE_THIS_ITEM optimization where they don't fill in things that aren't needed at the time by a display, color, or tap's dfilter. So this commit offers a way to force the dissectors to populate all the applicable field_infos in the tree, by setting the proto_tree to be visible. Obviously that is going to impact performance, since it basically bypasses the TRY_TO_FAKE_THIS_ITEM optimization; so the patch only does this if the Lua script author told it to explicitly, by adding an argument to Listener.new() and register_postdissector(). Change-Id: I11d3559fbe8c14fbadf1b51415a3701dc1200b7b Reviewed-on: https://code.wireshark.org/review/286 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-01-08TFShark (Terminal Fileshark) v.001. Bug 9607 ↵Michael Mann1-0/+29
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9607) This is a VERY PRELIMINARY version of tfshark. It's an attempt to jumpstart FileShark and its architecture. Right now it's mostly just a very stripped down version of tshark with all of the necessary build modifications (including now building filetap library since tfshark depends on it) This code has helped me identify what I believe to be all of the necessary layers for a complete fileshark architecture. And those layers will slowly be added in time (patches always welcome!). svn path=/trunk/; revision=54646
2013-12-10Fix epan building with undefined HAVE_PLUGINSJakub Zawadzki1-0/+2
+ guard prototypes with HAVE_PLUGINS in .h files to get errors before linking. svn path=/trunk/; revision=53909
2013-12-05Initialize the error-reporting routines before scanning for plugins, asGuy Harris1-9/+1
the code to scan for them uses those routines. This means epan_init() no longer takes those routines as arguments - which is just as well, given that the mechanism in question is no longer part of libwireshark, but is part of libwsutil. This should fix bug 9508. svn path=/trunk/; revision=53796
2013-12-03Dissectors should not use dfilter.h, don't include it.Jakub Zawadzki1-0/+2
XXX ncp2222 dissector is using dfilter_compile(), why? svn path=/trunk/; revision=53766
2013-12-02Move most of the plugin code from epan to wsutil and remove allGuy Harris1-0/+14
knowledge of particular types of plugins. Instead, let particular types of plugins register with the common plugin code, giving a name and a routine to recognize that type of plugin. In particular applications, only process the relevant plugin types. Add a Makefile.common to the codecs directory. svn path=/trunk/; revision=53710
2013-11-23Create the ability to have packet scoped "proto" data. Bug 9470 ↵Michael Mann1-0/+2
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470) I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future. And search/replace of a function name is easy enough to do. The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As. All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope(). All other dissectors were converted to using file_scope() which was the original scope for "proto" data. svn path=/trunk/; revision=53520
2013-11-04Effectively remove the tree memory pool and port some of its behaviour to theEvan Huus1-4/+18
pinfo memory pool, they have exactly the same scope. Simplification and minor performance win (one GHashTable we longer have to create/destroy on every packet). svn path=/trunk/; revision=53076
2013-10-23Add Lua cleanup on shutdown, to help with memory leak detection. Bug 5575 ↵Michael Mann1-0/+3
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5575) From Robert G. Jakabosky From me: cleanup so that it applies to trunk. svn path=/trunk/; revision=52798
2013-10-202nd try to fix recent test failures.Jakub Zawadzki1-0/+2
After recent changes it's possible that epan_dissect_cleanup() can be called if there were no dissection run on it (epan_dissect_run()) In such case ->tvb will have random value, just initialize it to NULL in _init() and see if it's working. Thanks goes to Evan for backtrace. svn path=/trunk/; revision=52722
2013-10-20Reintroduce back epan_dissect_reset(), proto_tree_reset()Jakub Zawadzki1-2/+33
This time it makes more sense, cause for each dissection we need two wmem allocators. Reseting wmem allocator is much faster than destroy & create. svn path=/trunk/; revision=52706
2013-10-20Move resetting packet_info structure from dissect_packet() to ↵Jakub Zawadzki1-2/+2
epan_dissect_init() It'd be actually good idea to seperate packet_info data (packet.c) from epan_dissect_t (epan.c), but this rule is already violated. Strict seperation could allow for example allow multiple dissection on the same epan_dissect_t (I think it was idea behind it), but it's not working. svn path=/trunk/; revision=52705
2013-10-19From beroset@mindspring.com:Anders Broman1-1/+0
remove unnecessary and unused oid_resolv_cleanup() https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9295 svn path=/trunk/; revision=52697
2013-08-13As suggested in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9033Evan Huus1-4/+5
Make epan_free a no-op if the pointer is NULL. This fixes 99% of the cases causing problems for wmem_leave_file_scope() - remove that XXX comment and add back the assertion. Remove the cleanup_dissection call from epan_cleanup, it doesn't make sense there. init_dissection is only called from epan_new, so cleanup_dissection should only be called from epan_free. Add one missing epan_free call to tshark revealed by the above changes. svn path=/trunk/; revision=51342
2013-08-13Create the dissector hash table in only one place, and specify that its valuesEvan Huus1-1/+2
should be freed when it is destroyed. This requires splitting packet_init in two: the hash table which must be created before protocol registration, and the caching of common protocol handles, which must happen after registration. svn path=/trunk/; revision=51329
2013-08-07Ensure we have both _initialize() and a corresponding _cleanup() routines forJeff Morriss1-4/+4
the various name resolvers; put those two routines next to each other. Add generic addr_resolv_init() and addr_resolv_cleanup() routines which call all of those internal routines. Call the generic init/cleanup routine from epan_init() and epan_cleanup(). Create the hash tables for each name resolver in those initialization routines in order to avoid having to repeatedly check if the table is already created or not (and to avoid glib warnings if we neglected to perform that check): http://www.wireshark.org/lists/wireshark-dev/201308/msg00012.html Don't clean up hostnames in init_dissection(): it's done already in cleanup_dissection(). Don't initialize hostnames in cleanup_dissection(): it's done already in init_dissection(). svn path=/trunk/; revision=51191
2013-08-01Remove fdata->opt_comment, add pkt_comment to pinfoJakub Zawadzki1-0/+9
Original (read from file) comments can be accessed by pkthdr->opt_comment Keep user comments in seperated BST, add new method for epan session to get it. svn path=/trunk/; revision=51090
2013-08-01Use glibs hastables rather than home grown variants for manuf an wka(well ↵Anders Broman1-0/+2
known addresses). https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9000 svn path=/trunk/; revision=51084
2013-07-22Abuse epan_t more: add callback to get interface name.Jakub Zawadzki1-0/+9
svn path=/trunk/; revision=50794
2013-07-21Fix: epan.c:155: warning: assignment discards qualifiers from pointer target ↵Jakub Zawadzki1-1/+1
type svn path=/trunk/; revision=50767
2013-07-21Add helper function to epan_session which can be used to get absolute ↵Jakub Zawadzki1-0/+14
timestamp of given frame. Remove ->prev_cap, for testing purpose also replace ->prev_dis with number of previously displayed frame number. This patch reduce size of frame_data by 8B (amd64) This is what (I think) was suggested by Guy in comment 13 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5821#c13) svn path=/trunk/; revision=50765
2013-07-21try to fix: epan.c:141: error: invalid application of 'sizeof' to incomplete ↵Jakub Zawadzki1-1/+1
type 'epan_t' svn path=/trunk/; revision=50763
2013-07-21Some work on multi file dissectionJakub Zawadzki1-3/+25
- make init_dissection/cleanup_dissection private for libwireshark - implement epan_new(), epan_free() - pass epan_t to epan_dissect* svn path=/trunk/; revision=50761
2013-07-15Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific ↵Jeff Morriss1-1/+1
there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark). svn path=/trunk/; revision=50598
2013-07-11packet dissection now takes pointer to tvb instead of guint8 dataJakub Zawadzki1-4/+4
implement frame_tvbuff, right now almost a copy of 'real' tvb. svn path=/trunk/; revision=50497
2013-05-24Add expert info configuration framework. Bug 2412 ↵Michael Mann1-1/+3
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2412). Expert info "fields" can now be registered/addressed by name. Right now, the basic framework allows expert info fields to become "display filters". However more could be done, like user preferences overriding default severity level, speeding up expert info dialog load time by not needing to redissect a file, etc. Long term goal is to have all expert_info filterable and have the functionality of expert_add_info_format() include the "registered index". expert_add_info_format_text() is the workaround until all current calls to expert_add_info_format() have been updated with either expert_add_info() or expert_add_info_format_text(). Then the remaining expert_add_info_format_text() will be renamed to expert_add_info_format(). svn path=/trunk/; revision=49559
2013-05-22Turn "packet_is_ssl()" into a general "does the packet whose dissectionGuy Harris1-0/+19
is in this epan_dissect_t contain the field whose name is passed as an argument" routine in libwireshark, and use it where we used packet_is_ssl(). (We should check to see if anything *else* could use it.) svn path=/trunk/; revision=49530
2013-03-24Don't load the hosts file in epan_init, it's loaded when opening a fileAnders Broman1-1/+1
in cf_open(). svn path=/trunk/; revision=48526
2013-02-25Bugfix Lua pinfo.cols.protocol not holding value in postdissectorMichael Mann1-0/+3
From Hadriel Kaplan, bug 6020 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6020) svn path=/trunk/; revision=47877
2013-02-21include the wsutil/wsgcrypt.h instead of including gcrypt.h directlyMartin Kaiser1-1/+1
svn path=/trunk/; revision=47802
2012-12-19Dispatch all allocator creations through a single function using an enum toEvan Huus1-2/+1
determine the desired type. This has two advantages over the old way: - just one environment variable for valgrind to override in order to guarantee that ALL allocators use memory it can track, and just one place to check that variable - allocator owners no longer have to include headers specific to their allocator, allowing them to change allocators without adjusting all their #includes svn path=/trunk/; revision=46604
2012-12-18Rename allocator_glib to allocator_simple, since the block allocator alsoEvan Huus1-2/+2
uses glib and 'simple' describes the intention far better. svn path=/trunk/; revision=46603
2012-12-18Use 'new' instead of 'create' a consistent manner.Evan Huus1-1/+1
svn path=/trunk/; revision=46601
2012-12-02Actually destroy the pool in epan_dissect_cleanup. There are many casesEvan Huus1-2/+1
where the edt is on the stack, in which case epan_dissect_free never gets called and we were leaking the pool (although not any of the memory in it). svn path=/trunk/; revision=46333
2012-12-02Create a wmem pool in pinfo and use it for some address allocations.Evan Huus1-0/+6
A (better?) fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8030 See also thread starting at: http://www.wireshark.org/lists/wireshark-dev/201212/msg00001.html svn path=/trunk/; revision=46331
2012-11-03Manually revert r45669Jakub Zawadzki1-14/+0
svn path=/trunk/; revision=45884
2012-11-03Add wmem scopes for packet and file lifetimes. The file lifetime scope isn'tEvan Huus1-0/+4
yet initialized because I can't figure out where the enter() and leave() calls should go - the obvious place in packet.c causes a lot of assertion errors. svn path=/trunk/; revision=45879
2012-10-27Create init and cleanup functions for wmem as a whole.Evan Huus1-1/+4
Call them from epan_init() and epan_cleanup(). Expose a permanent wmem scope for allocations that should only be freed when epan is done (which is *not* necessarily when the program finishes). svn path=/trunk/; revision=45805
2012-10-20Move ep_free_all() *AFTER* packet dissection.Jakub Zawadzki1-6/+6
Use glib allocator for data_source. Thread on wireshark-dev: http://www.wireshark.org/lists/wireshark-dev/201210/msg00116.html svn path=/trunk/; revision=45673
2012-10-20Introduce epan_dissect_run_with_taps() which run dissection with taps.Jakub Zawadzki1-0/+12
unexport tap_queue_init, tap_push_tapped_queue svn path=/trunk/; revision=45670
2012-10-20- Allow reseting edt with new function epan_dissect_reset(),Jakub Zawadzki1-0/+14
- initialize edt once in few places, and later reset it after dissecting (add_packet_to_packet_list), - revert r45667, probably no longer needed. svn path=/trunk/; revision=45669
2012-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-2/+2
Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601