summaryrefslogtreecommitdiff
path: root/libnm-core/nm-errors.c
Commit message (Collapse)AuthorAgeFilesLines
* build: move "libnm-core/" to "src/" and split itThomas Haller2021-02-181-55/+0
| | | | | | | | | | | | | | | | | | | | "libnm-core/" is rather complicated. It provides a static library that is linked into libnm.so and NetworkManager. It also contains public headers (like "nm-setting.h") which are part of public libnm API. Then we have helper libraries ("libnm-core/nm-libnm-core-*/") which only rely on public API of libnm-core, but are themself static libraries that can be used by anybody who uses libnm-core. And "libnm-core/nm-libnm-core-intern" is used by libnm-core itself. Move "libnm-core/" to "src/". But also split it in different directories so that they have a clearer purpose. The goal is to have a flat directory hierarchy. The "src/libnm-core*/" directories correspond to the different modules (static libraries and set of headers that we have). We have different kinds of such modules because of how we combine various code together. The directory layout now reflects this.
* all: add "libnm-core/nm-default-libnm-core.h" as replacement for "nm-default.h"Thomas Haller2021-02-091-1/+1
|
* core: move NM_MANAGER_ERROR to shared/nm-glib-auxThomas Haller2021-01-151-1/+0
| | | | | | | | "src/nm-logging.c" should be independent of libnm-core. It almost is, except the error domain and code. Move NM_MANAGER_ERROR to "nm-glib-aux/nm-shared-utils.h" so that "nm-logging.c" is independent of libnm-core.
* all: update deprecated SPDX license identifiersThomas Haller2021-01-051-1/+1
| | | | | | | | | | | | | | | | These SPDX license identifiers are deprecated ([1]). Update them. [1] https://spdx.org/licenses/ sed \ -e '1 s%^/\* SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+ \*/$%/* SPDX-License-Identifier: \1-or-later */%' \ -e '1,2 s%^\(--\|#\|//\) SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+$%\1 SPDX-License-Identifier: \2-or-later%' \ -i \ $(git grep -l SPDX-License-Identifier -- \ ':(exclude)shared/c-*/' \ ':(exclude)shared/n-*/' \ ':(exclude)shared/systemd/src' \ ':(exclude)src/systemd/src')
* all: unify comment style for SPDX-License-Identifier tagThomas Haller2020-09-291-1/+1
| | | | | | | | | | Our coding style recommends C style comments (/* */) instead of C++ (//). Also, systemd (which we partly fork) uses C style comments for the SPDX-License-Identifier. Unify the style. $ sed -i '1 s#// SPDX-License-Identifier: \([^ ]\+\)$#/* SPDX-License-Identifier: \1 */#' -- $(git ls-files -- '*.[hc]' '*.[hc]pp')
* all: reformat all with new clang-format styleAntonio Cardace2020-09-281-43/+33
| | | | | | | | | | | | Run: ./contrib/scripts/nm-code-format.sh -i ./contrib/scripts/nm-code-format.sh -i Yes, it needs to run twice because the first run doesn't yet produce the final result. Signed-off-by: Antonio Cardace <acardace@redhat.com>
* all: require a semicolon after NM_CACHED_QUARK_FCN()Thomas Haller2020-09-231-8/+8
|
* all: unify format of our Copyright source code commentsThomas Haller2019-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```bash readarray -d '' FILES < <( git ls-files -z \ ':(exclude)po' \ ':(exclude)shared/c-rbtree' \ ':(exclude)shared/c-list' \ ':(exclude)shared/c-siphash' \ ':(exclude)shared/c-stdaux' \ ':(exclude)shared/n-acd' \ ':(exclude)shared/n-dhcp4' \ ':(exclude)src/systemd/src' \ ':(exclude)shared/systemd/src' \ ':(exclude)m4' \ ':(exclude)COPYING*' ) sed \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \ -e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \ -i \ "${FILES[@]}" echo ">>> untouched Copyright lines" git grep Copyright "${FILES[@]}" echo ">>> Copyright lines with unusual extra" git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved sed \ -e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \ -i \ "${FILES[@]}" ``` https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
* all: SPDX header conversionLubomir Rintel2019-09-101-15/+1
| | | | | $ find * -type f |xargs perl contrib/scripts/spdx.pl $ git rm contrib/scripts/spdx.pl
* all: drop emacs file variables from source filesThomas Haller2019-06-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | We no longer add these. If you use Emacs, configure it yourself. Also, due to our "smart-tab" usage the editor anyway does a subpar job handling our tabs. However, on the upside every user can choose whatever tab-width he/she prefers. If "smart-tabs" are used properly (like we do), every tab-width will work. No manual changes, just ran commands: F=($(git grep -l -e '-\*-')) sed '1 { /\/\* *-\*- *[mM]ode.*\*\/$/d }' -i "${F[@]}" sed '1,4 { /^\(#\|--\|dnl\) *-\*- [mM]ode/d }' -i "${F[@]}" Check remaining lines with: git grep -e '-\*-' The ultimate purpose of this is to cleanup our files and eventually use SPDX license identifiers. For that, first get rid of the boilerplate lines.
* Revert "libnm: don't assert for success of g_dbus_error_register_error()"Thomas Haller2019-05-221-1/+2
| | | | | | | | Now that unit tests no longer dynamically link against libnm/libnm.la, and statically against the same code, we can enable this assertion again. This reverts commit 7a0e347b38faf56ed1b3a103106199721d75f11c.
* libnm: don't assert for success of g_dbus_error_register_error()Thomas Haller2019-05-151-2/+1
| | | | | | | | libnm/tests/test-general statically links against libnm/libnm-utils.la and dynamically against libnm/libnm.so. Hence, _nm_utils_init() is invoked twice, failing the assertion. That is a bug that must be fixed. For now, just don't assert.
* libnm: cleanup register_error_domain()Thomas Haller2019-05-151-15/+10
|
* all: drop unnecessary includes of <errno.h> and <string.h>Thomas Haller2019-02-121-2/+1
| | | | | "nm-macros-interal.h" already includes <errno.h> and <string.h>. No need to include it everywhere else too.
* all: use NM_CACHED_QUARK_FCN() instead of G_DEFINE_QUARK()Thomas Haller2017-02-101-8/+8
| | | | | | | | | | | | | | | | | | I think NM_CACHED_QUARK_FCN() is better because: - the implementation is in our hand, meaning it is clear that putting a "static" before NM_CACHED_QUARK_FCN() is guaranteed to work -- without relying on G_DEFINE_QUARK() to be defined in a way that this works (in fact, we currently never do that and instead make all functions non-static). - it does not construct function names by appending "_quark". Thus you can grep for the entire function name and finding the place where it is implemented. - same with the stings, where the new macro doesn't stringify the argument, which is less surpising. Again, now you can grep for the string including the double quoting. (yes, I really use grep to understand the source-code)
* all: cleanup includes and let "nm-default.h" include "config.h"Thomas Haller2016-02-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - All internal source files (except "examples", which are not internal) should include "config.h" first. As also all internal source files should include "nm-default.h", let "config.h" be included by "nm-default.h" and include "nm-default.h" as first in every source file. We already wanted to include "nm-default.h" before other headers because it might contains some fixes (like "nm-glib.h" compatibility) that is required first. - After including "nm-default.h", we optinally allow for including the corresponding header file for the source file at hand. The idea is to ensure that each header file is self contained. - Don't include "config.h" or "nm-default.h" in any header file (except "nm-sd-adapt.h"). Public headers anyway must not include these headers, and internal headers are never included after "nm-default.h", as of the first previous point. - Include all internal headers with quotes instead of angle brackets. In practice it doesn't matter, because in our public headers we must include other headers with angle brackets. As we use our public headers also to compile our interal source files, effectively the result must be the same. Still do it for consistency. - Except for <config.h> itself. Include it with angle brackets as suggested by https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
* libnm: don't include "nm-version.h" in "nm-dbus-interface.h"Thomas Haller2015-09-251-1/+0
| | | | | | | | | We want "nm-dbus-interface.h" to have no dependancy on libnm and glib. That way, it is usable for example in the QT examples without dragging in dependencies to glib. Also drop all the unneccessary include to "nm-dbus-interface.h", which we already get by directly or indirectly including "nm-core-types.h".
* all: make use of new header file "nm-default.h"Thomas Haller2015-08-051-1/+1
|
* all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship2015-07-241-2/+1
| | | | | | | | | | | | | | | | Rather than randomly including one or more of <glib.h>, <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to nm-glib.h, include <gio/gio.h> from there, and then change all .c files in NM to include "nm-glib.h" rather than including the glib headers directly. (Public headers files still have to include the real glib headers, since nm-glib.h isn't installed...) Also, remove glib includes from header files that are already including a base object header file (which must itself already include the glib headers).
* libnm-core: fix VPN error domain (bgo #745997)Dan Winship2015-04-071-1/+1
| | | | | | In theory, NM_VPN_PLUGIN_ERROR should have names under org.freedesktop.NetworkManager.VPN.Plugin, but for historical reasons, it's actually org.freedesktop.NetworkManager.VPN.Error.
* all: consistently include config.hDan Winship2014-11-131-0/+2
| | | | | | | | | | | config.h should be included from every .c file, and it should be included before any other include. Fix that. (As a side effect of how I did this, this also changes us to consistently use "config.h" rather than <config.h>. To the extent that it matters [which is not much], quotes are more correct anyway, since we're talking about a file in our own build tree, not a system include.)
* libnm-core: fix trivial bug in NMVpnPluginError quarkDan Winship2014-10-281-1/+1
|
* libnm-core, libnm: move NMVpnPluginError to nm-errorsDan Winship2014-10-221-0/+8
| | | | | | | | | | Move the definition of NMVpnPluginError to nm-errors and register it with D-Bus. Rename GENERAL to FAILED, and CONNECTION_INVALID to INVALID_CONNECTION, for consistency. (As with the NMSecretAgentError renamings, the renaming here is not an ABI break, because the daemon currently never checks for any specific error codes other than INTERACTIVE_NOT_SUPPORTED.)
* libnm-core, libnm, settings: move NMSecretAgentError to nm-errorsDan Winship2014-10-221-0/+4
| | | | | | | | | | | | | | | | Move the definition of NMSecretAgentError to nm-errors, register it with D-Bus, and verify in the tests that it maps correctly. NM_SECRET_AGENT_ERROR_INTERNAL_ERROR is renamed to NM_SECRET_AGENT_ERROR_FAILED, and NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED to NM_SECRET_AGENT_ERROR_PERMISSION_DENIED, for consistency with other error domains. While NMSecretAgentError, unlike most other error domains, has always been correctly mapped across D-Bus, the renaming is not an ABI break, because the daemon never checks for either of those values, so all versions of the daemon will treat "org.freedesktop.NetworkManager.SecretAgent.InternalError" and "org.freedesktop.NetworkManager.SecretAgent.Failed" the same (by just ignoring the error name and keeping only the error message).
* libnm-core, settings: move NMAgentManagerError to nm-errorsDan Winship2014-10-221-0/+4
| | | | | Move the definition of NMAgentManagerError to nm-errors, register it with D-Bus, and verify in the tests that it maps correctly.
* libnm-core, settings: move NMSettingsError to nm-errorsDan Winship2014-10-221-0/+4
| | | | | | | | | Move the definition of NMSettingsError to nm-errors, register it with D-Bus, and verify in the tests that it maps correctly. Remove a few unused error codes, simplify a few others, and rename GENERAL to FAILED and HOSTNAME_INVALID to INVALID_HOSTNAME, for consistency.
* libnm-core, core: move NMManagerError to nm-errorsDan Winship2014-10-221-0/+4
| | | | | | | | | | | | | | | | | Move the definition of NMManagerError to nm-errors, register it with D-Bus, and verify in the tests that it maps correctly. NM_MANAGER_ERROR_INTERNAL gets renamed to NM_MANAGER_ERROR_FAILED for consistency. NM_MANAGER_ERROR_UNMANAGED_DEVICE is dropped since that name doesn't really describe the one place it was previously used in. NM_MANAGER_ERROR_SYSTEM_CONNECTION is dropped because it was't being used. NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE is dropped because it can be replaced with an NM_CONNECTION_ERROR. NM_MANAGER_ERROR_AUTOCONNECT_NOT_ALLOWED is turned into the more generic NM_MANAGER_ERROR_CONNECTION_NOT_AVAILABLE. Also, remove the <tp:possible-errors> sections from nm-manager.xml, since they were completely out of date.
* libnm-core, libnm, devices: merge client and daemon NMDeviceErrorDan Winship2014-10-221-0/+4
| | | | | | | | | | | | | | Merge libnm's NMDeviceError and the daemon's NMDeviceError into a single enum (in nm-errors.h). Register the domain with D-Bus, and add a test that the client side decodes it correctly. The daemon's NM_DEVICE_ERROR_CONNECTION_INVALID gets absorbed into libnm's NM_DEVICE_ERROR_INVALID_CONNECTION, and NM_DEVICE_ERROR_UNSUPPORTED_DEVICE_TYPE gets dropped, since it was only returned from one place, which is now using NM_DEVICE_ERROR_FAILED, since (a) it ought to be a "can't happen", and (b) the only caller of that function just logs error->message and then frees the error without ever looking at the code.
* libnm-core, core: register NMConnectionError with D-BusDan Winship2014-10-221-1/+34
| | | | | | Register NMConnectionError with D-Bus on both sides, so that, eg, connection validation failures in the daemon will translate to the correct error codes in the client.
* libnm-core: add nm-errors.[ch]Dan Winship2014-10-221-0/+27
Add nm-errors.[ch], and move libnm-core's two error domains (NMConnectionError and NMCryptoError) there. NMCryptoError wasn't previously visible, but it can be returned from some public API, so it should be.