diff options
-rw-r--r-- | config.nmake | 19 | ||||
-rw-r--r-- | epan/libethereal.def | 5 | ||||
-rw-r--r-- | packaging/nsis/Makefile.nmake | 6 | ||||
-rw-r--r-- | packaging/nsis/ethereal.nsi | 11 | ||||
-rw-r--r-- | plugins/Makefile.nmake | 17 | ||||
-rw-r--r-- | plugins/lua/Makefile.nmake | 41 | ||||
-rw-r--r-- | plugins/lua/lua_tvb.c | 22 | ||||
-rw-r--r-- | plugins/lua/plugin.c | 4 |
8 files changed, 111 insertions, 14 deletions
diff --git a/config.nmake b/config.nmake index a540034ee7..2ba6f91d74 100644 --- a/config.nmake +++ b/config.nmake @@ -157,6 +157,15 @@ PCRE_DIR=$(ETHEREAL_LIBS)\pcre-6.4 # NETTLE_DIR=$(ETHEREAL_LIBS)\nettle-1.10 # +# If you have the LUA library, set this to the pathname +# of the directory in which the LUA package has been extracted. +# +# If you don't have LUA, comment this line out, so that LUA_DIR +# isn't defined. +# +# LUA_DIR=$(ETHEREAL_LIBS)\lua-5.0.2 + +# # Set ICONV_DIR to the pathname of the directory in which the # ICONV include files and library resides. # @@ -419,6 +428,16 @@ GNUTLS_LIBS= GNUTLS_CONFIG= !ENDIF +!IFDEF LUA_DIR +LUA_CFLAGS=/I$(LUA_DIR)\include +LUA_LIBS=$(LUA_DIR)\bin\LibLua.lib $(LUA_DIR)\bin\LibLuaLib.lib +# Nmake uses carets to escape special characters +LUA_CONFIG=^#define HAVE_LUA 1 +!else +LUA_CFLAGS= +LUA_LIBS= +LUA_CONFIG= +!ENDIF # Construct the path PATH=$(PATH);$(CYGWIN_PATH);$(DLL_PATH);$(ZLIB_PATH);$(ADNS_PATH) diff --git a/epan/libethereal.def b/epan/libethereal.def index 16baf7403b..13ab7d26d2 100644 --- a/epan/libethereal.def +++ b/epan/libethereal.def @@ -326,6 +326,8 @@ get_dissector_table_ui_name get_ether_name get_hostname get_hostname6 +get_host_ipaddr +get_host_ipaddr6 get_manuf_name_if_known get_persconffile_path get_plugins_global_dir @@ -387,6 +389,7 @@ nstime_to_sec nt_cmd_vals DATA num_tap_filters DATA num_tree_types DATA +offset_from_real_beginning plugin_list DATA postseq_cleanup_all_protocols prefs DATA @@ -524,6 +527,7 @@ register_all_protocols register_all_protocol_handoffs register_dissector register_dissector_table +register_final_registration_routine register_giop_user register_giop_user_module register_heur_dissector_list @@ -536,6 +540,7 @@ register_tap_listener RegistrationRejectReason_vals DATA ReleaseCompleteReason_vals DATA relinquish_special_privs_perm +rel_time_to_str remove_tap_listener report_failure report_open_failure diff --git a/packaging/nsis/Makefile.nmake b/packaging/nsis/Makefile.nmake index a400e75f80..355bd2ef15 100644 --- a/packaging/nsis/Makefile.nmake +++ b/packaging/nsis/Makefile.nmake @@ -76,6 +76,9 @@ PLUGINS=../../plugins/acn/acn.dll \ ../../plugins/gryphon/gryphon.dll \ ../../plugins/h223/h223.dll \ ../../plugins/irda/irda.dll \ +!IFDEF LUA_DIR + ../../plugins/lua/lua.dll \ +!ENDIF ../../plugins/lwres/lwres.dll \ ../../plugins/mate/mate.dll \ ../../plugins/megaco/megaco.dll \ @@ -144,6 +147,9 @@ $(DEST)-setup-$(VERSION).exe : $(NSI) $(DELIVERABLES) Makefile.nmake !IF "$(ZLIB_DIR)" != "" /DZLIB_DIR=$(ZLIB_DIR) \ !ENDIF +!IFDEF LUA_DIR + /DLUA_DIR=$(LUA_DIR) \ +!ENDIF ethereal.nsi clean: diff --git a/packaging/nsis/ethereal.nsi b/packaging/nsis/ethereal.nsi index 2d9d82db53..cf3717df30 100644 --- a/packaging/nsis/ethereal.nsi +++ b/packaging/nsis/ethereal.nsi @@ -719,6 +719,14 @@ SetOutPath $INSTDIR\plugins\${VERSION} File "..\..\plugins\mate\mate.dll" SectionEnd +!ifdef LUA_DIR +Section "LUA Plugin" SecLua +;------------------------------------------- +SetOutPath $INSTDIR\plugins\${VERSION} +File "..\..\plugins\lua\lua.dll" +SectionEnd +!endif + Section "SNMP MIBs" SecMIBs ;------------------------------------------- !ifdef GTK1_DIR & GTK2_DIR @@ -984,6 +992,9 @@ SectionEnd !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Plugins with some extended dissections." !insertmacro MUI_DESCRIPTION_TEXT ${SecStatsTree} "Plugin for some extended statistics." !insertmacro MUI_DESCRIPTION_TEXT ${SecMate} "Plugin - Meta Analysis and Tracing Engine (Experimental)." +!ifdef LUA_DIR + !insertmacro MUI_DESCRIPTION_TEXT ${SecLua} "Plugin - LUA (Experimental)." +!endif !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection." !insertmacro MUI_DESCRIPTION_TEXT ${SecToolsGroup} "Additional command line based tools." !insertmacro MUI_DESCRIPTION_TEXT ${SecEditCap} "Editcap is a program that reads a capture file and writes some or all of the packets into another capture file." diff --git a/plugins/Makefile.nmake b/plugins/Makefile.nmake index d3fdeedfe1..c3cb1cc06b 100644 --- a/plugins/Makefile.nmake +++ b/plugins/Makefile.nmake @@ -18,6 +18,7 @@ all: \ gryphon \ h223 \ irda \ + lua\ lwres \ mate \ megaco \ @@ -88,6 +89,13 @@ irda:: $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake cd .. +lua:: +!IFDEF LUA_DIR + cd lua + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake + cd .. +!ENDIF + lwres:: cd lwres $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake @@ -176,6 +184,8 @@ clean: $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../irda $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean + cd ../lua + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../lwres $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../mate @@ -227,6 +237,8 @@ distclean: clean $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../irda $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean + cd ../lua + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../lwres $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../mate @@ -278,6 +290,8 @@ maintainer-clean: distclean $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean cd ../irda $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean + cd ../lua + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean cd ../lwres $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean cd ../mate @@ -324,6 +338,9 @@ install-plugins: xcopy gryphon\*.dll $(VERSION) /d xcopy h223\*.dll $(VERSION) /d xcopy irda\*.dll $(VERSION) /d +!IFDEF LUA_DIR + xcopy lua\*.dll $(VERSION) /d +!ENDIF xcopy lwres\*.dll $(VERSION) /d xcopy mate\*.dll $(VERSION) /d xcopy megaco\*.dll $(VERSION) /d diff --git a/plugins/lua/Makefile.nmake b/plugins/lua/Makefile.nmake new file mode 100644 index 0000000000..bf74bf0264 --- /dev/null +++ b/plugins/lua/Makefile.nmake @@ -0,0 +1,41 @@ +# +# $Id$ +# + +include ..\..\config.nmake + +############### no need to modify below this line ######### + +CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) $(LUA_CFLAGS)\ + /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) + +LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) + +!IFDEF LUA_DIR +!IFDEF ENABLE_LIBETHEREAL +LINK_PLUGIN_WITH=..\..\epan\libethereal.lib +CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) + +OBJECTS= \ + lua_tvb.obj \ + lua_proto.obj \ + lua_tree.obj \ + lua_pinfo.obj \ + lua_tap.obj \ + lua_gui.obj \ + packet-lua.obj \ + plugin.obj + +lua.dll lua.exp lua.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:lua.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ + $(GLIB_LIBS) $(LUA_LIBS) + +!ENDIF +!ENDIF + +clean: + rm -f $(OBJECTS) lua.dll lua.exp lua.lib *.pdb + +distclean: clean + +maintainer-clean: distclean diff --git a/plugins/lua/lua_tvb.c b/plugins/lua/lua_tvb.c index 7d3abb60c1..5b86af79e2 100644 --- a/plugins/lua/lua_tvb.c +++ b/plugins/lua/lua_tvb.c @@ -34,20 +34,20 @@ LUA_CLASS_DEFINE(ByteArray,BYTE_ARRAY,if (! *p) luaL_argerror(L,index,"null byte static int ByteArray_new(lua_State* L) { GByteArray* ba = g_byte_array_new(); + const gchar* s; + /* XXX: slow! */ + int nibble[2]; + int i = 0; + gchar c; if (lua_gettop(L) == 1) { - const gchar* s = luaL_checkstring(L,1); + s = luaL_checkstring(L,1); if (!s) { luaL_argerror(L,1,"not a string"); return 0; } - /* XXX: slow! */ - int nibble[2]; - int i = 0; - gchar c; - for (; (c = *s); s++) { switch(c) { case '0': case '1': case '2': case '3': case '4': case '5' : case '6' : case '7': case '8' : case '9' : @@ -282,6 +282,9 @@ int ByteArray_register(lua_State* L) { static int Tvb_new_real (lua_State *L) { ByteArray ba = checkByteArray(L,1); + const gchar* name = luaL_optstring(L,2,"Unnamed") ; + guint8* data; + Tvb tvb; if (!ba) return 0; @@ -294,14 +297,12 @@ static int Tvb_new_real (lua_State *L) { return 0; } - const gchar* name = luaL_optstring(L,2,"Unnamed") ; - guint8* data; if (! ba) return 0; data = g_memdup(ba->data, ba->len); - Tvb tvb = tvb_new_real_data(data, ba->len,ba->len); + tvb = tvb_new_real_data(data, ba->len,ba->len); tvb_set_free_cb(tvb, g_free); add_new_data_source(lua_pinfo, tvb, name); @@ -334,11 +335,12 @@ static int Tvb_new_subset (lua_State *L) { static int Tvb_tostring(lua_State* L) { Tvb tvb = checkTvb(L,1); int len; + gchar* str; if (!tvb) return 0; len = tvb_length(tvb); - gchar* str = ep_strdup_printf("TVB(%i) : %s",len,tvb_bytes_to_str(tvb,0,len)); + str = ep_strdup_printf("TVB(%i) : %s",len,tvb_bytes_to_str(tvb,0,len)); lua_pushstring(L,str); return 1; } diff --git a/plugins/lua/plugin.c b/plugins/lua/plugin.c index 5d9c55e075..9e449d1fb9 100644 --- a/plugins/lua/plugin.c +++ b/plugins/lua/plugin.c @@ -50,7 +50,6 @@ #endif void proto_register_lua(void); -void proto_reg_handoff_lua(void); static gboolean initialized = FALSE; @@ -67,8 +66,5 @@ G_MODULE_EXPORT void plugin_reg_handoff(void) proto_register_lua(); initialized = 1; } - - proto_reg_handoff_lua(); - } #endif |