summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* examples: add setting-user-data.pyThomas Haller2017-05-061-0/+246
| | | | | | | | Add an example python script to show and set setting's user-data. This is useful, as nmcli still doesn't support user data. (cherry picked from commit 447c766f526ec8bc4f5aa109a5e261cf060d1042)
* build: declare build dependencies requiring "nm-core-enum-types.h"Thomas Haller2017-03-293-1/+12
| | | | | | | | | | | | | | | | cat <<-EOF > /tmp/glib-mkenums #!/bin/bash sleep 15 && /usr/bin/glib-mkenums "\$@" EOF chmod +x /tmp/glib-mkenums (export PATH="/tmp:$PATH" && git clean -fdx && ./autogen.sh && make -j20 all-am) (cherry picked from commit 68ab166f3894834af9473d42f5dab72e0ed15394)
* device: add spec "driver:" to match devicesThomas Haller2017-03-171-0/+11
| | | | | | | | Changing the MAC address of devices is known to fail with certain drivers. Add a device-spec to allow disabling it for for such devices. Related: https://bugzilla.gnome.org/show_bug.cgi?id=777523
* include: use double-quotes to include our own headersThomas Haller2017-03-093-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* example: add example configuration snippet '30-anon.conf'th/stable-id-bgo776904Thomas Haller2017-01-091-0/+55
|
* examples: add DNS example with python and GObject introspectionBeniamino Galvani2016-12-121-0/+63
|
* examples/python: fix "import gi" in exampleThomas Haller2016-11-161-0/+2
| | | | | | | Otherwise there is a warning: from gi.repository import GLib, NM __main__:1: PyGIWarning: NM was imported without specifying a version first. Use gi.require_version(NM, 1.0) before import to ensure that the right version gets loaded.
* build: merge "examples/Makefile.am" into toplevel Makefileth/non-recursive-make-bgo772985Thomas Haller2016-10-2110-64/+0
|
* build: merge "examples/C/qt/Makefile.am" into toplevel MakefileThomas Haller2016-10-213-52/+0
|
* build: merge "examples/C/glib/Makefile.am" into toplevel MakefileThomas Haller2016-10-212-56/+1
|
* checkpoint: make python example accept multiple devices and timeoutBeniamino Galvani2016-09-261-22/+34
| | | | | Add a timeout parameter and allow passing multiple interfaces to make the script more useful for testing purposes.
* checkpoint: add python D-Bus exampleBeniamino Galvani2016-08-171-0/+63
|
* examples: fix crash in add-connection-libnmBeniamino Galvani2016-04-201-1/+1
| | | | Reported-by: Ali Nematollahi <alirezan1@gmail.com>
* man: fix typo in NetworkManager.conf manual and 10-ifcfg-rh-routes.sh commentThomas Haller2016-03-311-1/+1
|
* docs: replace spec.html with docbook D-Bus API referenceLubomir Rintel2016-03-261-1/+1
| | | | | | May use a lot of improvement (actually documenting the names and objects that use the interfaces in question), but at least this looks a lot better on developer.gnome.org.
* Fix missing commas in list-devices devtypes dict.Adrian Likins2016-03-021-5/+5
|
* device: add new NMDeviceType NM_DEVICE_TYPE_VETHThomas Haller2016-02-233-0/+3
| | | | Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
* examples: add missing device-types to examplesThomas Haller2016-02-233-1/+13
| | | | Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
* all: cleanup includes and let "nm-default.h" include "config.h"Thomas Haller2016-02-198-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* examples: avoid compile errors around NM versioningDan Williams2016-01-281-1/+2
|
* contrib/rpm: install pre-up dispatcher script "10-ifcfg-rh-routes.sh" as no-waitThomas Haller2016-01-081-0/+3
| | | | | | | | | The main reason to introduce the "no-wait.d" dispatcher directory was "10-ifcfg-rh-routes.sh", which (as a pre-up script) delays activation. We even extracted the script to a separate package on RHEL to avoid delays by default. Invoke the script via no-wait.d.
* build: rename directory "include" to "shared"Thomas Haller2015-12-241-2/+2
| | | | | | | | | | Up to now, the "include" directory contained (only) header files that were used project-wide by libs, core, clients, et al. Since the directory now also contains a non-header file, the "include" name is misleading. Instead of adding yet another directory that is project-wide, with non-header-only content, rename the "include" directory to "shared".
* examples: add README for python-networkmanager NetworkManager libraryThomas Haller2015-12-073-1/+9
|
* examples: add README for examples/python/giThomas Haller2015-12-072-1/+4
|
* libnm/libnm-glib: add NMClient.get_all_devices() method and AllDevices propertyDan Williams2015-12-041-0/+41
| | | | | Mirror new NetworkManager API to return both real devices and device placeholders.
* python: use gi.require_version() in generate-setting-docs.py and examplesThomas Haller2015-11-1110-0/+20
| | | | | | | | | | | | | | gi now emits a warning when not loading a specific library version [1]: ./generate-setting-docs.py:21: PyGIWarning: NM was imported without specifying a version first. Use gi.require_version(NM, 1.0) before import to ensure that the right version gets loaded. from gi.repository import NM, GObject Seems require_version() is reasonably old to just always use it without breaking on older versions [2]. [1] Related: https://bugzilla.gnome.org/show_bug.cgi?id=727379 [2] https://git.gnome.org/browse/pygobject/commit/?id=76758efb6579752237a0dc4d56cf9518de6c6e55
* examples: add python GI example for retrieving LLDP neighborsBeniamino Galvani2015-10-121-0/+52
|
* build: extract version macros from "nm-version.h" to new header file ↵Thomas Haller2015-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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
* examples: generate UUID in add-wifi-eap-connection.pyJiří Klimeš2015-09-171-2/+2
| | | | so that it can be run multiple times.
* examples: add a python example for adding WPA PSK Wi-Fi connectionJiří Klimeš2015-09-173-1/+58
| | | | and rename add-system-wifi-connection.py to add-wifi-eap-connection.py
* examples: add flags and mode parsing to show-wifi-networks.[lua|py]Jiří Klimeš2015-08-242-0/+107
|
* examples: add python+dbus example to print active access pointDan Williams2015-07-082-1/+68
|
* examples: python: add an D-Bus example creating and activating a bondJiří Klimeš2015-06-232-1/+116
|
* examples: add wifi-hotspot.py script to Makefile.amJiří Klimeš2015-06-231-1/+2
| | | | Fixes: 1af8e2f132f64a9f3c012a57f4b67422ccf62ad5
* examples: add DBus + Python example for starting/stopping a WiFi hotspotDan Williams2015-05-181-0/+112
|
* examples: bash: print errors int stderrPetr Vorel2015-03-182-3/+3
| | | | | | + whitespace Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
* examples: update Python NM example to print detailed connection stateSrdjan Grubor2015-03-121-6/+19
| | | | | | | Current Python NM example has a very crude connection state output and the global NM connectivity is not used in them either. https://bugzilla.gnome.org/show_bug.cgi?id=746045
* examples: python: print into stderrPetr Vorel2015-03-105-5/+5
| | | | | | https://mail.gnome.org/archives/networkmanager-list/2015-March/msg00024.html Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
* examples/trvial: replace tabs by whitespace in python exampleThomas Haller2015-03-101-2/+2
|
* examples: add a Python example deactivating connections by type (bgo #732826)Jiří Klimeš2015-03-052-1/+83
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=732826
* examples: add a Lua example deactivating connections by type (bgo #732826)Jiří Klimeš2015-03-052-1/+84
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=732826
* examples: add a Lua example setting user name for a VPN connectionJiří Klimeš2015-02-112-1/+87
|
* examples: add a Lua example getting IP configuration of a deviceJiří Klimeš2015-02-102-1/+162
| | | | | | Unfortunately, there is a bug in lgi library causing the incorrect values being returned and the example crashes. I am going to send a patch to lgi to fix the issues.
* examples: add a Lua example showing basic NetworkManager informationJiří Klimeš2015-02-092-1/+53
|
* examples: add a Lua example for getting Wi-Fi access pointsJiří Klimeš2015-02-092-1/+81
|
* examples: add some examples in Lua using lgi libraryJiří Klimeš2015-01-306-0/+219
| | | | | | | | | | | | | [libnm] https://developer.gnome.org/libnm/1.0/ [lgi] https://github.com/pavouk/lgi [lgi-guide] https://github.com/pavouk/lgi/blob/master/docs/guide.md On most distribution just install lua-lgi. Note: There is a bug in lgi. It doesn't handle GPtrArray corectly. It results in crashing on list-devices.lua and list-connections.lua. I will send a patch to lgi to fix the issue.
* dispatcher: fix ifcfg-rh example dispatcher script (rh #1160013)Dan Winship2015-01-271-4/+17
| | | | | | Routing table entries for a device get flushed when the device is deactivated, but rules table entries don't, so we have to flush them by hand.
* ifcfg-rh: allow handling complex routing rules via dispatcher (rh #1160013)Dan Winship2015-01-122-0/+22
| | | | | | | | If a connection has an associated "rule-NAME" or "rule6-NAME" file, don't try to read in the routes, since NetworkManager won't be able to parse them correctly. Instead, log a warning that they will need to be applied via a dispatcher script, and provide a script that would do that in examples/dispatcher/.
* examples: update python examplesDan Winship2014-11-1512-137/+227
| | | | | | | | | | Update the raw D-Bus python examples to use newer APIs where appropriate (and split the add-connection example into 1.0-only and 0.9-compatible versions). Update the gi-based python examples for the various API changes since they were last updated. Also add a comment to the ruby add-connection example pointing out that it's still using the old settings APIs.
* all: consistently include config.hDan Winship2014-11-138-0/+16
| | | | | | | | | | | 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.)