Re: How to add a plugin for NM
- From: Mu Qiao <qiaomuf gmail com>
- To: Dan Williams <dcbw redhat com>
- Cc: networkmanager-list gnome org
- Subject: Re: How to add a plugin for NM
- Date: Wed, 24 Mar 2010 09:59:02 +0800
Wow, thanks. It's really helpful. I think I somehow know how to start. What I want to do is to make Gentoo work with NM, which now they can't
work together.
There's one extra question.
I don't know clearly what features does ifcfg-rh or ifupdown provide. I think they can accept local configurations of hostname, DNS, ipv4 wired and wireless network. Is there any other feature they provide? I could make a plan according to that. It is more helpful if you could estimate for me which are simpler or more difficult.
Thanks again for your help :-)
On Wed, Mar 24, 2010 at 2:19 AM, Dan Williams
<dcbw redhat com> wrote:
On Tue, 2010-03-23 at 20:55 +0800, Mu Qiao wrote:
> Hello,
>
> I need to develop a plugin for NM to read local configuration files
> just like RH and Ubuntu do. (I'm not sure whether the plugin is
> ifcfg-rh and ifupdown)
Great!
> Where should I start? Where can I find documentations for developing
> plugin and source code of ifcfg-rh and ifupdown?
The C interface is documented in:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/src/system-settings/nm-system-config-interface.h
The 'keyfile' connection is probably the best example so far as it's
most complete:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/system-settings/plugins/keyfile
But the ifcfg-suse plugin is actually the simplest one that just
provides persistent hostname support.
Basically, you have a GObject subclass that implements
NM_TYPE_SYSTEM_CONFIG_INTERFACE, which is the first link I pasted. That
implements the actual plugin, which has a number of properties that
NetworkManager asks for like hostname and capabilities.
That object then parses the config files, and for each distinct saved
network "profile" or whatever on your distro, you create an object
that's a subclass of NMSysconfigConnection as you can see in:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/system-settings/plugins/keyfile/nm-keyfile-connection.h
NMSysconfigConnection provides a number of helpful class functions that
make your implementation a bit easier. In any case, your connection
subclass just wraps each distinct saved connection profile and watches
that profile for changes. The actual read/write work I usually put into
separate files since they are easier to link into the unit test
programs, plus the connection subclass can easily use them anyway.
If you need more pointers, let me know. It does get somewhat
complicated when you do everything like reading and writing connections,
but starting simple and expanding from there should be an easier way to
go.
Dan
--
Best wishes,
Qiao Mu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]