kill unmaintained python bindings

Change-Id: I1fa4f0d76b6b29d2935723b83b5ea7165039c807
Reviewed-on: https://code.wireshark.org/review/2258
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
Evan Huus 2014-06-16 11:43:27 -07:00
parent a279fa7705
commit ad97c1eb87
15 changed files with 11 additions and 1323 deletions

View File

@ -33,11 +33,6 @@ if (HAVE_LIBLUA)
endif()
source_group(wslua FILES ${WSLUA_FILES})
if (HAVE_LIBPYTHON)
include( wspython/CMakeLists.txt )
endif()
source_group(wspython FILES ${WSPYTHON_FILES})
add_subdirectory( dissectors/dcerpc )
include_directories(
@ -46,7 +41,6 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/dissectors
${CMAKE_CURRENT_SOURCE_DIR}/ftypes
${CMAKE_CURRENT_SOURCE_DIR}/wslua
${CMAKE_CURRENT_SOURCE_DIR}/wspython
)
set(CRYPT_FILES
@ -1620,7 +1614,6 @@ set(epan_LIBS
${SMI_LIBRARIES}
${M_LIBRARIES}
${LUA_LIBRARIES}
${PYTHON_LIBRARIES}
${WIN_PSAPI_LIBRARY}
)
@ -1641,7 +1634,6 @@ set(CLEAN_FILES
${LIBWIRESHARK_ASM_FILES}
${WMEM_FILES}
${WSLUA_FILES}
${WSPYTHON_FILES}
)
if (WERROR)
@ -1662,7 +1654,6 @@ add_library(epan ${LINK_MODE_LIB}
${FTYPE_FILES}
${WMEM_FILES}
${WSLUA_FILES}
${WSPYTHON_FILES}
${DISSECTOR_FILES}
${DISSECTOR_SUPPORT_SRC}
${LIBWIRESHARK_ASM_FILES}

View File

@ -33,21 +33,9 @@ wslua_dir =
wslua_dist_dir = wslua
endif # HAVE_LIBLUA
if HAVE_LIBPY
wspython_lib = wspython/libwspython.la
wspython_dir = wspython
wspython_dist_dir =
py_dissectors_dir = -DPYTHON_DIR=\"@pythondir@\"
else
wspython_lib =
wspython_dir =
wspython_dist_dir = wspython
py_dissectors_dir = -DPYTHONDIR=
endif
SUBDIRS = crypt ftypes dfilter dissectors wmem $(wslua_dir)
SUBDIRS = crypt ftypes dfilter dissectors wmem $(wslua_dir) $(wspython_dir)
DIST_SUBDIRS = $(SUBDIRS) $(wslua_dist_dir) $(wspython_dist_dir)
DIST_SUBDIRS = $(SUBDIRS) $(wslua_dist_dir)
ACLOCAL_AMFLAGS = `../aclocal-flags`
@ -138,7 +126,7 @@ libwireshark_la_LIBADD = \
libwireshark_asmopt.la crypt/libairpdcap.la \
ftypes/libftypes.la dfilter/libdfilter.la dissectors/libdissectors.la \
dissectors/libdirtydissectors.la dissectors/libfiledissectors.la \
wmem/libwmem.la $(wslua_lib) $(wspython_lib) @SOCKET_LIBS@ @NSL_LIBS@ \
wmem/libwmem.la $(wslua_lib) @SOCKET_LIBS@ @NSL_LIBS@ \
@C_ARES_LIBS@ @ADNS_LIBS@ @LIBGCRYPT_LIBS@ @LIBGNUTLS_LIBS@ \
@KRB5_LIBS@ @SSL_LIBS@ @LIBSMI_LDFLAGS@ @GEOIP_LIBS@ \
${top_builddir}/wiretap/libwiretap.la @GLIB_LIBS@ \
@ -148,7 +136,7 @@ libwireshark_la_DEPENDENCIES = \
libwireshark_generated.la \
libwireshark_asmopt.la crypt/libairpdcap.la \
ftypes/libftypes.la dfilter/libdfilter.la dissectors/libdissectors.la \
dissectors/libdirtydissectors.la wmem/libwmem.la $(wslua_lib) $(wspython_lib) \
dissectors/libdirtydissectors.la wmem/libwmem.la $(wslua_lib) \
${top_builddir}/wsutil/libwsutil.la \
${top_builddir}/wiretap/libwiretap.la

View File

@ -18,7 +18,7 @@ COMMON_CFLAGS=\
/I. /I.. /I../wiretap $(GLIB_CFLAGS) \
$(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) \
$(LUA_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
$(PYTHON_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS)
$(SMI_CFLAGS) $(GEOIP_CFLAGS)
#
# These are the flags for generated source files; we don't include
@ -52,14 +52,6 @@ WSLUA_LIB=
WSLUA_DIR=
!ENDIf
!IFDEF PYTHON_DIR
WSPYTHON_LIB=wspython\wspython.lib
WSPYTHON_DIR=wspython
!ELSE
WSPYTHON_LIB=
WSPYTHON_DIR=
!ENDIf
# For use when making libwireshark.dll
libwireshark_LIBS = \
$(GLIB_LIBS) \
@ -70,7 +62,6 @@ libwireshark_LIBS = \
$(ZLIB_LIBS) \
$(GNUTLS_LIBS) \
$(LUA_LIBS) \
$(PYTHON_LIBS) \
$(SMI_LIBS) \
$(GEOIP_LIBS) \
..\wsutil\libwsutil.lib \
@ -80,7 +71,6 @@ libwireshark_LIBS = \
dfilter\dfilter.lib \
wmem\wmem.lib \
$(WSLUA_LIB) \
$(WSPYTHON_LIB) \
dissectors\dissectors.lib
.c.obj::
@ -100,17 +90,17 @@ DOXYGEN_DEP=doxygen
!ENDIF
!IFDEF ENABLE_LIBWIRESHARK
all: crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.dll
all: crypt ftypes dfilter wmem $(WSLUA_DIR) dissectors libwireshark.dll
!ELSE
all: crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.lib
all: crypt ftypes dfilter wmem $(WSLUA_DIR) dissectors libwireshark.lib
!ENDIF
# For use when making libwireshark.dll
libwireshark.lib: libwireshark.dll
libwireshark.exp: libwireshark.dll
libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib dissectors\dissectors.lib $(WSLUA_LIB) $(WSPYTHON_LIB) ..\image\libwireshark.res
libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter wmem $(WSLUA_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib dissectors\dissectors.lib $(WSLUA_LIB) ..\image\libwireshark.res
@echo Linking libwireshark.dll
$(link) $(dlllflags) $(conlibsdll) shell32.lib psapi.lib \
$(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \
@ -120,8 +110,8 @@ libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter wmem
dissectors\register.obj \
$(EXTRA_OBJECTS)
libwireshark.lib : ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib $(WSLUA_LIB) $(WSPYTHON_LIB) dissectors\dissectors.lib
libwireshark.lib : ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter wmem $(WSLUA_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib $(WSLUA_LIB) dissectors\dissectors.lib
link /lib /out:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
$(EXTRA_OBJECTS)
@ -150,8 +140,6 @@ clean: clean-local
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
cd ../wslua
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
cd ../wspython
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
cd ..
#
@ -184,8 +172,6 @@ distclean: distclean-local
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
cd ../wslua
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
cd ../wspython
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
cd ..
maintainer-clean-local: distclean-local
@ -203,8 +189,6 @@ maintainer-clean: maintainer-clean-local
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
cd ../wslua
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
cd ../wspython
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
cd ..
crypt:: ..\config.h
@ -237,11 +221,6 @@ wslua:: ..\config.h
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
cd ..
wspython:: ..\config.h
cd wspython
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
cd ..
doxygen.cfg: ..\config.nmake doxygen.cfg.in
sed -e s/@VERSION@/$(VERSION)/ \
< doxygen.cfg.in > $@
@ -277,7 +256,6 @@ TVBTEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
$(GLIB_LIBS) \
..\wsutil\libwsutil.lib \
$(GNUTLS_LIBS) \
$(PYTHON_LIBS) \
!IFDEF ENABLE_LIBWIRESHARK
libwireshark.lib \
!ELSE
@ -306,7 +284,6 @@ OIDS_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
$(GLIB_LIBS) \
..\wsutil\libwsutil.lib \
$(GNUTLS_LIBS) \
$(PYTHON_LIBS) \
!IFDEF ENABLE_LIBWIRESHARK
libwireshark.lib \
!ELSE
@ -336,7 +313,6 @@ REASSEMBLE_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
$(GLIB_LIBS) \
..\wsutil\libwsutil.lib \
$(GNUTLS_LIBS) \
$(PYTHON_LIBS) \
!IFDEF ENABLE_LIBWIRESHARK
libwireshark.lib \
!ELSE

View File

@ -1,42 +0,0 @@
# CMakeLists.txt
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
set(WSPYTHON_FILES
wspython/wspy_register.c
wspython/wspy_proto.c
)
install(PROGRAMS
wspython/register-dissector.py
wspython/wspy_dissector.py
wspython/wspy_libws.py
DESTINATION
${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}/python/${CPACK_PACKAGE_VERSION}
)
install(DIRECTORY
wspython/wspy_dissectors
DESTINATION
${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}/python/${CPACK_PACKAGE_VERSION}
PATTERN ".svn" EXCLUDE
)

View File

@ -1,58 +0,0 @@
# Makefile.am
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
if HAVE_WARNINGS_AS_ERRORS
AM_CFLAGS = -Werror
endif
include Makefile.common
noinst_LTLIBRARIES = libwspython.la
CLEANFILES = \
libwspython.a \
libwspython.la \
*~
MAINTAINERCLEANFILES = \
Makefile.in
AM_CPPFLAGS = -I$(srcdir)/../.. -I$(srcdir)/..
libwspython_la_SOURCES = $(LIBWSPYTHON_SRC) $(LIBWSPYTHON_INCLUDES)
libwspython_la_LIBADD = @PY_LIBS@
libwspython_la_CFLAGS = @PY_CFLAGS@
wspythondir = @pythondir@
wspython_DATA = \
register-dissector.py \
wspy_dissector.py \
wspy_dissectors/homeplug.py.sample \
wspy_libws.py
EXTRA_DIST = \
Makefile.common \
Makefile.nmake \
$(wspython_DATA) \
CMakeLists.txt

View File

@ -1,30 +0,0 @@
# Makefile.common
# Contains the stuff from Makefile.am and Makefile.nmake that is
# a) common to both files and
# b) portable between both files
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
LIBWSPYTHON_SRC = \
wspy_register.c \
wspy_proto.c
LIBWSPYTHON_INCLUDES = \
wspy_register.h \
wspy_proto.h

View File

@ -1,29 +0,0 @@
#
include ..\..\config.nmake
include Makefile.common
############### no need to modify below this line #########
CFLAGS=$(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \
/I. /I.. /I../.. $(GLIB_CFLAGS) \
$(PYTHON_CFLAGS) -DWS_BUILD_DLL
.c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $<
LIBWSPYTHON_OBJECTS = $(LIBWSPYTHON_SRC:.c=.obj)
wspython.lib: $(LIBWSPYTHON_OBJECTS)
link /lib /out:wspython.lib $(LIBWSPYTHON_OBJECTS)
clean:
rm -f $(LIBWSPYTHON_OBJECTS) wspython.lib *.pdb *.sbr
distclean: clean
maintainer-clean: distclean
checkapi:
$(PERL) ../../tools/checkAPIs.pl -g termoutput -build \
$(LIBWSPYTHON_OBJECTS)

View File

@ -1,105 +0,0 @@
# register-dissector.py
#
# Wireshark Protocol Python Binding
#
# Copyright (c) 2009 by Sebastien Tandel <sebastien [AT] tandel [dot] be>
# Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import sys
import re
import os
import imp
#
# Build a list of files belonging to a directory and matching a regexp (f.e.
# '(?P<plugin>.*)\.py$' )
#
def get_plugin_list(dir, regexp):
lDir = os.listdir(dir)
lPlugins=[]
for sDir in lDir:
MatchedObject = re.match(regexp, sDir)
if (MatchedObject != None):
lPlugins.append(MatchedObject.group("plugin"))
return lPlugins
#Import the module "name"
def plugin_import(name):
#if the module was already loaded
try:
return sys.modules[name]
except KeyError:
pass
r = __import__(name)
return r
def register_dissectors(wspython_dir, plugins_pers_dir=None):
#append dir to be able to import py_lib
sys.path.append(wspython_dir)
from wspy_libws import get_libws_handle
libws = get_libws_handle()
dissectors_dirs = [
os.path.join(wspython_dir, 'wspy_dissectors'),
plugins_pers_dir
]
registered_protocols = []
for dissectors_dir in dissectors_dirs:
#Check if we have the dissectors directory
if not os.path.isdir(dissectors_dir):
continue
#append dir to be able to import python dissectors
sys.path.append(dissectors_dir)
#Read all python dissectors
dissectors = get_plugin_list(dissectors_dir, "(?P<plugin>.*)\.py$")
#For each dissector, register it and put it in the list of registered
#protocols
for dissector in dissectors:
try:
d = plugin_import(dissector)
registered_protocol = d.register_protocol()
if registered_protocol:
registered_protocols.append(registered_protocol)
except Exception as e:
print('register dissector %s exception %s' % (dissector, e))
return registered_protocols
if False:
import linecache
# Start tracing when import has finished
def tracer(frame, event, arg):
if event == "line":
lineno = frame.f_lineno
filename = frame.f_globals["__file__"]
if (filename.endswith(".pyc") or
filename.endswith(".pyo")):
filename = filename[:-1]
name = frame.f_globals["__name__"]
line = linecache.getline(filename, lineno)
print("%s:%s: %s" % (name, lineno, line.rstrip()))
if event == "exception":
print("exception", arg)
return tracer
sys.settrace(tracer)

View File

@ -1,458 +0,0 @@
# wspy_dissector.py
#
# Wireshark Protocol Python Binding
#
# Copyright (c) 2009 by Sebastien Tandel <sebastien [AT] tandel [dot] be>
# Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import ctypes as ct
from wspy_libws import get_libws_handle
# From epan/proto.h
# ? STA ? : is there a better way to include/define these constants?
# (duplicating definition is not a good thing)
(BASE_NONE,
BASE_DEC,
BASE_HEX,
BASE_OCT,
BASE_DEC_HEX,
BASE_HEX_DEC,
BASE_CUSTOM) = map(int, range(7))
# field types, see epan/ftypes/ftypes.h
(FT_NONE,
FT_PROTOCOL,
FT_BOOLEAN,
FT_UINT8,
FT_UINT16,
FT_UINT24,
FT_UINT32,
FT_UINT64,
FT_INT8,
FT_INT16,
FT_INT24,
FT_INT32,
FT_INT64,
FT_FLOAT,
FT_DOUBLE,
FT_ABSOLUTE_TIME,
FT_RELATIVE_TIME,
FT_STRING,
FT_STRINGZ,
FT_EBCDIC,
FT_UINT_STRING,
FT_ETHER,
FT_BYTES,
FT_UINT_BYTES,
FT_IPv4,
FT_IPv6,
FT_IPXNET,
FT_FRAMENUM,
FT_PCRE,
FT_GUID,
FT_OID,
FT_REL_OID) = map(int, range(32))
# hf_register_info from usual dissectors
class register_info(object):
def __init__(self, wsl):
self.__protocol = None
self.__wsl = wsl
self.__hf_register = None
self.__registers = []
def add(self, name, short_desc, \
type=FT_UINT32, display=BASE_DEC, \
strings=None, bitmask=0x0, desc=None):
if not desc:
desc = name
self.__registers.append( (name, short_desc, \
type, display, strings, bitmask, desc) )
def register(self, protocol):
self.__protocol = protocol
hf = self.__registers
lr = len(hf)
if not lr:
return None
self.__hf_register = self.__wsl.hf_register_info_create(lr)
chf = self.__hf_register
if not self.__hf_register:
return None
for i in range(lr):
n, sd, t, d, st, bm, ld = hf[i]
sdn = sd.replace('.', '_')
self.__dict__[sdn] = ct.c_int(-1)
p_id = ct.pointer(self.__dict__[sdn])
self.__wsl.hf_register_info_add(chf, i, p_id, n , sd, t, d, st, bm, ld)
self.__wsl.proto_register_field_array(self.__protocol, chf, lr)
def display(self):
self.__wsl.hf_register_info_print(self.__hf_register, \
len(self.__registers))
def get(self):
return self.__hf_register, len(self.__registers)
def __del__(self):
self.__wsl.hf_register_info_destroy(self.__hf_register)
#Subtrees definition
#Every subtree added can be accesses as an attribute after having been
#registered
class Subtree(object):
def __init__(self, wsl, protocol):
self.__wsl = wsl
self.__protocol = protocol
self.__st = {}
self.__user_defined_protocol_tree = False
def add(self, name):
if name == self.__protocol:
self.__user_defined_protocol_tree = True
self.__st[name] = ct.c_int(-1)
def has_user_defined_protocol_tree(self):
return self.__user_defined_protocol_tree
def register(self):
if not self.__user_defined_protocol_tree:
self.__st[self.__protocol] = ct.c_int(-1)
ls = len(self.__st)
if not ls:
return
CSubtrees = ct.POINTER(ct.c_int) * ls
p_sts = CSubtrees()
k = self.__st.keys()
for i in range(ls):
p_sts[i] = ct.pointer(self.__st[k[i]])
self.__wsl.proto_register_subtree_array(p_sts, ls)
def __getattr__(self, name):
if self.__st.has_key(name):
return self.__st[name]
#raise KeyError
#Dissector class : base class to write a dissector in python
class Dissector(object):
def __init__(self, protocol_name, short_desc, short):
self.__protocol_name = protocol_name
self.__short_desc = short_desc
self.__short = short
self.__tvb = None
self.__pinfo = None
self.__tree = None
self.__Tree = None
self.__offset = 0
self.__wsl = get_libws_handle()
self.__hf = None
self.__subtree = None
def _fields(self):
'''hf property : hf_register_info fields. every defined field is available
as an attribute of this object'''
if not self.__hf:
self.__hf = register_info(self.__wsl)
return self.__hf
hf = property(_fields)
def _subtrees(self):
'''subtrees property : subtress definition. every subtree added is
accessible as an attribute of this object'''
if not self.__subtree:
self.__subtree = Subtree(self.__wsl, self.__short)
return self.__subtree
subtrees = property(_subtrees)
def _tree(self):
'''tree property : initial tree at the start of the dissection'''
if not self.__Tree:
self.__Tree = Tree(self.__tree, self)
return self.__Tree
tree = property(_tree)
def display(self):
print(self.__short)
def _libhandle(self):
'''libhandle property : return a handle to the libwireshark lib. You don't
want to use this in normal situation. Use it only if you know what you're
doing.'''
return self.__wsl
libhandle = property(_libhandle)
def _raw_tree(self):
'''raw_tree property : returns the raw tree pointer. You can use this with
libhandle. You don't want to use this in normal situation. Use it only if
you know what you're doing.'''
return self.__tree
raw_tree = property(_raw_tree)
def _raw_pinfo(self):
'''raw_pinfo property : return the raw pinfo pointer. You can use this with
libhandle. You don't want to use this in normal situation. Use it only if
you know what you're doing.'''
return self.__pinfo
raw_pinfo = property(_raw_pinfo)
def _raw_tvb(self):
'''raw_tvb property : returns the raw tvb pointer. You can use this with
libhandle. You don't want to use this in normal situation. Use it only if
you know what you're doing.'''
return self.__tvb
raw_tvb = property(_raw_tvb)
def __str__(self):
# STA TODO : keep with short_desc because used in the hash table of
# dissectors in C code. If it is modified, it won't work anymore
return self.__short_desc
def __unicode__(self):
return self.__short
def __hash__(self):
return hash(self.__short)
def protocol(self):
return self.__protocol
def register_protocol(self):
'''private function called by libwireshark when registering all
protocols'''
self.__protocol = \
self.__wsl.proto_register_protocol( \
self.__protocol_name, self.__short_desc, \
self.__short)
self.__hf.register(self.__protocol)
#self.__hf.display()
self.subtrees.register()
def dissect(self):
'''point of entry when starting dissecting a packet. This method must be
therefore overloaded by the object implementing the dissector of a specific
protocol.'''
raise AttributeError('Dissector.dissect must be overridden')
def pre_dissect(self):
'''private method executed right before dissect in order to retrieve some
internal information and enabling the possibility to add the base tree of
this protocol dissection to the tree without any user intervention'''
self.__tvb = ct.c_void_p()
self.__pinfo = ct.c_void_p()
self.__tree = ct.c_void_p()
self.__wsl.py_dissector_args(ct.byref(self.__tvb), ct.byref(self.__pinfo), ct.byref(self.__tree))
# print self.__tvb, self.__pinfo, self.__tree
#self.__wsl.print_current_proto(ct.py_object(pinfo))
subt = self.subtrees
try:
if not subt.has_user_defined_protocol_tree():
p_tree = self.tree.add_item(self.protocol())
self.__Tree = p_tree.add_subtree(self.subtrees)
except:
print('pre_dissect error',e)
self.dissect()
def protocol_ids(self):
'''defined a list of tuples containing three values. Each tuple is defining
the parameters of dissector_add(). This function MUST be defined when
implementing the dissector of a specific protocol.'''
return [ (None, 0, None) ]
def find_dissector(self, protocol):
'''find_dissector : see proto.h'''
return self.__wsl.find_dissector(protocol)
def register_handoff(self):
'''private method used during the registration of protocol dissectors'''
#TODO STA : think how we would use dissector_add in an easy way *and* with
#the possibility to add the same dissector for TCP and UDP (extend
#py_generic_dissector)
private_handle = None
try:
ids = self.protocol_ids()
for type, protocol_id, handle in self.protocol_ids():
if not type:
continue
if not handle:
if not private_handle:
handle = self.__wsl.py_create_dissector_handle(self.__protocol)
else:
handle = private_handle
ct_type = ct.create_string_buffer(type)
ct_protocol_id = ct.c_uint(protocol_id)
self.__wsl.dissector_add_uint(ct_type, ct_protocol_id, handle)
except Exception as e:
print("creating dissector \"%s\" failed %s" % (self.__protocol_name, e))
raise
def advance(self, step):
'''method used to change the value of the offset'''
self.__offset += step
def _offset(self):
'''offset property : if is the current offset computed from the
dissection.'''
return self.__offset
offset = property(_offset)
#Tree class implementation
#see proto.h
class Tree(object):
def __init__(self, tree, dissector):
self.__dissector = dissector
self.__tree = ct.c_void_p(tree)
self.__wsl = dissector.libhandle
self.__tvb = dissector.raw_tvb
def _raw_tree(self):
return self.__tree
raw_tree = property(_raw_tree)
def add_item(self, field, offset=0, length=-1, little_endian=False, adv=True):
'''add an item to the tree'''
try:
tree = self.__wsl.proto_tree_add_item(self.__tree,
field, self.__tvb, self.__dissector.offset, length,
little_endian)
except Exception as e:
print(e)
else:
if length > 0 and adv:
self.__dissector.advance(length)
return Tree(tree, self.__dissector)
def add_uint(self, field, value, offset=0, length=4, adv=True):
'''add unsigned integer to the tree'''
try:
tree = self.__wsl.proto_tree_add_uint(self.__tree, field, self.__tvb, self.__dissector.offset, length, value)
except Exception as e:
print(e)
else:
if adv:
self.__dissector.advance(length)
return Tree(tree, self.__dissector)
def add_text(self, string, offset=0, length=-1, adv=True):
'''add text to the tree'''
try:
tree = self.__wsl.proto_tree_add_text(self.__tree, self.__tvb, self.__dissector.offset, length, string)
except Exception as e:
print(e)
else:
if length > 0 and adv:
self.__dissector.advance(length)
return Tree(tree, self.__dissector)
def add_subtree(self, subtree):
'''add a subtree to the tree'''
try:
tree = self.__wsl.proto_item_add_subtree(self.__tree, subtree)
except Exception as e:
print(e)
else:
return Tree(tree, self.__dissector)
#tvb class implementation
#see proto.h
class TVB(object):
def __init__(self, wsl, tvb, dissector):
self.__tvb = tvb
self.__wsl = wsl
self.__dissector = dissector
def length(self):
return self.__wsl.length(self.__wsl)
def length_remaining(self, offset=-1):
if offset < 0:
offset = self.__dissector.offset
return self.__wsl.tvb_length_remaining(self.__tvb, offset)
def reported_length(self):
return self.__wsl.tvb_reported_length(self.__tvb)
def reported_length_remaining(self, offset=-1):
if offset < 0:
offset = self.__dissector.offset
return self.__wsl.tvb_length_remaining(self.__tvb, offset)
def get_guint8(self, offset=-1):
if offset < 0:
offset = self.__dissector.offset
return self.__wsl.tvb_get_guint8(self.__tvb)
def get_ntohs(self, offset=-1):
if offset < 0:
offset = self.__dissector.offset
return self.__wsl.tvb_get_ntohs(self.__tvb, offset)
def get_ntohl(self, offset=-1):
if offset < 0:
offset = self.__dissector.offset
return self.__wsl.tvb_get_ntohl(self.__tvb, offset)
def get_letohl(self, offset=-1):
if offset < 0:
offset = self.__dissector.offset
return self.__wsl.tvb_get_letohl(self.__tvb, offset)
def get_letohs(self, offset=-1):
if offset < 0:
offset = self.__dissector.offset
return self.__wsl.tvb_get_letohs(self.__tvb, offset)
#STA TODO : check that we can do that
def get_ptr(self, offset=-1):
if offset < 0:
offset = self.__dissector.offset
return self.__wsl.tvb_get_ptr(self.__tvb, offset)
#how to get this working ??? check how application uses this!
#def new_subset(self, offset=0):
# return self.__wsl.tvb_get_new_subset(self.tvb, offset)
if False:
import linecache
import sys
# Start tracing when import has finished
def tracer(frame, event, arg):
if event == "line":
lineno = frame.f_lineno
filename = frame.f_globals["__file__"]
if (filename.endswith(".pyc") or
filename.endswith(".pyo")):
filename = filename[:-1]
name = frame.f_globals["__name__"]
line = linecache.getline(filename, lineno)
print("%s:%s: %s" % (name, lineno, line.rstrip()))
if event == "exception":
print("exception", arg)
return tracer
sys.settrace(tracer)

View File

@ -1,90 +0,0 @@
from wspy_dissector import Dissector
from wspy_dissector import FT_UINT8, FT_NONE
from wspy_dissector import BASE_NONE, BASE_HEX
class homeplug_py(Dissector):
# return the two first parameters of dissector_add as a tuple
def protocol_ids(self):
#you could use self.find_dissector() or self.create_dissector_handle() as
#defined in proto.h and pass the result in the third element of the tuple
#returned
return [ ("ethertype", 0x887B, None) ]
#Main default entry point of dissection
def dissect(self):
self.dissect_mctrl()
self.dissect_mehdr()
self.dissect_melen()
def dissect_mctrl(self):
self.subt = self.subtrees
self.c_tree = self.tree
try:
tree = self.c_tree.add_item(self.hf.homeplug_mctrl, length=1, adv=False)
mctrl_tree = tree.add_subtree(self.subt.mctrl)
mctrl_tree.add_item(self.hf.homeplug_mctrl_rsvd, length=1, adv=False)
mctrl_tree.add_item(self.hf.homeplug_mctrl_ne, length=1)
#item = self.libhandle.proto_tree_add_text(mctrl_tree.raw_tree, self.raw_tvb, 0, 1, "test") => example using libhandle
except Exception, e:
print e
def dissect_mehdr(self):
try:
tree = self.c_tree.add_item(self.hf.homeplug_mehdr, length=1, adv=False)
mehdr_tree = tree.add_subtree(self.subt.mehdr)
mehdr_tree.add_item(self.hf.homeplug_mehdr_mev, length=1, adv=False)
mehdr_tree.add_item(self.hf.homeplug_mehdr_metype, length=1)
except Exception, e:
print e
def dissect_melen(self):
try:
self.c_tree.add_item(self.hf.homeplug_melen, length=1)
except Exception, e:
print e
def dissect_mme(self):
try:
self.c_tree.add_item(self.hf.homeplug_mme, length=1)
except Exception, e:
print e
HOMEPLUG_MCTRL_RSVD = 0x80
HOMEPLUG_MCTRL_NE = 0x7F
HOMEPLUG_MEHDR_MEV = 0xE0
HOMEPLUG_MEHDR_METYPE = 0x1F
def register_protocol():
tp = homeplug_py("HomePlug protocol (python)", "HomePlug.py", "homeplug_py")
#
# Register Protocol Fields
#
hf = tp.hf
# MAC Control Field
hf.add("Mac Control Field", "homeplug_py.mctrl", FT_NONE, BASE_NONE)
hf.add("Reserved", "homeplug_py.mctrl.rsvd", FT_UINT8, bitmask=HOMEPLUG_MCTRL_RSVD)
hf.add("Number of MAC Data Entries", "homeplug_py.mctrl.ne", FT_UINT8, bitmask=HOMEPLUG_MCTRL_NE)
# MAC Entry Header
hf.add("MAC Management Entry Header", "homeplug_py.mehdr", FT_NONE, BASE_NONE)
hf.add("MAC Entry Version", "homeplug_py.mehdr.mev", FT_UINT8, bitmask=HOMEPLUG_MEHDR_MEV)
hf.add("MAC Entry Type", "homeplug_py.mehdr.metype", FT_UINT8, BASE_HEX, bitmask=HOMEPLUG_MEHDR_METYPE)
# MAC Entry Len
hf.add("MAC Management Entry Length", "homeplug_py.melen", FT_UINT8)
# MAC Management Entry
hf.add("MAC Management Entry Data", "homeplug_py.mmentry", FT_UINT8)
#
# Register Subtrees
#
subt = tp.subtrees
#subt.add("homeplug_py") => we let Dissector output the main tree of this protocol
subt.add("mctrl")
subt.add("mehdr")
return tp

View File

@ -1,53 +0,0 @@
# wspy_libws.py
#
# Wireshark Protocol Python Binding
#
# Copyright (c) 2009 by Sebastien Tandel <sebastien [AT] tandel [dot] be>
# Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from ctypes import cdll, c_char_p, c_void_p, c_int, c_uint, POINTER
import platform
__libwireshark = None
# XXX - We should probably return a full path here, at least on Windows.
def get_libws_libname():
system = platform.system()
if system == "Darwin":
return 'libwireshark.dylib'
elif system == "Windows":
return 'libwireshark.dll'
else:
return 'libwireshark.so'
def get_libws_handle():
global __libwireshark
try:
if not __libwireshark:
libname = get_libws_libname()
__libwireshark = cdll.LoadLibrary(libname)
__libwireshark.py_create_dissector_handle.restype = c_void_p
__libwireshark.py_create_dissector_handle.argtypes = [c_int]
__libwireshark.py_dissector_args.argtypes = [POINTER(c_void_p),POINTER(c_void_p),POINTER(c_void_p)]
__libwireshark.dissector_add_uint.argtypes = [c_char_p, c_uint, c_void_p]
__libwireshark.proto_tree_add_item.argtypes = [c_void_p, c_int, c_void_p, c_int, c_int, c_int]
return __libwireshark
except Exception as e:
print(e)
return None

View File

@ -1,87 +0,0 @@
/* wspy_proto.c
*
* Wireshark Protocol Python Binding
*
* Copyright (c) 2009 by Sebastien Tandel <sebastien [AT] tandel [dot] be>
* Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#ifdef HAVE_PYTHON
#include <Python.h>
#include <glib.h>
#include <stdio.h>
#include "proto.h"
hf_register_info *hf_register_info_create(const guint8 size)
{
hf_register_info *hf = g_malloc0(sizeof(hf_register_info) * size);
/**STA TODO :
* if (!hf_register_info)
* raise exception
*/
return hf;
}
void hf_register_info_destroy(hf_register_info *hf)
{
if (hf) {
g_free(hf);
}
}
void hf_register_info_add(hf_register_info *hf, guint8 index,
int *p_id, const char *name, const char *abbrev,
enum ftenum type, int display, const void *strings,
guint32 bitmask, const char *blurb)
{
hf[index].p_id = p_id;
hf[index].hfinfo.name = name;
hf[index].hfinfo.abbrev = abbrev;
hf[index].hfinfo.type = type;
hf[index].hfinfo.display = display;
hf[index].hfinfo.strings = strings;
hf[index].hfinfo.bitmask = bitmask;
hf[index].hfinfo.blurb = blurb;
hf[index].hfinfo.id = 0;
hf[index].hfinfo.parent = 0;
hf[index].hfinfo.ref_type = HF_REF_TYPE_NONE;
hf[index].hfinfo.same_name_next = NULL;
hf[index].hfinfo.same_name_prev_id = -1;
}
void hf_register_info_print(hf_register_info *hf, guint8 size)
{
guint8 c;
if (!hf)
return;
for (c = 0; c < size; c++) {
printf("%s : %s : %s\n", hf[c].hfinfo.name,
hf[c].hfinfo.abbrev,
hf[c].hfinfo.blurb);
}
}
#endif /* HAVE_PYTHON */

View File

@ -1,42 +0,0 @@
/* wspy_proto.h
*
* Wireshark Protocol Python Binding
*
* Copyright (c) 2009 by Sebastien Tandel <sebastien [AT] tandel [dot] be>
* Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __WS_PY_PROTO_H__
#define __WS_PY_PROTO_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef HAVE_PYTHON
hf_register_info *hf_register_info_create(const guint8 size);
void hf_register_info_destroy(hf_register_info *hf);
void hf_register_info_add(hf_register_info *hf, guint8 index,
int *p_id, const char *name, const char *abbrev,
enum ftenum type, int display, const void *strings,
guint32 bitmask, const char *blurb);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __WS_PY_PROTO_H__ */

View File

@ -1,230 +0,0 @@
/* wspy_register.c
*
* Wireshark Protocol Python Binding
*
* Copyright (c) 2009 by Sebastien Tandel <sebastien [AT] tandel [dot] be>
* Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#ifdef HAVE_PYTHON
#include <Python.h>
#include <glib.h>
#include <stdio.h>
#include "epan.h"
#include "proto.h"
#include "packet.h"
#include "tvbuff.h"
#include "filesystem.h"
#include "wspy_register.h"
/* hash table containing all the registered python dissectors */
GHashTable * g_py_dissectors=NULL;
/**
* Global objects that python method dissect() will get. Avoid to write a
* function for each proto_tree*.
* Is it the only way to do that? I can't believe it ... think about it
*/
tvbuff_t * g_tvb = NULL;
packet_info * g_pinfo = NULL;
proto_tree * g_tree = NULL;
/* Initialization of the Python Interpreter */
static inline
void wspy_init(void)
{
Py_Initialize();
}
/* Finalization of the Python Interpreter */
static inline
void wspy_finalize(void)
{
Py_Finalize();
}
/*const char * py_dissector_short_desc(PyObject * py_dissector)
{
}*/
/**
* Returns the __str__ of the python object
*/
char * py_dissector_name(PyObject * py_dissector)
{
PyObject * py_object_name;
assert(py_dissector);
py_object_name = PyObject_Str(py_dissector);
#if PY_MAJOR_VERSION == 2
return PyString_AS_STRING(py_object_name);
#else
return PyUnicode_AsString(py_object_name);
#endif
}
/**
* Register the dissector
*/
void py_dissector_register(PyObject * py_dissector)
{
/**
* Register protocol, fields, subtrees
*
* Done by calling register method of the object
*/
PyObject_CallMethod(py_dissector, "register_protocol", NULL);
}
static const char *get_py_register_file(void)
{
static const char * wspython_register_file = NULL;
if (!wspython_register_file) {
#ifdef _WIN32
wspython_register_file = g_strdup_printf("%s\\register-dissector.py", get_wspython_dir());
#else
wspython_register_file = g_strdup_printf("%s/register-dissector.py", get_wspython_dir());
#endif /* _WIN32 */
}
return wspython_register_file;
}
/**
* Finds out all the python dissectors and register them
*/
void register_all_py_protocols_func(void)
{
FILE * py_reg;
PyObject * global_dict, * main_module, * register_fn;
PyObject * py_dissectors, * py_dissector;
PyObject * py_args;
Py_ssize_t index;
char * name;
/* intialize the hash table where all the python dissectors are kept */
g_py_dissectors = g_hash_table_new(g_str_hash, g_str_equal);
/* STA TODO : init only if prefs is enabled */
wspy_init();
/* load the python register module */
py_reg = fopen(get_py_register_file(), "r");
if (py_reg == NULL) {
printf("Can't open Python registration file: %s\n", get_py_register_file());
return;
}
PyRun_SimpleFile(py_reg, get_py_register_file());
/* Getting the global symbols from the python register module */
main_module = PyImport_AddModule("__main__");
global_dict = PyModule_GetDict(main_module);
/* Get the python register function */
register_fn = PyDict_GetItemString(global_dict, "register_dissectors");
if (register_fn == NULL) {
printf("Error in Python registration file: %s\n", get_py_register_file());
return;
}
/* Execute the python register function */
/* This function returns a sequence of python dissectors objects */
py_args = Py_BuildValue("ss", get_wspython_dir(), get_plugins_pers_dir());
py_dissectors = PyObject_CallObject(register_fn, py_args);
/* Check that the py_dissectors is really a sequence */
if (!py_dissectors || !PySequence_Check(py_dissectors)) {
printf("Python dissectors not registered ...\n");
return;
}
/**
* For each dissector, register it in cb and registers all fields, subtrees,
* protocol name, etc ...
*/
for (index = 0; (py_dissector = PySequence_GetItem(py_dissectors, index)); index++)
{
name = py_dissector_name(py_dissector);
py_dissector_register(py_dissector);
g_hash_table_insert(g_py_dissectors, (gpointer*)name, py_dissector);
}
}
void py_dissector_args(tvbuff_t ** tvb, packet_info ** pinfo, proto_tree ** tree)
{
*tvb = g_tvb;
*pinfo = g_pinfo;
*tree = g_tree;
}
/*
* Generic Python Dissector
*
* Search the correct PyObject dissector based on
* pinfo->current_proto in the hash table py_dissectors.
*
* We then call the method "dissect" of this PyObject.
*/
void py_dissect(tvbuff_t * tvb, packet_info * pinfo,
proto_tree * tree)
{
PyObject * py_dissector;
/* printf("pinfo->current_proto : %s\n", pinfo->current_proto); */
/* NOTE => pinfo->current_proto == "HomePlug" */
g_tree = tree;
g_pinfo = pinfo;
g_tvb = tvb;
py_dissector = g_hash_table_lookup(g_py_dissectors, pinfo->current_proto);
assert(py_dissector);
PyObject_CallMethod(py_dissector, "pre_dissect", NULL);
}
dissector_handle_t py_create_dissector_handle(const int proto)
{
return create_dissector_handle(&py_dissect, proto);
}
static void register_all_py_handoffs_foreach(gpointer key _U_, gpointer value, gpointer user_data _U_)
{
PyObject * py_dissector = (PyObject *)value;
PyObject_CallMethod(py_dissector, "register_handoff", NULL);
}
/**
* Finalize the registration of the python protocol dissectors
*/
void
register_all_py_handoffs_func(void)
{
g_hash_table_foreach(g_py_dissectors, register_all_py_handoffs_foreach, NULL);
}
#endif /* HAVE_PYTHON */

View File

@ -1,43 +0,0 @@
/* wspy_register.h
*
* Wireshark Protocol Python Binding
*
* Copyright (c) 2009 by Sebastien Tandel <sebastien [AT] tandel [dot] be>
* Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __WS_PY_REGISTER_H__
#define __WS_PY_REGISTER_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef HAVE_PYTHON
void register_all_py_protocols_func(void);
void register_all_py_handoffs_func(void);
WS_DLL_PUBLIC
dissector_handle_t py_create_dissector_handle(const int proto);
WS_DLL_PUBLIC
void py_dissector_args(tvbuff_t ** tvb, packet_info ** pinfo, proto_tree ** tree);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __WS_PY_REGISTER_H__ */