Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / tools / idl2wrs
blob7a51f4bd67b8002e94b25de09f9ffe5e1e44137e
1 #!/bin/sh
3 # File : idl2wrs
5 # Author : Frank Singleton (frank.singleton@ericsson.com)
7 # Copyright (C) 2001 Frank Singleton, Ericsson Inc.
9 # This file is a simple shell script wrapper for the IDL to
10 # Wireshark dissector code.
12 # ie: wireshark_be.py and wireshark_gen.py
14 # This file is used to generate "Wireshark" dissectors from IDL descriptions.
15 # The output language generated is "C". It will generate code to use the
16 # GIOP/IIOP get_CDR_XXX API.
18 # Please see packet-giop.h in Wireshark distro for API description.
19 # Wireshark is available at https://www.wireshark.org/
21 # Omniidl is part of the OmniOrb distribution, and is available at
22 # http://omniorb.sourceforge.net/
24 # This program is free software; you can redistribute it and/or modify it
25 # under the terms of the GNU General Public License as published by
26 # the Free Software Foundation; either version 2 of the License, or
27 # (at your option) any later version.
29 # This program is distributed in the hope that it will be useful,
30 # but WITHOUT ANY WARRANTY; without even the implied warranty of
31 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 # General Public License for more details.
34 # You should have received a copy of the GNU General Public License
35 # along with this program; if not, write to the Free Software
36 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
37 # 02111-1307, USA.
41 # Must at least supply an IDL file
43 if [ $# -lt 1 ]; then
44 echo "idl2wrs Error: no IDL file specified."
45 echo "Usage: idl2wrs idl_file_name"
46 exit 1;
49 # Check the file name for valid characters.
50 # Implementation based on Dave Taylor's validalnum shell script from his book,
51 # "Wicked Cool Shell Scripts", as well as Mark Rushakoff's answer he provided
52 # to the question posted at stackoverflow.com entitled, "How can I use the
53 # UNIX shell to count the number of times a letter appears in a text file?"
54 file=$(basename $1)
55 compressed="$(echo $file | sed 's/[^[:alnum:]._]//g')"
56 if [ "$compressed" != "$file" ]; then
57 echo "idl2wrs Error: Invalid file name: $file"
58 exit 1;
61 # Only allow one '.' at most.
62 count=$(echo $compressed | awk -F. '{c += NF - 1} END {print c}')
63 if [ $count -gt 1 ] ; then
64 echo "idl2wrs Error: Invalid file name: $file"
65 exit 1;
69 # Run wireshark backend, looking for wireshark_be.py and wireshark_gen.py
70 # in pythons's "site-packages" directory. If cannot find that, then
71 # try looking in current directory. If still cannot, then exit with
72 # error.
74 if [ -f $PYTHONPATH/site-packages/wireshark_be.py ] && [ -f $PYTHONPATH/site-packages/wireshark_gen.py ]; then
75 exec omniidl -p $PYTHONPATH/site-packages -b wireshark_be $@
76 /* not reached */
79 # Try current directory.
81 if [ -f ./wireshark_be.py ] && [ -f ./wireshark_gen.py ]; then
82 exec omniidl -p ./ -b wireshark_be $@
83 /* not reached */
86 # Could not find both wireshark_be.py AND wireshark_gen.py
87 # So let's just try to run it without -p, hoping that the installation
88 # set up a valid path.
90 exec omniidl -b wireshark_be $@
92 old code: not reached
94 echo "idl2wrs Error: Could not find both wireshark_be.py AND wireshark_gen.py."
95 echo "Please ensure you have the PYTHONPATH variable set, or that wireshark_be.py "
96 echo "and wireshark_gen.py exist in the current directory. "
97 echo
98 echo "On this system, PYTHONPATH is : $PYTHONPATH"
99 echo
101 exit 2
105 # Editor modelines - https://www.wireshark.org/tools/modelines.html
107 # Local variables:
108 # c-basic-offset: 4
109 # indent-tabs-mode: nil
110 # End:
112 # vi: set shiftwidth=4 expandtab:
113 # :indentSize=4:noTabs=true: