- Katılım
- 24 Şubat 2018
- Mesajlar
- 24,930
Kod:
/*
*
* Connection Manager
*
* Copyright (C) 2007-2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <errno.h>
#include <string.h>
#include <gdbus.h>
#include "connman.h"
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:
case ECONNREFUSED:
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);
}