5 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
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.
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.
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
24 #include <connman/dbus.h>
34 DBusConnection *main_connection;
36 /* session test cases */
37 unsigned int max_sessions;
38 struct test_session *session;
42 typedef void (* util_test_setup_cb) (struct test_fix *fix,
44 typedef void (* util_test_teardown_cb) (struct test_fix *fix,
47 gboolean util_quit_loop(gpointer fix);
48 guint util_idle_call(struct test_fix *fix, GSourceFunc func,
49 GDestroyNotify notify);
50 guint util_call(struct test_fix *fix, GSourceFunc func,
51 GDestroyNotify notify);
52 void util_test_add(const char *test_name, GSourceFunc test_func,
53 util_test_setup_cb setup_cb,
54 util_test_teardown_cb teardown_cb);
55 void util_setup(struct test_fix *fix, gconstpointer data);
56 void util_teardown(struct test_fix *fix, gconstpointer data);
58 void util_session_create(struct test_fix *fix, unsigned int max_sessions);
59 void util_session_destroy(gpointer fix);
61 typedef void (* notify_cb) (struct test_session *session);
63 enum connman_session_roaming_policy {
64 CONNMAN_SESSION_ROAMING_POLICY_UNKNOWN = 0,
65 CONNMAN_SESSION_ROAMING_POLICY_DEFAULT = 1,
66 CONNMAN_SESSION_ROAMING_POLICY_ALWAYS = 2,
67 CONNMAN_SESSION_ROAMING_POLICY_FORBIDDEN = 3,
68 CONNMAN_SESSION_ROAMING_POLICY_NATIONAL = 4,
69 CONNMAN_SESSION_ROAMING_POLICY_INTERNATIONAL = 5,
72 struct test_session_info {
74 connman_bool_t online;
76 /* ipv4, ipv6 dicts */
77 GSList *allowed_bearers;
78 connman_bool_t priority;
79 connman_bool_t avoid_handover;
80 connman_bool_t stay_connected;
81 unsigned int periodic_connect;
82 unsigned int idle_timeout;
84 enum connman_session_roaming_policy roaming_policy;
93 DBusConnection *connection;
99 struct test_session_info *info;
102 struct test_bearer_info {
107 void bearer_info_cleanup(gpointer bearer_info, gpointer user_data);
109 void session_append_settings(DBusMessageIter *dict,
110 struct test_session_info *info);
111 int session_notify_register(struct test_session *session,
112 const char *notify_path);
113 int session_notify_unregister(struct test_session *session,
114 const char *notify_path);
116 DBusMessage *session_connect(DBusConnection *connection,
117 struct test_session *session);
118 DBusMessage *session_disconnect(DBusConnection *connection,
119 struct test_session *session);
122 DBusMessage *manager_get_services(DBusConnection *connection);
123 DBusMessage *manager_create_session(DBusConnection *connection,
124 struct test_session_info *info,
125 const char *notifier_path);
126 DBusMessage *manager_destroy_session(DBusConnection *connection,
127 const char *notifier_path);
128 DBusMessage *manager_set_session_mode(DBusConnection *connection,
129 connman_bool_t enable);
136 #define LOG(fmt, arg...) do { \
137 fprintf(stdout, "%s:%s() " fmt "\n", \
138 __FILE__, __FUNCTION__ , ## arg); \
141 #define LOG(fmt, arg...)