static DBusMessage *disable_technology(DBusConnection *conn, DBusMessage *msg, void *data) { enum connman_service_type type; const char *str; DBG("conn %p", conn); dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID); if (g_strcmp0(str, "ethernet") == 0) type = CONNMAN_SERVICE_TYPE_ETHERNET; else if (g_strcmp0(str, "wifi") == 0) type = CONNMAN_SERVICE_TYPE_WIFI; else if (g_strcmp0(str, "wimax") == 0) type = CONNMAN_SERVICE_TYPE_WIMAX; else if (g_strcmp0(str, "bluetooth") == 0) type = CONNMAN_SERVICE_TYPE_BLUETOOTH; else if (g_strcmp0(str, "cellular") == 0) type = CONNMAN_SERVICE_TYPE_CELLULAR; else return __connman_error_invalid_arguments(msg); if (__connman_notifier_is_registered(type) == FALSE) return __connman_error_not_registered(msg); if (__connman_notifier_is_enabled(type) == FALSE) return __connman_error_already_disabled(msg); __connman_technology_disable(type, msg); return NULL; }
DBusMessage *__connman_error_failed(DBusMessage *msg, int errnum) { const char *str = strerror(errnum); switch (errnum) { case ESRCH: return __connman_error_not_registered(msg); case ENXIO: return __connman_error_not_found(msg); case EACCES: return __connman_error_permission_denied(msg); case EEXIST: return __connman_error_already_exists(msg); case EINVAL: return __connman_error_invalid_arguments(msg); case ENOSYS: return __connman_error_not_implemented(msg); case ENOLINK: return __connman_error_no_carrier(msg); case ENOTUNIQ: return __connman_error_not_unique(msg); case EOPNOTSUPP: return __connman_error_not_supported(msg); case ECONNABORTED: return __connman_error_operation_aborted(msg); case EISCONN: return __connman_error_already_connected(msg); case ENOTCONN: return __connman_error_not_connected(msg); case ETIMEDOUT: return __connman_error_operation_timeout(msg); case EALREADY: case EINPROGRESS: return __connman_error_in_progress(msg); case ENOKEY: return __connman_error_passphrase_required(msg); } return g_dbus_create_error(msg, CONNMAN_ERROR_INTERFACE ".Failed", "%s", str); }