Re: programming using networkmanager
- From: Dan Williams <dcbw redhat com>
- To: ashraful ansur no
- Cc: networkmanager-list gnome org
- Subject: Re: programming using networkmanager
- Date: Tue, 18 Aug 2009 09:01:40 -0500
On Mon, 2009-08-03 at 18:40 +0200, Syed Md. Ashraful Karim wrote:
> Hi
> I want to write an application to detect any changes in the network
> interface (up and down) and the system will some task depending on that.
> Then I need the active up interfaces too.
> Can anybody help me giving any reference how I can I handle such up/down
> of interfaces event from NetworkManager. The code can be written in Java
> or C/C++.
> thanks in advance.
Sorry for the late reply...
NetworkManager provides two methods for doing this. First, there are
dispatcher scripts from /etc/NetworkManager/dispatcher.d that get run
whenever a device goes up or down.
Second, and preferred, is the D-Bus API. D-Bus [1] is a lightweight IPC
mechanism that is quite popular on Linux and elsewhere. NetworkManager
provides a dbus "service" that allows rich access and control to
networking information on your system. The D-Bus API specification is
here [2]. The best thing to do is to find dbus bindings for language of
choice; there are bindings for both C/C++ (libdbus) and Java (dbus-java)
[3].
See (for example) the D-Bus tutorial for a better explanation of how
D-Bus IPC works [4].
Let us know if you have further questions...
Dan
[1] http://www.freedesktop.org/wiki/Software/dbus
[2] http://projects.gnome.org/NetworkManager/developers/spec.html
[3] http://dbus.freedesktop.org/doc/dbus-java/
[4] http://dbus.freedesktop.org/doc/dbus-tutorial.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]