mod_Core.c 1.7 KB

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