summaryrefslogtreecommitdiff
path: root/epan/wslua/wslua.h
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-02-02 22:49:30 -0500
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2014-02-14 10:11:50 +0000
commitc4f1777a97415b8b7d76eda27dcd6f238501e5f3 (patch)
treecbbd054deb3b70052b9cf95e655378b941005e43 /epan/wslua/wslua.h
parent7a503703ac0c4ce5bc00225d6cd61d83c1ff947e (diff)
downloadwireshark-c4f1777a97415b8b7d76eda27dcd6f238501e5f3.tar.gz
Adds support for Lua struct library so one can pack/unpack binary structures
This is based on Roberto Ierusalimschy's struct library, along with additional options based on Flemming Madsen's patch to the lua-users mailing list, and some changes I made to support 64-bit integer packing/unpacking. Details are in the top comments for wslua_struct.c. This also includes a test script. Change-Id: Ifcd0116ba013d5c760927721c8d6e9f28965534b Reviewed-on: https://code.wireshark.org/review/98 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/wslua/wslua.h')
-rw-r--r--epan/wslua/wslua.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index 4cb16d2588..6deef65468 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -256,6 +256,7 @@ typedef tvbparse_action_t* Shortcut;
typedef struct _wslua_main* WireShark;
typedef struct _wslua_dir* Dir;
typedef struct _wslua_private_table* PrivateTable;
+typedef gchar* Struct;
/*
* toXxx(L,idx) gets a Xxx from an index (Lua Error if fails)
@@ -450,6 +451,11 @@ extern void lua_prime_all_fields(proto_tree* tree);
extern int Proto_commit(lua_State* L);
+extern void Int64_pack(lua_State* L, luaL_Buffer *b, gint idx, gboolean asLittleEndian);
+extern int Int64_unpack(lua_State* L, const gchar *buff, gboolean asLittleEndian);
+extern void UInt64_pack(lua_State* L, luaL_Buffer *b, gint idx, gboolean asLittleEndian);
+extern int UInt64_unpack(lua_State* L, const gchar *buff, gboolean asLittleEndian);
+
extern Tvb* push_Tvb(lua_State* L, tvbuff_t* tvb);
extern gboolean push_TvbRange(lua_State* L, tvbuff_t* tvb, int offset, int len);
extern void clear_outstanding_Tvb(void);