forked from osmocom/wireshark
WSDG: deprecate wtap_filetypes.
Recommend the use of wtap_name_to_file_type_subtype() to get filetype
values, unless you need to run on older versions of Wireshark that don't
have it.
Don't even *mention* wtap_filetypes in the documentation for the new
wtap_ routines, as, if you have those routines, you have
wtap_name_to_file_type_subtype(), because it's one of those routines.
Fix references to "nul" while we're at it - it's "nil" in Lua.
(That part of the WSDG - the Lua reference - is generated, so this
involves changing the source code implementing the Lua routines.)
(cherry picked from commit 5b3c3d0682
)
This commit is contained in:
parent
3213fb0a19
commit
66e6f092f9
|
@ -20,7 +20,11 @@
|
|||
|
||||
The classes/functions defined in this module are for using a `Dumper` object to
|
||||
make Wireshark save a capture file to disk. `Dumper` represents Wireshark's built-in
|
||||
file format writers (see the `wtap_filetypes` table in `init.lua`).
|
||||
file format writers (see the `wtap_name_to_file_type_subtype` function).
|
||||
|
||||
(The `wtap_filetypes` table in `init.lua` is deprecated, and should
|
||||
only be used in code that must run on Wireshark 3.4.3 and earlier 3.4
|
||||
releases or in Wireshark 3.2.11 and earlier 3.2.x releases.)
|
||||
|
||||
To have a Lua script create its own file format writer, see the chapter titled
|
||||
"Custom file format reading/writing".
|
||||
|
@ -197,7 +201,12 @@ WSLUA_CONSTRUCTOR Dumper_new(lua_State* L) {
|
|||
`Dumper:new_for_current()` will probably be a better choice.
|
||||
*/
|
||||
#define WSLUA_ARG_Dumper_new_FILENAME 1 /* The name of the capture file to be created. */
|
||||
#define WSLUA_OPTARG_Dumper_new_FILETYPE 2 /* The type of the file to be created - a number entry from the `wtap_filetypes` table in `init.lua`. */
|
||||
#define WSLUA_OPTARG_Dumper_new_FILETYPE 2 /* The type of the file to be created - a number returned by `wtap_name_to_file_type_subtype()`.
|
||||
(The `wtap_filetypes` table in `init.lua`
|
||||
is deprecated, and should only be used
|
||||
in code that must run on Wireshark 3.4.3 and earlier 3.4 releases
|
||||
or in Wireshark 3.2.11 and earlier
|
||||
3.2.x releases.) */
|
||||
#define WSLUA_OPTARG_Dumper_new_ENCAP 3 /* The encapsulation to be used in the file to be created - a number entry from the `wtap_encaps` table in `init.lua`. */
|
||||
Dumper d;
|
||||
const char* fname = luaL_checkstring(L,WSLUA_ARG_Dumper_new_FILENAME);
|
||||
|
|
|
@ -27,7 +27,7 @@ WSLUA_FUNCTION wslua_wtap_file_type_subtype_description(lua_State* LS) {
|
|||
|
||||
@since 3.2.12, 3.4.4
|
||||
*/
|
||||
#define WSLUA_ARG_file_type_subtype_description_FILETYPE 1 /* The type for which the description is to be fetched - a number entry from the `wtap_filetypes` table in `init.lua`. */
|
||||
#define WSLUA_ARG_file_type_subtype_description_FILETYPE 1 /* The type for which the description is to be fetched - a number returned by `wtap_name_to_file_type_subtype()`. */
|
||||
lua_Number filetype = luaL_checknumber(LS,WSLUA_ARG_file_type_subtype_description_FILETYPE);
|
||||
/* wtap_file_type_subtype_string()'s name isn't really descriptive. */
|
||||
if (filetype > INT_MAX) {
|
||||
|
@ -40,7 +40,7 @@ WSLUA_FUNCTION wslua_wtap_file_type_subtype_description(lua_State* LS) {
|
|||
else
|
||||
lua_pushstring(LS,str);
|
||||
}
|
||||
WSLUA_RETURN(1); /* The description of the file type with that filetype value, or nul if there is no such file type. */
|
||||
WSLUA_RETURN(1); /* The description of the file type with that filetype value, or nil if there is no such file type. */
|
||||
}
|
||||
|
||||
WSLUA_FUNCTION wslua_wtap_file_type_subtype_name(lua_State* LS) {
|
||||
|
@ -50,7 +50,7 @@ WSLUA_FUNCTION wslua_wtap_file_type_subtype_name(lua_State* LS) {
|
|||
|
||||
@since 3.2.12, 3.4.4
|
||||
*/
|
||||
#define WSLUA_ARG_file_type_subtype_name_FILETYPE 1 /* The type for which the name is to be fetched - a number entry from the `wtap_filetypes` table in `init.lua`. */
|
||||
#define WSLUA_ARG_file_type_subtype_name_FILETYPE 1 /* The type for which the name is to be fetched - a number returned by `wtap_name_to_file_type_subtype()`. */
|
||||
lua_Number filetype = luaL_checknumber(LS,WSLUA_ARG_file_type_subtype_name_FILETYPE);
|
||||
/* wtap_file_type_subtype_string()'s name isn't really descriptive. */
|
||||
if (filetype > INT_MAX) {
|
||||
|
@ -63,7 +63,7 @@ WSLUA_FUNCTION wslua_wtap_file_type_subtype_name(lua_State* LS) {
|
|||
else
|
||||
lua_pushstring(LS,str);
|
||||
}
|
||||
WSLUA_RETURN(1); /* The name of the file type with that filetype value, or nul if there is no such file type. */
|
||||
WSLUA_RETURN(1); /* The name of the file type with that filetype value, or nil if there is no such file type. */
|
||||
}
|
||||
|
||||
WSLUA_FUNCTION wslua_wtap_name_to_file_type_subtype(lua_State* LS) {
|
||||
|
@ -73,7 +73,7 @@ WSLUA_FUNCTION wslua_wtap_name_to_file_type_subtype(lua_State* LS) {
|
|||
|
||||
@since 3.2.12, 3.4.4
|
||||
*/
|
||||
#define WSLUA_ARG_name_to_file_type_subtype_NAME 1 /* A timestamp value to convert. */
|
||||
#define WSLUA_ARG_name_to_file_type_subtype_NAME 1 /* The name of a file type. */
|
||||
const char* name = luaL_checkstring(LS,WSLUA_ARG_name_to_file_type_subtype_NAME);
|
||||
/* wtap_short_string_to_file_type_subtype()'s name isn't really descriptive. */
|
||||
lua_Number filetype = wtap_short_string_to_file_type_subtype(name);
|
||||
|
|
Loading…
Reference in New Issue