summaryrefslogtreecommitdiff
path: root/wiretap/ascend.y
AgeCommit message (Collapse)AuthorFilesLines
2016-09-16Don't pick up junk from an unset error-number variable.Guy Harris1-3/+7
Keep the actual error code and pointer-to-error-string in the scanner state, rather than pointers to the variables passed in to us. Initialize them to 0 and NULL, respectively. That way, when the actual scanner routine returns, we don't check for an error by looking at the error variable pointed to by our argument, which might not have been set by the scanner and might have stack junk in it, we look at a structure member we set to 0 before the scan. Change-Id: I81a4fd6d5cf5e56f5638fae1253c48dc50c9c36d Reviewed-on: https://code.wireshark.org/review/17721 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-18Just return the value of yyparse() from run_ascend_parser().Guy Harris1-3/+1
That's what we're doing already, but get rid of the variable to which we assigned the return value. Change-Id: I55e31664bc26bbfffe4a4ca764c917eefbb9a8f1 Reviewed-on: https://code.wireshark.org/review/17126 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-17The caplen for a packet is always "number of bytes seen".Guy Harris1-16/+7
Set wirelen to the length from the header, but don't set caplen; start caplen out as 0 and count it up whenever we add a byte. Bug: 12754 Change-Id: Ib4e45e947df6077f97a423157c152dac9f57734a Reviewed-on: https://code.wireshark.org/review/17120 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-05Set the extra type the right way.Guy Harris1-1/+1
Use %option extra_type= rather than #defining YY_EXTRA_TYPE. Change comments to reflect that the state structure is used both by the lexical analyzer and the parser. Change-Id: I19a81de61cbd6e86d71154f376ef0681cc6d42fb Reviewed-on: https://code.wireshark.org/review/14826 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03Make the Flex scanners and YACC parser in libraries reentrant.Guy Harris1-236/+159
master-branch libpcap now generates a reentrant Flex scanner and Bison/Berkeley YACC parser for capture filter expressions, so it requires versions of Flex and Bison/Berkeley YACC that support that. We might as well do the same. For libwiretap, it means we could actually have multiple K12 text or Ascend/Lucent text files open at the same time. For libwireshark, it might not be as useful, as we only read configuration files at startup (which should only happen once, in one thread) or on demand (in which case, if we ever support multiple threads running libwireshark, we'd need a mutex to ensure that only one file reads it), but it's still the right thing to do. We also require a version of Flex that can write out a header file, so we change the runlex script to generate the header file ourselves. This means we require a version of Flex new enough to support --header-file. Clean up some other stuff encountered in the process. Change-Id: Id23078c6acea549a52fc687779bb55d715b55c16 Reviewed-on: https://code.wireshark.org/review/14719 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-06Get rid of a bunch of unused variables.Guy Harris1-1/+0
("Unused" includes "set but not used".) Change-Id: Id67859b366e8caa50262f8530630ec4e8ef1507a Reviewed-on: https://code.wireshark.org/review/12457 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-08More unnecessary <stdio.h> includes.Guy Harris1-1/+0
libwiretap no longer uses standard I/O routines to read files; those includes are left over from when it did. Change-Id: Ia46c5e24ed25c6bd254cd271746ace539a37e590 Reviewed-on: https://code.wireshark.org/review/11634 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-02Rename buffer_ routines to ws_buffer_ to avoid name collisions.Guy Harris1-2/+2
In particular, epan/wslua/lrexlib.c has its own buffer_ routines, causing some linker warnings on some platforms, as reported in bug 10332. (Not to be backported to 1.12, as that would change the API and ABI of libwsutil and libwiretap. We should also make the buffer_ routines in epan/wslua/lrexlib.c static, which should also address this problem, but the name change avoids other potential namespace collisions.) Change-Id: I1d42c7d1778c7e4c019deb2608d476c52001ce28 Reviewed-on: https://code.wireshark.org/review/3351 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-15Only one buffer.c, please.Guy Harris1-1/+1
Otherwise, if you link with both libwiretap and libfiletap, it's anybody's guess which one you get. That means you're wasting memory with two copies of its routines if they're identical, and means surprising behavior if they're not (which showed up when I was debugging a double-free crash - fixing libwiretap's buffer_free() didn't fix the problem, because Wireshark happened to be calling libfiletap' unfixed buffer_free()). There's nothing *tap-specific about Buffers, anyway, so it really belongs in wsutil. Change-Id: I91537e46917e91277981f8f3365a2c0873152870 Reviewed-on: https://code.wireshark.org/review/3066 Reviewed-by: Guy Harris <guy@alum.mit.edu>
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-02Fix build on FreeBSD 10.0Edwin Groothuis1-1/+2
Change-Id: I6be0d2dfe3b44f166233b1dd20ef02c10a024f97 Reviewed-on: https://code.wireshark.org/review/74 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2013-06-16Have the seek-read routines take a Buffer rather than a guint8 pointerGuy Harris1-38/+64
as the "where to put the packet data" argument. This lets more of the libwiretap code be common between the read and seek-read code paths, and also allows for more flexibility in the "fill in the data" path - we can expand the buffer as needed in both cases. svn path=/trunk/; revision=49949
2013-05-16Hoist a bunch of common code between ascend_read() andGuy Harris1-11/+53
ascend_seek_read() into parse_ascend(). Adjust the buffer size *before* attempting to fill it up. svn path=/trunk/; revision=49343
2013-05-16Get rid of unused global variable.Guy Harris1-3/+1
svn path=/trunk/; revision=49341
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-2/+0
svn path=/trunk/; revision=45016
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-05-11Use "%parse-param" instead of a global variable. Fixes a scan-buildGerald Combs1-31/+31
warning. svn path=/trunk/; revision=42578
2011-05-31Fix some gcc 'old-style function definition' warnings.Bill Meier1-1/+1
svn path=/trunk/; revision=37482
2010-02-25Have parse_ascend() return:Guy Harris1-6/+9
PARSED_RECORD if we got a packet; PARSED_NONRECORD if the parser succeeded but didn't see a packet; PARSE_FAILED if the parser failed. Treat anything other than PARSED_RECORD as a failure, for now; I'm not sure why we were treating "parser succeeded but didn't see a packet" as success, as that was causing us to recognize some non-Ascend-output text files as Ascend files and to return "records" with bogus caplen and len values. svn path=/trunk/; revision=32009
2009-06-15From Ben Winslow via bug 3535:Gerald Combs1-1/+10
Because Lucent/Ascend equipment will sometimes omit the hex dump for a packet or send two headers followed by two hex dumps, Wireshark needs to be very lenient when parsing a Lucent/Ascend trace. On a busy access server, a packet like this is pretty likely to appear within a few minutes. svn path=/trunk/; revision=28749
2009-06-15Rename all of the ascend files:Jörg Mayer1-0/+515
That way we hopefully won't need the runlex.sh hack any more. Also the ylwrap stuff is (hopefully) obsolete. ascend.[hc] -> ascendtext.[hc] ascend-scanner.l -> ascend_scanner.l ascend-grammar.y -> ascend.y svn path=/trunk/; revision=28744