summaryrefslogtreecommitdiff
path: root/libnm/nm-client.h
Commit message (Collapse)AuthorAgeFilesLines
* all: return output dictionary from "AddAndActivate2"Thomas Haller2019-01-141-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a "a{sv}" output argument to "AddAndActivate2" D-Bus API. "AddAndActivate2" replaces "AddAndActivate" with more options. It also has a dictionary argument to be forward compatible so that we hopefully won't need an "AddAndActivate3". However, it lacked a similar output dictionary. Add it for future extensibility. I think this is really to workaround a shortcoming of D-Bus, which does provide strong typing and type information about its API, but does not allow to extend an existing API in a backward compatible manner. So we either resort to Method(), Method2(), Method3() variants, or a catch-all variant with a generic "a{sv}" input/output argument. In libnm, rename "nm_client_add_and_activate_connection_options()" to "nm_client_add_and_activate_connection2()". I think libnm API should have an obvious correspondence with D-Bus API. Or stated differently, if "AddAndActivateOptions" would be a better name, then the D-Bus API should be renamed. We should prefer one name over the other, but regardless of which is preferred, the naming for D-Bus and libnm API should correspond. In this case, I do think that AddAndActivate2() is a better name than AddAndActivateOptions(). Hence I rename the libnm API. Also, unless necessary, let libnm still call "AddAndActivate" instead of "AddAndActivate2". Our backward compatibility works the way that libnm requires a server version at least as new as itself. As such, libnm theoretically could assume that server version is new enough to support "AddAndActivate2" and could always use the more powerful variant. However, we don't need to break compatibility intentionally and for little gain. Here, it's easy to let libnm also handle old server API, by continuing to use "AddAndActivate" for nm_client_add_and_activate_connection(). Note that during package update, we don't restart the currently running NetworkManager instance. In such a scenario, it can easily happen that nmcli/libnm is newer than the server version. Let's try a bit harder to not break that. Changes as discussed in [1]. [1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/37#note_79876
* libnm: drop "_async" suffix from nm_client_add_and_activate_connection_options()Thomas Haller2018-11-191-8/+8
| | | | | | | | Synchronous D-Bus calls seems harmful to me, such API should not be added to libnm. As such, all API is by default and preferably "_async". Don't add an "_async" suffix. While we are not consistent in libnm about this, I think for new code we should.
* libnm: add missing NM_AVAILABLE_IN_1_16 macros for new APIth/pr/37Thomas Haller2018-11-181-0/+2
|
* libnm: Add support to pass options to AddAndActivateConnectionBenjamin Berg2018-11-171-0/+12
| | | | | | | This adds the new methods nm_client_add_and_activate_connection_options_* and ports the existing methods to use the new AddAndActivateConnection2 call rather than AddAndActivateConnection, allowing further parameters to be passed in.
* all: remove consecutive empty linesBeniamino Galvani2018-04-301-1/+0
| | | | | | | Normalize coding style by removing consecutive empty lines from C sources and headers. https://github.com/NetworkManager/NetworkManager/pull/108
* libnm: rework checkpoint APIThomas Haller2018-04-041-17/+17
| | | | | | | | | | | | | | | | | | | | | | The libnm API fir checkpoints was only introduced with 1.11. It is not yet stable, so there is still time to adjust it. Note that this changes API/ABI of the development branch. Changes: - we only add async variants of the checkpoint functions. I believe that synchronous D-Bus methods are fundamentally flawed, because they mess up the ordering of events. Rename the async functions by removing the "_async" suffix. This matches glib style, for which the async form is also not specially marked. - for function that refere to a particular checkpoint (rollback and destroy), accept the D-Bus path as string, instead of an NMCheckpoint instance. This form is more flexible, because it allows to use the function without having a NMCheckpoint instance at hand. On the other hand, if one has a NMCheckpoint instance, he can trivially obtain the path to make the call.
* checkpoint: allow resetting the rollback timeout via D-BusThomas Haller2018-04-041-0/+13
| | | | | | | | | | | | | | | | | | | | | | This allows to adjust the timeout of an existing checkpoint. The main usecase of checkpoints, is to have a fail-safe when configuring the network remotely. By allowing to reset the timeout, the user can perform a series of actions, and keep bumping the timeout. That way, the entire series is still guarded by the same checkpoint, but the user can start with short timeout, and re-adjust the timeout as he goes along. The libnm API only implements the async form (at least for now). Sync methods are fundamentally wrong with D-Bus, and it's probably not needed. Also, follow glib convenction, where the async form doesn't have the _async name suffix. Also, accept a D-Bus path as argument, not a NMCheckpoint instance. The libnm API should not be more restricted than the underlying D-Bus API. It would be cumbersome to require the user to lookup the NMCheckpoint instance first, especially since libnm doesn't provide an efficient or convenient lookup-by-path method. On the other hand, retrieving the path from a NMCheckpoint instance is always possible.
* libnm: add checkpoint supportBeniamino Galvani2017-11-091-0/+39
|
* libnm: add gtk-doc Since markers for new API and missing enum documentationThomas Haller2017-08-171-0/+7
|
* client: expose connectivity-check-{available,enabled} propertiesJames Henstridge2017-08-171-1/+9
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=785117
* include: use double-quotes to include our own headersThomas Haller2017-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In practice, this should only matter when there are multiple header files with the same name. That is something we try to avoid already, by giving headers a distinct name. When building NetworkManager itself, we clearly want to use double-quotes for including our own headers. But we also want to do that in our public headers. For example: ./a.c #include <stdio.h> #include <nm-1.h> void main() { printf ("INCLUDED %s/nm-2.h\n", SYMB); } ./1/nm-1.h #include <nm-2.h> ./1/nm-2.h #define SYMB "1" ./2/nm-2.h #define SYMB "2" $ cc -I./2 -I./1 ./a.c $ ./a.out INCLUDED 2/nm-2.h Exceptions to this are - headers in "shared/nm-utils" that include <NetworkManager.h>. These headers are copied into projects and hence used like headers owned by those projects. - examples/C
* libnm: implement support for DNS manager propertiesBeniamino Galvani2016-12-121-0/+29
|
* auth: check when setting statistics refresh rateAlfonso Sanchez-Beato2016-08-171-1/+4
|
* permissions: properly add checkpoint-rollback permissionThomas Haller2016-08-171-1/+3
| | | | Fixes: a52d4654ec4d3afbbb0ef70ada55f4a5ddac92db
* libnm/client: emit signals when active connection disappearsLubomir Rintel2016-07-071-0/+2
| | | | It allows us to reliably track failures to activate a connection.
* manager: add Reload() D-Bus commandThomas Haller2016-06-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new Reload D-Bus command to reload NetworkManager configuration. For now, this is like sending SIGHUP to the process. There are several advantages here: - it is guarded via PolicyKit authentication while signals can only be sent by root. - the user can wait for the reload to be complete instead of sending an asynchronous signal. For now, we operation completes after nm_config_reload() returns, but later we could delay the response further until specific parts are fully reloaded. - SIGHUP reloads everything including re-reading configuration from disk while SIGUSR1 reloads just certain parts such as writing out DNS configuration anew. Now, the Reload command has a flags argument which is more granular in selecting parts which are to be reloaded. For example, via signals the user can: 1) send SIGUSR1: this writes out the DNS configuration to resolv.conf and possibly reloads other parts without re-reading configuration and without restarting the DNS plugin. 2) send SIGHUP: this reloads configuration from disk, writes out resolv.conf and restarts the DNS plugin. There is no way, to only restart the DNS plugin without also reloading everything else.
* libnm: implement missing NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNSThomas Haller2016-06-011-1/+4
|
* docs: libnm: add doc comment to typesBeniamino Galvani2016-05-051-0/+3
| | | | | | This is required to add objects in the "Types and Values" section and in the API index. Later, we may want to add useful content in those empty comments.
* libnm/libnm-glib: add NMClient.get_all_devices() method and AllDevices propertyDan Williams2015-12-041-1/+8
| | | | | Mirror new NetworkManager API to return both real devices and device placeholders.
* nm-manager: add 'metered' propertyBeniamino Galvani2015-06-091-0/+1
| | | | | | This introduces a global metered property which makes easier for clients to obtain the metered status of the current primary connection.
* libnm: change GSList to GPtrArray in libnm methodsDan Winship2014-10-281-1/+1
| | | | | | | libnm mostly used GPtrArrays in its APIs, except that arrays of connections were usually GSLists. Fix this and make them GPtrArrays too (and rename nm_client_list_connections() to nm_client_get_connections() to match everything else).
* libnm: consolidate NMClientError and NMObjectErrorDan Winship2014-10-221-9/+11
| | | | | | | | | | | | | Consolidate NMClientError and NMObjectError (such that there is now only one libnm-API-specific error domain). In particular, merge NM_CONNECTION_ERROR_CONNECTION_REMOVED with NM_OBJECT_ERROR_OBJECT_CREATION_FAILURE as the new NM_CONNECTION_ERROR_OBJECT_CREATION_FAILED. Also make object_creation_failed() be a plain method rather than a signal, since there's no reason for anyone to be connecting to it on another object. And remove its GError argument because the subclass can just create its own more-specific error.
* libnm: add nm-types.h, to avoid include loopsDan Winship2014-10-101-11/+3
| | | | | Add nm-types.h defining all the type structs, to avoid future include loops. Clean up the includes in all of the installed headers.
* libnm: merge NMRemoteSettings into NMClientDan Winship2014-10-101-0/+76
| | | | | Make NMRemoteSettings internal and have NMClient wrap all of its APIs, just like it does with NMManager.
* libnm: split "NMManager" out of NMClientDan Winship2014-10-101-3/+2
| | | | | Clone NMClient as NMManager, and make NMClient just be a wrapper around that new class.
* libnm: (trivial) reorder NMClient function declarations/codeDan Winship2014-10-101-45/+56
| | | | | | | | Rearrange the NMClient function declarations and the functions themselves, and group them into "general", "device", and "active connection" sections. No code changes, just moving things around.
* libnm: return errors in nm_client_networking_set_enabled()Jiří Klimeš2014-10-011-2/+4
| | | | | and do not print an error in the library. The caller can decide what to do on an error.
* libnm: add some missing sync/async method variantsDan Winship2014-09-251-4/+12
| | | | | | | | | | | | | Add the missing variant in most places in the API where previously there was either only a synchronous version or only an asynchronous version. There is not yet a synchronous nm_client_activate_connection(), nm_client_add_and_activate_connection(), or nm_remote_settings_add_connection(), because the existing async code depends on waiting for other asynchronous events, so making them run synchronously is slightly more complicated. But these APIs can be added later.
* libnm: make sync/async APIs more GLib-likeDan Winship2014-09-251-26/+26
| | | | | | | | | | | | Make synchronous APIs take GCancellables, and make asynchronous APIs use GAsyncReadyCallbacks and have names ending in "_async", with "_finish" functions to retrieve the results. Also, make nm_client_activate_connection_finish(), nm_client_add_and_activate_finish(), and nm_remote_settings_add_connection_finish() be (transfer full) rather than (transfer none), because the refcounting semantics become slightly confusing in some edge cases otherwise.
* all: remove a bunch of unnecessary dbus/dbus-glib includesDan Winship2014-09-031-1/+0
|
* all: fix up multiple-include-guard definesDan Winship2014-08-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include guard, which meant that nm-test-utils.h could not tell which of them was being included (and so, eg, if you tried to include nm-ip4-config.h in a libnm test, it would fail to compile because nm-test-utils.h was referring to symbols in src/nm-ip4-config.h). Fix this by changing the include guards in the non-API-stable parts of the tree: - libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H - libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__ - src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__ And likewise for all other headers. The two non-"nm"-prefixed headers, libnm/NetworkManager.h and src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and __NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely consistent with the general scheme, do still mostly make sense in isolation.
* libnm: synchronize NMClient and NMRemoteSettings "is NM running" propertiesDan Winship2014-08-071-2/+2
| | | | | Rename NMClient:manager-running and NMRemoteSettings:service-running to both be :nm-running.
* libnm: add NetworkManager.h, disallow including individual headersDan Winship2014-08-011-0/+4
| | | | | | | | | | Add NetworkManager.h, which includes all of the other NM header, and require all external users of libnm to use that rather than the individual headers. (An exception is made for nm-dbus-interface.h, nm-vpn-dbus-interface.h, and nm-version.h, which can be included separately.)
* libnm: rename NetworkManager.h and NetworkManagerVPN.hDan Winship2014-08-011-1/+1
| | | | | | | "NetworkManager.h"'s name (and non-standard capitalization) suggest that it's some sort of high-level super-important header, but it's really just low-level D-Bus stuff. Rename it to "nm-dbus-interface.h" and likewise "NetworkManagerVPN.h" to "nm-vpn-dbus-interface.h"
* libnm: make the the use of GInitable mandatoryDan Winship2014-08-011-1/+2
| | | | | | | | | | | Remove _nm_object_ensure_inited(), etc; objects that implement GInitable are now mandatory-to-init(). Remove constructor() implementations that sometimes return NULL; do all the relevant checking in init() instead. Make nm_client_new() and nm_remote_settings_new() take a GCancellable and a GError**.
* libnm: fix up class struct reserved slotsDan Winship2014-08-011-7/+2
| | | | | | | | | | | | | | Add reserved slots to those classes that were missing them (or had run out), and sync up the number of slots across classes: - 8 slots for "important" classes, abstract base classes, and classes we expect we might need to add new virtual methods or signals to later. - 4 for everything else Also, rearrange the class elements in a few places into standard order (signals first, then methods).
* libnm: remove Since tags and NM_AVAILABLE_IN_* attributesDan Winship2014-08-011-2/+0
| | | | Everything currently in libnm has always been there.
* libnm: remove all deprecated functions and typesDan Winship2014-08-011-1/+0
| | | | | | | Remove deprecated functions and enum types. For now, deprecated properties are still around, because removing them would cause warnings when talking to older implementations.
* libnm: add libnm/libnm-core (part 1)Dan Winship2014-08-011-0/+255
This commit begins creating the new "libnm", which will replace libnm-util and libnm-glib. The main reason for the libnm-util/libnm-glib split is that the daemon needs to link to libnm-util (to get NMSettings, NMConnection, etc), but can't link to libnm-glib (because it uses many of the same type names as the NetworkManager daemon. eg, NMDevice). So the daemon links to only libnm-util, but basically all clients link to both. With libnm, there will be only a single client-visible library, and NetworkManager will internally link against a private "libnm-core" containing the parts that used to be in libnm-util. (The "libnm-core" parts still need to be in their own directory so that the daemon can see those header files without also seeing the ones in libnm/ that conflict with its own headers.) [This commit just copies the source code from libnm-util/ to libnm-core/, and libnm-glib/ to libnm/: mkdir -p libnm-core/tests/ mkdir -p libnm/tests/ cp libnm-util/*.[ch] libnm-util/nm-version.h.in libnm-core/ rm -f libnm-core/nm-version.h libnm-core/nm-setting-template.[ch] libnm-core/nm-utils-enum-types.[ch] cp libnm-util/tests/*.[ch] libnm-core/tests/ cp libnm-glib/*.[ch] libnm/ rm -f libnm/libnm_glib.[ch] libnm/libnm-glib-test.c libnm/nm-glib-enum-types.[ch] cp libnm-glib/tests/*.[ch] libnm/tests/ ]