mod_Router.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /**
  2. * $Id$
  3. *
  4. * Copyright (C) 2012 Konstantin Mosesov
  5. *
  6. * This file is part of Kamailio, a free SIP server.
  7. *
  8. * This file 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. *
  14. * This file is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. */
  24. // Python includes
  25. #include <Python.h>
  26. #include "structmember.h"
  27. // Other/system includes
  28. #include <libgen.h>
  29. // router includes
  30. #include "../../str.h"
  31. #include "../../sr_module.h"
  32. // local includes
  33. #include "python_exec.h"
  34. #include "python_mod.h"
  35. #include "python_iface.h"
  36. #include "python_msgobj.h"
  37. #include "python_support.h"
  38. #include "mod_Router.h"
  39. PyMethodDef RouterMethods[] = {
  40. {NULL, NULL, 0, NULL}
  41. };
  42. void init_mod_Router(void)
  43. {
  44. main_module = Py_InitModule("Router", RouterMethods);
  45. main_module_dict = PyModule_GetDict(main_module);
  46. Py_INCREF(main_module);
  47. #ifdef WITH_EXTRA_DEBUG
  48. LM_ERR("Module 'Router' has been initialized\n");
  49. #endif
  50. }
  51. void destroy_mod_Router(void)
  52. {
  53. Py_XDECREF(main_module);
  54. Py_XDECREF(main_module_dict);
  55. #ifdef WITH_EXTRA_DEBUG
  56. LM_ERR("Module 'Router' has been destroyed\n");
  57. #endif
  58. }