Lua: add routines to return pcap/nsec pcap/pcapng file type/subtypes.

These will be backported, for the benefit of Lua scripts that want those
specific file types/subtypes (typically in order to write files of those
types); that allows those types to be fetched without having to know the
right string to hand to wslua_wtap_name_to_file_type_subtype().

(cherry picked from commit bc3cc17bc4)
This commit is contained in:
Guy Harris 2021-02-22 22:23:54 -08:00
parent 077a9c9354
commit 4560ac0527
1 changed files with 33 additions and 0 deletions

View File

@ -83,3 +83,36 @@ WSLUA_FUNCTION wslua_wtap_name_to_file_type_subtype(lua_State* LS) {
lua_pushnumber(LS,filetype);
WSLUA_RETURN(1); /* The filetype value for the file type with that name, or nil if there is no such file type. */
}
WSLUA_FUNCTION wslua_wtap_pcap_file_type_subtype(lua_State* LS) {
/*
Get the filetype value for pcap files.
@since 3.2.12, 3.4.4
*/
lua_Number filetype = WTAP_FILE_TYPE_SUBTYPE_PCAP;
lua_pushnumber(LS,filetype);
WSLUA_RETURN(1); /* The filetype value for pcap files. */
}
WSLUA_FUNCTION wslua_wtap_pcap_nsec_file_type_subtype(lua_State* LS) {
/*
Get the filetype value for nanosecond-resolution pcap files.
@since 3.2.12, 3.4.4
*/
lua_Number filetype = WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC;
lua_pushnumber(LS,filetype);
WSLUA_RETURN(1); /* The filetype value for nanosecond-resolution pcap files. */
}
WSLUA_FUNCTION wslua_wtap_pcapng_file_type_subtype(lua_State* LS) {
/*
Get the filetype value for pcapng files.
@since 3.2.12, 3.4.4
*/
lua_Number filetype = WTAP_FILE_TYPE_SUBTYPE_PCAPNG;
lua_pushnumber(LS,filetype);
WSLUA_RETURN(1); /* The filetype value for pcapng files. */
}