aboutsummaryrefslogtreecommitdiffstats
path: root/tools/asn2wrs.py
AgeCommit message (Collapse)AuthorFilesLines
2019-07-27HTTPS In More Places, update some URLs.Guy Harris1-2/+2
Change-Id: Ice2e1e2e4d94f6c9da7c651866cfa1a8ac4a31d8 Reviewed-on: https://code.wireshark.org/review/34096 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-06-23asn2wrs: use system lex and yacc from ply if availablePeter Wu1-2/+8
Tested with python-ply 3.11 and Python 3.7.3 on Arch Linux using the 'ninja asn1' command. Bundling lex.py and yacc.py is one distribution method suggested by PLY upstream (https://www.dabeaz.com/ply/README.txt), but since it is also available in many Linux distributions, we could potentially remove it in the future. Windows developers can install it through pip if needed. Change-Id: I9c847072916ee33da49994820b435ec1d7110303 Reviewed-on: https://code.wireshark.org/review/33708 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-06-09tools: Switch some scripts exclusively to Python 3.Gerald Combs1-4/+8
Convert asn2wrs.py to Python 3 via `2to3 --print-function --write` along with additional tweaks. Convert asn2deb and idl2deb using `2to3 --write`. Work around what appears to be a Debian packaging bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818609 Change-Id: I5cc246f7162c2d713673955c10c092e1b91adf82 Reviewed-on: https://code.wireshark.org/review/33504 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-08OER: Dissect Boolean and IA5String types.Anders Broman1-6/+6
Change-Id: I12f1f605807809b94a7e51a5be2a4c3588f2d16f Reviewed-on: https://code.wireshark.org/review/33106 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04asn2wrs: Improve filtername of named bits.Anders Broman1-2/+7
Change-Id: Ie22137e95c8752a0783e3e9ff99b45c0b79b0d4a Reviewed-on: https://code.wireshark.org/review/32714 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04PER: Use proto_tree_add_bitmask... () for named bits.Anders Broman1-3/+3
Change-Id: I2f4258e2f4fd11c26bdc101e1375d0b5708610b7 Reviewed-on: https://code.wireshark.org/review/32713 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04epan: Convert our PROTO_ITEM_ macros to inline functions.Gerald Combs1-1/+1
Convert our various PROTO_ITEM_ macros to inline functions and document them. Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c Reviewed-on: https://code.wireshark.org/review/32706 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-03ASN.1: Use proto_tree_add_bitmask... () for named bits.Anders Broman1-13/+31
Change-Id: Ied0c91ea070ee76603e7ecb29d874e0c1a65892e Reviewed-on: https://code.wireshark.org/review/32684 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-16ASN1: Also show root node for exports.Martin Mathieson1-4/+11
For now, only apply to nr-rrc. Change-Id: I9be4bc5c3af33acad76c0a24ac04547e5f302c73 Reviewed-on: https://code.wireshark.org/review/32058 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal@wireshark.org> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2019-02-04For ASN.1-based protocols, make sure protocol filter will match.Martin Mathieson1-1/+11
This is optional, and enabled by setting PROTO_ROOT_NAME to the name of the item in the OPT section of the .cnf file. For now, setting only in nr-rrc. Change-Id: Ibe96c7de982af0346af90bc0e095f20d1a7ac506 Reviewed-on: https://code.wireshark.org/review/31876 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2019-01-01Fix asn2wrs.py: always add BASE_VAL64_STRINGChristophe GUERBER1-6/+2
In some cases (e.g. when a field has a user defined dissection function) the type reported for this field is a 'virtual' one and the latter is not contained in selt.type. Consequently, BASE_VAL64_STRING is not set. Function eth_get_type_attr should return all the attributes of a type and it seems resonable to expect it to return the BASE_VAL64_STRING. This will solve the above mentioned error and may solve any possible issue in other parts that call this function. Change-Id: Iaee9ce5bd30f2a768cfcecf628df23bf1ed54e55 Reviewed-on: https://code.wireshark.org/review/31287 Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-12-31asn2wrs.py: use BASE_VAL64_STRING and val64_stringChristophe GUERBER1-5/+24
When UINT64 contains value strings, in addition to using VALS64 to give the list of names, the type of the structure has to be val64_string and the display parameter has to be ORed with BASE_VAL64_STRING. Change-Id: I0a619c91027df1eaae8209ada816f45b85d6431d Reviewed-on: https://code.wireshark.org/review/31268 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-30asn2wrs.py: fix regression introduced by gf4b0b2109Pascal Quantin1-1/+2
FT_(U)INT64 are restricted to integer types only currently. Do not use VALS64() for other types. Change-Id: Id2299a9291c53ef246b90d732eb84811510ccb85 Reviewed-on: https://code.wireshark.org/review/31257 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-12-30Fixes ASN.1 generation for VALS using 64 bitsChristophe GUERBER1-1/+4
VALS generation did not take into account the constraints on integers. We now generate VALS if no constraints are present and VALS64 if the interger needs 64 bits. Change-Id: Ia044ee1ba1bd5b45554c19a458876e20110b1b7f Reviewed-on: https://code.wireshark.org/review/31252 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-30IEEE1609dot2: generate automatically dissector from ASN.1 descriptionPascal Quantin1-36/+51
Add basic OER support to asn2wrs.py. There is still work required as we miss many basic functions in packet-oer.c file. Change-Id: I3ebebdb2e9b0c90eb1dfa8885cebbb077b16f246 Reviewed-on: https://code.wireshark.org/review/30434 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-12Fix WITHOUT_VALS.Guy Harris1-2/+2
It was setting EF_TYPE and then clearing it; it should set EF_TYPE and clear EF_VALS. Change-Id: Ie0a85a12646c0395e50abb34caf32367e4191da0 Reviewed-on: https://code.wireshark.org/review/29621 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-09spdx: more licenses converted.Dario Lombardo1-24/+1
Change-Id: I8f6693108c43959e54911d35b4fbf730c59add60 Reviewed-on: https://code.wireshark.org/review/26361 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-25asn2wrs.py: use 64 bits variant for constrained integers using MIN or MAX ↵Pavel Strnad1-2/+3
keywords Change-Id: Iffc7c81e9653e8c1cd938de8f4fc26c5912eceec Reviewed-on: https://code.wireshark.org/review/24049 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-04asn2wrs: put back parsetab.py file in ASN.1 source folderPascal Quantin1-1/+1
Otherwise it breaks multi threaded compilation. Follow-up of gd04be01 Bug: 12621 Change-Id: I2f6b7d6ca85a1cf5a6713c2b36c823a520d3bf3d Reviewed-on: https://code.wireshark.org/review/16886 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-08-04Ply parser updated to 3.8 from http://www.dabeaz.com/ply/Balint Reczey1-1/+2
The Ubuntu packaged Ply 3.7 with Ubuntu 16.04's Python makes ASN.1 based dissector generation fail. Ply's API changed after 3.5 and the small change to asn2wrs.py adapts to that. The commit breaking the API in Ply's repository is the following: commit af651673ba6117a0a5405055a92170fffd028106 Author: David Beazley <dave@dabeaz.com> Date: Tue Apr 21 16:31:32 2015 -0500 Added optional support for defaulted states Change-Id: I1db33fdcccf7c39ecdb0e435a5ea9183362471ad Bug: 12621 Reviewed-on: https://code.wireshark.org/review/16864 Reviewed-by: Balint Reczey <balint@balintreczey.hu> Petri-Dish: Balint Reczey <balint@balintreczey.hu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt> Tested-by: João Valverde <j@v6e.pt>
2016-03-13Move /asn1 to /epan/dissectorsJoão Valverde1-4/+3
Change-Id: I1208fe3c2ba428995526f561e8f792b8d871e9a9 Reviewed-on: https://code.wireshark.org/review/14388 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: João Valverde <j@v6e.pt>
2016-02-04Fix asn2wrs warnings [-Wredundant-decls]João Valverde1-1/+4
Change-Id: Iced801f17c56618eaaf1bb7c85d68ecdebd633a1 Reviewed-on: https://code.wireshark.org/review/13705 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-10Convert ASN.1 dissectors to remove "new" from "new-style" dissector function ↵Michael Mann1-40/+19
names that were generated from asn2wrs.py This includes: 1. new_create_dissector_handle -> create_dissector_handle 2. new_register_dissector -> register_dissector 3. new_register_ber_oid_dissector -> register_ber_oid_dissector 4. new_register_ber_syntax_dissector -> register_ber_syntax_dissector Also remove PDU_NEW, SYNTAX_NEW and REGISTER_NEW as there is no need for the distinction anymore. Change-Id: I82c7de7c8ffeeab3259d1b55bb4afc5f6a1e0329 Reviewed-on: https://code.wireshark.org/review/12491 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-25asn2wrs.py: always use relative pathsPeter Wu1-6/+10
Avoids absolute paths when using cmake and doing an in-tree build. Before (source directory is /tmp/wireshark): /*--- Included file: /tmp/wireshark/asn1/t38/packet-t38-exp.h ---*/ After: /*--- Included file: packet-t38-exp.h ---*/ Change-Id: Id5c98bff7b97447479e1a09751701f2f52132b20 Reviewed-on: https://code.wireshark.org/review/12118 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-11-22asn2wrs.py: fix path substitution when generating ASN.1 dissectors with ↵Pascal Quantin1-2/+2
CMake on Windows Change-Id: I48e7d48544274f27d276e7128f8d2a2727c0b9cd Reviewed-on: https://code.wireshark.org/review/12031 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-29tools/asn2wrs.py: fix isdn-sup generation with Py3Peter Wu1-16/+10
Python 3 has removed the cmp function for sort functions, relying on a key function instead. Tested with Python 2.7.10 and 3.4.3. Change-Id: Id571b836304528ecc3b23a0f8a2843c4538c3e1b Reviewed-on: https://code.wireshark.org/review/9212 Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-06-29tools/asn2wrs.py: handle windows-1252 encodingPeter Wu1-3/+12
The RRC ASN.1 definitions resulted in a decode error in Python because the file is encoded as windows-1252 instead of UTF-8. This patch makes the tool more forgiving in handling windows-1252 encodings. Tested with Python 2.6.9, 2.7.10, 3.4.3. Change-Id: I9c9269e1065c98b8bcfb57ab4bfd21d5e183a656 Reviewed-on: https://code.wireshark.org/review/9133 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-02-18Add a CF_FUNC macro for casting BASE_CUSTOM functions.Gerald Combs1-3/+3
Add a CF_FUNC macro to match VALS, TFS, etc. This should help us to avoid the following warning: warning: ISO C forbids initialization between function pointer and 'void *' [-Wpedantic] We could start adding DIAG_OFF+DIAG_ON everywhere but this seems to be more consistent with the other macros in proto.h. Update each instance of BASE_CUSTOM to use CF_FUNC. Adjust a dummy variable name generated by asn2wrs.py that was triggering an invalid error in checkhf.pl. Fix an encoding arguement in packet-elasticsearch.c found by fix-encoding-args.pl. Change-Id: Id0e75076c2d71736639d486f47b87bab84e07d22 Reviewed-on: https://code.wireshark.org/review/7150 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-18asn2wrs: autodetect if 64 bits variant is required for constrained integersPascal Quantin1-1/+15
It does not work with defines, but is already a great step forward Change-Id: I346d4124690ec46a2299d4eae8031bbb19a3db8e Reviewed-on: https://code.wireshark.org/review/6617 Reviewed-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-10-07asn2wrs: Added support for #.SYNTAX_NEWStig Bjørlykke1-4/+12
This allows syntaxes to be registered as "new" dissectors. Change-Id: Ibb76688d9d3cbf47222610956aa627fa374bcbce Reviewed-on: https://code.wireshark.org/review/4524 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-02-26Remove a trailing space from a line of generated code.Bill Meier1-1/+1
Change-Id: Ib95c0db932c54f5664905bde9286aad7a195570f Reviewed-on: https://code.wireshark.org/review/411 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-14Remove $Id$ and other Subversion leftovers from the tools.Jeff Morriss1-2/+0
There are a few things in here which could still use attention. Don't regenerate anything now. Change-Id: I283c224d3523212144707fca3d6265916cb11792 Reviewed-on: https://code.wireshark.org/review/205 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-02-04asn2wrs: Rewrite relative paths in header.Stig Bjørlykke1-3/+4
Change both absolute paths and relative paths generated outside source directory to paths relative to asn1/<proto> subdir. Change-Id: I867d3a31c687b08347b11336ce69fc70db2d7c7b Reviewed-on: https://code.wireshark.org/review/88 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2013-12-20Change G_GINT64_CONSTANT(xxxxU) to G_GUINT64_CONSTANT(xxxx)Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=54314
2013-11-17Add a way to retrieve a PER variable bit string lengthPascal Quantin1-1/+2
svn path=/trunk/; revision=53382
2013-10-23Add an X11/MIT license to asn2wrs.py as it's compatible with our license, that'sEvan Huus1-1/+26
what the original base code was, and Tomas (who made most of the wireshark-specific changes) has no particular preference. svn path=/trunk/; revision=52801
2013-10-06Add support for RELATIVE-OID ASN.1 type. Bug 9192 ↵Michael Mann1-1/+1
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192) From Ed Beroset. svn path=/trunk/; revision=52393
2013-09-05Add modelines to avoid using tabs in the codeJörg Mayer1-0/+7
svn path=/trunk/; revision=51779
2013-09-05Change the regexp syntax a bit.Jörg Mayer1-6/+3
svn path=/trunk/; revision=51778
2013-09-05Use intended regex modification for absolute paths.Stig Bjørlykke1-4/+4
svn path=/trunk/; revision=51777
2013-09-05Removed TAB as indent.Stig Bjørlykke1-7/+7
Fixed regex for modifying absolute paths in header. svn path=/trunk/; revision=51776
2013-09-05Adapt generated output to always print paths relative toJörg Mayer1-1/+8
the asn1/<proto>/ subdir. This makes cmake generated builds look identical to autotools generated builds. svn path=/trunk/; revision=51775
2013-08-02Make sure we're compatible with Python 2 + 3. Tested with Pythons 2.5,Gerald Combs1-5787/+5791
2.7, and 3.3. svn path=/trunk/; revision=51105
2013-06-04Allow C directives in #.FN_HDR, #.FN_FTR, #.FN_BODY, they have to start with ##Tomas Kukosa1-1/+5
svn path=/trunk/; revision=49763
2013-05-27Postfix FT_NONE fields with "_element" string to reduce number of ↵Pascal Quantin1-1/+4
incompatible filters in ASN.1 dissectors https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2402 svn path=/trunk/; revision=49599
2013-04-10Use consistent "generated automatically" wording which will hopefully beGerald Combs1-2/+2
picked up by licensecheck. svn path=/trunk/; revision=48812
2013-04-03From Tomas Kukosa:Anders Broman1-43/+78
Make it possible to sort LocalCode value_strings. svn path=/trunk/; revision=48720
2013-03-22OPERATION and ERROR tables can loop through only items with either local or ↵Tomas Kukosa1-3/+10
global CODEs svn path=/trunk/; revision=48476
2013-03-01Export libwireshark symbols using WS_DLL_PUBLIC defineBalint Reczey1-6/+9
Also remove old WS_VAR_IMPORT define and related Makefile magic everywhere in the project. svn path=/trunk/; revision=47992