mirror of
https://github.com/bol-van/zapret2.git
synced 2026-03-14 06:13:09 +00:00
nfqws2: remove unused lua code
This commit is contained in:
231
nfq2/lua.c
231
nfq2/lua.c
@@ -2545,220 +2545,6 @@ static int luacall_resolve_range(lua_State *L)
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
|
||||
static int luacall_tls_record_is_tls_client_hello(lua_State *L)
|
||||
{
|
||||
// (blob,partialOK)
|
||||
lua_check_argc_range(L,"tls_record_is_tls_client_hello",1,2);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
int argc=lua_gettop(L);
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
bool bPartialOK = argc>=2 && lua_toboolean(L,2);
|
||||
|
||||
lua_pushboolean(L,IsTLSClientHello(data,len,bPartialOK));
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_record_is_tls_server_hello(lua_State *L)
|
||||
{
|
||||
// (blob,partialOK)
|
||||
lua_check_argc_range(L,"tls_record_is_tls_server_hello",1,2);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
int argc=lua_gettop(L);
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
bool bPartialOK = argc>=2 && lua_toboolean(L,2);
|
||||
|
||||
lua_pushboolean(L,IsTLSServerHello(data,len,bPartialOK));
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_handshake_is_tls_client_hello(lua_State *L)
|
||||
{
|
||||
// (blob,partialOK)
|
||||
lua_check_argc_range(L,"tls_handshake_is_tls_client_hello",1,2);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
int argc=lua_gettop(L);
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
bool bPartialOK = argc>=2 && lua_toboolean(L,2);
|
||||
|
||||
lua_pushboolean(L,IsTLSHandshakeClientHello(data,len,bPartialOK));
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_handshake_is_tls_server_hello(lua_State *L)
|
||||
{
|
||||
// (blob,partialOK)
|
||||
lua_check_argc_range(L,"tls_handshake_is_tls_server_hello",1,2);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
int argc=lua_gettop(L);
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
bool bPartialOK = argc>=2 && lua_toboolean(L,2);
|
||||
|
||||
lua_pushboolean(L,IsTLSHandshakeServerHello(data,len,bPartialOK));
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_record_find_ext(lua_State *L)
|
||||
{
|
||||
// (blob,type,partialOK)
|
||||
lua_check_argc_range(L,"tls_record_find_ext",2,3);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
int argc=lua_gettop(L);
|
||||
size_t len, len_ext;
|
||||
const uint8_t *ext, *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
luaL_checktype(L,2,LUA_TNUMBER);
|
||||
uint16_t type = (uint16_t)lua_tointeger(L,2);
|
||||
bool bPartialOK = argc>=3 && lua_toboolean(L,3);
|
||||
|
||||
bool b = TLSFindExt(data, len, type, &ext, &len_ext, bPartialOK);
|
||||
lua_pushinteger(L,b ? ext-data+1 : 0);
|
||||
lua_pushinteger(L,b ? len_ext : 0);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,2)
|
||||
}
|
||||
static int luacall_tls_handshake_find_ext(lua_State *L)
|
||||
{
|
||||
// (blob,type,partialOK)
|
||||
lua_check_argc_range(L,"tls_handshake_find_ext",2,3);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
int argc=lua_gettop(L);
|
||||
size_t len, len_ext;
|
||||
const uint8_t *ext, *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
luaL_checktype(L,2,LUA_TNUMBER);
|
||||
uint16_t type = (uint16_t)lua_tointeger(L,2);
|
||||
bool bPartialOK = argc>=3 && lua_toboolean(L,3);
|
||||
|
||||
bool b = TLSFindExtInHandshake(data, len, type, &ext, &len_ext, bPartialOK);
|
||||
lua_pushinteger(L,b ? ext-data+1 : 0);
|
||||
lua_pushinteger(L,b ? len_ext : 0);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,2)
|
||||
}
|
||||
static int luacall_tls_record_find_extlen(lua_State *L)
|
||||
{
|
||||
// (blob)
|
||||
lua_check_argc(L,"tls_record_find_extlen",1);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
size_t len, offset;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
|
||||
bool b = TLSFindExtLen(data, len, &offset);
|
||||
lua_pushinteger(L,b ? offset+1 : 0);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_handshake_find_extlen(lua_State *L)
|
||||
{
|
||||
// (blob)
|
||||
lua_check_argc(L,"tls_handshake_find_extlen",1);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
size_t len, offset;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
|
||||
bool b = TLSFindExtLenOffsetInHandshake(data, len, &offset);
|
||||
lua_pushinteger(L,b ? offset+1 : 0);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_record_len(lua_State *L)
|
||||
{
|
||||
// (blob)
|
||||
lua_check_argc(L,"tls_record_len",1);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
lua_pushinteger(L,IsTLSHello(data,len,0,true) ? TLSRecordLen(data) : 0);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_record_data_len(lua_State *L)
|
||||
{
|
||||
// (blob)
|
||||
lua_check_argc(L,"tls_record_data_len",1);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
lua_pushinteger(L,IsTLSHello(data,len,0,true) ? TLSRecordDataLen(data) : 0);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_record_is_full(lua_State *L)
|
||||
{
|
||||
// (blob)
|
||||
lua_check_argc(L,"tls_record_is_full",1);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
lua_pushboolean(L,IsTLSHello(data,len,0,true) && IsTLSRecordFull(data,len) );
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_handshake_len(lua_State *L)
|
||||
{
|
||||
// (blob)
|
||||
lua_check_argc(L,"tls_handshake_len",1);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
lua_pushinteger(L,IsTLSHandshakeHello(data,len,0,true) ? TLSHandshakeLen(data) : 0);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_handshake_data_len(lua_State *L)
|
||||
{
|
||||
// (blob)
|
||||
lua_check_argc(L,"tls_handshake_data_len",1);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
lua_pushinteger(L,IsTLSHandshakeHello(data,len,0,true) ? TLSHandshakeDataLen(data) : 0);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
static int luacall_tls_handshake_is_full(lua_State *L)
|
||||
{
|
||||
// (blob)
|
||||
lua_check_argc(L,"tls_handshake_is_full",1);
|
||||
|
||||
LUA_STACK_GUARD_ENTER(L)
|
||||
|
||||
size_t len;
|
||||
const uint8_t *data = (uint8_t*)luaL_checklstring(L,1,&len);
|
||||
lua_pushboolean(L,IsTLSHandshakeFull(data,len));
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
|
||||
|
||||
static int luacall_tls_mod(lua_State *L)
|
||||
{
|
||||
// (blob, modlist, payload)
|
||||
@@ -2806,6 +2592,7 @@ static int luacall_tls_mod(lua_State *L)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
|
||||
@@ -3337,21 +3124,7 @@ static void lua_init_functions(void)
|
||||
{"resolve_multi_pos",luacall_resolve_multi_pos},
|
||||
{"resolve_range",luacall_resolve_range},
|
||||
|
||||
// tls parse functions
|
||||
{"tls_record_is_tls_client_hello",luacall_tls_record_is_tls_client_hello},
|
||||
{"tls_record_is_tls_server_hello",luacall_tls_record_is_tls_server_hello},
|
||||
{"tls_record_find_ext",luacall_tls_record_find_ext},
|
||||
{"tls_record_find_extlen",luacall_tls_record_find_extlen},
|
||||
{"tls_record_len",luacall_tls_record_len},
|
||||
{"tls_record_data_len",luacall_tls_record_data_len},
|
||||
{"tls_record_is_full",luacall_tls_record_is_full},
|
||||
{"tls_handshake_is_tls_client_hello",luacall_tls_handshake_is_tls_client_hello},
|
||||
{"tls_handshake_is_tls_server_hello",luacall_tls_handshake_is_tls_server_hello},
|
||||
{"tls_handshake_find_ext",luacall_tls_handshake_find_ext},
|
||||
{"tls_handshake_find_extlen",luacall_tls_handshake_find_extlen},
|
||||
{"tls_handshake_len",luacall_tls_handshake_len},
|
||||
{"tls_handshake_data_len",luacall_tls_handshake_data_len},
|
||||
{"tls_handshake_is_full",luacall_tls_handshake_is_full},
|
||||
// tls
|
||||
{"tls_mod",luacall_tls_mod}
|
||||
};
|
||||
for(int i=0;i<(sizeof(lfunc)/sizeof(*lfunc));i++)
|
||||
|
||||
Reference in New Issue
Block a user