Release tizen_2.0_beta
[framework/connectivity/connman.git] / include / task.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007-2010  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_TASK_H
23 #define __CONNMAN_TASK_H
24
25 #include <dbus/dbus.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /**
32  * SECTION:task
33  * @title: Task premitives
34  * @short_description: Functions for handling tasks
35  */
36
37 struct connman_task;
38
39 typedef void (* connman_task_exit_t) (struct connman_task *task,
40                                                 int exit_code, void *user_data);
41
42 typedef DBusMessage * (* connman_task_notify_t) (struct connman_task *task,
43                                 DBusMessage *message, void *user_data);
44
45 struct connman_task *connman_task_create(const char *program);
46 void connman_task_destroy(struct connman_task *task);
47
48 const char *connman_task_get_path(struct connman_task *task);
49
50 int connman_task_add_argument(struct connman_task *task,
51                                 const char *name, const char *format, ...);
52 int connman_task_add_variable(struct connman_task *task,
53                                 const char *key, const char *format, ...);
54
55 int connman_task_set_notify(struct connman_task *task, const char *member,
56                         connman_task_notify_t function, void *user_data);
57
58 int connman_task_run(struct connman_task *task,
59                         connman_task_exit_t function, void *user_data,
60                         int *stdin_fd, int *stdout_fd, int *stderr_fd);
61 int connman_task_stop(struct connman_task *task);
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif /* __CONNMAN_TASK_H */