58 static int GetMimeDecField(
lua_State *luastate,
Flow *flow,
const char *name)
75 return LuaCallbackError(luastate,
"Internal error: no fields in transaction");
78 const uint8_t *field_value;
81 if (!SCMimeSmtpGetHeader(mime, name, &field_value, &field_len)) {
100 static int SMTPGetMimeField(
lua_State *luastate)
112 return LuaCallbackError(luastate,
"1st argument missing, empty or wrong type");
114 GetMimeDecField(luastate, flow, name);
138 if(smtp_tx == NULL) {
146 const uint8_t *field_name;
151 lua_newtable(luastate);
152 while (SCMimeSmtpGetHeaderName(mime, &field_name, &field_len, (uint32_t)num)) {
153 if (field_len != 0) {
154 lua_pushinteger(luastate,num++);
156 lua_settable(luastate,-3);
173 static int SMTPGetMimeList(
lua_State *luastate)
185 GetMimeList(luastate, flow);
209 if(smtp_tx == NULL) {
230 static int SMTPGetMailFrom(
lua_State *luastate)
242 GetMailFrom(luastate, flow);
266 if(smtp_tx == NULL) {
271 lua_newtable(luastate);
277 lua_pushinteger(luastate, u++);
279 lua_settable(luastate, -3);
297 static int SMTPGetRcptList(
lua_State *luastate)
309 GetRcptList(luastate, flow);
318 lua_pushcfunction(luastate, SMTPGetMimeField);
319 lua_setglobal(luastate,
"SMTPGetMimeField");
321 lua_pushcfunction(luastate, SMTPGetMimeList);
322 lua_setglobal(luastate,
"SMTPGetMimeList");
324 lua_pushcfunction(luastate, SMTPGetMailFrom);
325 lua_setglobal(luastate,
"SMTPGetMailFrom");
327 lua_pushcfunction(luastate, SMTPGetRcptList);
328 lua_setglobal(luastate,
"SMTPGetRcptList");