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