diff options
| author | Michael Biebl <biebl@debian.org> | 2012-03-24 01:37:02 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2012-03-24 01:37:02 +0100 |
| commit | de06e5715e780baade318f3490ac7a4c9ce84e32 (patch) | |
| tree | 23fbc3fafc12072476eff98bee60100eb54c29db /examples | |
| parent | b436a68a20ff3114ded32a7a3d70cdd4954039f9 (diff) | |
Imported Upstream version 0.9.4.0 upstream/0.9.4.0
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/C/Makefile.in | 9 | ||||
| -rw-r--r-- | examples/C/glib/Makefile.am | 27 | ||||
| -rw-r--r-- | examples/C/glib/Makefile.in | 72 | ||||
| -rw-r--r-- | examples/C/glib/list-connections-libnm-glib.c | 2 | ||||
| -rw-r--r-- | examples/C/glib/monitor-nm-running-GDBus.c | 92 | ||||
| -rw-r--r-- | examples/C/glib/monitor-nm-running-dbus-glib.c | 125 | ||||
| -rw-r--r-- | examples/C/glib/monitor-nm-state-GDBus.c | 138 | ||||
| -rw-r--r-- | examples/C/qt/Makefile.am | 22 | ||||
| -rw-r--r-- | examples/C/qt/Makefile.in | 58 | ||||
| -rw-r--r-- | examples/C/qt/monitor-nm-running.cpp | 89 | ||||
| -rw-r--r-- | examples/Makefile.am | 2 | ||||
| -rw-r--r-- | examples/Makefile.in | 11 | ||||
| -rw-r--r-- | examples/python/Makefile.in | 9 | ||||
| -rw-r--r-- | examples/ruby/Makefile.am | 4 | ||||
| -rw-r--r-- | examples/ruby/Makefile.in | 482 | ||||
| -rwxr-xr-x | examples/ruby/add-connection.rb | 86 | ||||
| -rwxr-xr-x | examples/ruby/get-basic-nm-info.rb | 51 | ||||
| -rwxr-xr-x | examples/ruby/list-devices.rb | 85 | ||||
| -rw-r--r-- | examples/shell/Makefile.am | 3 | ||||
| -rw-r--r-- | examples/shell/Makefile.in | 481 | ||||
| -rwxr-xr-x | examples/shell/get-hostname.sh | 45 | ||||
| -rwxr-xr-x | examples/shell/nm-logging.sh | 46 |
22 files changed, 1918 insertions, 21 deletions
diff --git a/examples/C/Makefile.in b/examples/C/Makefile.in index 03e238b1..463b6d49 100644 --- a/examples/C/Makefile.in +++ b/examples/C/Makefile.in @@ -148,6 +148,8 @@ GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAKEFILE = @GLIB_MAKEFILE@ +GLIB_MKENUMS = @GLIB_MKENUMS@ GMODULE_CFLAGS = @GMODULE_CFLAGS@ GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ @@ -202,11 +204,15 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ +LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -217,6 +223,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -256,6 +263,8 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ diff --git a/examples/C/glib/Makefile.am b/examples/C/glib/Makefile.am index 1063d520..428f6adc 100644 --- a/examples/C/glib/Makefile.am +++ b/examples/C/glib/Makefile.am @@ -1,6 +1,8 @@ INCLUDES = -I${top_srcdir}/libnm-util \ + -I${top_builddir}/libnm-util \ -I${top_srcdir}/libnm-glib \ - -I${top_srcdir}/include + -I${top_srcdir}/include \ + -I${top_builddir}/include AM_CPPFLAGS = \ $(DBUS_CFLAGS) \ @@ -12,7 +14,10 @@ noinst_PROGRAMS = \ get-active-connections-dbus-glib \ list-connections-dbus-glib \ list-connections-libnm-glib \ - get-ap-info-libnm-glib + get-ap-info-libnm-glib \ + monitor-nm-running-dbus-glib \ + monitor-nm-running-GDBus \ + monitor-nm-state-GDBus add_connection_dbus_glib_SOURCES = add-connection-dbus-glib.c add_connection_dbus_glib_LDADD = \ @@ -53,11 +58,27 @@ get_ap_info_libnm_glib_LDADD = \ $(DBUS_LIBS) \ $(GLIB_LIBS) +monitor_nm_running_dbus_glib_SOURCES = monitor-nm-running-dbus-glib.c +monitor_nm_running_dbus_glib_LDADD = \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + +monitor_nm_running_GDBus_SOURCES = monitor-nm-running-GDBus.c +monitor_nm_running_GDBus_LDADD = \ + $(GIO_LIBS) + +monitor_nm_state_GDBus_SOURCES = monitor-nm-state-GDBus.c +monitor_nm_state_GDBus_LDADD = \ + $(GIO_LIBS) + EXTRA_DIST = \ add-connection-dbus-glib.c \ add-connection-libnm-glib.c \ get-active-connections-dbus-glib.c \ list-connections-dbus-glib.c \ list-connections-libnm-glib.c \ - get-ap-info-libnm-glib.c + get-ap-info-libnm-glib.c \ + monitor-nm-running-dbus-glib.c \ + monitor-nm-running-GDBus.c \ + monitor-nm-state-GDBus.c diff --git a/examples/C/glib/Makefile.in b/examples/C/glib/Makefile.in index 1a220537..871da9c9 100644 --- a/examples/C/glib/Makefile.in +++ b/examples/C/glib/Makefile.in @@ -39,7 +39,10 @@ noinst_PROGRAMS = add-connection-dbus-glib$(EXEEXT) \ get-active-connections-dbus-glib$(EXEEXT) \ list-connections-dbus-glib$(EXEEXT) \ list-connections-libnm-glib$(EXEEXT) \ - get-ap-info-libnm-glib$(EXEEXT) + get-ap-info-libnm-glib$(EXEEXT) \ + monitor-nm-running-dbus-glib$(EXEEXT) \ + monitor-nm-running-GDBus$(EXEEXT) \ + monitor-nm-state-GDBus$(EXEEXT) subdir = examples/C/glib DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -108,6 +111,20 @@ list_connections_libnm_glib_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) +am_monitor_nm_running_GDBus_OBJECTS = \ + monitor-nm-running-GDBus.$(OBJEXT) +monitor_nm_running_GDBus_OBJECTS = \ + $(am_monitor_nm_running_GDBus_OBJECTS) +monitor_nm_running_GDBus_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_monitor_nm_running_dbus_glib_OBJECTS = \ + monitor-nm-running-dbus-glib.$(OBJEXT) +monitor_nm_running_dbus_glib_OBJECTS = \ + $(am_monitor_nm_running_dbus_glib_OBJECTS) +monitor_nm_running_dbus_glib_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_monitor_nm_state_GDBus_OBJECTS = monitor-nm-state-GDBus.$(OBJEXT) +monitor_nm_state_GDBus_OBJECTS = $(am_monitor_nm_state_GDBus_OBJECTS) +monitor_nm_state_GDBus_DEPENDENCIES = $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles @@ -139,13 +156,19 @@ SOURCES = $(add_connection_dbus_glib_SOURCES) \ $(get_active_connections_dbus_glib_SOURCES) \ $(get_ap_info_libnm_glib_SOURCES) \ $(list_connections_dbus_glib_SOURCES) \ - $(list_connections_libnm_glib_SOURCES) + $(list_connections_libnm_glib_SOURCES) \ + $(monitor_nm_running_GDBus_SOURCES) \ + $(monitor_nm_running_dbus_glib_SOURCES) \ + $(monitor_nm_state_GDBus_SOURCES) DIST_SOURCES = $(add_connection_dbus_glib_SOURCES) \ $(add_connection_libnm_glib_SOURCES) \ $(get_active_connections_dbus_glib_SOURCES) \ $(get_ap_info_libnm_glib_SOURCES) \ $(list_connections_dbus_glib_SOURCES) \ - $(list_connections_libnm_glib_SOURCES) + $(list_connections_libnm_glib_SOURCES) \ + $(monitor_nm_running_GDBus_SOURCES) \ + $(monitor_nm_running_dbus_glib_SOURCES) \ + $(monitor_nm_state_GDBus_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -194,6 +217,8 @@ GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAKEFILE = @GLIB_MAKEFILE@ +GLIB_MKENUMS = @GLIB_MKENUMS@ GMODULE_CFLAGS = @GMODULE_CFLAGS@ GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ @@ -248,11 +273,15 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ +LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -263,6 +292,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -302,6 +332,8 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -366,8 +398,10 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I${top_srcdir}/libnm-util \ + -I${top_builddir}/libnm-util \ -I${top_srcdir}/libnm-glib \ - -I${top_srcdir}/include + -I${top_srcdir}/include \ + -I${top_builddir}/include AM_CPPFLAGS = \ $(DBUS_CFLAGS) \ @@ -412,13 +446,29 @@ get_ap_info_libnm_glib_LDADD = \ $(DBUS_LIBS) \ $(GLIB_LIBS) +monitor_nm_running_dbus_glib_SOURCES = monitor-nm-running-dbus-glib.c +monitor_nm_running_dbus_glib_LDADD = \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + +monitor_nm_running_GDBus_SOURCES = monitor-nm-running-GDBus.c +monitor_nm_running_GDBus_LDADD = \ + $(GIO_LIBS) + +monitor_nm_state_GDBus_SOURCES = monitor-nm-state-GDBus.c +monitor_nm_state_GDBus_LDADD = \ + $(GIO_LIBS) + EXTRA_DIST = \ add-connection-dbus-glib.c \ add-connection-libnm-glib.c \ get-active-connections-dbus-glib.c \ list-connections-dbus-glib.c \ list-connections-libnm-glib.c \ - get-ap-info-libnm-glib.c + get-ap-info-libnm-glib.c \ + monitor-nm-running-dbus-glib.c \ + monitor-nm-running-GDBus.c \ + monitor-nm-state-GDBus.c all: all-am @@ -481,6 +531,15 @@ list-connections-dbus-glib$(EXEEXT): $(list_connections_dbus_glib_OBJECTS) $(lis list-connections-libnm-glib$(EXEEXT): $(list_connections_libnm_glib_OBJECTS) $(list_connections_libnm_glib_DEPENDENCIES) @rm -f list-connections-libnm-glib$(EXEEXT) $(AM_V_CCLD)$(LINK) $(list_connections_libnm_glib_OBJECTS) $(list_connections_libnm_glib_LDADD) $(LIBS) +monitor-nm-running-GDBus$(EXEEXT): $(monitor_nm_running_GDBus_OBJECTS) $(monitor_nm_running_GDBus_DEPENDENCIES) + @rm -f monitor-nm-running-GDBus$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(monitor_nm_running_GDBus_OBJECTS) $(monitor_nm_running_GDBus_LDADD) $(LIBS) +monitor-nm-running-dbus-glib$(EXEEXT): $(monitor_nm_running_dbus_glib_OBJECTS) $(monitor_nm_running_dbus_glib_DEPENDENCIES) + @rm -f monitor-nm-running-dbus-glib$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(monitor_nm_running_dbus_glib_OBJECTS) $(monitor_nm_running_dbus_glib_LDADD) $(LIBS) +monitor-nm-state-GDBus$(EXEEXT): $(monitor_nm_state_GDBus_OBJECTS) $(monitor_nm_state_GDBus_DEPENDENCIES) + @rm -f monitor-nm-state-GDBus$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(monitor_nm_state_GDBus_OBJECTS) $(monitor_nm_state_GDBus_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -494,6 +553,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-ap-info-libnm-glib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list-connections-dbus-glib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list-connections-libnm-glib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor-nm-running-GDBus.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor-nm-running-dbus-glib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor-nm-state-GDBus.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ diff --git a/examples/C/glib/list-connections-libnm-glib.c b/examples/C/glib/list-connections-libnm-glib.c index edb5ccc3..01a9f254 100644 --- a/examples/C/glib/list-connections-libnm-glib.c +++ b/examples/C/glib/list-connections-libnm-glib.c @@ -76,7 +76,7 @@ show_connection (NMConnection *data, gpointer user_data) char timestamp_real_str[64]; const char *val1, *val2, *val3, *val4, *val5; - s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION); + s_con = nm_connection_get_setting_connection (connection); if (s_con) { /* Get various info from NMSettingConnection and show it */ timestamp = nm_setting_connection_get_timestamp (s_con); diff --git a/examples/C/glib/monitor-nm-running-GDBus.c b/examples/C/glib/monitor-nm-running-GDBus.c new file mode 100644 index 00000000..42f9b758 --- /dev/null +++ b/examples/C/glib/monitor-nm-running-GDBus.c @@ -0,0 +1,92 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* vim: set ft=c ts=4 sts=4 sw=4 noexpandtab smartindent: */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (C) Copyright 2012 Red Hat, Inc. + */ + +/* + * This example monitors whether NM is running by checking if + * "org.freedesktop.NetworkManager" is owned by a process on D-Bus. + * It uses g_bus_watch_name(). + * + * See also http://developer.gnome.org/gio/stable/gio-Watching-Bus-Names.html + * + * Standalone compilation: + * gcc -Wall `pkg-config --libs --cflags glib-2.0 gio-2.0` monitor-nm-running-GDBus.c -o monitor-nm-running-GDBus + */ + +#include <gio/gio.h> + +#if GLIB_CHECK_VERSION(2,26,0) +static void +on_name_appeared (GDBusConnection *connection, + const gchar *name, + const gchar *name_owner, + gpointer user_data) +{ + g_print ("Name '%s' on the system bus is owned by %s => NM is running\n", + name, name_owner); +} + +static void +on_name_vanished (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + g_print ("Name '%s' does not exist on the system bus => NM is not running\n", name); +} +#endif + + +int +main (int argc, char *argv[]) +{ +#if GLIB_CHECK_VERSION(2,26,0) + guint watcher_id; + GMainLoop *loop; + GBusNameWatcherFlags flags; + + /* Initialize GType system */ + g_type_init (); + + g_print ("Monitor 'org.freedesktop.NetworkManager' D-Bus name\n"); + g_print ("===================================================\n"); + + flags = G_BUS_NAME_WATCHER_FLAGS_NONE; + + /* Start to watch "org.freedesktop.NetworkManager" bus name */ + watcher_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM, + "org.freedesktop.NetworkManager", + flags, + on_name_appeared, + on_name_vanished, + NULL, + NULL); + + /* Run main loop */ + loop = g_main_loop_new (NULL, FALSE); + g_main_loop_run (loop); + + /* Stop watching the name */ + g_bus_unwatch_name (watcher_id); +#else + g_print ("Sorry, you need at least GLib 2.26 for GDBus.\n"); +#endif + + return 0; +} + diff --git a/examples/C/glib/monitor-nm-running-dbus-glib.c b/examples/C/glib/monitor-nm-running-dbus-glib.c new file mode 100644 index 00000000..3290fb1a --- /dev/null +++ b/examples/C/glib/monitor-nm-running-dbus-glib.c @@ -0,0 +1,125 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* vim: set ft=c ts=4 sts=4 sw=4 noexpandtab smartindent: */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (C) Copyright 2012 Red Hat, Inc. + */ + +/* + * This example monitors whether NM is running by checking D-Bus + * NameOwnerChanged signal. + * It uses dbus-glib library. + * + * Standalone compilation: + * gcc -Wall `pkg-config --libs --cflags glib-2.0 dbus-glib-1` monitor-nm-running.c -o monitor-nm-running + */ + +#include <glib.h> +#include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-bindings.h> +#include <string.h> + +#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager" + +static void +proxy_name_owner_changed (DBusGProxy *proxy, + const char *name, + const char *old_owner, + const char *new_owner, + gpointer user_data) +{ + gboolean *nm_running = (gboolean *) user_data; + gboolean old_good = (old_owner && strlen (old_owner)); + gboolean new_good = (new_owner && strlen (new_owner)); + gboolean new_running = FALSE; + + /* We are only interested in NetworkManager */ + if (!name || strcmp (name, NM_DBUS_SERVICE) != 0) + return; + + if (!old_good && new_good) + new_running = TRUE; + else if (old_good && !new_good) + new_running = FALSE; + + *nm_running = new_running; + + g_print ("name: '%s', old_owner: '%s', new_owner: '%s'", name, old_owner, new_owner); + g_print (" => NM is %s\n", *nm_running ? "running" : "not running"); +} + + +int +main (int argc, char *argv[]) +{ + DBusGConnection *bus; + DBusGProxy *bus_proxy; + GMainLoop *loop = NULL; + GError *err = NULL; + gboolean nm_running; + + /* Initialize GType system */ + g_type_init (); + + g_print ("Monitor 'org.freedesktop.NetworkManager' D-Bus name\n"); + g_print ("===================================================\n"); + + /* Get system bus */ + bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); + + /* Create a D-Bus proxy to D-Bus daemon */ + bus_proxy = dbus_g_proxy_new_for_name (bus, + "org.freedesktop.DBus", + "/org/freedesktop/DBus", + "org.freedesktop.DBus"); + + if (!bus_proxy) { + g_message ("Error: Couldn't create D-Bus object proxy for org.freedesktop.DBus."); + dbus_g_connection_unref (bus); + return -1; + } + + /* Call NameHasOwner method to find out if NM is running. When NM runs it claims + * 'org.freedesktop.NetworkManager' service name on D-Bus */ + if (!org_freedesktop_DBus_name_has_owner (bus_proxy, NM_DBUS_SERVICE, &nm_running, &err)) { + g_message ("Error: NameHasOwner request failed: %s", + (err && err->message) ? err->message : "(unknown)"); + g_clear_error (&err); + g_object_unref (bus_proxy); + dbus_g_connection_unref (bus); + return -1; + } + g_print ("NM is %s\n", nm_running ? "running" : "not running"); + + + /* Connect to NameOwnerChanged signal to monitor NM running state */ + dbus_g_proxy_add_signal (bus_proxy, "NameOwnerChanged", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal (bus_proxy, + "NameOwnerChanged", + G_CALLBACK (proxy_name_owner_changed), + &nm_running, NULL); + + loop = g_main_loop_new (NULL, FALSE); /* Create main loop */ + g_main_loop_run (loop); /* Run main loop */ + + g_object_unref (bus_proxy); + dbus_g_connection_unref (bus); + + return 0; +} + diff --git a/examples/C/glib/monitor-nm-state-GDBus.c b/examples/C/glib/monitor-nm-state-GDBus.c new file mode 100644 index 00000000..22ff65b7 --- /dev/null +++ b/examples/C/glib/monitor-nm-state-GDBus.c @@ -0,0 +1,138 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* vim: set ft=c ts=4 sts=4 sw=4 noexpandtab smartindent: */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (C) Copyright 2012 Red Hat, Inc. + */ + +/* + * This example monitors NM state via D-Bus "StateChanged" signal on + * "org.freedesktop.NetworkManager" object. + * It uses GDBus. + + * You don't need to have NetworkManager devel package installed. You can just + * grab NetworkManager.h and put it in the path. + * + * Standalone compilation: + * gcc -Wall `pkg-config --libs --cflags glib-2.0 gio-2.0 NetworkManager` monitor-nm-state-GDBus.c -o monitor-nm-state-GDBus + */ + +#include <gio/gio.h> +#include <string.h> +#include <NetworkManager.h> + +#if GLIB_CHECK_VERSION(2,26,0) +static const char * +nm_state_to_string (NMState state) +{ + switch (state) { + case NM_STATE_ASLEEP: + return "asleep"; + case NM_STATE_CONNECTING: + return "connecting"; + case NM_STATE_CONNECTED_LOCAL: + return "connected (local only)"; + case NM_STATE_CONNECTED_SITE: + return "connected (site only)"; + case NM_STATE_CONNECTED_GLOBAL: + return "connected"; + case NM_STATE_DISCONNECTING: + return "disconnecting"; + case NM_STATE_DISCONNECTED: + return "disconnected"; + case NM_STATE_UNKNOWN: + default: + return "unknown"; + } +} + +static void +on_signal (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + guint32 new_state; + + /* Print all signals */ + //gchar *parameters_str; + //parameters_str = g_variant_print (parameters, TRUE); + //g_print (" *** Received Signal: %s: %s\n", signal_name, parameters_str); + //g_free (parameters_str); + + /* We are only interested in "StateChanged" signal */ + if (strcmp (signal_name, "StateChanged") == 0) { + GVariant *tmp = g_variant_get_child_value (parameters, 0); + new_state = g_variant_get_uint32 (tmp); + g_variant_unref (tmp); + g_print ("NetworkManager state is: (%d) %s\n", new_state, nm_state_to_string ((NMState) new_state)); + } +} +#endif + + +int +main (int argc, char *argv[]) +{ +#if GLIB_CHECK_VERSION(2,26,0) + GMainLoop *loop; + GError *error = NULL; + GDBusProxyFlags flags; + GDBusProxy *proxy; + + /* Initialize GType system */ + g_type_init (); + + /* Monitor 'StateChanged' signal on 'org.freedesktop.NetworkManager' interface */ + g_print ("Monitor NetworkManager's state\n"); + g_print ("==============================\n"); + + flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START; + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + flags, + NULL, /* GDBusInterfaceInfo */ + "org.freedesktop.NetworkManager", + "/org/freedesktop/NetworkManager", + "org.freedesktop.NetworkManager", + NULL, /* GCancellable */ + &error); + + if (proxy == NULL) + { + g_printerr ("Error creating D-Bus proxy: %s\n", error->message); + g_error_free (error); + return -1; + } + + /* Connect to g-signal to receive signals from proxy (remote object) */ + g_signal_connect (proxy, + "g-signal", + G_CALLBACK (on_signal), + NULL); + + /* Run main loop */ + loop = g_main_loop_new (NULL, FALSE); + g_main_loop_run (loop); + + g_object_unref (proxy); +#else + g_print ("Sorry, you need at least GLib 2.26 for GDBus.\n"); +#endif + + return 0; +} + diff --git a/examples/C/qt/Makefile.am b/examples/C/qt/Makefile.am index 5f0c6a1e..a0cf8f4d 100644 --- a/examples/C/qt/Makefile.am +++ b/examples/C/qt/Makefile.am @@ -1,4 +1,5 @@ -INCLUDES = -I${top_srcdir}/include +INCLUDES = -I${top_srcdir}/include \ + -I${top_builddir}/include AM_CPPFLAGS = \ $(DBUS_CFLAGS) \ @@ -7,7 +8,8 @@ AM_CPPFLAGS = \ noinst_PROGRAMS = \ add-connection-wired \ list-connections \ - change-ipv4-addresses + change-ipv4-addresses \ + monitor-nm-running add_connection_wired_SOURCES = add-connection-wired.cpp add_connection_wired_LDADD = \ @@ -24,8 +26,22 @@ change_ipv4_addresses_LDADD = \ $(DBUS_LIBS) \ $(QT_LIBS) +monitor_nm_running_SOURCES = monitor-nm-running.cpp +monitor_nm_running_LDADD = \ + $(DBUS_LIBS) \ + $(QT_LIBS) + +monitor-nm-running.moc: monitor-nm-running.cpp + $(AM_V_GEN) $(MOC) -i $< -o $@ + +BUILT_SOURCES = \ + monitor-nm-running.moc + EXTRA_DIST = \ add-connection-wired.cpp \ list-connections.cpp \ - change-ipv4-addresses.cpp + change-ipv4-addresses.cpp \ + monitor-nm-running.cpp + +CLEANFILES = $(BUILT_SOURCES) diff --git a/examples/C/qt/Makefile.in b/examples/C/qt/Makefile.in index 6887f168..5c3f9a33 100644 --- a/examples/C/qt/Makefile.in +++ b/examples/C/qt/Makefile.in @@ -35,7 +35,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = add-connection-wired$(EXEEXT) \ - list-connections$(EXEEXT) change-ipv4-addresses$(EXEEXT) + list-connections$(EXEEXT) change-ipv4-addresses$(EXEEXT) \ + monitor-nm-running$(EXEEXT) subdir = examples/C/qt DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -73,6 +74,10 @@ am_list_connections_OBJECTS = list-connections.$(OBJEXT) list_connections_OBJECTS = $(am_list_connections_OBJECTS) list_connections_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) +am_monitor_nm_running_OBJECTS = monitor-nm-running.$(OBJEXT) +monitor_nm_running_OBJECTS = $(am_monitor_nm_running_OBJECTS) +monitor_nm_running_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles @@ -100,9 +105,11 @@ AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(add_connection_wired_SOURCES) \ - $(change_ipv4_addresses_SOURCES) $(list_connections_SOURCES) + $(change_ipv4_addresses_SOURCES) $(list_connections_SOURCES) \ + $(monitor_nm_running_SOURCES) DIST_SOURCES = $(add_connection_wired_SOURCES) \ - $(change_ipv4_addresses_SOURCES) $(list_connections_SOURCES) + $(change_ipv4_addresses_SOURCES) $(list_connections_SOURCES) \ + $(monitor_nm_running_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -151,6 +158,8 @@ GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAKEFILE = @GLIB_MAKEFILE@ +GLIB_MKENUMS = @GLIB_MKENUMS@ GMODULE_CFLAGS = @GMODULE_CFLAGS@ GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ @@ -205,11 +214,15 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ +LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -220,6 +233,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -259,6 +273,8 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -322,7 +338,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = -I${top_srcdir}/include +INCLUDES = -I${top_srcdir}/include \ + -I${top_builddir}/include + AM_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(QT_CFLAGS) @@ -342,12 +360,23 @@ change_ipv4_addresses_LDADD = \ $(DBUS_LIBS) \ $(QT_LIBS) +monitor_nm_running_SOURCES = monitor-nm-running.cpp +monitor_nm_running_LDADD = \ + $(DBUS_LIBS) \ + $(QT_LIBS) + +BUILT_SOURCES = \ + monitor-nm-running.moc + EXTRA_DIST = \ add-connection-wired.cpp \ list-connections.cpp \ - change-ipv4-addresses.cpp + change-ipv4-addresses.cpp \ + monitor-nm-running.cpp -all: all-am +CLEANFILES = $(BUILT_SOURCES) +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj @@ -399,6 +428,9 @@ change-ipv4-addresses$(EXEEXT): $(change_ipv4_addresses_OBJECTS) $(change_ipv4_a list-connections$(EXEEXT): $(list_connections_OBJECTS) $(list_connections_DEPENDENCIES) @rm -f list-connections$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(list_connections_OBJECTS) $(list_connections_LDADD) $(LIBS) +monitor-nm-running$(EXEEXT): $(monitor_nm_running_OBJECTS) $(monitor_nm_running_DEPENDENCIES) + @rm -f monitor-nm-running$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(monitor_nm_running_OBJECTS) $(monitor_nm_running_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -409,6 +441,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add-connection-wired.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/change-ipv4-addresses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list-connections.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor-nm-running.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -526,10 +559,12 @@ distdir: $(DISTFILES) fi; \ done check-am: all-am -check: check-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(PROGRAMS) installdirs: -install: install-am +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -546,6 +581,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -554,6 +590,7 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ @@ -625,7 +662,7 @@ ps-am: uninstall-am: -.MAKE: install-am install-strip +.MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS ctags distclean \ @@ -641,6 +678,9 @@ uninstall-am: pdf pdf-am ps ps-am tags uninstall uninstall-am +monitor-nm-running.moc: monitor-nm-running.cpp + $(AM_V_GEN) $(MOC) -i $< -o $@ + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/examples/C/qt/monitor-nm-running.cpp b/examples/C/qt/monitor-nm-running.cpp new file mode 100644 index 00000000..861f251e --- /dev/null +++ b/examples/C/qt/monitor-nm-running.cpp @@ -0,0 +1,89 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* vim: set ft=c ts=4 sts=4 sw=4 expandtab smartindent: */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (C) Copyright 2012 Red Hat, Inc. + */ + +/* + * This example monitors whether NM is running by checking if + * "org.freedesktop.NetworkManager" is owned by a process on D-Bus. + * It uses QDBusServiceWatcher class. + * + * Standalone compilation: + * moc-qt4 monitor-nm-running.cpp -o monitor-nm-running.moc + * g++ -Wall `pkg-config --libs --cflags QtCore QtDBus` monitor-nm-running.cpp -o monitor-nm-running + * + * You don't need to have NetworkManager devel package installed. + */ + +#include <iostream> +#include <QObject> +#include <QCoreApplication> +#include <QtDBus/QDBusServiceWatcher> +#include <QtDBus/QDBusConnection> +#include <QtCore/QDebug> + +const QString NM_DBUS_SERVICE = "org.freedesktop.NetworkManager"; + +// Define a class with slots +class NMWatcher: public QObject { + Q_OBJECT; + + public slots: + void serviceRegistered(const QString& name); + void serviceUnregistered(const QString& name); +}; + + +void NMWatcher::serviceRegistered(const QString& name) +{ + std::cout << "Name '" << name.toStdString() << "' registered" + << " => NM is running" << std::endl; +} + +void NMWatcher::serviceUnregistered(const QString& name) +{ + std::cout << "Name '" << name.toStdString() << "' unregistered" + << " => NM is not running" << std::endl; +} + +int main(int argc, char *argv[]) +{ + QCoreApplication app (argc, argv); + + qDebug() << "Monitor 'org.freedesktop.NetworkManager' D-Bus name"; + qDebug() << "==================================================="; + + NMWatcher nm_watcher; + + // Watch all changes of D-Bus NM_DBUS_SERVICE name + QDBusServiceWatcher *watcher = new QDBusServiceWatcher(NM_DBUS_SERVICE, + QDBusConnection::systemBus()); + + QObject::connect(watcher, SIGNAL(serviceRegistered(const QString&)), + &nm_watcher, SLOT(serviceRegistered(const QString&))); + + QObject::connect(watcher, SIGNAL(serviceUnregistered(const QString&)), + &nm_watcher, SLOT(serviceUnregistered(const QString&))); + + app.exec(); + + delete watcher; + return 0; +} + +#include "monitor-nm-running.moc" diff --git a/examples/Makefile.am b/examples/Makefile.am index 643959b1..eeea8771 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,3 +1,5 @@ SUBDIRS= \ + shell \ python \ + ruby \ C diff --git a/examples/Makefile.in b/examples/Makefile.in index 243af5ec..bd89738c 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -147,6 +147,8 @@ GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAKEFILE = @GLIB_MAKEFILE@ +GLIB_MKENUMS = @GLIB_MKENUMS@ GMODULE_CFLAGS = @GMODULE_CFLAGS@ GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ @@ -201,11 +203,15 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ +LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -216,6 +222,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -255,6 +262,8 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -319,7 +328,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = \ + shell \ python \ + ruby \ C all: all-recursive diff --git a/examples/python/Makefile.in b/examples/python/Makefile.in index 5231cef8..fce5f16a 100644 --- a/examples/python/Makefile.in +++ b/examples/python/Makefile.in @@ -107,6 +107,8 @@ GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAKEFILE = @GLIB_MAKEFILE@ +GLIB_MKENUMS = @GLIB_MKENUMS@ GMODULE_CFLAGS = @GMODULE_CFLAGS@ GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ @@ -161,11 +163,15 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ +LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -176,6 +182,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -215,6 +222,8 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ diff --git a/examples/ruby/Makefile.am b/examples/ruby/Makefile.am new file mode 100644 index 00000000..14f97ef8 --- /dev/null +++ b/examples/ruby/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = \ + add-connection.rb \ + get-basic-nm-info.rb \ + list-devices.rb diff --git a/examples/ruby/Makefile.in b/examples/ruby/Makefile.in new file mode 100644 index 00000000..0e5db416 --- /dev/null +++ b/examples/ruby/Makefile.in @@ -0,0 +1,482 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = examples/ruby +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DBUS_SYS_DIR = @DBUS_SYS_DIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DHCLIENT_PATH = @DHCLIENT_PATH@ +DHCLIENT_VERSION = @DHCLIENT_VERSION@ +DHCPCD_PATH = @DHCPCD_PATH@ +DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAKEFILE = @GLIB_MAKEFILE@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GMODULE_CFLAGS = @GMODULE_CFLAGS@ +GMODULE_LIBS = @GMODULE_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +IPTABLES_PATH = @IPTABLES_PATH@ +IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ +IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ +KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBNL1_CFLAGS = @LIBNL1_CFLAGS@ +LIBNL1_LIBS = @LIBNL1_LIBS@ +LIBNL2_CFLAGS = @LIBNL2_CFLAGS@ +LIBNL2_LIBS = @LIBNL2_LIBS@ +LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ +LIBNL3_LIBS = @LIBNL3_LIBS@ +LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ +LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ +LIBNL_LIBS = @LIBNL_LIBS@ +LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ +LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MOC = @MOC@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ +NM_MICRO_VERSION = @NM_MICRO_VERSION@ +NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_VERSION = @NM_VERSION@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG_PATH = @PKGCONFIG_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ +POSUB = @POSUB@ +PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ +QT_CFLAGS = @QT_CFLAGS@ +QT_LIBS = @QT_LIBS@ +RANLIB = @RANLIB@ +RESOLVCONF_PATH = @RESOLVCONF_PATH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ +UDEV_BASE_DIR = @UDEV_BASE_DIR@ +USE_NLS = @USE_NLS@ +UUID_CFLAGS = @UUID_CFLAGS@ +UUID_LIBS = @UUID_LIBS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + add-connection.rb \ + get-basic-nm-info.rb \ + list-devices.rb + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/ruby/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/ruby/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/ruby/add-connection.rb b/examples/ruby/add-connection.rb new file mode 100755 index 00000000..4256848f --- /dev/null +++ b/examples/ruby/add-connection.rb @@ -0,0 +1,86 @@ +#!/usr/bin/env ruby +# vim: ft=ruby ts=2 sts=2 sw=2 et ai +# -*- Mode: ruby; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2011 Red Hat, Inc. +# + +require 'dbus' +require 'ipaddr' + +# +# This example adds a new ethernet connection via Addconnection() D-Bus call. +# It also shows how to specify D-Bus signature for properties like "addresses" +# and "clone-mac-address". +# +# Configuration settings are described here: +# http://projects.gnome.org/NetworkManager/developers/api/09/ref-settings.html +# + +# Helper functions +def ip_to_int(ip_addr) + return IPAddr.new(ip_addr).hton.unpack('L').first +end + +def rand_hex_3(l) + "%0#{l}x" % rand(1 << l*4) +end + +def rand_uuid + [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-') +end + + +# Create new connection settings +s_con = { + "type" => "802-3-ethernet", + "uuid"=> rand_uuid, + "id" => "__MyConnection__" +} + +s_wired = { "cloned-mac-address" => ["ay", [0x00, 0x22, 0x68, 0x01, 0x02, 0x03]]} + +ip1 = ip_to_int("192.168.1.12") +ip2 = ip_to_int("192.168.1.13") +gw1 = ip_to_int("192.168.1.1") +ip3 = ip_to_int("10.0.2.5") +gw2 = ip_to_int("10.0.2.254") +dns1 = ip_to_int("8.8.8.8") +dns2 = ip_to_int("8.8.4.4") + +s_ip4 = { + "addresses"=> ["aau", [[ip1, 24, gw1], [ip2, 24, gw1], [ip3, 24, gw2]]], + "method"=>["s", "manual"], + "dns"=> ["au", [dns1, dns2]] +} +s_ip6 = {"method" => "ignore"} + +con = { + "802-3-ethernet" => s_wired, + "connection" => s_con, + "ipv4" => s_ip4, + "ipv6" => s_ip6 +} + +system_bus = DBus::SystemBus.instance +nm = system_bus.service("org.freedesktop.NetworkManager").object("/org/freedesktop/NetworkManager/Settings") +nm.introspect +settings_iface = nm["org.freedesktop.NetworkManager.Settings"] + +ret = settings_iface.AddConnection(con) +puts "New connection added: #{ret.first}" + diff --git a/examples/ruby/get-basic-nm-info.rb b/examples/ruby/get-basic-nm-info.rb new file mode 100755 index 00000000..1cf67947 --- /dev/null +++ b/examples/ruby/get-basic-nm-info.rb @@ -0,0 +1,51 @@ +#!/usr/bin/env ruby +# vim: ft=ruby ts=2 sts=2 sw=2 et ai +# -*- Mode: ruby; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2011 Red Hat, Inc. +# + +require 'dbus' + +# +# This example gets basic information about NetworkManager. +# Namely, it gets properties from /org/freedesktop/NetworkManager object. +# + +# Get system bus +system_bus = DBus::SystemBus.instance + +# Get the NetworkManager service +nm_service = system_bus.service("org.freedesktop.NetworkManager") + +# Get the object from the service +nm_object = nm_service.object("/org/freedesktop/NetworkManager") + +# Set default interface for the object +nm_object.default_iface = "org.freedesktop.NetworkManager" + +# Introspect it +nm_object.introspect + +properties = nm_object["org.freedesktop.DBus.Properties"].GetAll("org.freedesktop.NetworkManager") + +puts "Basic NM properties:" +puts "====================" +properties[0].each do |prop,val| + puts "#{prop} = #{val}" +end + diff --git a/examples/ruby/list-devices.rb b/examples/ruby/list-devices.rb new file mode 100755 index 00000000..5831a126 --- /dev/null +++ b/examples/ruby/list-devices.rb @@ -0,0 +1,85 @@ +#!/usr/bin/env ruby +# vim: ft=ruby ts=2 sts=2 sw=2 et ai +# -*- Mode: ruby; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2011 Red Hat, Inc. +# + +require 'dbus' + +# +# This example lists basic information about network interfaces known to NM +# + +devtypes = { 1 => "Ethernet", + 2 => "WiFi", + 5 => "Bluetooth", + 6 => "OLPC", + 7 => "WiMAX", + 8 => "Modem" } + +states = { 0 => "Unknown", + 10 => "Unmanaged", + 20 => "Unavailable", + 30 => "Disconnected", + 40 => "Prepare", + 50 => "Config", + 60 => "Need Auth", + 70 => "IP Config", + 80 => "IP Check", + 90 => "Secondaries", + 100 => "Activated", + 110 => "Deactivating", + 120 => "Failed" } + +# Get system bus +system_bus = DBus::SystemBus.instance + +# Get the NetworkManager service +nm_service = system_bus.service("org.freedesktop.NetworkManager") + +# Get the object from the service +nm_object = nm_service.object("/org/freedesktop/NetworkManager") + +# Set default interface for the object +nm_object.default_iface = "org.freedesktop.NetworkManager" + +# Introspect it +nm_object.introspect + +# Get all devices known to NM +devices = nm_object.GetDevices.first + +# and print their properties +devices.each do |d| + dev_obj = system_bus.service("org.freedesktop.NetworkManager").object(d) + dev_obj.introspect + props = dev_obj["org.freedesktop.DBus.Properties"].GetAll("org.freedesktop.NetworkManager.Device") + + puts "============================" + puts "Interface: #{props[0]['Interface']}" + + devtype = devtypes[props[0]['DeviceType']] + devtype = "Unknown" if devtype.nil? + puts "Type: #{devtype}" + + puts "Driver: #{props[0]['Driver']}" + + state = states[props[0]['State']] + state = "Unknown" if state.nil? + puts "State: #{state}" +end diff --git a/examples/shell/Makefile.am b/examples/shell/Makefile.am new file mode 100644 index 00000000..e4083d9a --- /dev/null +++ b/examples/shell/Makefile.am @@ -0,0 +1,3 @@ +EXTRA_DIST = \ + nm-logging.sh \ + get-hostname.sh diff --git a/examples/shell/Makefile.in b/examples/shell/Makefile.in new file mode 100644 index 00000000..1933a406 --- /dev/null +++ b/examples/shell/Makefile.in @@ -0,0 +1,481 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = examples/shell +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DBUS_SYS_DIR = @DBUS_SYS_DIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DHCLIENT_PATH = @DHCLIENT_PATH@ +DHCLIENT_VERSION = @DHCLIENT_VERSION@ +DHCPCD_PATH = @DHCPCD_PATH@ +DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAKEFILE = @GLIB_MAKEFILE@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GMODULE_CFLAGS = @GMODULE_CFLAGS@ +GMODULE_LIBS = @GMODULE_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +IPTABLES_PATH = @IPTABLES_PATH@ +IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ +IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ +KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBNL1_CFLAGS = @LIBNL1_CFLAGS@ +LIBNL1_LIBS = @LIBNL1_LIBS@ +LIBNL2_CFLAGS = @LIBNL2_CFLAGS@ +LIBNL2_LIBS = @LIBNL2_LIBS@ +LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ +LIBNL3_LIBS = @LIBNL3_LIBS@ +LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ +LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ +LIBNL_LIBS = @LIBNL_LIBS@ +LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ +LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MOC = @MOC@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ +NM_MICRO_VERSION = @NM_MICRO_VERSION@ +NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_VERSION = @NM_VERSION@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG_PATH = @PKGCONFIG_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ +POSUB = @POSUB@ +PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ +QT_CFLAGS = @QT_CFLAGS@ +QT_LIBS = @QT_LIBS@ +RANLIB = @RANLIB@ +RESOLVCONF_PATH = @RESOLVCONF_PATH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ +UDEV_BASE_DIR = @UDEV_BASE_DIR@ +USE_NLS = @USE_NLS@ +UUID_CFLAGS = @UUID_CFLAGS@ +UUID_LIBS = @UUID_LIBS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + nm-logging.sh \ + get-hostname.sh + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/shell/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/shell/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/shell/get-hostname.sh b/examples/shell/get-hostname.sh new file mode 100755 index 00000000..a521132c --- /dev/null +++ b/examples/shell/get-hostname.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# vim: ft=sh ts=2 sts=2 sw=2 et ai +# -*- Mode: sh; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2011 Red Hat, Inc. +# + +# +# Call Get() method on org.freedesktop.DBus.Properties interface to get Hostname +# property of /org/freedesktop/NetworkManager/Settings object +# + +SERVICE_NAME="org.freedesktop.NetworkManager" +OBJECT_PATH="/org/freedesktop/NetworkManager/Settings" +METHOD="org.freedesktop.DBus.Properties.Get" + + +dbus-send --system --print-reply --dest=$SERVICE_NAME $OBJECT_PATH $METHOD \ + string:"org.freedesktop.NetworkManager.Settings" string:"Hostname" | \ +sed -n 's/.*"\([^"]*\)".*/\1/p' + + +# The same with glib's gdbus +# gdbus call --system --dest $SERVICE_NAME --object-path $OBJECT_PATH --method $METHOD \ +# "org.freedesktop.NetworkManager.Settings" "Hostname" + + +# The same with qt's qdbus +# qdbus --system $SERVICE_NAME $OBJECT_PATH $METHOD \ +# "org.freedesktop.NetworkManager.Settings" "Hostname" + diff --git a/examples/shell/nm-logging.sh b/examples/shell/nm-logging.sh new file mode 100755 index 00000000..afd06e5a --- /dev/null +++ b/examples/shell/nm-logging.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# vim: ft=sh ts=2 sts=2 sw=2 et ai +# -*- Mode: sh; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2011 Red Hat, Inc. +# + +# +# Sets NM logging level and/or domains (see description in 'man NetworkManager.conf') +# The level controls how verbose NM's log output will be (err,warn,info,debug). +# Domains control what parts of networking NM emits log messages for. Leaving +# either of the two arguments blank (i.e., an empty string) will leave that +# parameter unchanged. +# +# The normal logging level is 'info', for debugging use 'debug'. +# +# Examples: +# nm-logging.sh debug - switches the debugging level on +# nm-logging.sh info - turns debugging off (back to normal) +# nm-logging.sh "" "WIFI" - changes domain to print only WiFi related messages +# nm-logging.sh err "HW,IP4" - will print only error messages related to hardware or IPv4 +# + +LOG_LEVEL=$1 +LOG_DOMAINS=$2 + +dbus-send --system --print-reply \ +--dest=org.freedesktop.NetworkManager \ +/org/freedesktop/NetworkManager \ +org.freedesktop.NetworkManager.SetLogging \ +string:"$LOG_LEVEL" string:"$LOG_DOMAINS" + |