Lines Matching refs:priv
59 static void process_watch(struct wpas_dbus_priv *priv,
62 dbus_connection_ref(priv->con);
64 priv->should_dispatch = 0;
73 if (priv->should_dispatch) {
74 dispatch_data(priv->con);
75 priv->should_dispatch = 0;
78 dbus_connection_unref(priv->con);
102 struct wpas_dbus_priv *priv = data;
113 priv, watch);
117 priv, watch);
121 priv, watch);
124 dbus_watch_set_data(watch, priv, NULL);
167 struct wpas_dbus_priv *priv = data;
172 process_timeout, priv, timeout);
174 dbus_timeout_set_data(timeout, priv, NULL);
182 struct wpas_dbus_priv *priv = data;
183 eloop_cancel_timeout(process_timeout, priv, timeout);
199 struct wpas_dbus_priv *priv = signal_ctx;
201 if (sig != SIGPOLL || !priv->con)
204 if (dbus_connection_get_dispatch_status(priv->con) !=
209 dbus_connection_ref(priv->con);
210 dbus_connection_dispatch(priv->con);
211 dbus_connection_unref(priv->con);
224 struct wpas_dbus_priv *priv = data;
228 priv->should_dispatch = 1;
235 * @priv: a dbus control interface data structure
238 static int integrate_with_eloop(struct wpas_dbus_priv *priv)
240 if (!dbus_connection_set_watch_functions(priv->con, add_watch,
242 priv, NULL) ||
243 !dbus_connection_set_timeout_functions(priv->con, add_timeout,
245 timeout_toggled, priv,
252 if (eloop_register_signal(SIGPOLL, process_wakeup_main, priv))
254 dbus_connection_set_wakeup_main_function(priv->con, wakeup_main,
255 priv, NULL);
264 struct wpas_dbus_priv *priv = data;
270 wpa_supplicant_terminate_proc(priv->global);
277 static int wpas_dbus_init_common(struct wpas_dbus_priv *priv)
284 priv->con = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
285 if (priv->con) {
286 dbus_connection_add_filter(priv->con, disconnect_filter, priv,
299 static int wpas_dbus_init_common_finish(struct wpas_dbus_priv *priv)
302 integrate_with_eloop(priv);
312 priv->con, NULL);
318 static void wpas_dbus_deinit_common(struct wpas_dbus_priv *priv)
320 if (priv->con) {
322 priv->con, NULL);
323 eloop_cancel_timeout(process_timeout, priv, ELOOP_ALL_CTX);
325 dbus_connection_set_watch_functions(priv->con, NULL, NULL,
327 dbus_connection_set_timeout_functions(priv->con, NULL, NULL,
329 dbus_connection_remove_filter(priv->con, disconnect_filter,
330 priv);
332 dbus_connection_unref(priv->con);
335 os_free(priv);
341 struct wpas_dbus_priv *priv;
343 priv = os_zalloc(sizeof(*priv));
344 if (priv == NULL)
346 priv->global = global;
348 if (wpas_dbus_init_common(priv) < 0) {
349 wpas_dbus_deinit(priv);
354 if (wpas_dbus_ctrl_iface_init(priv) < 0) {
355 wpas_dbus_deinit(priv);
361 if (wpa_supplicant_dbus_ctrl_iface_init(priv) < 0) {
362 wpas_dbus_deinit(priv);
367 if (wpas_dbus_init_common_finish(priv) < 0) {
368 wpas_dbus_deinit(priv);
372 return priv;
376 void wpas_dbus_deinit(struct wpas_dbus_priv *priv)
378 if (priv == NULL)
382 wpas_dbus_ctrl_iface_deinit(priv);
389 wpas_dbus_deinit_common(priv);