1 /*
2 * $Id$
3 *
4 * Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23
24 #ifndef _CFGUTILS_API_H_
25 #define _CFGUTILS_API_H_
26
27 #include "../../core/str.h"
28
29 typedef int (*cfgutils_lock_f)(str *lkey);
30 typedef int (*cfgutils_unlock_f)(str *lkey);
31
32 /**
33 * @brief CFGUTILS API structure
34 */
35 typedef struct cfgutils_api {
36 cfgutils_lock_f mlock;
37 cfgutils_unlock_f munlock;
38 } cfgutils_api_t;
39
40 typedef int (*bind_cfgutils_f)(cfgutils_api_t* api);
41
42 /**
43 * @brief Load the CFGUTILS API
44 */
cfgutils_load_api(cfgutils_api_t * api)45 static inline int cfgutils_load_api(cfgutils_api_t *api)
46 {
47 bind_cfgutils_f bindcfgutils;
48
49 bindcfgutils = (bind_cfgutils_f)find_export("bind_cfgutils", 0, 0);
50 if(bindcfgutils == 0) {
51 LM_ERR("cannot find bind_cfgutils\n");
52 return -1;
53 }
54 if (bindcfgutils(api)<0)
55 {
56 LM_ERR("cannot bind cfgutils api\n");
57 return -1;
58 }
59 return 0;
60 }
61
62 #endif
63