|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include <glib.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <lua.h>#include <lualib.h>#include <lauxlib.h>#include <ws_log_defs.h>#include <wiretap/wtap.h>#include <wsutil/report_message.h>#include <wsutil/nstime.h>#include <wsutil/ws_assert.h>#include <wsutil/wslog.h>#include <epan/packet.h>#include <epan/strutil.h>#include <epan/to_str.h>#include <epan/uat-int.h>#include <epan/uat.h>#include <epan/prefs.h>#include <epan/prefs-int.h>#include <epan/proto.h>#include <epan/epan_dissect.h>#include <epan/tap.h>#include <epan/column-utils.h>#include <wsutil/filesystem.h>#include <wsutil/wsgcrypt.h>#include <epan/funnel.h>#include <epan/tvbparse.h>#include <epan/epan.h>#include <epan/expert.h>#include <epan/exceptions.h>#include <epan/show_exception.h>#include <epan/conversation.h>#include <epan/wslua/declare_wslua.h>Go to the source code of this file.
Classes | |
| struct | _wslua_tvb |
| struct | _wslua_pinfo |
| struct | _wslua_tvbrange |
| struct | _wslua_tw |
| struct | _wslua_field_t |
| struct | _wslua_expert_field_t |
| struct | _wslua_pref_t |
| struct | _wslua_proto_t |
| struct | _wslua_conv_data_t |
| struct | _wslua_distbl_t |
| struct | _wslua_col_info |
| struct | _wslua_cols |
| struct | _wslua_private_table |
| struct | _wslua_treeitem |
| struct | _wslua_header_field_info |
| struct | _wslua_field_info |
| struct | _wslua_func_saver |
| struct | _wslua_tap |
| struct | _wslua_file |
| struct | _wslua_captureinfo |
| struct | _wslua_rec |
| struct | _wslua_const_rec |
| struct | _wslua_filehandler |
| struct | _wslua_dir |
| struct | _wslua_progdlg |
| struct | tappable_t |
| struct | wslua_ft_types_t |
| struct | wslua_conv_types_t |
| struct | _wslua_attribute_table |
| struct | _wslua_class |
| Type for defining new classes. More... | |
Macros | |
| #define | WSLUA_INIT_ROUTINES "init_routines" |
| #define | WSLUA_PREFS_CHANGED "prefs_changed" |
| #define | wslua_toint(L, i) (int) ( lua_tointeger(L,i) ) |
| #define | wslua_toint32(L, i) (int32_t) ( lua_tointeger(L,i) ) |
| #define | wslua_toint64(L, i) (int64_t) ( lua_tonumber(L,i) ) |
| #define | wslua_touint64(L, i) (uint64_t) ( lua_tonumber(L,i) ) |
| #define | wslua_checkint(L, i) (int) ( luaL_checkinteger(L,i) ) |
| #define | wslua_checkint32(L, i) (int32_t) ( luaL_checkinteger(L,i) ) |
| #define | wslua_checkint64(L, i) (int64_t) ( luaL_checknumber(L,i) ) |
| #define | wslua_checkuint64(L, i) (uint64_t) ( luaL_checknumber(L,i) ) |
| #define | wslua_optint(L, i, d) (int) ( luaL_optinteger(L,i,d) ) |
| #define | wslua_optint32(L, i, d) (int32_t) ( luaL_optinteger(L,i,d) ) |
| #define | wslua_optint64(L, i, d) (int64_t) ( luaL_optnumber(L,i,d) ) |
| #define | wslua_optuint64(L, i, d) (uint64_t) ( luaL_optnumber(L,i,d) ) |
| #define | wslua_touint(L, i) (unsigned) ( lua_tounsigned(L,i) ) |
| #define | wslua_touint32(L, i) (uint32_t) ( lua_tounsigned(L,i) ) |
| #define | wslua_checkuint(L, i) (unsigned) ( luaL_checkunsigned(L,i) ) |
| #define | wslua_checkuint32(L, i) (uint32_t) ( luaL_checkunsigned(L,i) ) |
| #define | wslua_optuint(L, i, d) (unsigned) ( luaL_optunsigned(L,i,d) ) |
| #define | wslua_optuint32(L, i, d) (uint32_t) ( luaL_optunsigned(L,i,d) ) |
| #define | WSLUA_CLASS_DEFINE(C, check_code) WSLUA_CLASS_DEFINE_BASE(C,check_code,NULL) |
| #define | WSLUA_CLASS_DEFINE_BASE(C, check_code, retval) |
| #define | WSLUA_TYPEOF_FIELD "__typeof" |
| #define | WSLUA_FUNCTION extern int |
| #define | WSLUA_INTERNAL_FUNCTION extern int |
| #define | WSLUA_REGISTER_FUNCTION(name) { lua_pushcfunction(L, wslua_## name); lua_setglobal(L, #name); } |
| #define | WSLUA_REGISTER extern int |
| #define | WSLUA_METHOD static int |
| #define | WSLUA_CONSTRUCTOR static int |
| #define | WSLUA_ATTR_SET static int |
| #define | WSLUA_ATTR_GET static int |
| #define | WSLUA_METAMETHOD static int |
| #define | WSLUA_METHODS static const luaL_Reg |
| #define | WSLUA_META static const luaL_Reg |
| #define | WSLUA_CLASS_FNREG(class, name) { #name, class##_##name } |
| #define | WSLUA_CLASS_FNREG_ALIAS(class, aliasname, name) { #aliasname, class##_##name } |
| #define | WSLUA_CLASS_MTREG(class, name) { "__" #name, class##__##name } |
| #define | WSLUA_ATTRIBUTES static const wslua_attribute_table |
| #define | WSLUA_ATTRIBUTE_RWREG(class, name) { #name, class##_get_##name, class##_set_##name } |
| #define | WSLUA_ATTRIBUTE_ROREG(class, name) { #name, class##_get_##name, NULL } |
| #define | WSLUA_ATTRIBUTE_WOREG(class, name) { #name, NULL, class##_set_##name } |
| #define | WSLUA_STATELESS_PAIRS_BODY(C) |
| #define | WSLUA_ATTRIBUTE_FUNC_SETTER(C, field) |
| #define | WSLUA_ATTRIBUTE_GET(C, name, block) |
| #define | WSLUA_ATTRIBUTE_NAMED_BOOLEAN_GETTER(C, name, member) WSLUA_ATTRIBUTE_GET(C,name,{lua_pushboolean(L, obj->member );}) |
| #define | WSLUA_ATTRIBUTE_NAMED_INTEGER_GETTER(C, name, member) WSLUA_ATTRIBUTE_GET(C,name,{lua_pushinteger(L,(lua_Integer)(obj->member));}) |
| #define | WSLUA_ATTRIBUTE_INTEGER_GETTER(C, member) WSLUA_ATTRIBUTE_NAMED_INTEGER_GETTER(C,member,member) |
| #define | WSLUA_ATTRIBUTE_BLOCK_NUMBER_GETTER(C, name, block) WSLUA_ATTRIBUTE_GET(C,name,{lua_pushnumber(L,(lua_Number)(block));}) |
| #define | WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(C, name, member) |
| #define | WSLUA_ATTRIBUTE_STRING_GETTER(C, member) WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(C,member,member) |
| #define | WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_STRING_GETTER(C, name, member, option) |
| #define | WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_NTH_STRING_GETTER(C, name, member, option) |
| #define | WSLUA_ATTRIBUTE_SET(C, name, block) |
| #define | WSLUA_ATTRIBUTE_NAMED_BOOLEAN_SETTER(C, name, member) |
| #define | WSLUA_ATTRIBUTE_NAMED_INTEGER_SETTER(C, name, member, cast) |
| #define | WSLUA_ATTRIBUTE_INTEGER_SETTER(C, member, cast) WSLUA_ATTRIBUTE_NAMED_INTEGER_SETTER(C,member,member,cast) |
| #define | WSLUA_ATTRIBUTE_NAMED_STRING_SETTER(C, field, member, need_free) |
| #define | WSLUA_ATTRIBUTE_STRING_SETTER(C, field, need_free) WSLUA_ATTRIBUTE_NAMED_STRING_SETTER(C,field,field,need_free) |
| #define | WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_STRING_SETTER(C, field, member, option) |
| #define | WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_NTH_STRING_SETTER(C, field, member, option) |
| #define | WSLUA_ERROR(name, error) { luaL_error(L, "%s%s", #name ": ", error); } |
| #define | WSLUA_ARG_ERROR(name, attr, error) { luaL_argerror(L,WSLUA_ARG_ ## name ## _ ## attr, #name ": " error); } |
| #define | WSLUA_OPTARG_ERROR(name, attr, error) { luaL_argerror(L,WSLUA_OPTARG_##name##_ ##attr, #name ": " error); } |
| #define | WSLUA_REG_GLOBAL_BOOL(L, n, v) { lua_pushboolean(L,v); lua_setglobal(L,n); } |
| #define | WSLUA_REG_GLOBAL_STRING(L, n, v) { lua_pushstring(L,v); lua_setglobal(L,n); } |
| #define | WSLUA_REG_GLOBAL_INTEGER(L, n, v) { lua_pushinteger(L,v); lua_setglobal(L,n); } |
| #define | WSLUA_RETURN(i) return (i) |
| #define | WSLUA_API extern |
| #define | NOP (void)p |
| #define | FAIL_ON_NULL(s) if (! *p) luaL_argerror(L,idx,"null " s) |
| #define | FAIL_ON_NULL_OR_EXPIRED(s) |
| #define | CLEAR_OUTSTANDING(C, marker, marker_val) |
| #define | WSLUA_CLASS_DECLARE(C) |
| #define | THROW_LUA_ERROR(...) THROW_FORMATTED(DissectorError, __VA_ARGS__) |
| #define | WRAP_NON_LUA_EXCEPTIONS(code) |
Typedefs | |
| typedef struct _wslua_field_t | wslua_field_t |
| typedef struct _wslua_expert_field_t | wslua_expert_field_t |
| typedef struct _wslua_pref_t | wslua_pref_t |
| typedef struct _wslua_proto_t | wslua_proto_t |
| typedef struct _wslua_conv_data_t | wslua_conv_data_t |
| typedef void(* | tap_extractor_t) (lua_State *, const void *) |
| typedef wslua_pref_t * | Pref |
| typedef wslua_pref_t * | Prefs |
| typedef struct _wslua_field_t * | ProtoField |
| typedef struct _wslua_expert_field_t * | ProtoExpert |
| typedef struct _wslua_proto_t * | Proto |
| typedef struct _wslua_distbl_t * | DissectorTable |
| typedef dissector_handle_t | Dissector |
| typedef GByteArray * | ByteArray |
| typedef gcry_cipher_hd_t * | GcryptCipher |
| typedef struct _wslua_tvb * | Tvb |
| typedef struct _wslua_tvbrange * | TvbRange |
| typedef struct _wslua_col_info * | Column |
| typedef struct _wslua_cols * | Columns |
| typedef struct _wslua_pinfo * | Pinfo |
| typedef struct _wslua_treeitem * | TreeItem |
| typedef address * | Address |
| typedef nstime_t * | NSTime |
| typedef int64_t | Int64 |
| typedef uint64_t | UInt64 |
| typedef struct _wslua_header_field_info * | Field |
| typedef struct _wslua_field_info * | FieldInfo |
| typedef struct _wslua_tap * | Listener |
| typedef struct _wslua_tw * | TextWindow |
| typedef struct _wslua_progdlg * | ProgDlg |
| typedef struct _wslua_file * | File |
| typedef struct _wslua_captureinfo * | CaptureInfo |
| typedef struct _wslua_captureinfo * | CaptureInfoConst |
| typedef struct _wslua_rec * | FrameInfo |
| typedef struct _wslua_const_rec * | FrameInfoConst |
| typedef struct _wslua_filehandler * | FileHandler |
| typedef wtap_dumper * | Dumper |
| typedef struct lua_pseudo_header * | PseudoHeader |
| typedef tvbparse_t * | Parser |
| typedef tvbparse_wanted_t * | Rule |
| typedef tvbparse_elem_t * | Node |
| typedef tvbparse_action_t * | Shortcut |
| typedef struct _wslua_dir * | Dir |
| typedef struct _wslua_private_table * | PrivateTable |
| typedef conversation_t * | Conversation |
| typedef char * | Struct |
| typedef struct _wslua_attribute_table | wslua_attribute_table |
| typedef struct _wslua_class | wslua_class |
| Type for defining new classes. | |
Functions | |
| int | wslua_reg_attributes (lua_State *L, const wslua_attribute_table *t, bool is_getter) |
| Registers attributes for a Lua table. | |
| lua_State * | wslua_state (void) |
| Retrieves the Lua state associated with Wireshark. | |
| void | wslua_register_classinstance_meta (lua_State *L, const wslua_class *cls_def) |
| void | wslua_register_class (lua_State *L, const wslua_class *cls_def) |
| int | wslua__concat (lua_State *L) |
| Concatenates two objects to a string. | |
| bool | wslua_toboolean (lua_State *L, int n) |
| Converts a Lua value to a boolean. | |
| bool | wslua_checkboolean (lua_State *L, int n) |
| Checks if a Lua value at a given index is a boolean. | |
| bool | wslua_optbool (lua_State *L, int n, bool def) |
| Checks if a Lua value at a given index is a boolean and returns its value, or a default value if not. | |
| lua_Integer | wslua_tointeger (lua_State *L, int n) |
| Converts a Lua value to an integer. | |
| int | wslua_optboolint (lua_State *L, int n, int def) |
| Retrieves an optional boolean or integer value from the Lua stack. | |
| const char * | wslua_checklstring_only (lua_State *L, int n, size_t *l) |
| Checks if the value at the given index is a Lua string and returns it. | |
| const char * | wslua_checkstring_only (lua_State *L, int n) |
| Checks if a Lua value at a given index is a string. | |
| void | wslua_setfuncs (lua_State *L, const luaL_Reg *l, int nup) |
| Set functions in a Lua table. | |
| const char * | wslua_typeof (lua_State *L, int idx) |
| bool | wslua_get_table (lua_State *L, int idx, const char *name) |
| bool | wslua_get_field (lua_State *L, int idx, const char *name) |
| int | dissect_lua (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
| bool | heur_dissect_lua (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
| expert_field * | wslua_get_expert_field (const int group, const int severity) |
| Retrieves an expert field based on group and severity. | |
| void | wslua_prefs_changed (void) |
| Notify Lua scripts that preferences have changed. | |
| void | proto_register_lua (void) |
| Registers the Lua protocol. | |
| GString * | lua_register_all_taps (void) |
| Registers all Lua taps. | |
| void | wslua_prime_dfilter (epan_dissect_t *edt) |
| Prime the dissector filter with a protocol tree. | |
| bool | wslua_has_field_extractors (void) |
| Checks if there are any registered field extractors. | |
| void | lua_prime_all_fields (proto_tree *tree) |
| Primes all fields in the protocol tree. | |
| int | Proto_commit (lua_State *L) |
| Commits protocol changes. | |
| TreeItem | create_TreeItem (proto_tree *tree, proto_item *item) |
| Creates a new TreeItem. | |
| void | clear_outstanding_FuncSavers (lua_State *L) |
| Clears outstanding function savers associated with a Lua state. | |
| void | Int64_pack (lua_State *L, luaL_Buffer *b, int idx, bool asLittleEndian) |
| Packs a 64-bit integer into a Lua string using the specified endianness. | |
| int | Int64_unpack (lua_State *L, const char *buff, bool asLittleEndian) |
| Unpacks a 64-bit integer from a buffer with specified endianness and pushes it onto the Lua stack. | |
| void | UInt64_pack (lua_State *L, luaL_Buffer *b, int idx, bool asLittleEndian) |
| Packs a 64-bit unsigned integer into a Lua string buffer with specified endianness. | |
| int | UInt64_unpack (lua_State *L, const char *buff, bool asLittleEndian) |
| Unpacks a 64-bit unsigned integer from a buffer with specified endianness and pushes it onto the Lua stack. | |
| uint64_t | getUInt64 (lua_State *L, int i) |
| Retrieves a 64-bit unsigned integer from the Lua stack. | |
| Tvb * | push_Tvb (lua_State *L, tvbuff_t *tvb) |
| Pushes a tvbuff_t to the Lua stack as a Tvb object. | |
| int | push_wsluaTvb (lua_State *L, Tvb t) |
| Pushes a Tvb object onto the Lua stack. | |
| bool | push_TvbRange (lua_State *L, tvbuff_t *tvb, int offset, int len) |
| Pushes a TvbRange object onto the Lua stack. | |
| void | clear_outstanding_Tvb (void) |
| Clears all outstanding Tvb objects. | |
| void | clear_outstanding_TvbRange (void) |
| Clears all outstanding TvbRange objects. | |
| Pinfo * | push_Pinfo (lua_State *L, packet_info *p) |
| Pushes a packet information structure onto the Lua stack. | |
| void | clear_outstanding_Pinfo (void) |
| Clears all outstanding Pinfo objects. | |
| void | clear_outstanding_Column (void) |
| Clears all outstanding Column objects. | |
| void | clear_outstanding_Columns (void) |
| Clears all outstanding Column objects. | |
| void | clear_outstanding_PrivateTable (void) |
| Clears any outstanding PrivateTable entries. | |
| int | get_hf_wslua_text (void) |
| Retrieves the value of hf_wslua_text. | |
| TreeItem | push_TreeItem (lua_State *L, proto_tree *tree, proto_item *item) |
| Pushes a TreeItem onto the Lua stack. | |
| void | clear_outstanding_TreeItem (void) |
| Clears all outstanding TreeItem objects. | |
| FieldInfo * | push_FieldInfo (lua_State *L, field_info *f) |
| Pushes a field information object onto the Lua stack. | |
| void | clear_outstanding_FieldInfo (void) |
| Clears any outstanding FieldInfo structures. | |
| void | wslua_print_stack (char *s, lua_State *L) |
| Prints the stack of a Lua state with a given prefix. | |
| void | wslua_init (register_cb cb, void *client_data, const char *app_env_var_prefix) |
| Initialize Wireshark Lua support. | |
| void | wslua_early_cleanup (void) |
| void | wslua_cleanup (void) |
| Cleans up Lua resources. | |
| tap_extractor_t | wslua_get_tap_extractor (const char *name) |
| Retrieves a tap extractor by name. | |
| int | wslua_set_tap_enums (lua_State *L) |
| Set tap enumerations in Lua. | |
| ProtoField | wslua_is_field_available (lua_State *L, const char *field_abbr) |
| char * | wslua_get_actual_filename (const char *fname) |
| Retrieves the actual filename with normalized path separators. | |
| int | wslua_bin2hex (lua_State *L, const uint8_t *data, const unsigned len, const bool lowercase, const char *sep) |
| Convert binary data to hexadecimal string. | |
| int | wslua_hex2bin (lua_State *L, const char *data, const unsigned len, const char *sep) |
| Convert hexadecimal string to binary data. | |
| int | luaopen_rex_pcre2 (lua_State *L) |
| Open the Lua library for PCRE2 regular expressions. | |
| const char * | get_current_plugin_version (void) |
| Get the current plugin version. | |
| void | clear_current_plugin_version (void) |
| Clear the current plugin version. | |
| int | wslua_deregister_heur_dissectors (lua_State *L) |
| Deregisters all Lua-based heuristics dissectors. | |
| int | wslua_deregister_protocols (lua_State *L) |
| Deregisters all Lua-based protocol dissectors. | |
| int | wslua_deregister_dissector_tables (lua_State *L) |
| Deregisters all registered dissector tables. | |
| int | wslua_deregister_listeners (lua_State *L) |
| int | wslua_deregister_fields (lua_State *L) |
| Deregisters Lua fields. | |
| int | wslua_deregister_filehandlers (lua_State *L) |
| Deregisters file handlers and menus in Wireshark's Lua environment. | |
| void | wslua_deregister_menus (void) |
| Deregisters all menus registered by Wireshark Lua. | |
| void | wslua_init_wtap_filetypes (lua_State *L) |
| Initialize Wireshark Lua file types. | |
| const wslua_conv_types_t * | wslua_inspect_convtype_enum (void) |
| Retrieves the enumeration of conversation types for Lua inspection. | |
Variables | |
| packet_info * | lua_pinfo |
| TreeItem | lua_tree |
| tvbuff_t * | lua_tvb |
| bool | lua_initialized |
| int | lua_dissectors_table_ref |
| int | lua_heur_dissectors_table_ref |
| const char * | lua_app_env_var_prefix |
| GPtrArray * | lua_outstanding_FuncSavers |
| const char * | wslua_typeof_unknown |
| #define CLEAR_OUTSTANDING | ( | C, | |
| marker, | |||
| marker_val | |||
| ) |
| #define FAIL_ON_NULL_OR_EXPIRED | ( | s | ) |
| #define WRAP_NON_LUA_EXCEPTIONS | ( | code | ) |
| #define WSLUA_ATTRIBUTE_FUNC_SETTER | ( | C, | |
| field | |||
| ) |
| #define WSLUA_ATTRIBUTE_GET | ( | C, | |
| name, | |||
| block | |||
| ) |
| #define WSLUA_ATTRIBUTE_NAMED_BOOLEAN_SETTER | ( | C, | |
| name, | |||
| member | |||
| ) |
| #define WSLUA_ATTRIBUTE_NAMED_INTEGER_SETTER | ( | C, | |
| name, | |||
| member, | |||
| cast | |||
| ) |
| #define WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_NTH_STRING_GETTER | ( | C, | |
| name, | |||
| member, | |||
| option | |||
| ) |
| #define WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_NTH_STRING_SETTER | ( | C, | |
| field, | |||
| member, | |||
| option | |||
| ) |
| #define WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_STRING_GETTER | ( | C, | |
| name, | |||
| member, | |||
| option | |||
| ) |
| #define WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_STRING_SETTER | ( | C, | |
| field, | |||
| member, | |||
| option | |||
| ) |
| #define WSLUA_ATTRIBUTE_NAMED_STRING_GETTER | ( | C, | |
| name, | |||
| member | |||
| ) |
| #define WSLUA_ATTRIBUTE_NAMED_STRING_SETTER | ( | C, | |
| field, | |||
| member, | |||
| need_free | |||
| ) |
| #define WSLUA_ATTRIBUTE_SET | ( | C, | |
| name, | |||
| block | |||
| ) |
| #define WSLUA_CLASS_DECLARE | ( | C | ) |
| #define WSLUA_STATELESS_PAIRS_BODY | ( | C | ) |
| #define wslua_touint | ( | L, | |
| i | |||
| ) | (unsigned) ( lua_tounsigned(L,i) ) |
On Lua 5.3 and later, the unsigned conversions may not be defined (depending on a compatibility define), and they're just casts if they are.
| typedef struct _wslua_class wslua_class |
Type for defining new classes.
A new class is defined as a Lua table type. Instances of this class are created through pushXxx which sets the appropriate metatable.
|
extern |
Clears outstanding function savers associated with a Lua state.
| L | The Lua state to clear function savers for. |
|
extern |
Clears all outstanding Tvb objects.
This function removes and frees all Tvb objects from the outstanding_Tvb array.
|
extern |
Creates a new TreeItem.
| tree | The parent proto_tree. |
| item | The associated proto_item. |
|
extern |
Get the current plugin version.
|
extern |
Retrieves the value of hf_wslua_text.
|
extern |
Retrieves a 64-bit unsigned integer from the Lua stack.
This function checks the type of the value at the specified index on the Lua stack and converts it to a uint64_t. It supports numbers, strings, and Int64 userdata types.
| L | The Lua state. |
| i | The index on the Lua stack where the value is located. |
|
extern |
Packs a 64-bit integer into a Lua string using the specified endianness.
| L | The Lua state. |
| b | The Lua buffer to add the packed data to. |
| idx | The index of the integer on the Lua stack. |
| asLittleEndian | Whether to pack in little-endian format. |
|
extern |
Unpacks a 64-bit integer from a buffer with specified endianness and pushes it onto the Lua stack.
| L | The Lua state. |
| buff | The buffer containing the packed integer. |
| asLittleEndian | Whether the integer is packed in little-endian format. |
|
extern |
Primes all fields in the protocol tree.
This function primes all fields in the given protocol tree, preparing them for use in Lua scripts.
| tree | The protocol tree to prime. |
|
extern |
Registers all Lua taps.
This function registers all Lua taps with Wireshark, enabling Lua scripts to create and use custom taps for packet analysis.
|
extern |
Open the Lua library for PCRE2 regular expressions.
| L | The Lua state to register the library with. |
|
extern |
Commits protocol changes.
This function commits any pending protocol changes made during the current Lua script execution.
| L | The Lua state. |
|
extern |
Registers the Lua protocol.
This function registers the Lua protocol with Wireshark, allowing Lua scripts to define and use custom protocols.
|
extern |
Pushes a field information object onto the Lua stack.
| L | The Lua state. |
| f | The field information to push. |
|
extern |
Pushes a packet information structure onto the Lua stack.
| L | The Lua state. |
| p | The Wireshark packet information structure. |
|
extern |
Pushes a TreeItem onto the Lua stack.
| L | The Lua state. |
| tree | The protocol tree associated with the item. |
| item | The protocol item to push. |
Pushes a tvbuff_t to the Lua stack as a Tvb object.
| L | The Lua state. |
| tvb | The tvbuff_t to push. |
|
extern |
Pushes a TvbRange object onto the Lua stack.
| L | The Lua state. |
| tvb | The tvbuff_t object. |
| offset | The offset within the tvbuff_t. |
| len | The length of the range to push. |
|
extern |
Pushes a Tvb object onto the Lua stack.
| L | The Lua state. |
| t | The Tvb object to push. |
|
extern |
Packs a 64-bit unsigned integer into a Lua string buffer with specified endianness.
| L | The Lua state. |
| b | The Lua buffer to pack the integer into. |
| idx | The index of the integer in the Lua stack. |
| asLittleEndian | Whether to pack the integer in little-endian format. |
|
extern |
Unpacks a 64-bit unsigned integer from a buffer with specified endianness and pushes it onto the Lua stack.
| L | The Lua state. |
| buff | The buffer containing the packed unsigned integer. |
| asLittleEndian | Whether the unsigned integer is packed in little-endian format. |
|
extern |
Concatenates two objects to a string.
This function attempts to convert the first and second arguments to strings using the __tostring metamethod, and then concatenates them. If the metamethod is not available, it pushes the value as is.
| L | The Lua state. |
|
extern |
Convert binary data to hexadecimal string.
Converts a given binary data buffer into a hexadecimal string representation.
| L | Lua state. |
| data | Pointer to the binary data. |
| len | Length of the binary data. |
| lowercase | If true, use lowercase letters in the output; otherwise, use uppercase. |
| sep | Separator between bytes in the output string. |
|
extern |
Checks if a Lua value at a given index is a boolean.
This function checks if the value at the specified index is a boolean or nil.
| L | The Lua state. |
| n | The index of the value to check. |
|
extern |
Checks if the value at the given index is a Lua string and returns it.
| L | The Lua state. |
| n | The index of the value to check. |
| l | A pointer to store the length of the string. |
|
extern |
Checks if a Lua value at a given index is a string.
| L | The Lua state. |
| n | The index of the value to check. |
|
extern |
Cleans up Lua resources.
This function closes the Lua state if it exists and resets initialization flags.
|
extern |
Deregisters all registered dissector tables.
This function iterates through all registered dissector tables and deregisters them.
| L | The Lua state. |
|
extern |
Deregisters Lua fields.
| L | The Lua state. |
|
extern |
Deregisters file handlers and menus in Wireshark's Lua environment.
This function is responsible for cleaning up resources associated with file handlers and menus registered by Lua scripts.
| L | The Lua state from which to deregister the file handlers. |
|
extern |
Deregisters all Lua-based heuristics dissectors.
This function iterates through all registered heuristic dissectors and removes them from the system.
| L | The Lua state. |
|
extern |
Deregisters all menus registered by Wireshark Lua.
This function is responsible for removing all menu items that were previously registered by Wireshark's Lua scripting interface.
|
extern |
Deregisters all Lua-based protocol dissectors.
This function iterates through all registered protocol dissectors and removes them from the system.
| L | The Lua state. |
|
extern |
Retrieves the actual filename with normalized path separators.
| fname | The original filename to process. |
|
extern |
Retrieves an expert field based on group and severity.
| group | The group of the expert field. |
| severity | The severity level of the expert field. |
|
extern |
Retrieves a tap extractor by name.
| name | The name of the tap extractor to retrieve. |
|
extern |
Checks if there are any registered field extractors.
|
extern |
Convert hexadecimal string to binary data.
| L | Lua state. |
| data | Hexadecimal string to convert. |
| len | Length of the hexadecimal string. |
| sep | Separator between bytes (optional). |
|
extern |
Initialize Wireshark Lua support.
Registers a callback function and initializes various components for Wireshark Lua.
| cb | Callback function to be registered. |
| client_data | Data to be passed to the callback function. |
| app_env_var_prefix | Prefix for application environment variables. |
|
extern |
Initialize Wireshark Lua file types.
This function initializes the Wireshark Lua file types by creating a table indexed by strings, where each entry contains a name and a corresponding file type.
| L | The Lua state to initialize. |
|
extern |
Retrieves the enumeration of conversation types for Lua inspection.
|
extern |
Query field abbr that is defined and bound to a Proto in lua. They are not registered until the end of the initialization.
|
extern |
Checks if a Lua value at a given index is a boolean and returns its value, or a default value if not.
| L | The Lua state. |
| n | The index of the value to check. |
| def | The default value to return if the value is not a boolean. |
|
extern |
Retrieves an optional boolean or integer value from the Lua stack.
| L | The Lua state. |
| n | The index of the value on the stack. |
| def | The default value if the value is not a boolean or integer. |
|
extern |
Notify Lua scripts that preferences have changed.
This function is called when Wireshark's preferences are modified, and it notifies any registered Lua scripts about this change.
|
extern |
Prime the dissector filter with a protocol tree.
This function primes the dissector filter with the protocol tree from an epan_dissect_t structure.
| edt | The epan_dissect_t structure containing the protocol tree to prime the filter with. |
|
extern |
Prints the stack of a Lua state with a given prefix.
| s | The prefix string to prepend to each stack entry. |
| L | The Lua state whose stack is to be printed. |
|
extern |
Registers attributes for a Lua table.
This function registers getter and setter functions for fields in a Lua table.
| L | The Lua state. |
| t | A pointer to the attribute table containing field names and their corresponding getter and setter functions. |
| is_getter | If true, registers only the getter functions; if false, registers both getter and setter functions. |
| void wslua_register_class | ( | lua_State * | L, |
| const wslua_class * | cls_def | ||
| ) |
Registers a new class for use in Lua with the specified properties. The metatable for the class instance is internally registered with the given name.
This functions basically creates a class (type table) with this structure:
Class = { class_methods } Class.__typeof = "Class" – NOTE: Might be removed in future Class.__metatable = { class_meta } Class.__metatable.__typeof = "Class" – NOTE: Might be removed in future Class.__metatable.__index = function_that_errors_out Class.__metatable.__newindex = function_that_errors_out
It also registers another metatable for class instances (type userdata):
mt = { instance_meta } mt.__typeof = "Class" – will be passed upvalues (see wslua_instancemeta_index_impl). mt.__index = function_that_finds_right_property_or_method_getter mt.__newindex = function_thaon_that_finds_right_property_or_method_setter
For backwards compatibility, introspection is still possible (this detail might be removed in the future though, do not rely on this!):
Class.__metatable.__methods = Class Class.__metatable.__getters = { __typeof = "getter", getter_attrs } Class.__metatable.__setters = { __typeof = "setter", setter_attrs }
| void wslua_register_classinstance_meta | ( | lua_State * | L, |
| const wslua_class * | cls_def | ||
| ) |
Registers the metatable for class instances. See the documentation of wslua_register_class for the exact metatable.
|
extern |
Set tap enumerations in Lua.
| L | The Lua state. |
|
extern |
Set functions in a Lua table.
| L | The Lua state. |
| l | Array of function definitions. |
| nup | Number of upvalues to pass to each function. |
|
extern |
Retrieves the Lua state associated with Wireshark.
This function returns a pointer to the Lua state used by Wireshark for scripting and extensions.
|
extern |
Converts a Lua value to a boolean.
This function checks if the given Lua value is a boolean or nil, and returns its boolean value. If the value is a number, it converts 0 to false and any other number to true. If the value is neither a boolean nor a number, it raises an error.
| L | The Lua state. |
| n | The index of the value on the stack. |
|
extern |
Converts a Lua value to an integer.
| L | The Lua state. |
| n | The index of the value on the stack. |