app_lua_api.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * $Id$
  3. *
  4. * Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com)
  5. *
  6. * This file is part of Kamailio, a free SIP server.
  7. *
  8. * Kamailio is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version
  12. *
  13. * Kamailio is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #ifndef _APP_LUA_API_H_
  24. #define _APP_LUA_API_H_
  25. #include <lua.h>
  26. #include <lauxlib.h>
  27. #include <lualib.h>
  28. #include "../../parser/msg_parser.h"
  29. typedef struct _sr_lua_env
  30. {
  31. lua_State *L;
  32. lua_State *LL;
  33. struct sip_msg *msg;
  34. unsigned int flags;
  35. } sr_lua_env_t;
  36. sr_lua_env_t *sr_lua_env_get(void);
  37. int lua_sr_initialized(void);
  38. int lua_sr_init_mod(void);
  39. int lua_sr_init_child(void);
  40. void lua_sr_destroy(void);
  41. int lua_sr_init_probe(void);
  42. int sr_lua_load_script(char *script);
  43. int sr_lua_register_module(char *mname);
  44. int app_lua_dostring(struct sip_msg *msg, char *script);
  45. int app_lua_dofile(struct sip_msg *msg, char *script);
  46. int app_lua_runstring(struct sip_msg *msg, char *script);
  47. int app_lua_run(struct sip_msg *msg, char *func, char *p1, char *p2,
  48. char *p3);
  49. #define SRLUA_FALSE 0
  50. #define SRLUA_TRUE 1
  51. int app_lua_return_boolean(lua_State *L, int b);
  52. int app_lua_return_false(lua_State *L);
  53. int app_lua_return_true(lua_State *L);
  54. void app_lua_dump_stack(lua_State *L);
  55. #endif