summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2015-11-02tests: fix error message in nmtst_assert_ip6_address()Thomas Haller1-1/+1
Fixes: 09983442bd8be13392876cb8cf4e1564907b07e4
2015-11-02test: disable g_log_set_always_fatal() for non-assert tests on older glib ↵Thomas Haller1-0/+5
versions This fixes test-failure for src/platform/tests/test-link-fake on older systems.
2015-11-02core: add nm_utils_to_string_buffer global bufferThomas Haller1-2/+2
Having a static string buffer for convenience is useful not only for platform. Define the string buffer in NetworkManagerUtils.h, so that all to-string functions can reuse *one* buffer. Of course, this has the potential danger, that different to-string method might reuse the same buffer. Hence, low-level library functions are adviced to use their own buffer, because an upper level might already use the global buffer for another string.
2015-11-01platform: add buffer argument to platform to-string functionsThomas Haller1-4/+8
Arguably, it is more convenient to use the static buffer as it saves typing. But having such a low-level function use a static buffer also limits the way how to use it. As it was, you could not avoid using the static buffer. E.g. you cannot do: char buf[100]; _LOGD ("nmp-object: %s; platform-link: %s", nmp_object_to_string (nmpobj, buf, sizeof(buf)), nm_platform_link_to_string (link)); This will fail for non-obvious reasons because both to-string functions end up using the same static buffer. Also change the to-string implementations to accept NULL as valid and return it as "(null)". https://bugzilla.gnome.org/show_bug.cgi?id=756427
2015-11-01macros: add nm_sprintf_buf() helper macroThomas Haller1-0/+12
2015-11-01macros: add nm_clear_g_cancellable() utilityThomas Haller1-0/+12
2015-11-01tests: handle no_expect_message also for tests without assert-loggingThomas Haller1-0/+2
2015-11-01tests: add nmtst_rand_perm() utilityThomas Haller1-0/+41
2015-11-01tests: add nmtst_assert_ip4_address() and nmtst_assert_ip6_address() utility ↵Thomas Haller1-0/+31
method
2015-10-14test: add nmtst_get_rand_int() helperThomas Haller1-0/+6
2015-10-12macros: add nm_clear_g_variant() utilThomas Haller1-0/+11
2015-10-12macros: remove early return from nm_clear_g_signal_handler()Thomas Haller1-3/+0
It is valid to call nm_clear_g_signal_handler() with missing @self argument if (and only if) the @id is unspecified as well. Remove the check for @self to get an assertion in case @id is missing *and* @self is invalid. In this case, g_signal_handler_disconnect() will raise a g_critical() for us. Fixes: c33416178f88353b2f424a18c576de09b6ae3215
2015-10-12macros: allow NULL pointer in nm_clear_g_signal_handler()Jiří Klimeš1-1/+2
It does not make sense to issue an error. This should be a helper function. "NetworkManager[18341]: nm_clear_g_signal_handler: assertion 'G_IS_OBJECT (self)' failed" error started since commit e6d7fee5a617632acae02e12b1ec6156842df788 due to that.
2015-10-10libnm-util/test: use "nm-test-utils.h" in test-setting-dcbThomas Haller1-0/+10
2015-10-07macros: add NM_SET_OUT() macroThomas Haller1-0/+9
2015-10-05config: allow to enable/disable configuration snippetsThomas Haller1-0/+15
Support a new configuration option [.config] enable=<ENABLED> for configuration snippets. This new [.config] section is only relevant within the snippet itself and it is not merged into the combined configuration. Currently only the "enable" key is supported. If the "enable" key is missing, it obviously defaults to being enabled. It allows snippets to be skipped from loading. The main configuration "NetworkManager.conf" cannot be skipped. <ENABLED> can be a boolean value (false), to skip a configuration snippet from loading. It can also be a string to match against the NetworkManager version, like "enable=nm-version-min:1.1,nm-version-min:1.0.6" There are several motivations for this: - the user can disable an entire configuration snippet by toggeling one entry. This generalizes the functionality of the global-dns.enable setting, but in a way that applies to configuration on a per-file basis. - for developing, we often switch between different versions of NetworkManager. Thus, we might want to use different configuration. E.g. before global-dns options, I want to use "dns=none" and manage resolv.conf myself. Now, I can use global-dns setting to do that. That can be achieved with something like the following (not exactly, it's an example only): [.config] enable=nm-version-min:1.1 [main] dns=default [global-dns-domain-*] nameserver=127.0.0.1 Arguably, this would be more awesome, if we would bump our micro devel version (1.1.0) more often while developing 1.2.0 (*hint*). - in principle, packages could drop configuration snippets and enable them based on the NetworkManager version. - with the "env:" spec, you can enable/disable snippets by configuring an environment variable. Again, useful for testing and developing.
2015-10-05build: make NM_MORE_ASSERTS define numeric for different levels of more-assertsThomas Haller1-1/+1
Allows to enable more-asserts more granularly. Unfortunately, the old check was "${enable_more_asserts} == "yes", thus we cannot extend "--enable-more-assert=level" because that would mean that the same build script cannot set the option on both old and new NetworkManager. Thus, add a new option --with-more-asserts=level. If you put the following in your build script, it will work as expected whether you build a new or an old version of NetworkManager. ./configure --enable-more-asserts --with-more-asserts=5
2015-10-02macros: add nm_clear_g_signal_handler() helperThomas Haller1-0/+13
2015-10-01glib-compat: add g_hash_table_get_keys_as_array() compat functionBeniamino Galvani1-0/+39
2015-09-30build: extract version macros from "nm-version.h" to new header file ↵Thomas Haller2-1/+77
"nm-version-macros.h" For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus paths of NetworkManager. It is desirable to have this header usable without having a dependency on "glib.h", for example for a QT application. For that, commit c0852964a890cf43cc2dcaeff41ac6edc5028f24 removed that dependancy. For libnm-glib library, the analog to "nm-dbus-interface.h" is "NetworkManager.h", and the same applies there. Commit 159e827a72f420048e12d318f8ba1edd3f641fc8 removed that include. However, that broke build on PackageKit [1] which expected to get the version macros by including "NetworkManager.h". So at least for libnm-glib, we need to preserve old behavior so that a user including "NetworkManager.h" gets the version macros, but not "glib.h". Extract the version macros to a new header file "nm-version-macros.h". This header doesn't include "glib.h" and can be included from "NetworkManager.h". This gives as previous behavior and a glib-free include. For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h". Very few users will actually need the version macros, but not using libnm. Users that use libnm, should just include (libnm's) "NetworkManager.h" to get all headers. As a special case, a user who doesn't want to use glib/libnm, but still needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include them both separately. [1] https://github.com/hughsie/PackageKit/issues/85 Fixes: 4545a7fe9670ce4d7c259c11c2cc853bfae6729b
2015-09-30glib-compat: add compatibility function for g_hash_table_insert() and ↵Thomas Haller1-0/+29
g_hash_table_add() They have a different name, because we don't want to do the extra work unless explicitly requested.
2015-09-16systemd/build: use separate NETWORKMANAGER_COMPILATION define for systemd buildThomas Haller1-1/+2
2015-08-25macros: add NM_PRINT_FMT_QUOTE_STRING() macroThomas Haller1-0/+1
2015-08-12macros: use short-circuit evaluation in NM_IN_SET()Thomas Haller1-7/+9
All current users of NM_IN_SET() would rather use short-circuit evalation (or don't care). It seems that doing it by default seems favorable. The only downside is, that this might have somewhat unexpected behavior to a user who expects a regular function (which would evaluate always all arguments). Fixes: 7860ef959ae4b244017b9dc491e9c0a6024279dd
2015-08-12macros: rework NM_IN_SET() macro to expand to a plain logical expressionThomas Haller1-13/+83
Let the preprocessor do more work, but generate a simple expression that the compiler can optimize (presumably) better.
2015-08-10core: final gdbus portingDan Winship4-154/+0
Port remaining bits to gdbus and remove stray dbus-glib references Drop the dbus-glib version check from configure, since nothing depends on new dbus-glib any more. Move nm-dbus-glib-types.h and nm-gvaluearray-compat.h from include/ to libnm-util/ since they are now only used by libnm-util and libnm-glib.
2015-08-10core: port NMBusManager to gdbusDan Winship1-0/+19
Also remove some now-unused NMBusManager API
2015-08-05nm-default: include i18n headers via "nm-default.h"Thomas Haller1-0/+13
2015-08-05all: make use of new header file "nm-default.h"Thomas Haller2-3/+2
2015-08-05include: add convenience header "nm-default.h"Thomas Haller2-0/+60
This internal header file should be included by our internal source code files and header files. It includes in one place other headers that constitute to a minimal set of required headers. Most notably this is <glib.h> and our "nm-glib.h" header. Note that public header files and example source code cannot include this file as "nm-default.h" is internal only.
2015-07-24all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship5-17/+7
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).
2015-07-24include: add nm-dbus-compat.hDan Winship2-0/+75
Add a file containing the defines like DBUS_INTERFACE_DBUS from dbus-shared.h, and use it from the gdbus-using files. Also, convert a bunch of other places that were previously hardcoding the string values to use the defines instead, and fix the ifcfg-rh plugin to properly namespace its own D-Bus-related defines.
2015-07-24core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.hThomas Haller1-58/+0
NM_DEFINE_SINGLETON is used only by core and makes use of nm-logging. It does not belong to "include/nm-macros-internal.h". Move it to "src/".
2015-07-24Revert "core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.h"Thomas Haller1-0/+58
This reverts commit 1bca45986561ab6fa6ca3e624ef9ac84d98cdce9. I accidentely pushed that commit. Revert.
2015-07-24core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.hThomas Haller1-58/+0
NM_DEFINE_SINGLETON is used only by core and makes use of nm-logging. It does not belong to "include/nm-macros-internal.h". Move it to "src/".
2015-07-14test: add nmtst_platform_ip4_route() utilsThomas Haller1-0/+32
2015-07-12all: remove #if GLIB_CHECK_VERSION conditionals around g_type_init()Thomas Haller1-3/+1
g_type_init() is now provided by nm-glib-compat.h as nm_g_type_init().
2015-07-12core: add glib compatibility wrapper nm_g_type_init() for g_type_init()Thomas Haller1-0/+11
2015-07-12nmtst: add function nmtst_assert_str_has_substr()Thomas Haller1-0/+11
2015-07-02test: add nmtst_assert_success() utilThomas Haller1-0/+8
2015-07-02macros: add nm_strstrip() utilThomas Haller1-0/+9
2015-07-02glib-compat: backport g_key_file_save_to_file()Thomas Haller1-0/+37
2015-06-26macros: add NM_BACKPORT_SYMBOL()Dan Winship1-0/+14
Add a macro to insert the necessary compiler/linker magic to add a copy of an existing symbol to an older version. Also, update check-exports.sh to be able to check for such symbols by listed them commented-out in the appropriate section. [thaller@redhat.com: patch modified] Related: https://bugzilla.gnome.org/show_bug.cgi?id=742993
2015-06-23test: add NMTST_BUSY_WAIT() utilThomas Haller1-0/+12
2015-06-22glib-compat: include string.hLubomir Rintel1-0/+1
Needed for memmove().
2015-06-21trivial: fix spelling error in code commentThomas Haller1-1/+1
2015-06-17macros: add NM_PRINT_FMT_QUOTED() macroThomas Haller1-0/+5
2015-06-17glib-compat: add g_ptr_array_insert()Thomas Haller1-0/+32
2015-06-17utils: add nm_utils_is_power_of_two() macroThomas Haller1-0/+17
2015-06-17glib-compat: add nm_g_hash_table_replace() compat functionThomas Haller1-0/+17
The newer version of g_hash_table_replace() is useful, because it saves an additional hash table lookup.