29#include <ws_log_defs.h>
59#include <epan/wslua/declare_wslua.h>
65#define WSLUA_INIT_ROUTINES "init_routines"
66#define WSLUA_PREFS_CHANGED "prefs_changed"
92#define wslua_toint(L,i) (int) ( lua_tointeger(L,i) )
93#define wslua_toint32(L,i) (int32_t) ( lua_tointeger(L,i) )
94#define wslua_toint64(L,i) (int64_t) ( lua_tonumber(L,i) )
95#define wslua_touint64(L,i) (uint64_t) ( lua_tonumber(L,i) )
97#define wslua_checkint(L,i) (int) ( luaL_checkinteger(L,i) )
98#define wslua_checkint32(L,i) (int32_t) ( luaL_checkinteger(L,i) )
99#define wslua_checkint64(L,i) (int64_t) ( luaL_checknumber(L,i) )
100#define wslua_checkuint64(L,i) (uint64_t) ( luaL_checknumber(L,i) )
102#define wslua_optint(L,i,d) (int) ( luaL_optinteger(L,i,d) )
103#define wslua_optint32(L,i,d) (int32_t) ( luaL_optinteger(L,i,d) )
104#define wslua_optint64(L,i,d) (int64_t) ( luaL_optnumber(L,i,d) )
105#define wslua_optuint64(L,i,d) (uint64_t) ( luaL_optnumber(L,i,d) )
112#if LUA_VERSION_NUM < 503
113#define wslua_touint(L,i) (unsigned) ( lua_tounsigned(L,i) )
114#define wslua_touint32(L,i) (uint32_t) ( lua_tounsigned(L,i) )
115#define wslua_checkuint(L,i) (unsigned) ( luaL_checkunsigned(L,i) )
116#define wslua_checkuint32(L,i) (uint32_t) ( luaL_checkunsigned(L,i) )
117#define wslua_optuint(L,i,d) (unsigned) ( luaL_optunsigned(L,i,d) )
118#define wslua_optuint32(L,i,d) (uint32_t) ( luaL_optunsigned(L,i,d) )
120#define wslua_touint(L,i) (unsigned) ( lua_tointeger(L,i) )
121#define wslua_touint32(L,i) (uint32_t) ( lua_tointeger(L,i) )
122#define wslua_checkuint(L,i) (unsigned) ( luaL_checkinteger(L,i) )
123#define wslua_checkuint32(L,i) (uint32_t) ( luaL_checkinteger(L,i) )
124#define wslua_optuint(L,i,d) (unsigned) ( luaL_optinteger(L,i,d) )
125#define wslua_optuint32(L,i,d) (uint32_t) ( luaL_optinteger(L,i,d) )
214 int expert_info_table_ref;
221 bool is_postdissector;
286typedef void (*tap_extractor_t)(lua_State*,
const void*);
291 tap_extractor_t extractor;
332 char* internal_description;
340 int seq_read_close_ref;
341 int can_write_encap_ref;
363typedef struct {
const char* name; tap_extractor_t extractor; }
tappable_t;
375typedef GByteArray* ByteArray;
376typedef gcry_cipher_hd_t* GcryptCipher;
385typedef int64_t Int64;
386typedef uint64_t UInt64;
403typedef tvbparse_action_t* Shortcut;
418#define WSLUA_CLASS_DEFINE(C,check_code) \
419 WSLUA_CLASS_DEFINE_BASE(C,check_code,NULL)
421#define WSLUA_CLASS_DEFINE_BASE(C,check_code,retval) \
422C to##C(lua_State* L, int idx) { \
423 C* v = (C*)lua_touserdata (L, idx); \
424 if (!v) luaL_error(L, "bad argument %d (%s expected, got %s)", idx, #C, lua_typename(L, lua_type(L, idx))); \
425 return v ? *v : retval; \
427C check##C(lua_State* L, int idx) { \
429 luaL_checktype(L,idx,LUA_TUSERDATA); \
430 p = (C*)luaL_checkudata(L, idx, #C); \
432 return p ? *p : retval; \
434C* push##C(lua_State* L, C v) { \
436 luaL_checkstack(L,2,"Unable to grow stack\n"); \
437 p = (C*)lua_newuserdata(L,sizeof(C)); *p = v; \
438 luaL_getmetatable(L, #C); lua_setmetatable(L, -2); \
441bool is##C(lua_State* L,int i) { \
443 if(!lua_isuserdata(L,i)) return false; \
444 p = lua_touserdata(L, i); \
445 lua_getfield(L, LUA_REGISTRYINDEX, #C); \
446 if (p == NULL || !lua_getmetatable(L, i) || !lua_rawequal(L, -1, -2)) p=NULL; \
448 return p ? true : false; \
450C shift##C(lua_State* L,int i) { \
452 if(!lua_isuserdata(L,i)) return retval; \
453 p = (C*)lua_touserdata(L, i); \
454 lua_getfield(L, LUA_REGISTRYINDEX, #C); \
455 if (p == NULL || !lua_getmetatable(L, i) || !lua_rawequal(L, -1, -2)) p=NULL; \
457 if (p) { lua_remove(L,i); return *p; }\
463 const char *fieldname;
464 lua_CFunction getfunc;
465 lua_CFunction setfunc;
480#define WSLUA_TYPEOF_FIELD "__typeof"
485#define WSLUA_REGISTER_GC(C) \
486 luaL_getmetatable(L, #C); \
489 lua_pushcfunction(L, C ## __gc); \
490 lua_setfield(L, -2, "__gc"); \
494#define __WSLUA_REGISTER_META(C, ATTRS) { \
495 const wslua_class C ## _class = { \
497 .instance_meta = C ## _meta, \
500 wslua_register_classinstance_meta(L, &C ## _class); \
501 WSLUA_REGISTER_GC(C); \
504#define WSLUA_REGISTER_META(C) __WSLUA_REGISTER_META(C, NULL)
505#define WSLUA_REGISTER_META_WITH_ATTRS(C) \
506 __WSLUA_REGISTER_META(C, C ## _attributes)
508#define __WSLUA_REGISTER_CLASS(C, ATTRS) { \
509 const wslua_class C ## _class = { \
511 .class_methods = C ## _methods, \
512 .class_meta = C ## _meta, \
513 .instance_methods = C ## _methods, \
514 .instance_meta = C ## _meta, \
517 wslua_register_class(L, &C ## _class); \
518 WSLUA_REGISTER_GC(C); \
521#define WSLUA_REGISTER_CLASS(C) __WSLUA_REGISTER_CLASS(C, NULL)
522#define WSLUA_REGISTER_CLASS_WITH_ATTRS(C) \
523 __WSLUA_REGISTER_CLASS(C, C ## _attributes)
525#define WSLUA_INIT(L) \
527 wslua_register_classes(L); \
528 wslua_register_functions(L);
532#define WSLUA_FUNCTION extern int
534#define WSLUA_INTERNAL_FUNCTION extern int
536#define WSLUA_REGISTER_FUNCTION(name) { lua_pushcfunction(L, wslua_## name); lua_setglobal(L, #name); }
538#define WSLUA_REGISTER extern int
540#define WSLUA_METHOD static int
541#define WSLUA_CONSTRUCTOR static int
542#define WSLUA_ATTR_SET static int
543#define WSLUA_ATTR_GET static int
544#define WSLUA_METAMETHOD static int
546#define WSLUA_METHODS static const luaL_Reg
547#define WSLUA_META static const luaL_Reg
548#define WSLUA_CLASS_FNREG(class,name) { #name, class##_##name }
549#define WSLUA_CLASS_FNREG_ALIAS(class,aliasname,name) { #aliasname, class##_##name }
550#define WSLUA_CLASS_MTREG(class,name) { "__" #name, class##__##name }
552#define WSLUA_ATTRIBUTES static const wslua_attribute_table
554#define WSLUA_ATTRIBUTE_RWREG(class,name) { #name, class##_get_##name, class##_set_##name }
555#define WSLUA_ATTRIBUTE_ROREG(class,name) { #name, class##_get_##name, NULL }
556#define WSLUA_ATTRIBUTE_WOREG(class,name) { #name, NULL, class##_set_##name }
563#define WSLUA_STATELESS_PAIRS_BODY(C) \
565 lua_pushcfunction(L, C##_pairs_iter); \
566 lua_pushvalue(L, 1); \
570#define WSLUA_ATTRIBUTE_FUNC_SETTER(C,field) \
571 static int C##_set_##field (lua_State* L) { \
572 C obj = check##C (L,1); \
573 if (! lua_isfunction(L,-1) ) \
574 return luaL_error(L, "%s's attribute `%s' must be a function", #C , #field ); \
575 if (obj->field##_ref != LUA_NOREF) \
577 luaL_unref(L, LUA_REGISTRYINDEX, obj->field##_ref); \
578 obj->field##_ref = luaL_ref(L, LUA_REGISTRYINDEX); \
582 typedef void __dummy##C##_set_##field
584#define WSLUA_ATTRIBUTE_GET(C,name,block) \
585 static int C##_get_##name (lua_State* L) { \
586 C obj = check##C (L,1); \
591 typedef void __dummy##C##_get_##name
593#define WSLUA_ATTRIBUTE_NAMED_BOOLEAN_GETTER(C,name,member) \
594 WSLUA_ATTRIBUTE_GET(C,name,{lua_pushboolean(L, obj->member );})
596#define WSLUA_ATTRIBUTE_NAMED_INTEGER_GETTER(C,name,member) \
597 WSLUA_ATTRIBUTE_GET(C,name,{lua_pushinteger(L,(lua_Integer)(obj->member));})
599#define WSLUA_ATTRIBUTE_INTEGER_GETTER(C,member) \
600 WSLUA_ATTRIBUTE_NAMED_INTEGER_GETTER(C,member,member)
602#define WSLUA_ATTRIBUTE_BLOCK_NUMBER_GETTER(C,name,block) \
603 WSLUA_ATTRIBUTE_GET(C,name,{lua_pushnumber(L,(lua_Number)(block));})
605#define WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(C,name,member) \
606 WSLUA_ATTRIBUTE_GET(C,name, { \
607 lua_pushstring(L,obj->member); \
610#define WSLUA_ATTRIBUTE_STRING_GETTER(C,member) \
611 WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(C,member,member)
613#define WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_STRING_GETTER(C,name,member,option) \
614 WSLUA_ATTRIBUTE_GET(C,name, { \
616 if ((obj->member) && (obj->member->len > 0)) { \
617 if (wtap_block_get_string_option_value(g_array_index(obj->member, wtap_block_t, 0), option, &str) == WTAP_OPTTYPE_SUCCESS) { \
618 lua_pushstring(L,str); \
627#define WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_NTH_STRING_GETTER(C,name,member,option) \
628 WSLUA_ATTRIBUTE_GET(C,name, { \
630 if ((obj->member) && (obj->member->len > 0)) { \
631 if (wtap_block_get_nth_string_option_value(g_array_index(obj->member, wtap_block_t, 0), option, 0, &str) == WTAP_OPTTYPE_SUCCESS) { \
632 lua_pushstring(L,str); \
637#define WSLUA_ATTRIBUTE_SET(C,name,block) \
638 static int C##_set_##name (lua_State* L) { \
639 C obj = check##C (L,1); \
644 typedef void __dummy##C##_set_##name
646#define WSLUA_ATTRIBUTE_NAMED_BOOLEAN_SETTER(C,name,member) \
647 WSLUA_ATTRIBUTE_SET(C,name, { \
648 if (! lua_isboolean(L,-1) ) \
649 return luaL_error(L, "%s's attribute `%s' must be a boolean", #C , #name ); \
650 obj->member = lua_toboolean(L,-1); \
655#define WSLUA_ATTRIBUTE_NAMED_INTEGER_SETTER(C,name,member,cast) \
656 WSLUA_ATTRIBUTE_SET(C,name, { \
657 if (! lua_isinteger(L,-1) ) \
658 return luaL_error(L, "%s's attribute `%s' must be an integer", #C , #name ); \
659 obj->member = (cast) wslua_toint32(L,-1); \
662#define WSLUA_ATTRIBUTE_INTEGER_SETTER(C,member,cast) \
663 WSLUA_ATTRIBUTE_NAMED_INTEGER_SETTER(C,member,member,cast)
665#define WSLUA_ATTRIBUTE_NAMED_STRING_SETTER(C,field,member,need_free) \
666 static int C##_set_##field (lua_State* L) { \
667 C obj = check##C (L,1); \
669 if (lua_isstring(L,-1) || lua_isnil(L,-1)) { \
670 s = g_strdup(lua_tostring(L,-1)); \
672 return luaL_error(L, "%s's attribute `%s' must be a string or nil", #C , #field ); \
674 if (obj->member != NULL && need_free) \
675 g_free((void*) obj->member); \
680 typedef void __dummy##C##_set_##field
682#define WSLUA_ATTRIBUTE_STRING_SETTER(C,field,need_free) \
683 WSLUA_ATTRIBUTE_NAMED_STRING_SETTER(C,field,field,need_free)
685#define WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_STRING_SETTER(C,field,member,option) \
686 static int C##_set_##field (lua_State* L) { \
687 C obj = check##C (L,1); \
689 if (lua_isstring(L,-1) || lua_isnil(L,-1)) { \
690 s = g_strdup(lua_tostring(L,-1)); \
692 return luaL_error(L, "%s's attribute `%s' must be a string or nil", #C , #field ); \
694 if ((obj->member) && (obj->member->len > 0)) { \
695 wtap_block_set_string_option_value(g_array_index(obj->member, wtap_block_t, 0), option, s, strlen(s)); \
701 typedef void __dummy##C##_set_##field
703#define WSLUA_ATTRIBUTE_NAMED_OPT_BLOCK_NTH_STRING_SETTER(C,field,member,option) \
704 static int C##_set_##field (lua_State* L) { \
705 C obj = check##C (L,1); \
707 if (lua_isstring(L,-1) || lua_isnil(L,-1)) { \
708 s = g_strdup(lua_tostring(L,-1)); \
710 return luaL_error(L, "%s's attribute `%s' must be a string or nil", #C , #field ); \
712 if ((obj->member) && (obj->member->len > 0)) { \
713 wtap_block_set_nth_string_option_value(g_array_index(obj->member, wtap_block_t, 0), option, 0, s, strlen(s)); \
719 typedef void __dummy##C##_set_##field
721#define WSLUA_ERROR(name,error) { luaL_error(L, "%s%s", #name ": ", error); }
722#define WSLUA_ARG_ERROR(name,attr,error) { luaL_argerror(L,WSLUA_ARG_ ## name ## _ ## attr, #name ": " error); }
723#define WSLUA_OPTARG_ERROR(name,attr,error) { luaL_argerror(L,WSLUA_OPTARG_##name##_ ##attr, #name ": " error); }
725#define WSLUA_REG_GLOBAL_BOOL(L,n,v) { lua_pushboolean(L,v); lua_setglobal(L,n); }
726#define WSLUA_REG_GLOBAL_STRING(L,n,v) { lua_pushstring(L,v); lua_setglobal(L,n); }
727#define WSLUA_REG_GLOBAL_INTEGER(L,n,v) { lua_pushinteger(L,v); lua_setglobal(L,n); }
729#define WSLUA_RETURN(i) return (i)
731#define WSLUA_API extern
736#define FAIL_ON_NULL(s) if (! *p) luaL_argerror(L,idx,"null " s)
738#define FAIL_ON_NULL_OR_EXPIRED(s) if (!*p) { \
739 luaL_argerror(L,idx,"null " s); \
740 } else if ((*p)->expired) { \
741 luaL_argerror(L,idx,"expired " s); \
745#define CLEAR_OUTSTANDING(C, marker, marker_val) void clear_outstanding_##C(void) { \
746 while (outstanding_##C->len) { \
747 C p = (C)g_ptr_array_remove_index_fast(outstanding_##C,0); \
749 if (p->marker != marker_val) \
750 p->marker = marker_val; \
757#define WSLUA_CLASS_DECLARE(C) \
758extern C to##C(lua_State* L, int idx); \
759extern C check##C(lua_State* L, int idx); \
760extern C* push##C(lua_State* L, C v); \
761extern int C##_register(lua_State* L); \
762extern bool is##C(lua_State* L,int i); \
763extern C shift##C(lua_State* L,int i)
767#define THROW_LUA_ERROR(...) \
768 THROW_FORMATTED(DissectorError, __VA_ARGS__)
789#define WRAP_NON_LUA_EXCEPTIONS(code) \
791 volatile bool has_error = false; \
794 } CATCH3(BoundsError, FragmentBoundsError, ScsiBoundsError) { \
795 show_exception(lua_tvb, lua_pinfo, lua_tree->tree, EXCEPT_CODE, GET_MESSAGE); \
797 show_exception(lua_tvb, lua_pinfo, lua_tree->tree, EXCEPT_CODE, GET_MESSAGE); \
798 lua_pushfstring(L, "%s: %s", __func__, GET_MESSAGE ? GET_MESSAGE : "Malformed packet"); \
801 if (has_error) { lua_error(L); } \
808extern bool lua_initialized;
809extern int lua_dissectors_table_ref;
810extern int lua_heur_dissectors_table_ref;
811extern const char* lua_app_env_var_prefix;
812extern GPtrArray* lua_outstanding_FuncSavers;
814WSLUA_DECLARE_CLASSES()
815WSLUA_DECLARE_FUNCTIONS()
935extern void wslua_setfuncs(lua_State *L,
const luaL_Reg *l,
int nup);
936extern const char* wslua_typeof_unknown;
937extern const char* wslua_typeof(lua_State *L,
int idx);
938extern bool wslua_get_table(lua_State *L,
int idx,
const char *name);
939extern bool wslua_get_field(lua_State *L,
int idx,
const char *name);
1035extern void Int64_pack(lua_State* L, luaL_Buffer *b,
int idx,
bool asLittleEndian);
1045extern int Int64_unpack(lua_State* L,
const char *buff,
bool asLittleEndian);
1055extern void UInt64_pack(lua_State* L, luaL_Buffer *b,
int idx,
bool asLittleEndian);
1065extern int UInt64_unpack(lua_State* L,
const char *buff,
bool asLittleEndian);
1077extern uint64_t
getUInt64(lua_State *L,
int i);
1203extern void wslua_early_cleanup(
void);
1250extern int wslua_bin2hex(lua_State* L,
const uint8_t* data,
const unsigned len,
const bool lowercase,
const char* sep);
1261extern int wslua_hex2bin(lua_State* L,
const char* data,
const unsigned len,
const char* sep);
1312extern int wslua_deregister_listeners(lua_State* L);
Definition tap-funnel.c:21
Definition packet_info.h:40
Definition tvbparse.h:160
Represents an instance of a per-packet parser for tvbuff data.
Definition tvbparse.h:148
Describes a parsing rule or expectation for a tvbuff parser.
Definition tvbparse.h:93
Type for defining new classes.
Definition wslua.h:834
const wslua_attribute_table * attrs
Definition wslua.h:840
const luaL_Reg * class_meta
Definition wslua.h:837
const char * name
Definition wslua.h:835
const luaL_Reg * class_methods
Definition wslua.h:836
const luaL_Reg * instance_methods
Definition wslua.h:838
const luaL_Reg * instance_meta
Definition wslua.h:839
uat_field_t * uat_field_list
Definition wslua.h:196
struct _wslua_pref_t::@509::@511 uat_field_list_info
bool radio_buttons
Definition wslua.h:190
struct _wslua_pref_t::@509::@510 enum_info
char * default_s
Definition wslua.h:198
uint32_t max_value
Definition wslua.h:187
const enum_val_t * enumvals
Definition wslua.h:189
union _wslua_pref_t::@509 info
Definition packet-bt-dht.c:97
Definition conversation.h:227
Definition column-info.h:59
Definition epan_dissect.h:25
Definition prefs-int.h:24
Definition progress_frame.h:31
Definition tvbuff-int.h:33
Wiretap dumper handle and associated state.
Definition wtap_module.h:163
Definition file_wrappers.c:96
Definition wtap_module.h:58
void clear_outstanding_TvbRange(void)
Clears all outstanding TvbRange objects.
Definition wslua_tvb.c:396
void wslua_init(register_cb cb, void *client_data, const char *app_env_var_prefix)
Initialize Wireshark Lua support.
Definition init_wslua.c:1639
tap_extractor_t wslua_get_tap_extractor(const char *name)
Retrieves a tap extractor by name.
void wslua_print_stack(char *s, lua_State *L)
Prints the stack of a Lua state with a given prefix.
Definition wslua_internals.c:167
int push_wsluaTvb(lua_State *L, Tvb t)
Pushes a Tvb object onto the Lua stack.
Definition wslua_tvb.c:77
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.
Definition wslua_internals.c:119
const char * wslua_checkstring_only(lua_State *L, int n)
Checks if a Lua value at a given index is a string.
Definition wslua_internals.c:129
void lua_prime_all_fields(proto_tree *tree)
Primes all fields in the protocol tree.
void clear_outstanding_Column(void)
Clears all outstanding Column objects.
Definition wslua_column.c:28
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 ...
Definition wslua_int64.c:661
void wslua_cleanup(void)
Cleans up Lua resources.
Definition init_wslua.c:2086
int wslua_deregister_protocols(lua_State *L)
Deregisters all Lua-based protocol dissectors.
Definition wslua_proto.c:791
TreeItem create_TreeItem(proto_tree *tree, proto_item *item)
Creates a new TreeItem.
Definition wslua_tree.c:43
FieldInfo * push_FieldInfo(lua_State *L, field_info *f)
Pushes a field information object onto the Lua stack.
Definition wslua_field.c:36
void wslua_register_class(lua_State *L, const wslua_class *cls_def)
Definition wslua_internals.c:547
const char * get_current_plugin_version(void)
Get the current plugin version.
Definition wslua_utility.c:32
int wslua_deregister_dissector_tables(lua_State *L)
Deregisters all registered dissector tables.
Definition wslua_dissector.c:1111
int wslua_deregister_filehandlers(lua_State *L)
Deregisters file handlers and menus in Wireshark's Lua environment.
int luaopen_rex_pcre2(lua_State *L)
Open the Lua library for PCRE2 regular expressions.
Definition lpcre2.c:484
void wslua_prefs_changed(void)
Notify Lua scripts that preferences have changed.
Definition init_wslua.c:656
lua_State * wslua_state(void)
Retrieves the Lua state associated with Wireshark.
Definition init_wslua.c:2095
Pinfo * push_Pinfo(lua_State *L, packet_info *p)
Pushes a packet information structure onto the Lua stack.
Definition wslua_pinfo.c:39
void clear_outstanding_Pinfo(void)
Clears all outstanding Pinfo objects.
Definition wslua_pinfo.c:36
bool wslua_has_field_extractors(void)
Checks if there are any registered field extractors.
Definition wslua_field.c:521
int wslua_deregister_fields(lua_State *L)
Deregisters Lua fields.
int wslua_optboolint(lua_State *L, int n, int def)
Retrieves an optional boolean or integer value from the Lua stack.
Definition wslua_internals.c:102
int get_hf_wslua_text(void)
Retrieves the value of hf_wslua_text.
Definition init_wslua.c:187
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.
Definition wslua_internals.c:69
int wslua_deregister_heur_dissectors(lua_State *L)
Deregisters all Lua-based heuristics dissectors.
Definition wslua_proto.c:775
int wslua_reg_attributes(lua_State *L, const wslua_attribute_table *t, bool is_getter)
Registers attributes for a Lua table.
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.
Definition wslua_int64.c:620
void wslua_deregister_menus(void)
Deregisters all menus registered by Wireshark Lua.
Definition wslua_gui.c:103
void clear_current_plugin_version(void)
Clear the current plugin version.
Definition wslua_utility.c:36
void clear_outstanding_Columns(void)
Clears all outstanding Column objects.
Definition wslua_column.c:29
void clear_outstanding_FieldInfo(void)
Clears any outstanding FieldInfo structures.
Definition wslua_field.c:44
int wslua__concat(lua_State *L)
Concatenates two objects to a string.
Definition wslua_internals.c:27
bool push_TvbRange(lua_State *L, tvbuff_t *tvb, int offset, int len)
Pushes a TvbRange object onto the Lua stack.
Definition wslua_tvb.c:404
expert_field * wslua_get_expert_field(const int group, const int severity)
Retrieves an expert field based on group and severity.
Definition init_wslua.c:1170
bool wslua_toboolean(lua_State *L, int n)
Converts a Lua value to a boolean.
Definition wslua_internals.c:44
ProtoField wslua_is_field_available(lua_State *L, const char *field_abbr)
Definition wslua_proto.c:744
int Proto_commit(lua_State *L)
Commits protocol changes.
Definition wslua_proto.c:875
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.
Definition wslua_int64.c:169
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.
Definition wslua_internals.c:318
void clear_outstanding_Tvb(void)
Clears all outstanding Tvb objects.
Definition wslua_tvb.c:98
void wslua_register_classinstance_meta(lua_State *L, const wslua_class *cls_def)
Definition wslua_internals.c:470
void wslua_init_wtap_filetypes(lua_State *L)
Initialize Wireshark Lua file types.
Definition wslua_wtap.c:111
struct _wslua_class wslua_class
Type for defining new classes.
Tvb * push_Tvb(lua_State *L, tvbuff_t *tvb)
Pushes a tvbuff_t to the Lua stack as a Tvb object.
Definition wslua_tvb.c:106
void proto_register_lua(void)
Registers the Lua protocol.
char * wslua_get_actual_filename(const char *fname)
Retrieves the actual filename with normalized path separators.
Definition wslua_utility.c:373
const wslua_conv_types_t * wslua_inspect_convtype_enum(void)
Retrieves the enumeration of conversation types for Lua inspection.
Definition wslua_conversation.c:77
bool wslua_checkboolean(lua_State *L, int n)
Checks if a Lua value at a given index is a boolean.
Definition wslua_internals.c:60
int wslua_set_tap_enums(lua_State *L)
Set tap enumerations in Lua.
void clear_outstanding_FuncSavers(lua_State *L)
Clears outstanding function savers associated with a Lua state.
Definition wslua_proto.c:49
void clear_outstanding_PrivateTable(void)
Clears any outstanding PrivateTable entries.
Definition wslua_pinfo.c:37
GString * lua_register_all_taps(void)
Registers all Lua taps.
uint64_t getUInt64(lua_State *L, int i)
Retrieves a 64-bit unsigned integer from the Lua stack.
Definition wslua_int64.c:599
lua_Integer wslua_tointeger(lua_State *L, int n)
Converts a Lua value to an integer.
Definition wslua_internals.c:85
void clear_outstanding_TreeItem(void)
Clears all outstanding TreeItem objects.
Definition wslua_tree.c:53
void wslua_prime_dfilter(epan_dissect_t *edt)
Prime the dissector filter with a protocol tree.
Definition wslua_field.c:514
TreeItem push_TreeItem(lua_State *L, proto_tree *tree, proto_item *item)
Pushes a TreeItem onto the Lua stack.
Definition wslua_tree.c:30
int wslua_hex2bin(lua_State *L, const char *data, const unsigned len, const char *sep)
Convert hexadecimal string to binary data.
Definition wslua_internals.c:375
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.
Definition wslua_int64.c:128
void wslua_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
Set functions in a Lua table.
Definition wslua_internals.c:134