Add test suite for verifying Lua global variables/tables of previous releases have not disappeared.

Several bugs have been introduced due to changing of perl scripts or #define names, such
that things exported into Lua have dissapeared or changed unintentionally. This commit
adds a test suite which compares the Lua global table with the ones from previous
releases (1.8 and 1.10), to verify nothing has gone missing. New items can be added, but
old ones cannot go away. The added script to verify these things, called 'verify_globals.lua',
also has the ability to display what's new - i.e., what was not in the olrder releases.

Lastly, this commit also fixes a bug: MENU_STAT_ENDPOINT became MENU_STAT_ENDPOINT_LIST
due to a change in the make-init-lua.pl perl script in this 1.11 release.

Change-Id: Iba143d1a436e706970635a5f8cc2b317955392bf
Reviewed-on: https://code.wireshark.org/review/284
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
Hadriel Kaplan 2014-02-17 11:45:57 -05:00 committed by Evan Huus
parent fe64c4671b
commit 696353c129
9 changed files with 2317 additions and 1 deletions

View File

@ -152,7 +152,7 @@ while(<STAT_MENU>) {
# need to skip matching words in comments, and get to the enum
if (/^typedef enum {/) { $foundit = 1; }
# the problem here is we need to pick carefully, so we don't break existing scripts
if ($foundit && /REGISTER_([A-Z]+)_GROUP_(CONVERSATION|RESPONSE|[A-Z_]+)/) {
if ($foundit && /REGISTER_([A-Z]+)_GROUP_(CONVERSATION|RESPONSE|ENDPOINT|[A-Z_]+)/) {
$menu_groups .= "MENU_$1_$2 = $menu_i\n";
$menu_groups =~ s/_NONE//;
$menu_i++;

View File

@ -708,6 +708,7 @@ WSLUA_METAMETHOD Columns__newindex(lua_State *L) {
}
WSLUA_METAMETHOD Columns__index(lua_State *L) {
/* Gets a specific Column */
Columns cols = checkColumns(L,1);
const struct col_names_t* cn;
const char* colname = luaL_checkstring(L,2);
@ -778,6 +779,7 @@ WSLUA_CLASS_DEFINE(PrivateTable,FAIL_ON_NULL_OR_EXPIRED("PrivateTable"),NOP);
/* PrivateTable represents the pinfo->private_table. */
WSLUA_METAMETHOD PrivateTable__tostring(lua_State* L) {
/* Gets debugging type information about the private table */
PrivateTable priv = toPrivateTable(L,1);
GString *key_string;
GList *keys, *key;

View File

@ -47,6 +47,7 @@ extern "C" {
* REGISTER_ANALYZE_GROUP_CONVERSATION
* REGISTER_STAT_GROUP_CONVERSATION
* REGISTER_STAT_GROUP_RESPONSE
* REGISTER_STAT_GROUP_ENDPOINT
* In other words, because there is a REGISTER_STAT_GROUP_RESPONSE_TIME, you cannot
* add a REGISTER_STAT_GROUP_RESPONSE nor a REGISTER_STAT_GROUP_RESPONSE_FOOBAR
* because they use the same "REGISTER_STAT_GROUP_RESPONSE" prefix.

BIN
test/captures/empty.pcap Normal file

Binary file not shown.

827
test/lua/globals_1.10.txt Normal file
View File

@ -0,0 +1,827 @@
-- Wireshark version: 1.10.6
{
["Address"] = {
["__typeof"] = "Address",
["ip"] = '<function 1>',
["ipv4"] = '<function 1>',
['<metatable>'] = {
["__eq"] = '<function 2>',
["__gc"] = '<function 3>',
["__index"] = '<table 2>',
["__le"] = '<function 4>',
["__lt"] = '<function 5>',
["__tostring"] = '<function 6>'
}
},
["ByteArray"] = {
["__typeof"] = "ByteArray",
["append"] = '<function 7>',
["get_index"] = '<function 8>',
["len"] = '<function 9>',
["new"] = '<function 10>',
["prepend"] = '<function 11>',
["set_index"] = '<function 12>',
["set_size"] = '<function 13>',
["subset"] = '<function 14>',
["tvb"] = '<function 15>',
['<metatable>'] = {
["__call"] = '<function 14>',
["__concat"] = '<function 16>',
["__gc"] = '<function 17>',
["__index"] = '<table 3>',
["__tostring"] = '<function 18>'
}
},
["Column"] = {
["__typeof"] = "Column",
["append"] = '<function 19>',
["clear"] = '<function 20>',
["fence"] = '<function 21>',
["prepend"] = '<function 22>',
["preppend"] = '<function 22>',
["set"] = '<function 23>',
['<metatable>'] = {
["__gc"] = '<function 24>',
["__index"] = '<table 4>',
["__tostring"] = '<function 25>'
}
},
["DATA_DIR"] = '<filtered>',
["DESEGMENT_ONE_MORE_SEGMENT"] = 268435455,
["Dir"] = {
["__typeof"] = "Dir",
["close"] = '<function 26>',
["open"] = '<function 27>',
['<metatable>'] = {
["__call"] = '<function 28>',
["__gc"] = '<function 29>',
["__index"] = '<table 5>'
}
},
["Dissector"] = {
["__typeof"] = "Dissector",
["call"] = '<function 30>',
["get"] = '<function 31>',
['<metatable>'] = {
["__gc"] = '<function 32>',
["__index"] = '<table 6>',
["__tostring"] = '<function 33>'
}
},
["DissectorTable"] = {
["__typeof"] = "DissectorTable",
["add"] = '<function 34>',
["get"] = '<function 35>',
["get_dissector"] = '<function 36>',
["new"] = '<function 37>',
["remove"] = '<function 38>',
["try"] = '<function 39>',
['<metatable>'] = {
["__gc"] = '<function 40>',
["__index"] = '<table 7>',
["__tostring"] = '<function 41>'
}
},
["Dumper"] = {
["__typeof"] = "Dumper",
["close"] = '<function 42>',
["dump"] = '<function 43>',
["dump_current"] = '<function 44>',
["flush"] = '<function 45>',
["new"] = '<function 46>',
["new_for_current"] = '<function 47>',
['<metatable>'] = {
["__gc"] = '<function 48>',
["__index"] = '<table 8>'
}
},
["ENC_ASCII"] = 0,
["ENC_BIG_ENDIAN"] = 0,
["ENC_CHARENCODING_MASK"] = 2147483646,
["ENC_EBCDIC"] = 8,
["ENC_LITTLE_ENDIAN"] = 2147483648,
["ENC_NA"] = 0,
["ENC_TIME_NTP"] = 2,
["ENC_TIME_TIMESPEC"] = 0,
["ENC_UCS_2"] = 6,
["ENC_UTF_16"] = 4,
["ENC_UTF_8"] = 2,
["Field"] = {
["__typeof"] = "Field",
["new"] = '<function 49>',
['<metatable>'] = {
["__call"] = '<function 50>',
["__gc"] = '<function 51>',
["__index"] = '<table 9>',
["__tostring"] = '<function 52>'
}
},
["GUI_ENABLED"] = false,
["H225_ALERTING"] = 3,
["H225_CALL_PROCEDING"] = 1,
["H225_CONNECT"] = 2,
["H225_CS"] = 1,
["H225_EMPTY"] = 8,
["H225_FACILITY"] = 6,
["H225_INFORMATION"] = 4,
["H225_NOTIFY"] = 12,
["H225_OTHER"] = 13,
["H225_OTHERS"] = 2,
["H225_PROGRESS"] = 7,
["H225_RAS"] = 0,
["H225_RELEASE_COMPLET"] = 5,
["H225_SETUP"] = 0,
["H225_SETUP_ACK"] = 11,
["H225_STATUS"] = 9,
["H225_STATUS_INQUIRY"] = 10,
["Int64"] = {
["__typeof"] = "Int64",
['<metatable>'] = {
["__concat"] = '<function 53>',
["__gc"] = '<function 54>',
["__index"] = '<table 10>',
["__tostring"] = '<function 55>'
}
},
["Listener"] = {
["__typeof"] = "Listener",
["new"] = '<function 56>',
["remove"] = '<function 57>',
['<metatable>'] = {
["__gc"] = '<function 58>',
["__index"] = '<table 11>',
["__newindex"] = '<function 59>',
["__tostring"] = '<function 60>'
}
},
["MENU_ANALYZE_CONVERSATION"] = 1,
["MENU_ANALYZE_UNSORTED"] = 0,
["MENU_STAT_CONVERSATION"] = 4,
["MENU_STAT_ENDPOINT"] = 5,
["MENU_STAT_GENERIC"] = 3,
["MENU_STAT_RESPONSE"] = 6,
["MENU_STAT_TELEPHONY"] = 7,
["MENU_STAT_UNSORTED"] = 2,
["MENU_TOOLS_UNSORTED"] = 8,
["NSTime"] = '<function 61>',
["PI_CHAT"] = 2097152,
["PI_CHECKSUM"] = 16777216,
["PI_COMMENT"] = 1048576,
["PI_COMMENTS_GROUP"] = 184549376,
["PI_DEBUG"] = 134217728,
["PI_ERROR"] = 8388608,
["PI_GROUP_MASK"] = 4278190080,
["PI_MALFORMED"] = 117440512,
["PI_NOTE"] = 4194304,
["PI_PROTOCOL"] = 150994944,
["PI_REASSEMBLE"] = 100663296,
["PI_REQUEST_CODE"] = 67108864,
["PI_RESPONSE_CODE"] = 50331648,
["PI_SECURITY"] = 167772160,
["PI_SEQUENCE"] = 33554432,
["PI_SEVERITY_MASK"] = 15728640,
["PI_UNDECODED"] = 83886080,
["PI_WARN"] = 6291456,
["Pref"] = {
["__typeof"] = "Pref",
["bool"] = '<function 62>',
["enum"] = '<function 63>',
["range"] = '<function 64>',
["statictext"] = '<function 65>',
["string"] = '<function 66>',
["uint"] = '<function 67>',
['<metatable>'] = {
["__gc"] = '<function 68>',
["__index"] = '<table 12>'
}
},
["ProgDlg"] = {
["__typeof"] = "ProgDlg",
["close"] = '<function 69>',
["new"] = '<function 70>',
["stopped"] = '<function 71>',
["update"] = '<function 72>',
['<metatable>'] = {
["__gc"] = '<function 73>',
["__index"] = '<table 13>',
["__tostring"] = '<function 74>'
}
},
["Proto"] = '<function 75>',
["ProtoField"] = {
["__typeof"] = "ProtoField",
["absolute_time"] = '<function 76>',
["bool"] = '<function 77>',
["bytes"] = '<function 78>',
["double"] = '<function 79>',
["ether"] = '<function 80>',
["float"] = '<function 81>',
["framenum"] = '<function 82>',
["guid"] = '<function 83>',
["int16"] = '<function 84>',
["int24"] = '<function 85>',
["int32"] = '<function 86>',
["int64"] = '<function 87>',
["int8"] = '<function 88>',
["ipv4"] = '<function 89>',
["ipv6"] = '<function 90>',
["ipx"] = '<function 91>',
["new"] = '<function 92>',
["oid"] = '<function 93>',
["relative_time"] = '<function 94>',
["string"] = '<function 95>',
["stringz"] = '<function 96>',
["ubytes"] = '<function 97>',
["uint16"] = '<function 98>',
["uint24"] = '<function 99>',
["uint32"] = '<function 100>',
["uint64"] = '<function 101>',
["uint8"] = '<function 102>',
['<metatable>'] = {
["__gc"] = '<function 103>',
["__index"] = '<table 14>',
["__tostring"] = '<function 104>'
}
},
["PseudoHeader"] = {
["__typeof"] = "PseudoHeader",
["atm"] = '<function 105>',
["eth"] = '<function 106>',
["mtp2"] = '<function 107>',
["none"] = '<function 108>',
['<metatable>'] = {
["__gc"] = '<function 109>',
["__index"] = '<table 15>'
}
},
["TextWindow"] = {
["__typeof"] = "TextWindow",
["add_button"] = '<function 110>',
["append"] = '<function 111>',
["clear"] = '<function 112>',
["get_text"] = '<function 113>',
["new"] = '<function 114>',
["prepend"] = '<function 115>',
["set"] = '<function 116>',
["set_atclose"] = '<function 117>',
["set_editable"] = '<function 118>',
['<metatable>'] = {
["__gc"] = '<function 119>',
["__index"] = '<table 16>',
["__tostring"] = '<function 113>'
}
},
["TreeItem"] = {
["__typeof"] = "TreeItem",
["add"] = '<function 120>',
["add_expert_info"] = '<function 121>',
["add_le"] = '<function 122>',
["add_packet_field"] = '<function 123>',
["append_text"] = '<function 124>',
["set_expert_flags"] = '<function 125>',
["set_generated"] = '<function 126>',
["set_hidden"] = '<function 127>',
["set_len"] = '<function 128>',
["set_text"] = '<function 129>',
['<metatable>'] = {
["__gc"] = '<function 130>',
["__index"] = '<table 17>'
}
},
["Tvb"] = {
["__typeof"] = "Tvb",
["len"] = '<function 131>',
["offset"] = '<function 132>',
["range"] = '<function 133>',
["reported_len"] = '<function 134>',
["reported_length_remaining"] = '<function 135>',
['<metatable>'] = {
["__call"] = '<function 133>',
["__gc"] = '<function 136>',
["__index"] = '<table 18>',
["__tostring"] = '<function 137>'
}
},
["TvbRange"] = {
["__typeof"] = "TvbRange",
["bitfield"] = '<function 138>',
["bytes"] = '<function 139>',
["ether"] = '<function 140>',
["float"] = '<function 141>',
["int"] = '<function 142>',
["int64"] = '<function 143>',
["ipv4"] = '<function 144>',
["le_float"] = '<function 145>',
["le_int"] = '<function 146>',
["le_int64"] = '<function 147>',
["le_ipv4"] = '<function 148>',
["le_nstime"] = '<function 149>',
["le_uint"] = '<function 150>',
["le_uint64"] = '<function 151>',
["le_ustring"] = '<function 152>',
["le_ustringz"] = '<function 153>',
["len"] = '<function 154>',
["nstime"] = '<function 155>',
["offset"] = '<function 156>',
["range"] = '<function 157>',
["string"] = '<function 158>',
["stringz"] = '<function 159>',
["tvb"] = '<function 160>',
["uint"] = '<function 161>',
["uint64"] = '<function 162>',
["uncompress"] = '<function 163>',
["ustring"] = '<function 164>',
["ustringz"] = '<function 165>',
['<metatable>'] = {
["__call"] = '<function 157>',
["__concat"] = '<function 53>',
["__gc"] = '<function 166>',
["__index"] = '<table 19>',
["__tostring"] = '<function 167>'
}
},
["UInt64"] = {
["__typeof"] = "UInt64",
['<metatable>'] = {
["__concat"] = '<function 53>',
["__gc"] = '<function 168>',
["__index"] = '<table 20>',
["__tostring"] = '<function 169>'
}
},
["USER_DIR"] = '<filtered>',
["_G"] = '<table 1>',
["_VERSION"] = '<filtered>',
["all_field_infos"] = '<function 170>',
["apply_filter"] = '<function 171>',
["assert"] = '<function 172>',
["base"] = {
["DEC"] = 1,
["DEC_HEX"] = 4,
["HEX"] = 2,
["HEX_DEC"] = 5,
["NONE"] = 0,
["OCT"] = 3
},
["bit32"] = {
["arshift"] = '<function 173>',
["band"] = '<function 174>',
["bnot"] = '<function 175>',
["bor"] = '<function 176>',
["btest"] = '<function 177>',
["bxor"] = '<function 178>',
["extract"] = '<function 179>',
["lrotate"] = '<function 180>',
["lshift"] = '<function 181>',
["replace"] = '<function 182>',
["rrotate"] = '<function 183>',
["rshift"] = '<function 184>'
},
["browser_open_data_file"] = '<function 185>',
["browser_open_url"] = '<function 186>',
["collectgarbage"] = '<function 187>',
["copy_to_clipboard"] = '<function 188>',
["coroutine"] = {
["create"] = '<function 189>',
["resume"] = '<function 190>',
["running"] = '<function 191>',
["status"] = '<function 192>',
["wrap"] = '<function 193>',
["yield"] = '<function 194>'
},
["critical"] = '<function 195>',
["datafile_path"] = '<function 196>',
["debug"] = '<function 197>',
["disable_lua"] = false,
["dofile"] = '<function 198>',
["error"] = '<function 199>',
["format_date"] = '<function 200>',
["format_time"] = '<function 201>',
["ftypes"] = {
["ABSOLUTE_TIME"] = 15,
["AX25"] = 31,
["BOOLEAN"] = 2,
["BYTES"] = 21,
["DOUBLE"] = 14,
["ETHER"] = 20,
["EUI64"] = 30,
["FLOAT"] = 13,
["FRAMENUM"] = 26,
["GUID"] = 28,
["INT16"] = 9,
["INT24"] = 10,
["INT32"] = 11,
["INT64"] = 12,
["INT8"] = 8,
["IPXNET"] = 25,
["IPv4"] = 23,
["IPv6"] = 24,
["NONE"] = 0,
["OID"] = 29,
["PCRE"] = 27,
["PROTOCOL"] = 1,
["RELATIVE_TIME"] = 16,
["STRING"] = 17,
["STRINGZ"] = 18,
["UINT16"] = 4,
["UINT24"] = 5,
["UINT32"] = 6,
["UINT64"] = 7,
["UINT8"] = 3,
["UINT_BYTES"] = 22,
["UINT_STRING"] = 19
},
["get_filter"] = '<function 202>',
["get_version"] = '<function 203>',
["getmetatable"] = '<function 204>',
["gui_enabled"] = '<function 205>',
["h225_cs_type"] = {
[1] = "H225_CALL_PROCEDING",
[2] = "H225_CONNECT",
[3] = "H225_ALERTING",
[4] = "H225_INFORMATION",
[5] = "H225_RELEASE_COMPLET",
[6] = "H225_FACILITY",
[7] = "H225_PROGRESS",
[8] = "H225_EMPTY",
[9] = "H225_STATUS",
[10] = "H225_STATUS_INQUIRY",
[11] = "H225_SETUP_ACK",
[12] = "H225_NOTIFY",
[13] = "H225_OTHER",
[0] = "H225_SETUP"
},
["h225_msg_type"] = {
[1] = "H225_CS",
[2] = "H225_OTHERS",
[0] = "H225_RAS"
},
["info"] = '<function 206>',
["init_routines"] = {},
["io"] = {
["close"] = '<function 207>',
["flush"] = '<function 208>',
["input"] = '<function 209>',
["lines"] = '<function 210>',
["open"] = '<function 211>',
["output"] = '<function 212>',
["popen"] = '<function 213>',
["read"] = '<function 214>',
["stderr"] = '<userdata 1>',
["stdin"] = '<userdata 2>',
["stdout"] = '<userdata 3>',
["tmpfile"] = '<function 215>',
["type"] = '<function 216>',
["write"] = '<function 217>'
},
["ipairs"] = '<function 218>',
["load"] = '<function 219>',
["loadfile"] = '<function 220>',
["loadstring"] = '<function 219>',
["math"] = {
["abs"] = '<function 221>',
["acos"] = '<function 222>',
["asin"] = '<function 223>',
["atan"] = '<function 224>',
["atan2"] = '<function 225>',
["ceil"] = '<function 226>',
["cos"] = '<function 227>',
["cosh"] = '<function 228>',
["deg"] = '<function 229>',
["exp"] = '<function 230>',
["floor"] = '<function 231>',
["fmod"] = '<function 232>',
["frexp"] = '<function 233>',
["huge"] = '<number inf>',
["ldexp"] = '<function 234>',
["log"] = '<function 235>',
["log10"] = '<function 236>',
["max"] = '<function 237>',
["min"] = '<function 238>',
["modf"] = '<function 239>',
["pi"] = 3.1415926535898,
["pow"] = '<function 240>',
["rad"] = '<function 241>',
["random"] = '<function 242>',
["randomseed"] = '<function 243>',
["sin"] = '<function 244>',
["sinh"] = '<function 245>',
["sqrt"] = '<function 246>',
["tan"] = '<function 247>',
["tanh"] = '<function 248>'
},
["message"] = '<function 249>',
["module"] = '<function 250>',
["new_dialog"] = '<function 251>',
["next"] = '<function 252>',
["open_capture_file"] = '<function 253>',
["os"] = {
["clock"] = '<function 254>',
["date"] = '<function 255>',
["difftime"] = '<function 256>',
["execute"] = '<function 257>',
["exit"] = '<function 258>',
["getenv"] = '<function 259>',
["remove"] = '<function 260>',
["rename"] = '<function 261>',
["setlocale"] = '<function 262>',
["time"] = '<function 263>',
["tmpname"] = '<function 264>'
},
["package"] = {
["config"] = '<filtered>',
["cpath"] = '<filtered>',
["loaded"] = '<filtered>',
["loaders"] = {
[1] = '<function 265>',
[2] = '<function 266>',
[3] = '<function 267>',
[4] = '<function 268>' },
["loadlib"] = '<function 269>',
["path"] = '<filtered>',
["preload"] = {},
["searchers"] = '<table 27>',
["searchpath"] = '<function 270>',
["seeall"] = '<function 271>'
},
["pairs"] = '<function 272>',
["pcall"] = '<function 273>',
["persconffile_path"] = '<function 274>',
["print"] = '<function 275>',
["rawequal"] = '<function 276>',
["rawget"] = '<function 277>',
["rawlen"] = '<function 278>',
["rawset"] = '<function 279>',
["register_menu"] = '<function 280>',
["register_postdissector"] = '<function 281>',
["register_stat_cmd_arg"] = '<function 282>',
["reload"] = '<function 283>',
["report_failure"] = '<function 284>',
["require"] = '<function 285>',
["retap_packets"] = '<function 286>',
["run_user_scripts_when_superuser"] = '<filtered>',
["running_superuser"] = '<filtered>',
["select"] = '<function 287>',
["set_color_filter_slot"] = '<function 288>',
["set_filter"] = '<function 289>',
["setmetatable"] = '<function 290>',
["string"] = {
["byte"] = '<function 291>',
["char"] = '<function 292>',
["dump"] = '<function 293>',
["find"] = '<function 294>',
["format"] = '<function 295>',
["gmatch"] = '<function 296>',
["gsub"] = '<function 297>',
["len"] = '<function 298>',
["lower"] = '<function 299>',
["match"] = '<function 300>',
["rep"] = '<function 301>',
["reverse"] = '<function 302>',
["sub"] = '<function 303>',
["upper"] = '<function 304>'
},
["table"] = {
["concat"] = '<function 305>',
["insert"] = '<function 306>',
["maxn"] = '<function 307>',
["pack"] = '<function 308>',
["remove"] = '<function 309>',
["sort"] = '<function 310>',
["unpack"] = '<function 311>'
},
["tonumber"] = '<function 312>',
["tostring"] = '<function 313>',
["type"] = '<function 314>',
["typeof"] = '<function 315>',
["unpack"] = '<function 311>',
["warn"] = '<function 316>',
["wtap"] = {
["APPLE_IP_OVER_IEEE1394"] = 62,
["ARCNET"] = 8,
["ARCNET_LINUX"] = 9,
["ASCEND"] = 16,
["ATM_PDUS"] = 13,
["ATM_PDUS_UNTRUNCATED"] = 14,
["ATM_RFC1483"] = 10,
["AX25"] = 149,
["AX25_KISS"] = 148,
["BACNET_MS_TP"] = 63,
["BACNET_MS_TP_WITH_PHDR"] = 143,
["BER"] = 90,
["BLUETOOTH_H4"] = 41,
["BLUETOOTH_H4_WITH_PHDR"] = 99,
["BLUETOOTH_HCI"] = 102,
["CAN20B"] = 109,
["CATAPULT_DCT2000"] = 89,
["CHDLC"] = 28,
["CHDLC_WITH_PHDR"] = 40,
["CISCO_IOS"] = 29,
["COSINE"] = 34,
["DBUS"] = 147,
["DOCSIS"] = 33,
["DPNSS"] = 117,
["DVBCI"] = 132,
["ENC"] = 38,
["ERF"] = 98,
["ETHERNET"] = 1,
["FDDI"] = 5,
["FDDI_BITSWAPPED"] = 6,
["FIBRE_CHANNEL_FC2"] = 121,
["FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS"] = 122,
["FLEXRAY"] = 106,
["FRELAY"] = 26,
["FRELAY_WITH_PHDR"] = 27,
["GCOM_SERIAL"] = 78,
["GCOM_TIE1"] = 77,
["GPRS_LLC"] = 66,
["GSM_UM"] = 116,
["HHDLC"] = 32,
["I2C"] = 112,
["IEEE802_15_4"] = 104,
["IEEE802_15_4_NOFCS"] = 127,
["IEEE802_15_4_NONASK_PHY"] = 113,
["IEEE802_16_MAC_CPS"] = 93,
["IEEE_802_11"] = 20,
["IEEE_802_11_AIROPEEK"] = 145,
["IEEE_802_11_AVS"] = 24,
["IEEE_802_11_NETMON"] = 126,
["IEEE_802_11_PRISM"] = 21,
["IEEE_802_11_RADIOTAP"] = 23,
["IEEE_802_11_WITH_RADIO"] = 22,
["INFINIBAND"] = 151,
["IPMB"] = 103,
["IPNET"] = 124,
["IP_OVER_FC"] = 18,
["IP_OVER_IB"] = 137,
["IRDA"] = 44,
["ISDN"] = 17,
["IXVERIWAVE"] = 144,
["JPEG_JFIF"] = 123,
["JUNIPER_ATM1"] = 67,
["JUNIPER_ATM2"] = 68,
["JUNIPER_CHDLC"] = 86,
["JUNIPER_ETHER"] = 83,
["JUNIPER_FRELAY"] = 85,
["JUNIPER_GGSN"] = 87,
["JUNIPER_MLFR"] = 82,
["JUNIPER_MLPPP"] = 81,
["JUNIPER_PPP"] = 84,
["JUNIPER_PPPOE"] = 76,
["JUNIPER_SVCS"] = 152,
["JUNIPER_VP"] = 91,
["K12"] = 80,
["LAPB"] = 12,
["LAPD"] = 131,
["LAYER1_EVENT"] = 110,
["LIN"] = 107,
["LINUX_ATM_CLIP"] = 11,
["LINUX_LAPD"] = 88,
["LOCALTALK"] = 30,
["MIME"] = 134,
["MOST"] = 108,
["MPEG"] = 96,
["MPEG_2_TS"] = 138,
["MTP2"] = 42,
["MTP2_WITH_PHDR"] = 75,
["MTP3"] = 43,
["MUX27010"] = 133,
["NETANALYZER"] = 135,
["NETANALYZER_TRANSPARENT"] = 136,
["NETTL_ETHERNET"] = 71,
["NETTL_FDDI"] = 73,
["NETTL_RAW_ICMP"] = 64,
["NETTL_RAW_ICMPV6"] = 65,
["NETTL_RAW_IP"] = 70,
["NETTL_RAW_TELNET"] = 94,
["NETTL_TOKEN_RING"] = 72,
["NETTL_UNKNOWN"] = 74,
["NETTL_X25"] = 79,
["NFC_LLCP"] = 140,
["NFLOG"] = 141,
["NSTRACE_1_0"] = 119,
["NSTRACE_2_0"] = 120,
["NULL"] = 15,
["OLD_PFLOG"] = 31,
["PACKETLOGGER"] = 118,
["PFLOG"] = 39,
["PPI"] = 97,
["PPP"] = 4,
["PPP_ETHER"] = 139,
["PPP_WITH_PHDR"] = 19,
["RAW_IP"] = 7,
["RAW_IP4"] = 129,
["RAW_IP6"] = 130,
["RAW_IPFIX"] = 128,
["REDBACK"] = 69,
["SCCP"] = 101,
["SCTP"] = 150,
["SDH"] = 146,
["SDLC"] = 36,
["SITA"] = 100,
["SLIP"] = 3,
["SLL"] = 25,
["SOCKETCAN"] = 125,
["SYMANTEC"] = 61,
["TNEF"] = 114,
["TOKEN_RING"] = 2,
["TZSP"] = 37,
["UNKNOWN"] = 0,
["USB"] = 92,
["USBPCAP"] = 153,
["USB_LINUX"] = 95,
["USB_LINUX_MMAPPED"] = 115,
["USER0"] = 45,
["USER1"] = 46,
["USER10"] = 55,
["USER11"] = 56,
["USER12"] = 57,
["USER13"] = 58,
["USER14"] = 59,
["USER15"] = 60,
["USER2"] = 47,
["USER3"] = 48,
["USER4"] = 49,
["USER5"] = 50,
["USER6"] = 51,
["USER7"] = 52,
["USER8"] = 53,
["USER9"] = 54,
["V5_EF"] = 142,
["WFLEET_HDLC"] = 35,
["X2E_SERIAL"] = 111,
["X2E_XORAYA"] = 105
},
["wtap_encaps"] = '<table 30>',
["wtap_filetypes"] = {
["5VIEWS"] = 9,
["AETHRA"] = 60,
["ASCEND"] = 26,
["BER"] = 12,
["BTSNOOP"] = 50,
["CAMINS"] = 64,
["CATAPULT_DCT2000"] = 14,
["COMMVIEW"] = 49,
["COSINE"] = 17,
["CSIDS"] = 18,
["DAINTREE_SNA"] = 54,
["DBS_ETHERWATCH"] = 19,
["DCT3TRACE"] = 52,
["ERF"] = 20,
["EYESDN"] = 21,
["HCIDUMP"] = 13,
["I4BTRACE"] = 25,
["IPFIX"] = 58,
["IPTRACE_1_0"] = 10,
["IPTRACE_2_0"] = 11,
["ISERIES"] = 23,
["ISERIES_UNICODE"] = 24,
["JPEG_JFIF"] = 57,
["K12"] = 40,
["K12TEXT"] = 47,
["LANALYZER"] = 34,
["MIME"] = 59,
["MPEG"] = 46,
["MPEG_2_TS"] = 61,
["NETSCALER_1_0"] = 55,
["NETSCALER_2_0"] = 56,
["NETSCREEN"] = 48,
["NETTL"] = 22,
["NETWORK_INSTRUMENTS"] = 33,
["NETXRAY_1_0"] = 16,
["NETXRAY_1_1"] = 31,
["NETXRAY_OLD"] = 15,
["NGSNIFFER_COMPRESSED"] = 30,
["NGSNIFFER_UNCOMPRESSED"] = 29,
["PACKETLOGGER"] = 53,
["PCAP"] = 1,
["PCAPNG"] = 2,
["PCAP_AIX"] = 4,
["PCAP_NOKIA"] = 6,
["PCAP_NSEC"] = 3,
["PCAP_SS990417"] = 7,
["PCAP_SS990915"] = 8,
["PCAP_SS991029"] = 5,
["PEEKCLASSIC_V56"] = 43,
["PEEKCLASSIC_V7"] = 44,
["PEEKTAGGED"] = 45,
["PPPDUMP"] = 35,
["RADCOM"] = 36,
["SHOMITI"] = 38,
["SNOOP"] = 37,
["TNEF"] = 51,
["TOSHIBA"] = 41,
["TSPREC_CSEC"] = 2,
["TSPREC_DSEC"] = 1,
["TSPREC_MSEC"] = 3,
["TSPREC_NSEC"] = 9,
["TSPREC_SEC"] = 0,
["TSPREC_USEC"] = 6,
["UNKNOWN"] = 0,
["VISUAL_NETWORKS"] = 42,
["VMS"] = 39,
["VWR_80211"] = 62,
["VWR_ETH"] = 63
},
["xpcall"] = '<function 317>'
}

625
test/lua/globals_1.8.txt Normal file
View File

@ -0,0 +1,625 @@
-- Wireshark version: 1.8.12
{
["Address"] = {
["ip"] = '<function 1>',
["ipv4"] = '<function 2>'
},
["ByteArray"] = {
["append"] = '<function 3>',
["get_index"] = '<function 4>',
["len"] = '<function 5>',
["new"] = '<function 6>',
["prepend"] = '<function 7>',
["set_index"] = '<function 8>',
["set_size"] = '<function 9>',
["subset"] = '<function 10>',
["tvb"] = '<function 11>'
},
["Column"] = {
["append"] = '<function 12>',
["clear"] = '<function 13>',
["prepend"] = '<function 14>',
["preppend"] = '<function 15>',
["set"] = '<function 16>'
},
["DATA_DIR"] = '<filtered>',
["DESEGMENT_ONE_MORE_SEGMENT"] = 268435455,
["Dir"] = {
["close"] = '<function 17>',
["open"] = '<function 18>'
},
["Dissector"] = {
["call"] = '<function 19>',
["get"] = '<function 20>'
},
["DissectorTable"] = {
["add"] = '<function 21>',
["get"] = '<function 22>',
["get_dissector"] = '<function 23>',
["new"] = '<function 24>',
["remove"] = '<function 25>',
["try"] = '<function 26>'
},
["Dumper"] = {
["close"] = '<function 27>',
["dump"] = '<function 28>',
["dump_current"] = '<function 29>',
["flush"] = '<function 30>',
["new"] = '<function 31>',
["new_for_current"] = '<function 32>'
},
["ENC_ASCII"] = 0,
["ENC_BIG_ENDIAN"] = 0,
["ENC_CHARENCODING_MASK"] = 2147483646,
["ENC_EBCDIC"] = 8,
["ENC_LITTLE_ENDIAN"] = 2147483648,
["ENC_NA"] = 0,
["ENC_TIME_NTP"] = 2,
["ENC_TIME_TIMESPEC"] = 0,
["ENC_UCS_2"] = 6,
["ENC_UTF_16"] = 4,
["ENC_UTF_8"] = 2,
["Field"] = {
["new"] = '<function 33>'
},
["GUI_ENABLED"] = false,
["H225_ALERTING"] = 3,
["H225_CALL_PROCEDING"] = 1,
["H225_CONNECT"] = 2,
["H225_CS"] = 1,
["H225_EMPTY"] = 8,
["H225_FACILITY"] = 6,
["H225_INFORMATION"] = 4,
["H225_NOTIFY"] = 12,
["H225_OTHER"] = 13,
["H225_OTHERS"] = 2,
["H225_PROGRESS"] = 7,
["H225_RAS"] = 0,
["H225_RELEASE_COMPLET"] = 5,
["H225_SETUP"] = 0,
["H225_SETUP_ACK"] = 11,
["H225_STATUS"] = 9,
["H225_STATUS_INQUIRY"] = 10,
["Int64"] = {},
["Listener"] = {
["new"] = '<function 34>',
["remove"] = '<function 35>'
},
["MENU_ANALYZE_CONVERSATION"] = 1,
["MENU_ANALYZE_UNSORTED"] = 0,
["MENU_STAT_CONVERSATION"] = 4,
["MENU_STAT_ENDPOINT"] = 5,
["MENU_STAT_GENERIC"] = 3,
["MENU_STAT_RESPONSE"] = 6,
["MENU_STAT_TELEPHONY"] = 7,
["MENU_STAT_UNSORTED"] = 2,
["MENU_TOOLS_UNSORTED"] = 8,
["NSTime"] = '<function 36>',
["PI_CHAT"] = 2097152,
["PI_CHECKSUM"] = 16777216,
["PI_COMMENT"] = 1048576,
["PI_COMMENTS_GROUP"] = 184549376,
["PI_DEBUG"] = 134217728,
["PI_ERROR"] = 8388608,
["PI_GROUP_MASK"] = 4278190080,
["PI_MALFORMED"] = 117440512,
["PI_NOTE"] = 4194304,
["PI_PROTOCOL"] = 150994944,
["PI_REASSEMBLE"] = 100663296,
["PI_REQUEST_CODE"] = 67108864,
["PI_RESPONSE_CODE"] = 50331648,
["PI_SECURITY"] = 167772160,
["PI_SEQUENCE"] = 33554432,
["PI_SEVERITY_MASK"] = 15728640,
["PI_UNDECODED"] = 83886080,
["PI_WARN"] = 6291456,
["Pref"] = {
["bool"] = '<function 37>',
["enum"] = '<function 38>',
["range"] = '<function 39>',
["statictext"] = '<function 40>',
["string"] = '<function 41>',
["uint"] = '<function 42>'
},
["ProgDlg"] = {
["close"] = '<function 43>',
["new"] = '<function 44>',
["stopped"] = '<function 45>',
["update"] = '<function 46>'
},
["Proto"] = '<function 47>',
["ProtoField"] = {
["absolute_time"] = '<function 48>',
["bool"] = '<function 49>',
["bytes"] = '<function 50>',
["double"] = '<function 51>',
["ether"] = '<function 52>',
["float"] = '<function 53>',
["framenum"] = '<function 54>',
["guid"] = '<function 55>',
["int16"] = '<function 56>',
["int24"] = '<function 57>',
["int32"] = '<function 58>',
["int64"] = '<function 59>',
["int8"] = '<function 60>',
["ipv4"] = '<function 61>',
["ipv6"] = '<function 62>',
["ipx"] = '<function 63>',
["new"] = '<function 64>',
["oid"] = '<function 65>',
["relative_time"] = '<function 66>',
["string"] = '<function 67>',
["stringz"] = '<function 68>',
["ubytes"] = '<function 69>',
["uint16"] = '<function 70>',
["uint24"] = '<function 71>',
["uint32"] = '<function 72>',
["uint64"] = '<function 73>',
["uint8"] = '<function 74>'
},
["PseudoHeader"] = {
["atm"] = '<function 75>',
["eth"] = '<function 76>',
["mtp2"] = '<function 77>',
["none"] = '<function 78>'
},
["TextWindow"] = {
["add_button"] = '<function 79>',
["append"] = '<function 80>',
["clear"] = '<function 81>',
["get_text"] = '<function 82>',
["new"] = '<function 83>',
["prepend"] = '<function 84>',
["set"] = '<function 85>',
["set_atclose"] = '<function 86>',
["set_editable"] = '<function 87>'
},
["TreeItem"] = {
["add"] = '<function 88>',
["add_expert_info"] = '<function 89>',
["add_le"] = '<function 90>',
["add_packet_field"] = '<function 91>',
["append_text"] = '<function 92>',
["set_expert_flags"] = '<function 93>',
["set_generated"] = '<function 94>',
["set_hidden"] = '<function 95>',
["set_len"] = '<function 96>',
["set_text"] = '<function 97>'
},
["Tvb"] = {
["len"] = '<function 98>',
["offset"] = '<function 99>',
["range"] = '<function 100>',
["reported_len"] = '<function 101>',
["reported_length_remaining"] = '<function 102>'
},
["TvbRange"] = {
["bitfield"] = '<function 103>',
["bytes"] = '<function 104>',
["ether"] = '<function 105>',
["float"] = '<function 106>',
["int"] = '<function 107>',
["int64"] = '<function 108>',
["ipv4"] = '<function 109>',
["le_float"] = '<function 110>',
["le_int"] = '<function 111>',
["le_int64"] = '<function 112>',
["le_ipv4"] = '<function 113>',
["le_nstime"] = '<function 114>',
["le_uint"] = '<function 115>',
["le_uint64"] = '<function 116>',
["le_ustring"] = '<function 117>',
["le_ustringz"] = '<function 118>',
["len"] = '<function 119>',
["nstime"] = '<function 120>',
["offset"] = '<function 121>',
["range"] = '<function 122>',
["string"] = '<function 123>',
["stringz"] = '<function 124>',
["tvb"] = '<function 125>',
["uint"] = '<function 126>',
["uint64"] = '<function 127>',
["ustring"] = '<function 128>',
["ustringz"] = '<function 129>'
},
["UInt64"] = {},
["USER_DIR"] = '<filtered>',
["_G"] = '<table 1>',
["_VERSION"] = '<filtered>',
["all_field_infos"] = '<function 130>',
["apply_filter"] = '<function 131>',
["assert"] = '<function 132>',
["base"] = {
["DEC"] = 1,
["DEC_HEX"] = 4,
["HEX"] = 2,
["HEX_DEC"] = 5,
["NONE"] = 0,
["OCT"] = 3
},
["bit"] = {
["arshift"] = '<function 133>',
["band"] = '<function 134>',
["bnot"] = '<function 135>',
["bor"] = '<function 136>',
["bswap"] = '<function 137>',
["bxor"] = '<function 138>',
["lshift"] = '<function 139>',
["rol"] = '<function 140>',
["ror"] = '<function 141>',
["rshift"] = '<function 142>',
["tobit"] = '<function 143>',
["tohex"] = '<function 144>'
},
["browser_open_data_file"] = '<function 145>',
["browser_open_url"] = '<function 146>',
["collectgarbage"] = '<function 147>',
["copy_to_clipboard"] = '<function 148>',
["coroutine"] = {
["create"] = '<function 149>',
["resume"] = '<function 150>',
["running"] = '<function 151>',
["status"] = '<function 152>',
["wrap"] = '<function 153>',
["yield"] = '<function 154>'
},
["critical"] = '<function 155>',
["datafile_path"] = '<function 156>',
["debug"] = '<function 157>',
["disable_lua"] = false,
["dofile"] = '<function 158>',
["error"] = '<function 159>',
["format_date"] = '<function 160>',
["format_time"] = '<function 161>',
["ftypes"] = {
["ABSOLUTE_TIME"] = 15,
["BOOLEAN"] = 2,
["BYTES"] = 21,
["DOUBLE"] = 14,
["ETHER"] = 20,
["EUI64"] = 30,
["FLOAT"] = 13,
["FRAMENUM"] = 26,
["GUID"] = 28,
["INT16"] = 9,
["INT24"] = 10,
["INT32"] = 11,
["INT64"] = 12,
["INT8"] = 8,
["IPXNET"] = 25,
["IPv4"] = 23,
["IPv6"] = 24,
["NONE"] = 0,
["OID"] = 29,
["PCRE"] = 27,
["PROTOCOL"] = 1,
["RELATIVE_TIME"] = 16,
["STRING"] = 17,
["STRINGZ"] = 18,
["UINT16"] = 4,
["UINT24"] = 5,
["UINT32"] = 6,
["UINT64"] = 7,
["UINT8"] = 3,
["UINT_BYTES"] = 22,
["UINT_STRING"] = 19
},
["gcinfo"] = '<function 162>',
["get_version"] = '<function 163>',
["getfenv"] = '<function 164>',
["getmetatable"] = '<function 165>',
["gui_enabled"] = '<function 166>',
["h225_cs_type"] = {
[1] = "H225_CALL_PROCEDING",
[2] = "H225_CONNECT",
[3] = "H225_ALERTING",
[4] = "H225_INFORMATION",
[5] = "H225_RELEASE_COMPLET",
[6] = "H225_FACILITY",
[7] = "H225_PROGRESS",
[8] = "H225_EMPTY",
[9] = "H225_STATUS",
[10] = "H225_STATUS_INQUIRY",
[11] = "H225_SETUP_ACK",
[12] = "H225_NOTIFY",
[13] = "H225_OTHER",
[0] = "H225_SETUP"
},
["h225_msg_type"] = {
[1] = "H225_CS",
[2] = "H225_OTHERS",
[0] = "H225_RAS"
},
["info"] = '<function 167>',
["init_routines"] = {},
["io"] = {
["close"] = '<function 168>',
["flush"] = '<function 169>',
["input"] = '<function 170>',
["lines"] = '<function 171>',
["open"] = '<function 172>',
["output"] = '<function 173>',
["popen"] = '<function 174>',
["read"] = '<function 175>',
["stderr"] = '<userdata 1>',
["stdin"] = '<userdata 2>',
["stdout"] = '<userdata 3>',
["tmpfile"] = '<function 176>',
["type"] = '<function 177>',
["write"] = '<function 178>'
},
["ipairs"] = '<function 179>',
["load"] = '<function 180>',
["loadfile"] = '<function 181>',
["loadstring"] = '<function 182>',
["math"] = {
["abs"] = '<function 183>',
["acos"] = '<function 184>',
["asin"] = '<function 185>',
["atan"] = '<function 186>',
["atan2"] = '<function 187>',
["ceil"] = '<function 188>',
["cos"] = '<function 189>',
["cosh"] = '<function 190>',
["deg"] = '<function 191>',
["exp"] = '<function 192>',
["floor"] = '<function 193>',
["fmod"] = '<function 194>',
["frexp"] = '<function 195>',
["huge"] = '<number inf>',
["ldexp"] = '<function 196>',
["log"] = '<function 197>',
["log10"] = '<function 198>',
["max"] = '<function 199>',
["min"] = '<function 200>',
["mod"] = '<function 194>',
["modf"] = '<function 201>',
["pi"] = 3.1415926535898,
["pow"] = '<function 202>',
["rad"] = '<function 203>',
["random"] = '<function 204>',
["randomseed"] = '<function 205>',
["sin"] = '<function 206>',
["sinh"] = '<function 207>',
["sqrt"] = '<function 208>',
["tan"] = '<function 209>',
["tanh"] = '<function 210>'
},
["message"] = '<function 211>',
["module"] = '<function 212>',
["new_dialog"] = '<function 213>',
["newproxy"] = '<function 214>',
["next"] = '<function 215>',
["open_capture_file"] = '<function 216>',
["os"] = {
["clock"] = '<function 217>',
["date"] = '<function 218>',
["difftime"] = '<function 219>',
["execute"] = '<function 220>',
["exit"] = '<function 221>',
["getenv"] = '<function 222>',
["remove"] = '<function 223>',
["rename"] = '<function 224>',
["setlocale"] = '<function 225>',
["time"] = '<function 226>',
["tmpname"] = '<function 227>'
},
["package"] = {
["config"] = '<filtered>',
["cpath"] = '<filtered>',
["loaded"] = '<filtered>',
["loaders"] = {
[1] = '<function 228>',
[2] = '<function 229>',
[3] = '<function 230>',
[4] = '<function 231>' },
["loadlib"] = '<function 232>',
["path"] = '<filtered>',
["preload"] = {},
["seeall"] = '<function 233>'
},
["pairs"] = '<function 234>',
["pcall"] = '<function 235>',
["persconffile_path"] = '<function 236>',
["print"] = '<function 237>',
["rawequal"] = '<function 238>',
["rawget"] = '<function 239>',
["rawset"] = '<function 240>',
["register_menu"] = '<function 241>',
["register_postdissector"] = '<function 242>',
["register_stat_cmd_arg"] = '<function 243>',
["reload"] = '<function 244>',
["report_failure"] = '<function 245>',
["require"] = '<function 246>',
["retap_packets"] = '<function 247>',
["run_user_scripts_when_superuser"] = '<filtered>',
["running_superuser"] = '<filtered>',
["select"] = '<function 248>',
["set_color_filter_slot"] = '<function 249>',
["set_filter"] = '<function 250>',
["setfenv"] = '<function 251>',
["setmetatable"] = '<function 252>',
["string"] = {
["byte"] = '<function 253>',
["char"] = '<function 254>',
["dump"] = '<function 255>',
["find"] = '<function 256>',
["format"] = '<function 257>',
["gfind"] = '<function 258>',
["gmatch"] = '<function 258>',
["gsub"] = '<function 259>',
["len"] = '<function 260>',
["lower"] = '<function 261>',
["match"] = '<function 262>',
["rep"] = '<function 263>',
["reverse"] = '<function 264>',
["sub"] = '<function 265>',
["upper"] = '<function 266>'
},
["table"] = {
["concat"] = '<function 267>',
["foreach"] = '<function 268>',
["foreachi"] = '<function 269>',
["getn"] = '<function 270>',
["insert"] = '<function 271>',
["maxn"] = '<function 272>',
["remove"] = '<function 273>',
["setn"] = '<function 274>',
["sort"] = '<function 275>'
},
["tonumber"] = '<function 276>',
["tostring"] = '<function 277>',
["type"] = '<function 278>',
["unpack"] = '<function 279>',
["warn"] = '<function 280>',
["wtap"] = {
["APPLE_IP_OVER_IEEE1394"] = 62,
["ARCNET"] = 8,
["ARCNET_LINUX"] = 9,
["ASCEND"] = 16,
["ATM_PDUS"] = 13,
["ATM_PDUS_UNTRUNCATED"] = 14,
["ATM_RFC1483"] = 10,
["BACNET_MS_TP"] = 63,
["BACNET_MS_TP_WITH_PHDR"] = 143,
["BER"] = 90,
["BLUETOOTH_H4"] = 41,
["BLUETOOTH_H4_WITH_PHDR"] = 99,
["BLUETOOTH_HCI"] = 102,
["CAN20B"] = 109,
["CATAPULT_DCT2000"] = 89,
["CHDLC"] = 28,
["CHDLC_WITH_PHDR"] = 40,
["CISCO_IOS"] = 29,
["COSINE"] = 34,
["DOCSIS"] = 33,
["DPNSS"] = 117,
["DVBCI"] = 132,
["ENC"] = 38,
["ERF"] = 98,
["ETHERNET"] = 1,
["FDDI"] = 5,
["FDDI_BITSWAPPED"] = 6,
["FIBRE_CHANNEL_FC2"] = 121,
["FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS"] = 122,
["FLEXRAY"] = 106,
["FRELAY"] = 26,
["FRELAY_WITH_PHDR"] = 27,
["GCOM_SERIAL"] = 78,
["GCOM_TIE1"] = 77,
["GPRS_LLC"] = 66,
["GSM_UM"] = 116,
["HHDLC"] = 32,
["I2C"] = 112,
["IEEE802_15_4"] = 104,
["IEEE802_15_4_NOFCS"] = 127,
["IEEE802_15_4_NONASK_PHY"] = 113,
["IEEE802_16_MAC_CPS"] = 93,
["IEEE_802_11"] = 20,
["IEEE_802_11_AIROPEEK"] = 145,
["IEEE_802_11_AVS"] = 24,
["IEEE_802_11_NETMON"] = 126,
["IEEE_802_11_PRISM"] = 21,
["IEEE_802_11_RADIOTAP"] = 23,
["IEEE_802_11_WITH_RADIO"] = 22,
["IPMB"] = 103,
["IPNET"] = 124,
["IP_OVER_FC"] = 18,
["IP_OVER_IB"] = 137,
["IRDA"] = 44,
["ISDN"] = 17,
["IXVERIWAVE"] = 144,
["JPEG_JFIF"] = 123,
["JUNIPER_ATM1"] = 67,
["JUNIPER_ATM2"] = 68,
["JUNIPER_CHDLC"] = 86,
["JUNIPER_ETHER"] = 83,
["JUNIPER_FRELAY"] = 85,
["JUNIPER_GGSN"] = 87,
["JUNIPER_MLFR"] = 82,
["JUNIPER_MLPPP"] = 81,
["JUNIPER_PPP"] = 84,
["JUNIPER_PPPOE"] = 76,
["JUNIPER_VP"] = 91,
["K12"] = 80,
["LAPB"] = 12,
["LAPD"] = 131,
["LAYER1_EVENT"] = 110,
["LIN"] = 107,
["LINUX_ATM_CLIP"] = 11,
["LINUX_LAPD"] = 88,
["LOCALTALK"] = 30,
["MIME"] = 134,
["MOST"] = 108,
["MPEG"] = 96,
["MPEG_2_TS"] = 138,
["MTP2"] = 42,
["MTP2_WITH_PHDR"] = 75,
["MTP3"] = 43,
["MUX27010"] = 133,
["NETANALYZER"] = 135,
["NETANALYZER_TRANSPARENT"] = 136,
["NETTL_ETHERNET"] = 71,
["NETTL_FDDI"] = 73,
["NETTL_RAW_ICMP"] = 64,
["NETTL_RAW_ICMPV6"] = 65,
["NETTL_RAW_IP"] = 70,
["NETTL_RAW_TELNET"] = 94,
["NETTL_TOKEN_RING"] = 72,
["NETTL_UNKNOWN"] = 74,
["NETTL_X25"] = 79,
["NFC_LLCP"] = 140,
["NFLOG"] = 141,
["NSTRACE_1_0"] = 119,
["NSTRACE_2_0"] = 120,
["NULL"] = 15,
["OLD_PFLOG"] = 31,
["PACKETLOGGER"] = 118,
["PFLOG"] = 39,
["PPI"] = 97,
["PPP"] = 4,
["PPP_ETHER"] = 139,
["PPP_WITH_PHDR"] = 19,
["RAW_IP"] = 7,
["RAW_IP4"] = 129,
["RAW_IP6"] = 130,
["RAW_IPFIX"] = 128,
["REDBACK"] = 69,
["SCCP"] = 101,
["SDH"] = 146,
["SDLC"] = 36,
["SITA"] = 100,
["SLIP"] = 3,
["SLL"] = 25,
["SOCKETCAN"] = 125,
["SYMANTEC"] = 61,
["TNEF"] = 114,
["TOKEN_RING"] = 2,
["TZSP"] = 37,
["UNKNOWN"] = 0,
["USB"] = 92,
["USB_LINUX"] = 95,
["USB_LINUX_MMAPPED"] = 115,
["USER0"] = 45,
["USER1"] = 46,
["USER10"] = 55,
["USER11"] = 56,
["USER12"] = 57,
["USER13"] = 58,
["USER14"] = 59,
["USER15"] = 60,
["USER2"] = 47,
["USER3"] = 48,
["USER4"] = 49,
["USER5"] = 50,
["USER6"] = 51,
["USER7"] = 52,
["USER8"] = 53,
["USER9"] = 54,
["V5_EF"] = 142,
["WFLEET_HDLC"] = 35,
["X2E_SERIAL"] = 111,
["X2E_XORAYA"] = 105
},
["xpcall"] = '<function 281>'
}

706
test/lua/inspect.lua Normal file
View File

@ -0,0 +1,706 @@
-------------------------------------------------------------------
-- This was changed for Wireshark's use by Hadriel Kaplan.
--
-- Changes made:
-- * provided 'serialize' option to output serialized info (ie, can be marshaled),
-- though note that serializing functions/metatables/userdata/threads will not
-- magically make them be their original type when marshaled.
-- * provided 'notostring' option, which if true will disabled calling __tostring
-- metamethod of tables.
-- * made it always print the index number of numbered-array entries, and on separate
-- lines like the normal key'd entries (much easier to read this way I think)
-- New public functions:
-- inspect.compare(first,second[,options])
-- inspect.marshal(inString[,options])
-- inspect.makeFilter(arrayTable)
--
-- For the *changes*:
-- Copyright (c) 2014, Hadriel Kaplan
-- My change to the code is in the Public Domain, or the BSD (3 clause) license if
-- Public Domain does not apply in your country, or you would prefer a BSD license.
-- But the original code is still under Enrique García Cota's MIT license (below).
-------------------------------------------------------------------
local inspect ={
_VERSION = 'inspect.lua 2.0.0 - with changes',
_URL = 'http://github.com/kikito/inspect.lua',
_DESCRIPTION = 'human-readable representations of tables',
_LICENSE = [[
MIT LICENSE
Copyright (c) 2013 Enrique García Cota
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]],
_TINDEX_KEY = '<index>', -- the key name to use for index number entries for tables
_DEPTH_MARKER = " ['<depth>'] = true " -- instead of printing '...' we print this
}
-- Apostrophizes the string if it has quotes, but not aphostrophes
-- Otherwise, it returns a regular quoted string
local function smartQuote(str)
if str:match('"') and not str:match("'") then
return "'" .. str .. "'"
end
return '"' .. str:gsub('"', '\\"') .. '"'
end
local controlCharsTranslation = {
["\a"] = "\\a", ["\b"] = "\\b", ["\f"] = "\\f", ["\n"] = "\\n",
["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v"
}
local function escapeChar(c) return controlCharsTranslation[c] end
local function escape(str)
local result = str:gsub("\\", "\\\\"):gsub("(%c)", escapeChar)
return result
end
local function isIdentifier(str)
return type(str) == 'string' and str:match( "^[_%a][_%a%d]*$" )
end
local function isArrayKey(k, length)
return type(k) == 'number' and 1 <= k and k <= length
end
local function isDictionaryKey(k, length)
return not isArrayKey(k, length)
end
local defaultTypeOrders = {
['number'] = 1, ['boolean'] = 2, ['string'] = 3, ['table'] = 4,
['function'] = 5, ['userdata'] = 6, ['thread'] = 7
}
local function sortKeys(a, b)
local ta, tb = type(a), type(b)
-- strings and numbers are sorted numerically/alphabetically
if ta == tb and (ta == 'string' or ta == 'number') then return a < b end
local dta, dtb = defaultTypeOrders[ta], defaultTypeOrders[tb]
-- Two default types are compared according to the defaultTypeOrders table
if dta and dtb then return defaultTypeOrders[ta] < defaultTypeOrders[tb]
elseif dta then return true -- default types before custom ones
elseif dtb then return false -- custom types after default ones
end
-- custom types are sorted out alphabetically
return ta < tb
end
local function getDictionaryKeys(t)
local keys, length = {}, #t
for k,_ in pairs(t) do
if isDictionaryKey(k, length) then table.insert(keys, k) end
end
table.sort(keys, sortKeys)
return keys
end
local function getToStringResultSafely(t, mt)
local __tostring = type(mt) == 'table' and rawget(mt, '__tostring')
local str, ok
if type(__tostring) == 'function' then
ok, str = pcall(__tostring, t)
str = ok and str or 'error: ' .. tostring(str)
end
if type(str) == 'string' and #str > 0 then return str end
end
local maxIdsMetaTable = {
__index = function(self, typeName)
rawset(self, typeName, 0)
return 0
end
}
local idsMetaTable = {
__index = function (self, typeName)
local col = setmetatable({}, {__mode = "kv"})
rawset(self, typeName, col)
return col
end
}
local function countTableAppearances(t, tableAppearances)
tableAppearances = tableAppearances or setmetatable({}, {__mode = "k"})
if type(t) == 'table' then
if not tableAppearances[t] then
tableAppearances[t] = 1
for k,v in pairs(t) do
countTableAppearances(k, tableAppearances)
countTableAppearances(v, tableAppearances)
end
countTableAppearances(getmetatable(t), tableAppearances)
else
tableAppearances[t] = tableAppearances[t] + 1
end
end
return tableAppearances
end
local function parse_filter(filter)
if type(filter) == 'function' then return filter end
-- not a function, so it must be a table or table-like
filter = type(filter) == 'table' and filter or {filter}
local dictionary = {}
for _,v in pairs(filter) do dictionary[v] = true end
return function(x) return dictionary[x] end
end
local function makePath(path, key)
local newPath, len = {}, #path
for i=1, len do newPath[i] = path[i] end
newPath[len+1] = key
return newPath
end
-------------------------------------------------------------------
function inspect.inspect(rootObject, options)
options = options or {}
local depth = options.depth or math.huge
local filter = parse_filter(options.filter or {})
local serialize = options.serialize
local depth_marker = inspect._DEPTH_MARKER
local tableAppearances = countTableAppearances(rootObject)
local buffer = {}
local maxIds = setmetatable({}, maxIdsMetaTable)
local ids = setmetatable({}, idsMetaTable)
local level = 0
local blen = 0 -- buffer length
local function puts(...)
local args = {...}
for i=1, #args do
blen = blen + 1
buffer[blen] = tostring(args[i])
end
end
-- like puts above, but for things we want as quoted strings
-- so they become values, as we do if serializing
local function putv(...)
blen = blen + 1
buffer[blen] = "'"
puts(...)
blen = blen + 1
buffer[blen] = "'"
end
-- if serializing, using raw strings is unsafe, so we use the full "['key']" style
local function putk(...)
blen = blen + 1
buffer[blen] = "['"
puts(...)
blen = blen + 1
buffer[blen] = "']"
end
-- if not serializing, it's all puts
if not serialize then
putv = puts
putk = puts
depth_marker = '...'
end
-- disable using __tostring metamethod
local getToStringResultSafely = getToStringResultSafely
if options.notostring or serialize then
getToStringResultSafely = function() return end
end
local function down(f)
level = level + 1
f()
level = level - 1
end
local function tabify()
puts("\n", string.rep(" ", level))
end
local function commaControl(needsComma)
if needsComma then puts(',') end
return true
end
local function alreadyVisited(v)
return ids[type(v)][v] ~= nil
end
local function getId(v)
local tv = type(v)
local id = ids[tv][v]
if not id then
id = maxIds[tv] + 1
maxIds[tv] = id
ids[tv][v] = id
end
return id
end
local putValue -- forward declaration that needs to go before putTable & putKey
local function putKey(k)
if not serialize and isIdentifier(k) then return puts(k) end
puts("[")
putValue(k, {})
puts("]")
end
local function putTable(t, path)
if alreadyVisited(t) then
putv('<table ', getId(t), '>')
elseif level >= depth then
puts('{', depth_marker, '}')
else
if not serialize and tableAppearances[t] > 1 then puts('<', getId(t), '>') end
local dictKeys = getDictionaryKeys(t)
local length = #t
local mt = getmetatable(t)
local to_string_result = getToStringResultSafely(t, mt)
puts('{')
down(function()
if to_string_result then
puts(' -- ', escape(to_string_result))
if length >= 1 then tabify() end -- tabify the array values
end
local needsComma = false
if serialize and tableAppearances[t] > 1 then
getId(t)
end
for i=1, length do
needsComma = commaControl(needsComma)
-- just doing puts(' ') made for ugly arrays
tabify()
putKey(i)
puts(' = ')
putValue(t[i], makePath(path, i))
end
for _,k in ipairs(dictKeys) do
needsComma = commaControl(needsComma)
tabify()
putKey(k)
puts(' = ')
putValue(t[k], makePath(path, k))
end
if mt then
needsComma = commaControl(needsComma)
tabify()
putk('<metatable>')
puts(' = ')
putValue(mt, makePath(path, '<metatable>'))
end
end)
if #dictKeys > 0 or mt then -- dictionary table. Justify closing }
tabify()
elseif length > 0 then -- array tables have one extra space before closing }
puts(' ')
end
puts('}')
end
end
-- putvalue is forward-declared before putTable & putKey
putValue = function(v, path)
if filter(v, path) then
putv('<filtered>')
else
local tv = type(v)
if tv == 'string' then
puts(smartQuote(escape(v)))
elseif tv == 'number' and v == math.huge then
putv('<number inf>')
elseif tv == 'number' or tv == 'boolean' or tv == 'nil' then
puts(tostring(v))
elseif tv == 'table' then
putTable(v, path)
else
putv('<',tv,' ',getId(v),'>')
end
end
end
putValue(rootObject, {})
return table.concat(buffer)
end
setmetatable(inspect, { __call = function(_, ...) return inspect.inspect(...) end })
-------------------------------------------------------------------
-- The above is very close to Enrique's original inspect library.
-- Below are my main changes.
-------------------------------------------------------------------
-- Given a string generated by inspect() with the serialize option,
-- this function marshals it back into a Lua table/whatever.
-- If the string's table(s) had metatable(s), i.e. "<metatable>" tables,
-- then this keeps them as "<metatable>" subtables unless the option
-- 'nometa' is set to true.
--
-- This function also removes all "<index>" entries.
--
function inspect.marshal(inString, options)
options = options or {}
local index = inspect._TINDEX_KEY
local function removeIndex(t)
if type(t) == 'table' then
t[index] = nil
for _, v in pairs(t) do
removeIndex(v)
end
end
end
local function removeMeta(t)
if type(t) == 'table' then
t['<metatable>'] = nil
for _, v in pairs(t) do
removeMeta(v)
end
end
end
-- first skip past comments/empty-lines
-- warning: super-hack-ish weak
local pos, ok, dk = 1, true, true
local fin
local stop = string.len(inString)
while ok or dk do
ok, fin = inString:find("^[%s\r\n]+",pos)
if ok then pos = fin + 1 end
dk, fin = inString:find("^%-%-.-\n",pos)
if dk then pos = fin + 1 end
end
if not inString:find("^%s*return[%s%{]",pos) then
inString = "return " .. inString
end
local t = assert(loadstring(inString))()
removeIndex(t)
if options.nometa then removeMeta(t) end
return t
end
-------------------------------------------------------------------
-------------------------------------------------------------------
-- more private functions
-- things like '<function>' are equal to '<function 32>'
local mungetypes = {
{"^<function ?%d*>", '<function>'},
{"^<table ?%d*>", '<table>'},
{"^<userdata ?%d*>", '<userdata>'},
{"^<thread ?%d*>", '<thread>'}
}
local function normalizeString(s)
for _,t in ipairs(mungetypes) do
if s:find(t[1]) then
return t[2]
end
end
return s
end
local typetable = {
['<function>'] = 'function',
['<table>'] = 'table',
['<userdata>'] = 'userdata',
['<thread>'] = 'thread'
}
local function getType(v)
local tv = type(v)
if tv == 'string' then
tv = typetable[normalizeString(v)] or 'string'
end
return tv
end
local function tablelength(t)
local count = 0
for _ in pairs(t) do count = count + 1 end
return count
end
-- for pretty-printing paths, for debug output
-- this is non-optimal, but only gets used in verbose mode anyway
local function serializePath(path)
local t = {}
for i,k in ipairs(path) do
local tk = type(k)
if isIdentifier(k) then
t[i] = ((i == 1) and k) or ('.'..k)
elseif tk == 'string' then
t[i] = '[' .. smartQuote(escape(k)) .. ']'
elseif tk == 'number' or tk == 'boolean' then
t[i] = '[' .. tostring(k) .. ']'
else
t[i] = "['<" .. tk .. ">']"
end
end
if #t == 0 then t[1] = '{}' end
return table.concat(t)
end
-------------------------------------------------------------------
-------------------------------------------------------------------
-- Given one table and another, this function detects if the first is
-- completely contained in the second object. The second can have more
-- entries, but cannot be missing an entry in the first one. Entry values
-- must match as well - i.e., string values are the same, numbers the
-- same, booleans the same.
--
-- The function returns true if the first is in the second, false otherwise.
-- It also returns a table of the diff, which will be empty if they matched.
-- This returned table is structured like the first one passed in,
-- so calling print(inspect(returnedTabled)) will make it pretty print.
--
-- The returned table's members have their values replaced with mismatch
-- information, explaining what the mismatch was. Setting the option "keep"
-- makes it not replace the values, but keep them as they were in the first
-- table.
--
-- By default, the key's values must match in both tables. If the option
-- 'nonumber' is set, then number values are not compared. This is useful
-- if they're things that can change (like exported C-code numbers).
--
-- By default, the metatables/"<metatables>" are also compared. If the option
-- 'nometa' is set, then metatables are not compared, nor does it matter if
-- they exist in either table.
--
-- Like inspect(), there's a 'filter' option, which works the same way:
-- it ignores its value completely in terms of matching, so their string values
-- can be different, but the keys still have to exist. Sub-tables of
-- such keys (ie, if the key's value is a table) are not checked/compared.
-- In other words, it's identical to the filter option for inspect().
--
-- The option 'ignore' is similar to 'filter', except matching ones
-- are not checked for existence in the tables at all.
--
-- Setting the 'depth' option applies as in inspect(), to both tables.
--
-- Setting the option 'verbose' makes it print out as it compares, for
-- debugging or test purposes.
--
function inspect.compare(firstTable, secondTable, options)
options = options or {}
local depth = options.depth or math.huge
local filter = parse_filter(options.filter or {})
local ignore = parse_filter(options.ignore or {})
local function puts(...)
local args = {...}
for i=1, #args do
blen = blen + 1
buffer[blen] = tostring(args[i])
end
end
-- for debug printing
local function dprint(...)
local args = {...}
print(table.concat(args))
end
local serializePath = serializePath
if not options.verbose then
dprint = function() return end
serializePath = function() return end
end
-- for error message replacing key value
local function emsg(...)
local args = {...}
return(table.concat(args))
end
if options.keep then
emsg = function() return end
end
-- declare checkValue here
local checkValue
local function checkTable(f, s, path)
dprint("checking ",serializePath(path)," table contents")
for k, v in pairs(f) do
local child = makePath(path, k)
if not ignore(v,child) then
local ret, msg = checkValue(v, s[k], child)
if ret then
f[k] = nil
elseif msg then
f[k] = msg
dprint(serializePath(child)," ",msg)
end
else
dprint("ignoring ",serializePath(child))
f[k] = nil
end
end
return tablelength(f) == 0
end
-- a wrapper for failure cases in checkValue() that can be handled the same way
local function compCheck(f,s,func)
if not func() then
return false, emsg("mismatched ",getType(f)," values: ",tostring(f)," --> ",tostring(s))
end
return true
end
-- kinda ugly, but I wanted pretty information output
checkValue = function(f, s, path)
local tf = getType(f)
dprint("checking ",serializePath(path)," (",tf,")")
if s == nil then
return false, emsg("missing ",tf,"!")
elseif tf ~= getType(s) then
return false, emsg("type mismatch (",tf,") --> (",getType(s),")")
elseif type(f) == 'table' then
return checkTable(f, s, path)
end
return compCheck(f,s,function()
if tf == 'string' or tf == 'boolean' then
return f == s
elseif tf == 'number' then
return f == s or options.nonumber
else
-- asume they're the same functions/userdata/looped-table
-- type matching before would already cover it otherwise
return true
end
end)
end
-- inspect+serialize both tables, to normalize them, separate their
-- metatables, limit depth, etc. Also, since we pass the filter option on,
-- the filtered items become "<filtered>" and will by definition match
local function normalizeTable(t)
return assert( inspect.marshal( inspect.inspect(t,{serialize=true,depth=depth,filter=filter}), {nometa=options.nometa} ))
end
local first = normalizeTable(firstTable)
local second = normalizeTable(secondTable)
return checkTable(first, second, {}), first
end
-------------------------------------------------------------------
-------------------------------------------------------------------
-- Given a table of key strings, return a function that can be used for
-- the 'filter' option of inspect() and inspect.compare() functions.
function inspect.makeFilter(arrayTable)
local filter = {} -- our filter lookup tree (tables of tables)
local matchNode = {} -- a table instance we use as a key for nodes which match
local function buildFilter(pathname)
local t = filter
local key
for sep, name in pathname:gmatch("([%.%[\"\']*)([^%.%[\"\'%]]+)[\"\'%]]?") do
if sep == '[' then
if name == 'true' then
key = true
elseif name == 'false' then
key = false
else
key = tonumber(name)
end
else
-- to be safe, we'll check the key name doesn't mean a table/function/userdata
local tn = getType(name)
if tn == 'string' then
key = name
else
error("filter key '"..pathname.."' has key '"..name.."' which is an unsupported type ("..tn..")")
end
end
if not t[key] then
t[key] = {}
end
t = t[key]
end
t[matchNode] = true
end
-- we could call serializePath() and do a simple lookup, but it's expensive and
-- we'd be calling it a LOT. So instead we break up the filter
-- table into true "path" elements, into a filter tree, and compare
-- against it... thereby avoiding string concat/manip during compare.
for _, pathname in ipairs(arrayTable) do
buildFilter(pathname)
end
return function(_,path)
local t = filter
for _,v in ipairs(path) do
if not t[v] then
return false
end
t = t[v]
end
return t[matchNode] == true
end
end
return inspect

132
test/lua/verify_globals.lua Normal file
View File

@ -0,0 +1,132 @@
-- verify_globals.lua
-- ignore things that change on different machines or every release
-- the following items still have to exist, but their values don't have to match
local filter = {
-- differences by machine
"DATA_DIR",
"USER_DIR",
"package.cpath",
"package.path",
"package.loaded",
"run_user_scripts_when_superuser",
"running_superuser",
-- differences in Lua versions
"_VERSION",
"package.config",
-- differences caused by changes in wireshark 1.11
"NSTime",
"Proto",
'Listener["<metatable>"].__index'
}
-- the following items don't have to exist
local ignore = {
-- not sure why this was removed in wireshark 1.11, but it was
"TreeItem.set_expert_flags",
-- in Lua 5.1 only
"debug.getfenv",
"debug.setfenv",
"gcinfo",
"getfenv",
"io.gfind",
"setfenv",
"math.mod",
"newproxy",
"string.gfind",
"table.foreach",
"table.foreachi",
"table.getn",
"table.setn",
-- in Lua 5.2+ only
"bit32",
"debug.getuservalu",
"debug.setuservalu",
"debug.upvalueid",
"debug.upvaluejoin",
"package.searchers",
"package.searchpath",
"rawlen",
"table.pack",
"table.unpack",
}
local arg={...} -- get passed-in args
-- arg1 = path to find inspect
-- arg2 = filename to read in (optional, unless 'verify' is set)
-- arg3 = 'verify' to verify all of read-in file is in _G (default); 'new' to output all items in _G that are not in read-in file
-- arg4 = 'nometa' to ignore metatables; 'meta' otherwise (default)
local add_path = "lua/?.lua;"
if #arg > 0 then
add_path = arg[1].."?.lua;"
end
-- need the path to find inspect.lua
local old_path = package.path
package.path = add_path .. package.path
local inspect = require("inspect")
package.path = old_path -- return path to original
print("-- Wireshark version: " .. get_version())
if #arg == 1 then
-- no more args, so just output globals
print(inspect(_G, { serialize = true, filter = inspect.makeFilter(filter) }))
return
end
local file = assert(io.open(arg[2], "r"))
local input = file:read("*all")
input = inspect.marshal(input)
local nometa = false
if #arg > 3 and arg[4] == "nometa" then
nometa = true
end
if #arg == 2 or arg[3] == "verify" then
print(string.rep("\n", 2))
print("Verifying input file '"..arg[1].."' is contained within the global table")
local ret, diff = inspect.compare(input, _G, {
['filter'] = inspect.makeFilter(filter),
['ignore'] = inspect.makeFilter(ignore),
['nonumber'] = true,
['nometa'] = nometa
})
if not ret then
print("Comparison failed - global table does not have all the items in the input file!")
print(string.rep("\n", 2))
print(string.rep("-", 80))
print("Differences are:")
print(inspect(diff))
else
print("\n-----------------------------\n")
print("All tests passed!\n\n")
end
return
elseif #arg > 1 and arg[2] == "new" then
local ret, diff = inspect.compare(_G, input, {
['filter'] = inspect.makeFilter(filter),
['ignore'] = inspect.makeFilter(ignore),
['nonumber'] = true,
['keep'] = true,
['nometa'] = nometa
})
if not ret then
print(inspect(diff))
else
print("\n-----------------------------\n")
print("No new items!\n\n")
end
end

View File

@ -169,6 +169,28 @@ wslua_step_args_test() {
test_step_ok
}
unittests_step_globals_test() {
if [ $HAVE_LUA -ne 0 ]; then
test_step_skipped
return
fi
# Tshark catches lua script failures, so we have to parse the output.
$TSHARK -r $CAPTURE_DIR/empty.pcap -X lua_script:$TESTS_DIR/lua/verify_globals.lua -X lua_script1:$TESTS_DIR/lua/ -X lua_script1:$TESTS_DIR/lua/globals_1.8.txt > testout.txt 2>&1
grep -q "All tests passed!" testout.txt
if [ $? -ne 0 ]; then
cat testout.txt
test_step_failed "lua_globals_test test 1 failed"
fi
$TSHARK -r $CAPTURE_DIR/empty.pcap -X lua_script:$TESTS_DIR/lua/verify_globals.lua -X lua_script1:$TESTS_DIR/lua/ -X lua_script1:$TESTS_DIR/lua/globals_1.10.txt > testout.txt 2>&1
grep -q "All tests passed!" testout.txt
if [ $? -ne 0 ]; then
cat testout.txt
test_step_failed "lua_globals_test test 2 failed"
fi
test_step_ok
}
wslua_step_struct_test() {
if [ $HAVE_LUA -ne 0 ]; then
test_step_skipped
@ -195,6 +217,7 @@ wslua_suite() {
test_step_set_post wslua_cleanup_step
test_step_add "wslua dissector" wslua_step_dissector_test
test_step_add "wslua field/fieldinfo" wslua_step_field_test
test_step_add "wslua globals" unittests_step_globals_test
test_step_add "wslua int64" wslua_step_int64_test
test_step_add "wslua listener" wslua_step_listener_test
test_step_add "wslua nstime" wslua_step_nstime_test