session: Add configuration plugin
[platform/upstream/connman.git] / plugins / session_default.c
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2012  BMW Car IT GbmH. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program 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 St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <errno.h>
27 #include <string.h>
28
29 #define CONNMAN_API_SUBJECT_TO_CHANGE
30 #include <connman/plugin.h>
31 #include <connman/log.h>
32 #include <connman/session.h>
33
34 static int config_get_bool(const char *id, const char *key, connman_bool_t *val)
35 {
36         DBG("id %s key %s", id, key);
37
38         *val = FALSE;
39
40         return -EINVAL;
41 }
42
43 static int config_get_string(const char *id, const char *key, char **val)
44 {
45         DBG("id %s key %s", id, key);
46
47         *val = NULL;
48
49         return -EINVAL;
50 }
51
52 static struct connman_session_config session_config = {
53         .name = "session default configuration",
54         .get_bool = config_get_bool,
55         .get_string = config_get_string,
56 };
57
58 static int session_config_init(void)
59 {
60         int err;
61
62         err = connman_session_config_register(&session_config);
63         if (err < 0)
64                 return err;
65
66         return 0;
67 }
68
69 static void session_config_exit(void)
70 {
71         connman_session_config_unregister(&session_config);
72 }
73
74 CONNMAN_PLUGIN_DEFINE(session_default, "Session default configuration plugin",
75                 VERSION, CONNMAN_PLUGIN_PRIORITY_DEFAULT,
76                 session_config_init, session_config_exit)