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 * This file is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 // Python includes
23 #include <Python.h>
24 #include "structmember.h"
25
26 // Other/system includes
27 #include <libgen.h>
28
29 // router includes
30 #include "../../core/str.h"
31 #include "../../core/sr_module.h"
32
33 // local includes
34 #include "python_exec.h"
35 #include "app_python_mod.h"
36 #include "python_iface.h"
37 #include "python_msgobj.h"
38 #include "python_support.h"
39
40 #include "mod_Router.h"
41
42 PyObject *_sr_apy_main_module = NULL;
43 PyObject *_sr_apy_main_module_dict = NULL;
44
45 PyMethodDef RouterMethods[] = {
46 {NULL, NULL, 0, NULL}
47 };
48
init_mod_Router(void)49 void init_mod_Router(void)
50 {
51 _sr_apy_main_module = Py_InitModule("Router", RouterMethods);
52 _sr_apy_main_module_dict = PyModule_GetDict(_sr_apy_main_module);
53
54 Py_INCREF(_sr_apy_main_module);
55
56 #ifdef WITH_EXTRA_DEBUG
57 LM_ERR("Module 'Router' has been initialized\n");
58 #endif
59
60 }
61
destroy_mod_Router(void)62 void destroy_mod_Router(void)
63 {
64 Py_XDECREF(_sr_apy_main_module);
65 Py_XDECREF(_sr_apy_main_module_dict);
66
67 #ifdef WITH_EXTRA_DEBUG
68 LM_ERR("Module 'Router' has been destroyed\n");
69 #endif
70
71 }
72
73