a08419429afec3e269b800bf120f359cd6a12567
[platform/upstream/connman.git] / include / agent.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2012  Intel Corporation. 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 #ifndef __CONNMAN_AGENT_H
23 #define __CONNMAN_AGENT_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * SECTION:agent
31  * @title: agent primitives
32  * @short_description: Functions for handling generic agent details
33  */
34
35 struct connman_agent;
36
37 struct connman_agent_driver {
38         const char *name;
39         const char *interface;
40         int priority;
41         int (*probe) (struct connman_agent *agent);
42         void (*remove) (struct connman_agent *agent);
43         void * (*context_ref) (void *user_context);
44         void (*context_unref) (void *user_context);
45 };
46
47 int connman_agent_driver_register(struct connman_agent_driver *driver);
48 void connman_agent_driver_unregister(struct connman_agent_driver *driver);
49
50 typedef void (* report_error_cb_t) (void *user_context,
51                                 gboolean retry, void *user_data);
52
53 int connman_agent_report_error(void *user_context, const char *path,
54                                 const char *error,
55                                 report_error_cb_t callback, void *user_data);
56
57 int connman_agent_register(const char *sender, const char *path);
58 int connman_agent_unregister(const char *sender, const char *path);
59 void connman_agent_cancel(void *user_context);
60
61 typedef void (*agent_queue_cb)(DBusMessage *reply, void *user_data);
62
63 int connman_agent_queue_message(void *user_context,
64                                 DBusMessage *msg, int timeout,
65                                 agent_queue_cb callback, void *user_data);
66
67 void connman_agent_get_info(const char **sender, const char **path);
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73 #endif /* __CONNMAN_TECHNOLOGY_H */