mod_Core.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #include "mod_Core.h"
  40. PyMethodDef CoreMethods[] = {
  41. {NULL, NULL, 0, NULL}
  42. };
  43. void init_mod_Core(void)
  44. {
  45. core_module = Py_InitModule("Router.Core", CoreMethods);
  46. PyDict_SetItemString(main_module_dict, "Core", core_module);
  47. Py_INCREF(core_module);
  48. #ifdef WITH_EXTRA_DEBUG
  49. LM_ERR("Module 'Router.Core' has been initialized\n");
  50. #endif
  51. }
  52. void destroy_mod_Core(void)
  53. {
  54. Py_XDECREF(core_module);
  55. #ifdef WITH_EXTRA_DEBUG
  56. LM_ERR("Module 'Router.Core' has been destroyed\n");
  57. #endif
  58. }