Re: Is there a way to use dbus api to list the connected clients?

2021-11-05 Thread Thomas Haller via networkmanager-list
On Tue, 2021-11-02 at 20:34 +0800, Woodrow Shen via networkmanager-list
wrote:
> Hi all,
> 
> I know there are few methods to find connected clients with AP mode,
> but we have the same 
> question as[1] to look for the possibility to dump the information
> like dhcp lease.
> 
> Can someone help me with this topic?
> 
> Thanks,
> Woodrow
> 
> [1]
> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/633



Hi,

that would be a useful feature, but not done (yet).


best,
Thomas

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Is there a way to use dbus api to list the connected clients?

2021-11-02 Thread Woodrow Shen via networkmanager-list
Hi all,

I know there are few methods to find connected clients with AP mode, but we
have the same
question as[1] to look for the possibility to dump the information like
dhcp lease.

Can someone help me with this topic?

Thanks,
Woodrow

[1]
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/633
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Adhoc via dbus API?

2018-12-11 Thread Thomas Haller via networkmanager-list
On Tue, 2018-12-11 at 10:15 -0500, Jane Wyngaard via networkmanager-
list wrote:
> Hi,
> 
> I just started using the python dbus API, but am having some
> difficulties, hoping someone here might be able to help me?   (I did
> find the old thread in this list with an example script but API has
> changed so much that no longer works even with significant changes).
> 
> In brief:
> - I can successfully configure and use an ADHOC network using (1)
> manual edits of host file (after disabling NetworkManager), and (2)
> using iwconfig.  
> - I can create an ADHOC with nm-applette gui but cannot connect to
> it.  
> - What I need to do is create an adhoc with dbus but the attached
> script which works perfectly to create a hotspot (with mode 'ap')
> fails with bellow syslog messages when mode is 'adhoc'
> 
> It looks like it creates the connection fine and even attempts to
> activate but then hits some weird authentication issue I can't debug?

Hi,


while the script is not particularly elegant (e.g. it keeps polling
whether the profile is fully activate), it should work fine in
principle. It also succeeds to create a profile, but activation fails
later on.

This has nothing to do with D-Bus API. You can create the exact same
profile with nmcli and encounter the same problem.

What I mean, is that when I try `nmcli connection up MyAdhoc`, the
activation also fails (just like with the python script).
The question is, why it fails. But I don't know...


General tip: enabling level=TRACE logging is helpful (see [1]).
Also, check what is happening with `nmcli connection` and `nmcli
device`.

[1] 
https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/contrib/fedora/rpm/NetworkManager.conf#n28


best,
Thomas

> 
> Any chance someone has a working dbus API Adhoc network setup script
> they could share with me?
> 
> */var/log/syslog*
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4386] keyfile: add connection /etc/NetworkManager/system-
> connections/MyAdhoc-bac3019c-6be0-4d07-9617-c91a5438f422 (bac3019c-
> 6be0-4d07-9617-c91a5438f422,"MyAdhoc")
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4397] audit: op="connection-add" uuid="bac3019c-6be0-
> 4d07-9617-c91a5438f422" name="MyAdhoc" pid=18019 uid=1000
> result="success"
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4479] device (wlp4s0): disconnecting for new activation
> request.
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4479] device (wlp4s0): state change: activated ->
> deactivating (reason 'new-activation', sys-iface-state: 'managed')
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4480] manager: NetworkManager state is now
> CONNECTED_LOCAL
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4594] audit: op="connection-activate" uuid="bac3019c-
> 6be0-4d07-9617-c91a5438f422" name="MyAdhoc" pid=18019 uid=1000
> result="success"
> Dec 11 10:12:01 Squid dbus-daemon[878]: [system] Activating via
> systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-
> org.freedesktop.nm-dispatcher.service' requested by ':1.5229' (uid=0
> pid=17463 comm="/usr/sbin/NetworkManager --no-daemon "
> label="unconfined")
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4600] device (wlp4s0): state change: deactivating ->
> disconnected (reason 'new-activation', sys-iface-state: 'managed')
> Dec 11 10:12:01 Squid avahi-daemon[961]: Withdrawing address record
> for fe80::d80d:7c02:f195:d84f on wlp4s0.
> Dec 11 10:12:01 Squid avahi-daemon[961]: Leaving mDNS multicast group
> on interface wlp4s0.IPv6 with address fe80::d80d:7c02:f195:d84f.
> Dec 11 10:12:01 Squid avahi-daemon[961]: Interface wlp4s0.IPv6 no
> longer relevant for mDNS.
> Dec 11 10:12:01 Squid systemd[1]: Starting Network Manager Script
> Dispatcher Service...
> Dec 11 10:12:01 Squid dbus-daemon[878]: [system] Successfully
> activated service 'org.freedesktop.nm_dispatcher'
> Dec 11 10:12:01 Squid systemd[1]: Started Network Manager Script
> Dispatcher Service.
> Dec 11 10:12:01 Squid nm-dispatcher: req:1 'connectivity-change': new
> request (1 scripts)
> Dec 11 10:12:01 Squid nm-dispatcher: req:1 'connectivity-change':
> start running ordered scripts...
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4951] dhcp4 (wlp4s0): canceled DHCP transaction, DHCP
> client pid 17430
> Dec 11 10:12:01 Squid NetworkManager[17463]:  
> [1544541121.4951] dhcp4 (wlp4s0): state changed bound -> done
> Dec 11 10:12:01 Squid avahi-daemon[961]: Withdrawing address record
> for 10.38.83.150 on wlp4s0.
> Dec 11 10:12:01 Squid avahi-d

Adhoc via dbus API?

2018-12-11 Thread Jane Wyngaard via networkmanager-list
Hi,

I just started using the python dbus API, but am having some difficulties,
hoping someone here might be able to help me?   (I did find the old thread
in this list with an example script but API has changed so much that no
longer works even with significant changes).

In brief:
- I can successfully configure and use an ADHOC network using (1) manual
edits of host file (after disabling NetworkManager), and (2) using
iwconfig.
- I can create an ADHOC with nm-applette gui but cannot connect to it.
- What I need to do is create an adhoc with dbus but the attached script
which works perfectly to create a hotspot (with mode 'ap') fails with
bellow syslog messages when mode is 'adhoc'

It looks like it creates the connection fine and even attempts to activate
but then hits some weird authentication issue I can't debug?

Any chance someone has a working dbus API Adhoc network setup script they
could share with me?

*/var/log/syslog*
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4386]
keyfile: add connection
/etc/NetworkManager/system-connections/MyAdhoc-bac3019c-6be0-4d07-9617-c91a5438f422
(bac3019c-6be0-4d07-9617-c91a5438f422,"MyAdhoc")
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4397]
audit: op="connection-add" uuid="bac3019c-6be0-4d07-9617-c91a5438f422"
name="MyAdhoc" pid=18019 uid=1000 result="success"
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4479]
device (wlp4s0): disconnecting for new activation request.
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4479]
device (wlp4s0): state change: activated -> deactivating (reason
'new-activation', sys-iface-state: 'managed')
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4480]
manager: NetworkManager state is now CONNECTED_LOCAL
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4594]
audit: op="connection-activate" uuid="bac3019c-6be0-4d07-9617-c91a5438f422"
name="MyAdhoc" pid=18019 uid=1000 result="success"
Dec 11 10:12:01 Squid dbus-daemon[878]: [system] Activating via systemd:
service name='org.freedesktop.nm_dispatcher'
unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.5229'
(uid=0 pid=17463 comm="/usr/sbin/NetworkManager --no-daemon "
label="unconfined")
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4600]
device (wlp4s0): state change: deactivating -> disconnected (reason
'new-activation', sys-iface-state: 'managed')
Dec 11 10:12:01 Squid avahi-daemon[961]: Withdrawing address record for
fe80::d80d:7c02:f195:d84f on wlp4s0.
Dec 11 10:12:01 Squid avahi-daemon[961]: Leaving mDNS multicast group on
interface wlp4s0.IPv6 with address fe80::d80d:7c02:f195:d84f.
Dec 11 10:12:01 Squid avahi-daemon[961]: Interface wlp4s0.IPv6 no longer
relevant for mDNS.
Dec 11 10:12:01 Squid systemd[1]: Starting Network Manager Script
Dispatcher Service...
Dec 11 10:12:01 Squid dbus-daemon[878]: [system] Successfully activated
service 'org.freedesktop.nm_dispatcher'
Dec 11 10:12:01 Squid systemd[1]: Started Network Manager Script Dispatcher
Service.
Dec 11 10:12:01 Squid nm-dispatcher: req:1 'connectivity-change': new
request (1 scripts)
Dec 11 10:12:01 Squid nm-dispatcher: req:1 'connectivity-change': start
running ordered scripts...
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4951]
dhcp4 (wlp4s0): canceled DHCP transaction, DHCP client pid 17430
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.4951]
dhcp4 (wlp4s0): state changed bound -> done
Dec 11 10:12:01 Squid avahi-daemon[961]: Withdrawing address record for
10.38.83.150 on wlp4s0.
Dec 11 10:12:01 Squid avahi-daemon[961]: Leaving mDNS multicast group on
interface wlp4s0.IPv4 with address 10.38.83.150.
Dec 11 10:12:01 Squid kernel: [510680.306141] wlp4s0: deauthenticating from
88:1d:fc:e2:f0:1d by local choice (Reason: 3=DEAUTH_LEAVING)
Dec 11 10:12:01 Squid wpa_supplicant[963]: wlp4s0: CTRL-EVENT-DISCONNECTED
bssid=88:1d:fc:e2:f0:1d reason=3 locally_generated=1
Dec 11 10:12:01 Squid avahi-daemon[961]: Interface wlp4s0.IPv4 no longer
relevant for mDNS.
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.5097]
device (wlp4s0): Activation: starting connection 'MyAdhoc'
(bac3019c-6be0-4d07-9617-c91a5438f422)
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.5105]
sup-iface[0x562fafaded90,wlp4s0]: connection disconnected (reason -3)
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.5106]
device (wlp4s0): supplicant interface state: completed -> disconnected
Dec 11 10:12:01 Squid nm-dispatcher: req:2 'down' [wlp4s0]: new request (1
scripts)
Dec 11 10:12:01 Squid NetworkManager[17463]:   [1544541121.5171]
device (wlp4s0): state change: disconnected -> prepare (reason 'none',
sys-iface-state: 'managed')
Dec 11 10:12:01 Squid nm-dispatcher: req:2 'down' [wlp4s0]: start running
ordered scripts...
Dec 11 10:12:01 Squid NetworkM

Re: Searching for documentation how to add an interface to a bridge via DBus API

2017-12-08 Thread thilo.ceston...@ts.fujitsu.com
Hi Thomas,

thanks for your answer. Works! :)

Cheers,
Thilo

Am Freitag, den 08.12.2017, 08:11 +0100 schrieb Thomas Haller:
> On Thu, 2017-12-07 at 15:55 +, thilo.ceston...@ts.fujitsu.com
> wrote:
> > Hi!
> > 
> > So I found the settings.connection interface and can delete a
> > existing
> > ethernet <=> bridge connection.
> > 
> > So adding a connection is probably what I want.
> > 
> > Is it sufficient to create a dict with e.g. "id"=>"eth0" and
> > "master"=>"br0" to
> > create a connection of the ethernet device eth0 to the bridge br0?
> > 
> > Or what settings do I need to serve?
> 
> Hi,
> 
> yes, you need to create a connection profile for each slave.
> 
> 
> You also need to activate it (or it might auto-activate when you create
> it -- and if you configured that).
> 
> check what you created with `nmcli connection show "$CON"`.
> 
> Maybe see examples:
> https://cgit.freedesktop.org/NetworkManager/NetworkM
> anager/tree/examples/python/dbus
> 
> 
> best,
> Thomas
> 
> > 
> > Cheers,
> > Thilo
> > 
> > Am Donnerstag, den 07.12.2017, 13:44 + schrieb
> > thilo.ceston...@ts.fujitsu.com:
> > > Hi all!
> > > 
> > > I'm trying to add an ethernet device to a bridge via DBus API. 
> > > 
> > > gdbus-codegen generated me three functions for a bridge device:
> > > 
> > > network_manager_device_bridge_get_slaves
> > > network_manager_device_bridge_dup_slaves
> > > network_manager_device_bridge_set_slaves
> > > 
> > > get_slaves and dup_slaves working well. But set_slaves don't, as
> > > the slave-
> > > property is readonly.
> > > 
> > > My question is, how can I add an interface to a bridge via DBus
> > > API. I could
> > > find an hint anywhere or I didn't understand it to an hint :).
> > > 
> > > Could someone point me please in the right direction?
> > > 
> > > Thanks!
> > > 
> > > Cheers,
> > > Thilo
> > > ___
> > > networkmanager-list mailing list
> > > networkmanager-list@gnome.org
> > > https://mail.gnome.org/mailman/listinfo/networkmanager-list
> > 
> > ___
> > networkmanager-list mailing list
> > networkmanager-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/networkmanager-list

smime.p7s
Description: S/MIME cryptographic signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Searching for documentation how to add an interface to a bridge via DBus API

2017-12-07 Thread Thomas Haller
On Thu, 2017-12-07 at 15:55 +, thilo.ceston...@ts.fujitsu.com
wrote:
> Hi!
> 
> So I found the settings.connection interface and can delete a
> existing
> ethernet <=> bridge connection.
> 
> So adding a connection is probably what I want.
> 
> Is it sufficient to create a dict with e.g. "id"=>"eth0" and
> "master"=>"br0" to
> create a connection of the ethernet device eth0 to the bridge br0?
> 
> Or what settings do I need to serve?

Hi,

yes, you need to create a connection profile for each slave.


You also need to activate it (or it might auto-activate when you create
it -- and if you configured that).

check what you created with `nmcli connection show "$CON"`.

Maybe see examples:
https://cgit.freedesktop.org/NetworkManager/NetworkM
anager/tree/examples/python/dbus


best,
Thomas

> 
> Cheers,
> Thilo
> 
> Am Donnerstag, den 07.12.2017, 13:44 + schrieb
> thilo.ceston...@ts.fujitsu.com:
> > Hi all!
> > 
> > I'm trying to add an ethernet device to a bridge via DBus API. 
> > 
> > gdbus-codegen generated me three functions for a bridge device:
> > 
> > network_manager_device_bridge_get_slaves
> > network_manager_device_bridge_dup_slaves
> > network_manager_device_bridge_set_slaves
> > 
> > get_slaves and dup_slaves working well. But set_slaves don't, as
> > the slave-
> > property is readonly.
> > 
> > My question is, how can I add an interface to a bridge via DBus
> > API. I could
> > find an hint anywhere or I didn't understand it to an hint :).
> > 
> > Could someone point me please in the right direction?
> > 
> > Thanks!
> > 
> > Cheers,
> > Thilo
> > ___
> > networkmanager-list mailing list
> > networkmanager-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/networkmanager-list
> 
> ___
> networkmanager-list mailing list
> networkmanager-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/networkmanager-list

signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Searching for documentation how to add an interface to a bridge via DBus API

2017-12-07 Thread thilo.ceston...@ts.fujitsu.com
Hi!

So I found the settings.connection interface and can delete a existing
ethernet <=> bridge connection.

So adding a connection is probably what I want.

Is it sufficient to create a dict with e.g. "id"=>"eth0" and "master"=>"br0" to
create a connection of the ethernet device eth0 to the bridge br0?

Or what settings do I need to serve?

Cheers,
Thilo

Am Donnerstag, den 07.12.2017, 13:44 + schrieb
thilo.ceston...@ts.fujitsu.com:
> Hi all!
> 
> I'm trying to add an ethernet device to a bridge via DBus API. 
> 
> gdbus-codegen generated me three functions for a bridge device:
> 
> network_manager_device_bridge_get_slaves
> network_manager_device_bridge_dup_slaves
> network_manager_device_bridge_set_slaves
> 
> get_slaves and dup_slaves working well. But set_slaves don't, as the slave-
> property is readonly.
> 
> My question is, how can I add an interface to a bridge via DBus API. I could
> find an hint anywhere or I didn't understand it to an hint :).
> 
> Could someone point me please in the right direction?
> 
> Thanks!
> 
> Cheers,
> Thilo
> ___
> networkmanager-list mailing list
> networkmanager-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/networkmanager-list

smime.p7s
Description: S/MIME cryptographic signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Searching for documentation how to add an interface to a bridge via DBus API

2017-12-07 Thread thilo.ceston...@ts.fujitsu.com
Hi all!

I'm trying to add an ethernet device to a bridge via DBus API. 

gdbus-codegen generated me three functions for a bridge device:

network_manager_device_bridge_get_slaves
network_manager_device_bridge_dup_slaves
network_manager_device_bridge_set_slaves

get_slaves and dup_slaves working well. But set_slaves don't, as the slave-
property is readonly.

My question is, how can I add an interface to a bridge via DBus API. I could
find an hint anywhere or I didn't understand it to an hint :).

Could someone point me please in the right direction?

Thanks!

Cheers,
Thilo

smime.p7s
Description: S/MIME cryptographic signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Network Manager Dbus API License

2015-08-20 Thread Ali Muhammad Ali
Hello All,
  I am working on a network manager frontend that will use
network manager dbus api. Is there any license binding by network manager
on dbus api . I other words I need to know that can I keep the source of my
frontend closed and distribute only the binaries ?

Regards,
Muhammad Ali
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Network Manager Dbus API License

2015-08-20 Thread Lubomir Rintel
Hi,

On Thu, 2015-08-20 at 12:15 +0500, Ali Muhammad Ali wrote:
 Hello All,
   I am working on a network manager frontend that will 
 use
 network manager dbus api. Is there any license binding by network 
 manager
 on dbus api . I other words I need to know that can I keep the source 
 of my
 frontend closed and distribute only the binaries ?

NetworkManager is licensed under the terms of GPLv2 or (at your option)
any later version. This license applies as long as you're distributing
derived work from the NetworkManager source.

Please make sure you read and understand the license:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/COPYING

That is, if you distribute binaries that are built from a source tree
that contains code taken from NetworkManager then you need to
distribute the full source code with your binaries.

If you're merely dynamically linking to libnm or just doing DBus calls
from your own code (sounds like this is what you're doing), then no
restrictions apply and you don't need to distribute your source code.

 Regards,
 Muhammad Ali

Cheers,
Lubo
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-08 Thread Dan Williams
On Tue, 2014-07-08 at 08:57 +1000, Stuart Longland wrote:
 On 08/07/14 07:56, Dan Williams wrote:
  and so the 'connection' bit would be mandatory, and you might have *one*
   each of the other setting types?
  The type setting (eg 803-3-ethernet, 802-11-wireless, gsm, cdma,
  bluetooth, etc) is required too.  The 'type' setting and the
  'connection' setting are the only required ones.  Usually you'd lock the
  connection to a MAC address with the type setting, or it would contain
  stuff like MTU, SSID, and other hardware-specific stuff, so you can't
  really leave it out.
 
 Okay, so there's a setting called type too, that I presume is distinct
 from the connection setting's type attribute.  i.e. the minimum
 required:

Oh sorry :)  I was unclear.  By 'type' I mean 802-3-ethernet or
802-11-wireless or gsm or cdma or infiniband or bluetooth.
eg, the type of hardware to be used.  The name of that setting (a few of
which I've typed in quotes in the last sentence) is put into the type
property of the connection setting, like:

s_con = dbus.Dictionary({
-- 'type': '802-11-wireless',
'uuid': '7371bb78-c1f7-42a3-a9db-5b9566e8ca07',
'id': 'My Wifi'})
...
con = dbus.Dictionary({
'connection': s_con,
-- '802-11-wireless': s_wifi
})

Specifically, see:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/add-connection.py#n36
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/add-system-wifi-connection.py#n25

for two examples.

 {'connection': {...},
  'type': {...},
  ...}
 
 Where do I find information on this type setting?  Doing a search for
 type setting on
 https://developer.gnome.org/NetworkManager/0.9/ref-settings.html shows
 no matches.
 
  IPv4 and IPv6 are optional if you want automatic (DHCP, PPP/WWAN, etc)
  addressing, but obviously if you want static you have to specify one or
  both.
 
 Ahh so a minimal one might give a 'connection' object, whose 'interface'
 attribute references one of the physical network ports, and it'll just
 configure the network via DHCP.

Right; if you don't specify the IPv4 and/or IPv6 settings, they default
to automatic which means DHCP for IPv4 and SLAAC for IPv6.

Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-07 Thread Dan Williams
On Fri, 2014-07-04 at 11:51 +1000, Stuart Longland wrote:
 Hi Dan,
 On 04/07/14 10:51, Dan Williams wrote:
  On Fri, 2014-07-04 at 09:18 +1000, Stuart Longland wrote:
  But how do I encode my address settings in a Settings.Connection object?
   Where do I find a list of the settings and their possible values?
  There's actually a bunch of Python examples here:
  
  http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python
  
  that use both plain dbus and Python GObject introspection.  The GObject
  introspection ones are similar to python-networkmanager actually.  I'm
  not sure how python-networkmanager accepts a new connection to add, but
  perhaps the examples give you an idea how to do that?
 
 Ahh okay, that's handy.  I'll have a dig through those and see what I
 can uncover.
 
  I'd expect it to
  be a normal dict of dicts like the examples above show which is then
  passed to org.freedesktop.NetworkManager.Settings.AddConnection().
 
 It does appear that way, I tried pulling the information out for my
 Ethernet connection and got:
  In [9]: conn.GetSettings()
  Out[9]: 
  {u'bridge': {u'interface-name': u'br0', u'stp': False},
   u'connection': {u'id': u'Bridge Ethernet',
u'type': u'bridge',
u'uuid': u'357c4dcf-2600-45fa-8687-05f4c2cb82b4',
u'zone': u'work'},
   u'ipv4': {u'addresses': [],
u'dns': [],
u'may-fail': False,
u'method': u'auto',
u'routes': []},
   u'ipv6': {u'addresses': [], u'dns': [], u'method': u'auto', u'routes': []}}
 
 It seems NetworkManager doesn't much like my hand-configured bridge
 (won't see its IP address), but that's a side issue.
 
 What I'm curious about is what sorts of keys and values are expected in
 that dict of dicts?  At a basic level I need to be able to set IP
 addresses, static routes, DNS servers, domain and DNS search order.

As thomas already mentioned, these should be covered in the API
documentation that he linked.  Note that IPv4 addresses are arrays of
uint32 (address/prefix/optional gateway) and IPv4 routes are too
(network/prefix/next-hop/metric).  The address/network/next-hop IP
address members are network-byte-order.  So the code in Python to push
that into the dict that can be sent over D-Bus is something like this,
taken from:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/add-connection.py

def ip_to_int(ip_string):
return struct.unpack(=I, socket.inet_aton(ip_string))[0]

addr1 = dbus.Array([ip_to_int(10.1.2.3), dbus.UInt32(8L), 
ip_to_int(10.1.2.1)], signature=dbus.Signature('u'))
s_ip4 = dbus.Dictionary({
'addresses': dbus.Array([addr1], signature=dbus.Signature('au')),
'method': 'manual'})
...
con = dbus.Dictionary({
'802-3-ethernet': s_wired,
'connection': s_con,
'ipv4': s_ip4,
'ipv6': s_ip6})

this is mainly because Python doesn't have strongly-typed variables, but
D-Bus does, so you have to tell Python what the mapping is between the
Python types and the D-Bus types.

Dan

 Probably host name too (not sure if that's doable in NetworkManager).
 
 At least that will be the starting point.  The devices in question we're
 setting up will be headless boxes, basically appliances, intended to
 poll energy meters in an energy management system and pump the data
 elsewhere.
 
 So mostly wired access, there's a couple of places where we have a
 bridges and OpenVPN for technical support on some sites and I envisage
 some possibly needing cellular 3G support.
 
 No one has approached us with the need for WIFI support, but I bet
 someone will some day, thus it'd be useful to know how that's configured
 too.
 
 Is there some documentation as to how these various network types are
 specified as dict objects to NetworkManager?
 
 Regards,


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-07 Thread Stuart Longland
Hi Dan,
On 08/07/14 02:55, Dan Williams wrote:
 As thomas already mentioned, these should be covered in the API
 documentation that he linked.  Note that IPv4 addresses are arrays of
 uint32 (address/prefix/optional gateway) and IPv4 routes are too
 (network/prefix/next-hop/metric).  The address/network/next-hop IP
 address members are network-byte-order.  So the code in Python to push
 that into the dict that can be sent over D-Bus is something like this,
 taken from:
[...]
 this is mainly because Python doesn't have strongly-typed variables, but
 D-Bus does, so you have to tell Python what the mapping is between the
 Python types and the D-Bus types.

Yep, just experimenting with python-networkmanager, it seems this is one
of the details it looks after: IP addresses are translated to strings,
endianness is taken care of, etc.  Dicts are plain Python dicts.

Just looking at the documentation there though, am I correct in assuming
that to set up a simple connection, you would have a dict of the form:

{'connection': { global connection settings },
 'ipv4': { IPv4 address settings },
 'ipv6': { IPv6 address settings },
}

and so the 'connection' bit would be mandatory, and you might have *one*
each of the other setting types?

Regards,
-- 
Stuart Longland
Systems Engineer
 _ ___
\  /|_) |   T: +61 7 3535 9619
 \/ | \ | 38b Douglas StreetF: +61 7 3535 9699
   SYSTEMSMilton QLD 4064   http://www.vrt.com.au


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-07 Thread Dan Williams
On Tue, 2014-07-08 at 05:55 +1000, Stuart Longland wrote:
 Hi Dan,
 On 08/07/14 02:55, Dan Williams wrote:
  As thomas already mentioned, these should be covered in the API
  documentation that he linked.  Note that IPv4 addresses are arrays of
  uint32 (address/prefix/optional gateway) and IPv4 routes are too
  (network/prefix/next-hop/metric).  The address/network/next-hop IP
  address members are network-byte-order.  So the code in Python to push
  that into the dict that can be sent over D-Bus is something like this,
  taken from:
 [...]
  this is mainly because Python doesn't have strongly-typed variables, but
  D-Bus does, so you have to tell Python what the mapping is between the
  Python types and the D-Bus types.
 
 Yep, just experimenting with python-networkmanager, it seems this is one
 of the details it looks after: IP addresses are translated to strings,
 endianness is taken care of, etc.  Dicts are plain Python dicts.
 
 Just looking at the documentation there though, am I correct in assuming
 that to set up a simple connection, you would have a dict of the form:
 
 {'connection': { global connection settings },
  'ipv4': { IPv4 address settings },
  'ipv6': { IPv6 address settings },
 }
 
 and so the 'connection' bit would be mandatory, and you might have *one*
 each of the other setting types?

The type setting (eg 803-3-ethernet, 802-11-wireless, gsm, cdma,
bluetooth, etc) is required too.  The 'type' setting and the
'connection' setting are the only required ones.  Usually you'd lock the
connection to a MAC address with the type setting, or it would contain
stuff like MTU, SSID, and other hardware-specific stuff, so you can't
really leave it out.

IPv4 and IPv6 are optional if you want automatic (DHCP, PPP/WWAN, etc)
addressing, but obviously if you want static you have to specify one or
both.

Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-07 Thread Stuart Longland
On 08/07/14 07:56, Dan Williams wrote:
 and so the 'connection' bit would be mandatory, and you might have *one*
  each of the other setting types?
 The type setting (eg 803-3-ethernet, 802-11-wireless, gsm, cdma,
 bluetooth, etc) is required too.  The 'type' setting and the
 'connection' setting are the only required ones.  Usually you'd lock the
 connection to a MAC address with the type setting, or it would contain
 stuff like MTU, SSID, and other hardware-specific stuff, so you can't
 really leave it out.

Okay, so there's a setting called type too, that I presume is distinct
from the connection setting's type attribute.  i.e. the minimum
required:

{'connection': {...},
 'type': {...},
 ...}

Where do I find information on this type setting?  Doing a search for
type setting on
https://developer.gnome.org/NetworkManager/0.9/ref-settings.html shows
no matches.

 IPv4 and IPv6 are optional if you want automatic (DHCP, PPP/WWAN, etc)
 addressing, but obviously if you want static you have to specify one or
 both.

Ahh so a minimal one might give a 'connection' object, whose 'interface'
attribute references one of the physical network ports, and it'll just
configure the network via DHCP.
-- 
Stuart Longland
Systems Engineer
 _ ___
\  /|_) |   T: +61 7 3535 9619
 \/ | \ | 38b Douglas StreetF: +61 7 3535 9699
   SYSTEMSMilton QLD 4064   http://www.vrt.com.au
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-05 Thread Stuart Longland
Hi Thomas,
On 05/07/14 00:40, Thomas Haller wrote:
 On Fri, 2014-07-04 at 11:51 +1000, Stuart Longland wrote:
 Hi Dan,
 On 04/07/14 10:51, Dan Williams wrote:
 On Fri, 2014-07-04 at 09:18 +1000, Stuart Longland wrote:
 What I'm curious about is what sorts of keys and values are expected in
 that dict of dicts?  At a basic level I need to be able to set IP
 addresses, static routes, DNS servers, domain and DNS search order.
 
 Did you see https://wiki.gnome.org/Projects/NetworkManager/Developers ?
 especially
 https://developer.gnome.org/NetworkManager/0.9/ref-settings.html
 (or try `man nm-settings` if you have the manual pages installed)

Ahh no, I didn't see that, and it seems I wasn't asking Google the right
question. :-)

Is there any reason why those aren't mentioned under the Development
Resources on

https://wiki.gnome.org/action/show/Projects/NetworkManager?action=showredirect=NetworkManager
?

 Probably host name too (not sure if that's doable in NetworkManager).
 
 SaveHostname , see
 https://developer.gnome.org/NetworkManager/0.9/spec.html

Brilliant.  Thanks. :-)
Regards,
-- 
Stuart Longland
Systems Engineer
 _ ___
\  /|_) |   T: +61 7 3535 9619
 \/ | \ | 38b Douglas StreetF: +61 7 3535 9699
   SYSTEMSMilton QLD 4064   http://www.vrt.com.au


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-04 Thread Thomas Haller
On Fri, 2014-07-04 at 11:51 +1000, Stuart Longland wrote:
 Hi Dan,
 On 04/07/14 10:51, Dan Williams wrote:
  On Fri, 2014-07-04 at 09:18 +1000, Stuart Longland wrote:
  But how do I encode my address settings in a Settings.Connection object?
   Where do I find a list of the settings and their possible values?
  There's actually a bunch of Python examples here:
  
  http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python
  
  that use both plain dbus and Python GObject introspection.  The GObject
  introspection ones are similar to python-networkmanager actually.  I'm
  not sure how python-networkmanager accepts a new connection to add, but
  perhaps the examples give you an idea how to do that?
 
 Ahh okay, that's handy.  I'll have a dig through those and see what I
 can uncover.
 
  I'd expect it to
  be a normal dict of dicts like the examples above show which is then
  passed to org.freedesktop.NetworkManager.Settings.AddConnection().
 
 It does appear that way, I tried pulling the information out for my
 Ethernet connection and got:
  In [9]: conn.GetSettings()
  Out[9]: 
  {u'bridge': {u'interface-name': u'br0', u'stp': False},
   u'connection': {u'id': u'Bridge Ethernet',
u'type': u'bridge',
u'uuid': u'357c4dcf-2600-45fa-8687-05f4c2cb82b4',
u'zone': u'work'},
   u'ipv4': {u'addresses': [],
u'dns': [],
u'may-fail': False,
u'method': u'auto',
u'routes': []},
   u'ipv6': {u'addresses': [], u'dns': [], u'method': u'auto', u'routes': []}}
 
 It seems NetworkManager doesn't much like my hand-configured bridge
 (won't see its IP address), but that's a side issue.
 
 What I'm curious about is what sorts of keys and values are expected in
 that dict of dicts?  At a basic level I need to be able to set IP
 addresses, static routes, DNS servers, domain and DNS search order.

Did you see https://wiki.gnome.org/Projects/NetworkManager/Developers ?
especially
https://developer.gnome.org/NetworkManager/0.9/ref-settings.html
(or try `man nm-settings` if you have the manual pages installed)


 Probably host name too (not sure if that's doable in NetworkManager).

SaveHostname , see
https://developer.gnome.org/NetworkManager/0.9/spec.html


 At least that will be the starting point.  The devices in question we're
 setting up will be headless boxes, basically appliances, intended to
 poll energy meters in an energy management system and pump the data
 elsewhere.
 
 So mostly wired access, there's a couple of places where we have a
 bridges and OpenVPN for technical support on some sites and I envisage
 some possibly needing cellular 3G support.
 
 No one has approached us with the need for WIFI support, but I bet
 someone will some day, thus it'd be useful to know how that's configured
 too.

I would say, this *should* all work (without knowing your exact
requirements) 


 Is there some documentation as to how these various network types are
 specified as dict objects to NetworkManager?


I think above links is a good starting point, otherwise just ask.


Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Creating NetworkManager connections via DBus API

2014-07-03 Thread Stuart Longland
Hi all,

I'm in the process of writing a web frontend for a small Linux-based
appliance, thus am in need of a tool for configuring the network interfaces.

NetworkManager seems to be a good fit in that it supports a wide variety
of networks and runs as a daemon which is then accessed by unprivileged
users.  The web front-end software we're writing is based on Django, and
I'm creating a collection of models which will represent the
configuration of the network interface.  There's a nice Python library;
python-networkmanager which provides an abstraction ontop of DBus so
accessing NetworkManager isn't too painful.

https://pythonhosted.org/python-networkmanager/

So my task now, is knowing the name of a network device, its intended IP
address, routes, DNS configuration, etc, is to figure out how to tell
NetworkManager about it and get it to connect.

Now, there's a DBus spec which describes the objects here:
https://developer.gnome.org/NetworkManager/unstable/spec.html

Great.  By the looks of things, I create a
org.freedesktop.NetworkManager.Settings.Connection object, then hand
that to org.freedesktop.NetworkManager's ActivateConnection method.

But how do I encode my address settings in a Settings.Connection object?
 Where do I find a list of the settings and their possible values?

Regards,
-- 
Stuart Longland
Systems Engineer
 _ ___
\  /|_) |   T: +61 7 3535 9619
 \/ | \ | 38b Douglas StreetF: +61 7 3535 9699
   SYSTEMSMilton QLD 4064   http://www.vrt.com.au
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-03 Thread Dan Williams
On Fri, 2014-07-04 at 09:18 +1000, Stuart Longland wrote:
 Hi all,
 
 I'm in the process of writing a web frontend for a small Linux-based
 appliance, thus am in need of a tool for configuring the network interfaces.
 
 NetworkManager seems to be a good fit in that it supports a wide variety
 of networks and runs as a daemon which is then accessed by unprivileged
 users.  The web front-end software we're writing is based on Django, and
 I'm creating a collection of models which will represent the
 configuration of the network interface.  There's a nice Python library;
 python-networkmanager which provides an abstraction ontop of DBus so
 accessing NetworkManager isn't too painful.
 
 https://pythonhosted.org/python-networkmanager/
 
 So my task now, is knowing the name of a network device, its intended IP
 address, routes, DNS configuration, etc, is to figure out how to tell
 NetworkManager about it and get it to connect.
 
 Now, there's a DBus spec which describes the objects here:
 https://developer.gnome.org/NetworkManager/unstable/spec.html
 
 Great.  By the looks of things, I create a
 org.freedesktop.NetworkManager.Settings.Connection object, then hand
 that to org.freedesktop.NetworkManager's ActivateConnection method.
 
 But how do I encode my address settings in a Settings.Connection object?
  Where do I find a list of the settings and their possible values?

Hi!

There's actually a bunch of Python examples here:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python

that use both plain dbus and Python GObject introspection.  The GObject
introspection ones are similar to python-networkmanager actually.  I'm
not sure how python-networkmanager accepts a new connection to add, but
perhaps the examples give you an idea how to do that?  I'd expect it to
be a normal dict of dicts like the examples above show which is then
passed to org.freedesktop.NetworkManager.Settings.AddConnection().

Let me know if this helps, happy to answer any more questions you might
have!

Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating NetworkManager connections via DBus API

2014-07-03 Thread Stuart Longland
Hi Dan,
On 04/07/14 10:51, Dan Williams wrote:
 On Fri, 2014-07-04 at 09:18 +1000, Stuart Longland wrote:
 But how do I encode my address settings in a Settings.Connection object?
  Where do I find a list of the settings and their possible values?
 There's actually a bunch of Python examples here:
 
 http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python
 
 that use both plain dbus and Python GObject introspection.  The GObject
 introspection ones are similar to python-networkmanager actually.  I'm
 not sure how python-networkmanager accepts a new connection to add, but
 perhaps the examples give you an idea how to do that?

Ahh okay, that's handy.  I'll have a dig through those and see what I
can uncover.

 I'd expect it to
 be a normal dict of dicts like the examples above show which is then
 passed to org.freedesktop.NetworkManager.Settings.AddConnection().

It does appear that way, I tried pulling the information out for my
Ethernet connection and got:
 In [9]: conn.GetSettings()
 Out[9]: 
 {u'bridge': {u'interface-name': u'br0', u'stp': False},
  u'connection': {u'id': u'Bridge Ethernet',
   u'type': u'bridge',
   u'uuid': u'357c4dcf-2600-45fa-8687-05f4c2cb82b4',
   u'zone': u'work'},
  u'ipv4': {u'addresses': [],
   u'dns': [],
   u'may-fail': False,
   u'method': u'auto',
   u'routes': []},
  u'ipv6': {u'addresses': [], u'dns': [], u'method': u'auto', u'routes': []}}

It seems NetworkManager doesn't much like my hand-configured bridge
(won't see its IP address), but that's a side issue.

What I'm curious about is what sorts of keys and values are expected in
that dict of dicts?  At a basic level I need to be able to set IP
addresses, static routes, DNS servers, domain and DNS search order.

Probably host name too (not sure if that's doable in NetworkManager).

At least that will be the starting point.  The devices in question we're
setting up will be headless boxes, basically appliances, intended to
poll energy meters in an energy management system and pump the data
elsewhere.

So mostly wired access, there's a couple of places where we have a
bridges and OpenVPN for technical support on some sites and I envisage
some possibly needing cellular 3G support.

No one has approached us with the need for WIFI support, but I bet
someone will some day, thus it'd be useful to know how that's configured
too.

Is there some documentation as to how these various network types are
specified as dict objects to NetworkManager?

Regards,
-- 
Stuart Longland
Systems Engineer
 _ ___
\  /|_) |   T: +61 7 3535 9619
 \/ | \ | 38b Douglas StreetF: +61 7 3535 9699
   SYSTEMSMilton QLD 4064   http://www.vrt.com.au
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Setting the IP address and other IP infos through the DBus API of Network Manager version 0.9.4+

2014-06-10 Thread Dan Williams
On Sat, 2014-06-07 at 12:51 -0400, Simon Pleau wrote:
 Hi,
 
  
 
 I'm looking to change the IP address, prefix, gateway, etc.. of a connection 
 through the NM and its DBus API but the only examples I have found are for 
 version 0.8.x in which the Update method on 
 org.freedesktop.NetworkManager.Settings.Connection can be set using the 
 parameters returned by the method GetSettings. Changing the IP address was 
 done by modifying the dictionary named 'ipv4' in the settings returned and 
 passing the new settings through the Update() method on the same interface.

 I am using Debian and NM 0.9.4 and with the upgrade there seems to be no more 
 ipv4 setting returned by GetSettings() so I'm not sure if I can insert a new 
 dictionary entry for the ipv4 in the returned settings and simply return it 
 to Update() as before. 

Correct.  You can insert the new dictionary for the ipv4 setting and
send all the previous settings, plus the new ipv4 setting, back with
the Update() call.  That will save it to disk.

 Also, I noticed org.freedesktop.NetworkManager.IP4config does have a property 
 name Addresses which returns the type of information I am looking to modify 
 (but missing the dns infos in the old ipv4 structure) but there is not way to 
 modify and set these parameters through the interface or any other. 

The IP4Config interface is the runtime configuration, after the
Connection and it's associated settings have been applied to the
interface.  So for example, the Connection settings  might specify
method=auto (ie, DHCP), and then when DHCP is run, the actual IP
address and DNS settings populate the IP4Config object.  The Connection
is only the saved profile configuration information used to connect to
the network, but it does not store any runtime configuration in NM 0.9.8
and lower.

 Can anybody advise me on the right course to modify the IP settings in NM 
 0.9.4+?

Depending on the language you're working with, there are some examples
here:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples

I've just added two python examples which should show what needs to be
done:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/update-ip4-method.py
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/gi/update-ip4-method.py

Let me know if you have more questions!

Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Setting the IP address and other IP infos through the DBus API of Network Manager version 0.9.4+

2014-06-07 Thread Simon Pleau
Hi,

 

I'm looking to change the IP address, prefix, gateway, etc.. of a connection 
through the NM and its DBus API but the only examples I have found are for 
version 0.8.x in which the Update method on 
org.freedesktop.NetworkManager.Settings.Connection can be set using the 
parameters returned by the method GetSettings. Changing the IP address was done 
by modifying the dictionary named 'ipv4' in the settings returned and passing 
the new settings through the Update() method on the same interface.

 

I am using Debian and NM 0.9.4 and with the upgrade there seems to be no more 
ipv4 setting returned by GetSettings() so I'm not sure if I can insert a new 
dictionary entry for the ipv4 in the returned settings and simply return it to 
Update() as before. 

Also, I noticed org.freedesktop.NetworkManager.IP4config does have a property 
name Addresses which returns the type of information I am looking to modify 
(but missing the dns infos in the old ipv4 structure) but there is not way to 
modify and set these parameters through the interface or any other. 

 

Can anybody advise me on the right course to modify the IP settings in NM 
0.9.4+?

 

Thanks,

 

Simon Pleau, ing. jr.

Recherche  développement

Research  Development 

 

Simbol Test Systems Inc

Simbol.ca | PhotonCom.com 

616 Auguste-Mondoux, Gatineau Qc J9J 3K3 

819 770-7771 ext.131

 

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Trying to use the DBus API with QtDBus - does the example work?

2012-01-13 Thread Lamarque V. Souza
Em Wednesday 21 December 2011, devine-ml...@ddevnet.net escreveu:
 On Wed, 21 Dec 2011 10:21:45 -0200, Lamarque V. Souza wrote:
 
 
 You should use the Settings path to get the settings for a
 connection:
 
 I figured that out minutes before I saw your reply :S
 
 
 DBUS Service: org.freedesktop.NetworkManager
 DBUS Object Path:
 /org/freedesktop/NetworkManager
 DBUS Interface:
 org.freedesktop.NetworkManager
 
 This little snippet made me think.
 Depending which Object you're working with you have different Interfaces
 available to manipulate the object. I found the Settings object,
 eventually. Initially I was trying to work with a Devices object.
 
 Now
 that I know this, I went over the example again and did see
 getConnection was indeed returning a settings path.
 
  You should try
 
 QtNetworkManager instead of creating your program from scratch:
 
 
 https://projects.kde.org/projects/kdereview/libnm-qt
 
 
 QtNetworkManager make those details transparent. Unfortunately there is
 not small example of how to use it. I use it in Plasma
 NetworkManagement, but Plasma NM is a big program. If you want to try
 take a look at manager.h and connection.h, those probably contain the
 methods you are looking for.
 
 This is great news. The bad news is that I
 am very new to Qt and C++ so it may be too tricky for me to get started
 without examples.
 
 The functionality I need is the basic set: getting
 interfaces, IP addresses, default gateway, setting an IP addresses...
 Not much past that. Do you think you could put together a small example
 that lists interfaces and sets an IP address on an interface?

I added one example of how to list interfaces and retrieve the IP 
configuration (for static and dhcp). Git pull the repository and look at the 
examples directory. I still need to create the example for setting a IP 
address, which is not that simple since with NM you have to create a 
connection with the IP configuration first.
 
 The
 GObject and Python APIs look so simple :(

Well, QtNetworkManager is a working in progress and as so it is not 
finished yet.

-- 
Lamarque V. Souza
KDE's Network Management maintainer
http://planetkde.org/pt-br
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Trying to use the DBus API with QtDBus - does the example work?

2011-12-21 Thread devine-mlist
I have hacked up the change-ipv4-address.cpp example in an attempt to 
make it so that the program takes an interface name such as eth0 and 
changes the IP address instead of a UUID.

The problem is:
Error: could not update connection: 
org.freedesktop.DBus.Error.UnknownMethod Method Update with signature 
a{sa{sv}} on interface 
org.freedesktop.NetworkManager.Settings.Connection doesn't exist


This comes from a piece of code that I did not change and should work 
the same as the original - unless I have really misunderstood something.
Surfing around using the qdbus tool I noticed that I could not get to 
the Settings methods. I could only get 
org.freedesktop.NetworkManager.Device.* stuff.


qdbus --system org.freedesktop.NetworkManager 
/org/freedesktop/NetworkManager/Devices/0 
org.freedesktop.NetworkManager.[no Settings methods here!]



Example code: 
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/C/qt/change-ipv4-addresses.cpp



My code:
===

#include QtDBus/QDBusConnection
#include QtDBus/QDBusInterface
#include QtDBus/QDBusMetaType
#include QtDBus/QDBusReply
#include QtCore/QList
#include QtCore/QMap
#include QtCore/QString
#include QtCore/QDebug
#include QtNetwork/QHostAddress

#include arpa/inet.h

#include NetworkManager.h

typedef QMapQString, QMapQString, QVariant  Connection;
Q_DECLARE_METATYPE(Connection)
Q_DECLARE_METATYPE(QListuint);
Q_DECLARE_METATYPE(QListQListuint );


QString ifaceNameToPath(const QString iface_name){
// Set up DBus interface to org.freedesktop.NetworkManager
QDBusInterface interface(
NM_DBUS_SERVICE,
NM_DBUS_PATH,
NM_DBUS_INTERFACE,
QDBusConnection::systemBus());

// Call GetDevicesByIpIface using iface_name
QDBusReplyQDBusObjectPath path = 
interface.call(GetDeviceByIpIface, iface_name);

qDebug()  path.value().path();
// return the path.
return path.value().path();
}


void changeConnection(const QString ifname)
{
// Register types with D-Bus
qDBusRegisterMetaTypeConnection();
qDBusRegisterMetaTypeQListuint ();
qDBusRegisterMetaTypeQListQListuint  ();

Connection connection;
QString conPath;

// Find connection by provided UUID
conPath = ifaceNameToPath(ifname);
qDebug()  Derp conPath   conPath   ifname was   ifname;
if (!conPath.isEmpty()) {
QListQListuint  addresses;
QListuint addr1, addr2;

// Add some addresses
addr1  htonl(QHostAddress(192.168.1.105).toIPv4Address());
addresses  addr1;

// Set method to Manual and put addresses to the connection 
map

connection[ipv4][method] = manual;
connection[ipv4][addresses] = 
QVariant::fromValue(addresses);


QDBusInterface interface(
NM_DBUS_SERVICE,
conPath,
NM_DBUS_IFACE_SETTINGS_CONNECTION,
QDBusConnection::systemBus());

// Call Update() D-Bus method to update connection
QDBusReplyvoid result = interface.call(Update, 
QVariant::fromValue(connection));

if (result.isValid()) {
qDebug()  QString(Connection successfully updated (path 
%1)).arg(conPath);

} else {
   qDebug()  QString(Error: could not update connection: %1 
%2).arg(result.error().name()).arg(result.error().message());

}
} else {
qDebug()  QString(Error: connection with name '%1' not 
found).arg(ifname);

}
}

int main(int argc, char *argv[])
{
if (argc != 2) {
qDebug()  QString(Usage: %1 UUID).arg(argv[0]);
return -1;
}

changeConnection(argv[1]);
}

--Daniel Devine
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Trying to use the DBus API with QtDBus - does the example work?

2011-12-21 Thread Lamarque V. Souza
Em Wednesday 21 December 2011, devine-ml...@ddevnet.net escreveu:
  I have hacked up the change-ipv4-address.cpp example in an attempt to
  make it so that the program takes an interface name such as eth0 and
  changes the IP address instead of a UUID.
  The problem is:
  Error: could not update connection:
  org.freedesktop.DBus.Error.UnknownMethod Method Update with signature
  a{sa{sv}} on interface
  org.freedesktop.NetworkManager.Settings.Connection doesn't exist

change-ipv4-address.cpp was created to work with NM 0.9. If you are 
using NM 0.8 it will not work.
 
  This comes from a piece of code that I did not change and should work
  the same as the original - unless I have really misunderstood something.
  Surfing around using the qdbus tool I noticed that I could not get to
  the Settings methods. I could only get
  org.freedesktop.NetworkManager.Device.* stuff.
 
  qdbus --system org.freedesktop.NetworkManager
  /org/freedesktop/NetworkManager/Devices/0
  org.freedesktop.NetworkManager.[no Settings methods here!]

You should use the Settings path to get the settings for a connection:

qdbus --system org.freedesktop.NetworkManager 
 /org/freedesktop/NetworkManager/Settings/0

Although that is not very usefull since the most important methods in 
the Settings object uses custom objects which qdbus does not understand.

You should try QtNetworkManager instead of creating your program from 
scratch:

https://projects.kde.org/projects/kdereview/libnm-qt

QtNetworkManager make those details transparent. Unfortunately there is 
not small example of how to use it. I use it in Plasma NetworkManagement, but 
Plasma NM is a big program. If you want to try take a look at manager.h and 
connection.h, those probably contain the methods you are looking for.

OBS: the link above may change to 
https://projects.kde.org/projects/extragear/base/libnm-qt in some weeks.

  Example code:
  http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/C/
 qt/change-ipv4-addresses.cpp
 
 
  My code:
  ===
 
  #include QtDBus/QDBusConnection
  #include QtDBus/QDBusInterface
  #include QtDBus/QDBusMetaType
  #include QtDBus/QDBusReply
  #include QtCore/QList
  #include QtCore/QMap
  #include QtCore/QString
  #include QtCore/QDebug
  #include QtNetwork/QHostAddress
 
  #include arpa/inet.h
 
  #include NetworkManager.h
 
  typedef QMapQString, QMapQString, QVariant  Connection;
  Q_DECLARE_METATYPE(Connection)
  Q_DECLARE_METATYPE(QListuint);
  Q_DECLARE_METATYPE(QListQListuint );
 
 
  QString ifaceNameToPath(const QString iface_name){
  // Set up DBus interface to org.freedesktop.NetworkManager
  QDBusInterface interface(
  NM_DBUS_SERVICE,
  NM_DBUS_PATH,
  NM_DBUS_INTERFACE,
  QDBusConnection::systemBus());
 
  // Call GetDevicesByIpIface using iface_name
  QDBusReplyQDBusObjectPath path =
  interface.call(GetDeviceByIpIface, iface_name);
  qDebug()  path.value().path();
  // return the path.
  return path.value().path();
  }
 
 
  void changeConnection(const QString ifname)
  {
  // Register types with D-Bus
  qDBusRegisterMetaTypeConnection();
  qDBusRegisterMetaTypeQListuint ();
  qDBusRegisterMetaTypeQListQListuint  ();
 
  Connection connection;
  QString conPath;
 
  // Find connection by provided UUID
  conPath = ifaceNameToPath(ifname);
  qDebug()  Derp conPath   conPath   ifname was   ifname;
  if (!conPath.isEmpty()) {
  QListQListuint  addresses;
  QListuint addr1, addr2;
 
  // Add some addresses
  addr1  htonl(QHostAddress(192.168.1.105).toIPv4Address());
  addresses  addr1;
 
  // Set method to Manual and put addresses to the connection
  map
  connection[ipv4][method] = manual;
  connection[ipv4][addresses] =
  QVariant::fromValue(addresses);
 
  QDBusInterface interface(
  NM_DBUS_SERVICE,
  conPath,
  NM_DBUS_IFACE_SETTINGS_CONNECTION,
  QDBusConnection::systemBus());
 
  // Call Update() D-Bus method to update connection
  QDBusReplyvoid result = interface.call(Update,
  QVariant::fromValue(connection));
  if (result.isValid()) {
  qDebug()  QString(Connection successfully updated (path
  %1)).arg(conPath);
  } else {
 qDebug()  QString(Error: could not update connection: %1
  %2).arg(result.error().name()).arg(result.error().message());
  }
  } else {
  qDebug()  QString(Error: connection with name '%1' not
  found).arg(ifname);
  }
  }
 
  int main(int argc, char *argv[])
  {
  if (argc != 2) {
  qDebug()  QString(Usage: %1 UUID).arg(argv[0]);
  return -1;
  }
 
  changeConnection(argv[1]);
  }
 
  --Daniel Devine
 

Re: Trying to use the DBus API with QtDBus - does the example work?

2011-12-21 Thread Jirka Klimes
On Wednesday 21 of December 2011 12:14:14 devine-ml...@ddevnet.net wrote:
  I have hacked up the change-ipv4-address.cpp example in an attempt to
  make it so that the program takes an interface name such as eth0 and
  changes the IP address instead of a UUID.
  The problem is:
  Error: could not update connection:
  org.freedesktop.DBus.Error.UnknownMethod Method Update with signature
  a{sa{sv}} on interface
  org.freedesktop.NetworkManager.Settings.Connection doesn't exist
 
  This comes from a piece of code that I did not change and should work
  the same as the original - unless I have really misunderstood something.
  Surfing around using the qdbus tool I noticed that I could not get to
  the Settings methods. I could only get
  org.freedesktop.NetworkManager.Device.* stuff.
 
  qdbus --system org.freedesktop.NetworkManager
  /org/freedesktop/NetworkManager/Devices/0
  org.freedesktop.NetworkManager.[no Settings methods here!]
 
 
  Example code:
  http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/C/
 qt/change-ipv4-addresses.cpp
 
 

The example works just fine - it changes IP addresses in a connection profile.
However, you misunderstood the difference between static configuration 
parameters and active IP on an interface.
You probably want to change IP address on the interface, and that's another 
thing that modifying a static connection profile, which is done in the example.

The connection profile is just a bunch of configuration values and it has no 
relation to any device until it is activated. Thus there's no relation between 
interface name and the UUID. If the connection is activated on a device, then 
the parameters are applied to the device and you can find them under device 
path, like  /org/freedesktop/NetworkManager/Devices/n and IP stuff is under 
associated /org/freedesktop/NetworkManager/IP4Config/n

So, the problem here is that there's no Update() method on
/org/freedesktop/NetworkManager/Devices/0 object, because it doesn't 
represent a connection, but a device. You can only call the method on 
/org/freedesktop/NetworkManager/Settings/n object to edit
the connection. (You changed conPath.)

If you want to change IP address on an interface, you need to modify the 
connection profile (as the example does) and then activate it again on
the interface. Or simply use ifconfig or ip commands.

Useful links:
* NM configuration
 http://live.gnome.org/NetworkManagerConfiguration
* D-Bus API specification:

http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.freedesktop.NetworkManager.Settings.Connection

http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.freedesktop.NetworkManager.Device

You can also use 'd-feet' or 'qdbusviewer' GUI applications, which are nice to 
browse D-Bus API and see available objects and supported interfaces.

Jirka

  My code:
  ===
 
  #include QtDBus/QDBusConnection
  #include QtDBus/QDBusInterface
  #include QtDBus/QDBusMetaType
  #include QtDBus/QDBusReply
  #include QtCore/QList
  #include QtCore/QMap
  #include QtCore/QString
  #include QtCore/QDebug
  #include QtNetwork/QHostAddress
 
  #include arpa/inet.h
 
  #include NetworkManager.h
 
  typedef QMapQString, QMapQString, QVariant  Connection;
  Q_DECLARE_METATYPE(Connection)
  Q_DECLARE_METATYPE(QListuint);
  Q_DECLARE_METATYPE(QListQListuint );
 
 
  QString ifaceNameToPath(const QString iface_name){
  // Set up DBus interface to org.freedesktop.NetworkManager
  QDBusInterface interface(
  NM_DBUS_SERVICE,
  NM_DBUS_PATH,
  NM_DBUS_INTERFACE,
  QDBusConnection::systemBus());
 
  // Call GetDevicesByIpIface using iface_name
  QDBusReplyQDBusObjectPath path =
  interface.call(GetDeviceByIpIface, iface_name);
  qDebug()  path.value().path();
  // return the path.
  return path.value().path();
  }
 
 
  void changeConnection(const QString ifname)
  {
  // Register types with D-Bus
  qDBusRegisterMetaTypeConnection();
  qDBusRegisterMetaTypeQListuint ();
  qDBusRegisterMetaTypeQListQListuint  ();
 
  Connection connection;
  QString conPath;
 
  // Find connection by provided UUID
  conPath = ifaceNameToPath(ifname);
  qDebug()  Derp conPath   conPath   ifname was   ifname;
  if (!conPath.isEmpty()) {
  QListQListuint  addresses;
  QListuint addr1, addr2;
 
  // Add some addresses
  addr1  htonl(QHostAddress(192.168.1.105).toIPv4Address());
  addresses  addr1;
 
  // Set method to Manual and put addresses to the connection
  map
  connection[ipv4][method] = manual;
  connection[ipv4][addresses] =
  QVariant::fromValue(addresses);
 
  QDBusInterface interface(
  NM_DBUS_SERVICE,
  conPath,
  NM_DBUS_IFACE_SETTINGS_CONNECTION,
  

Re: NM dbus API bug ?

2011-10-06 Thread Jean Parpaillon
Thank you very much for your answer.

It actually solved my issue.


Jean

Le mercredi 05 octobre 2011 à 13:53 -0500, Dan Williams a écrit :
 On Tue, 2011-10-04 at 17:07 +0200, Jean Parpaillon wrote:
  Hi again :)
 
 Your original crash is a dbus-glib bug, which likely was a regression in
 dbus-glib 0.94 and is fixed by:
 
 http://cgit.freedesktop.org/dbus/dbus-glib/commit/?id=3e0828f57c3925ea9b63d22ab82d991a0fea0536
 
 ie it's been fixed in dbus-glib 0.96 and later.
 
  I'm quite confused on using NetworkManager DBUS API on master branch.
  1/ When getting the object with the path returned by
  NetworkManager.GetDevices() method, NM crashes (path is of the
  form: /org/freedesktop/NetworkManager/Devices/0)
 
 That is the correct form of paths.  Device names can change at runtime
 so they are not part of the object path as exposed over D-Bus.
 
  2/ If I get the Device object with path
  like /org/freedesktop/NetworkManager/Devices/eth0, I can get the object
  but Introspectable interface gives me no interface at all on this
  object. Strange...
 
 Right, because that's not actually an object that NetworkManager exports
 over D-Bus, which is why you won't get any introspection information.
 It could be a bug in the Python dbus bindings that you get an object
 here at all, but the Python bits us lazy bindings so they'll only look
 up the introspection information when you need it, which can be later
 than when you create the Interface object.
 
 In the end, the bug is in dbus-glib 0.94 and fixed in 0.96.
 
 Dan
 
  It is WIP ? It is supposed to work right now ?
  I can try to fix it, if someone gives me some hints :)
  
  Regards,
  Jean
  
  Le mardi 04 octobre 2011 à 14:15 +0200, Jean Parpaillon a écrit :
   Hi all,
   I'm using NetworkManager from master branch.
   
   Running the following python code crash NetworkManager:
   
   ###
   import dbus
   import sys
   
   NM_DBUS_SERVICE = org.freedesktop.NetworkManager
   NM_MANAGER_PATH = /org/freedesktop/NetworkManager
   NM_MANAGER_IFACE = org.freedesktop.NetworkManager
   NM_DEVICE_IFACE = org.freedesktop.NetworkManager.Device
   
   bus = dbus.SystemBus()
   
   manager_proxy = bus.get_object(NM_DBUS_SERVICE, NM_MANAGER_PATH)
   manager_iface = dbus.Interface(manager_proxy,
   dbus_interface=NM_MANAGER_IFACE)
   
   for device_path in manager_iface.GetDevices():
   print Device: %s % device_path
   
   device_proxy = bus.get_object(NM_DBUS_SERVICE, device_path)
   
   ###
   
   In a few words, it crashes when I try to get dbus proxy object with a
   path I get from GetDevices() method.
   The crashes produces the following backtrace:
   Oct  4 14:01:17 tiflis NetworkManager[26393]: warn caught signal 11.
   Generating backtrace...
   Oct  4 14:01:17 tiflis NetworkManager[26393]: *** START
   **
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   0: /usr/sbin/NetworkManager (nm_logging_backtrace+0x3b) [0x45e3fb]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   1: /usr/sbin/NetworkManager (0x40+0x4470c1) [0x4470c1]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7fbdf74d9000+0x7fbdf74e8020)
   [0x7fbdf74e8020]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   3: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
   +0x7fbdf79469b0) [0x7fbdf79469b0]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   4: /lib/libglib-2.0.so.0 (g_hash_table_foreach+0x43) [0x7fbdf6017bd3]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   5: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
   +0x7fbdf794808c) [0x7fbdf794808c]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   6: /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x7fbdf76f5000+0x7fbdf7713371)
   [0x7fbdf7713371]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   7: /lib/x86_64-linux-gnu/libdbus-1.so.3 (dbus_connection_dispatch+0x380)
   [0x7fbdf7705270]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   8: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
   +0x7fbdf7945675) [0x7fbdf7945675]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   9: /lib/libglib-2.0.so.0 (g_main_context_dispatch+0x1f3)
   [0x7fbdf60284a3]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   10: /lib/libglib-2.0.so.0 (0x7fbdf5fe3000+0x7fbdf6028c80)
   [0x7fbdf6028c80]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   11: /lib/libglib-2.0.so.0 (g_main_loop_run+0x182) [0x7fbdf60292f2]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   12: /usr/sbin/NetworkManager (main+0x1155) [0x4220f5]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   13: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xfd)
   [0x7fbdf57f7ead]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
   14: /usr/sbin/NetworkManager (0x40+0x42224d) [0x42224d]
   Oct  4 14:01:17 tiflis NetworkManager[26393]: *** END

Re: NM dbus API bug ?

2011-10-05 Thread Dan Williams
On Tue, 2011-10-04 at 17:07 +0200, Jean Parpaillon wrote:
 Hi again :)

Your original crash is a dbus-glib bug, which likely was a regression in
dbus-glib 0.94 and is fixed by:

http://cgit.freedesktop.org/dbus/dbus-glib/commit/?id=3e0828f57c3925ea9b63d22ab82d991a0fea0536

ie it's been fixed in dbus-glib 0.96 and later.

 I'm quite confused on using NetworkManager DBUS API on master branch.
 1/ When getting the object with the path returned by
 NetworkManager.GetDevices() method, NM crashes (path is of the
 form: /org/freedesktop/NetworkManager/Devices/0)

That is the correct form of paths.  Device names can change at runtime
so they are not part of the object path as exposed over D-Bus.

 2/ If I get the Device object with path
 like /org/freedesktop/NetworkManager/Devices/eth0, I can get the object
 but Introspectable interface gives me no interface at all on this
 object. Strange...

Right, because that's not actually an object that NetworkManager exports
over D-Bus, which is why you won't get any introspection information.
It could be a bug in the Python dbus bindings that you get an object
here at all, but the Python bits us lazy bindings so they'll only look
up the introspection information when you need it, which can be later
than when you create the Interface object.

In the end, the bug is in dbus-glib 0.94 and fixed in 0.96.

Dan

 It is WIP ? It is supposed to work right now ?
 I can try to fix it, if someone gives me some hints :)
 
 Regards,
 Jean
 
 Le mardi 04 octobre 2011 à 14:15 +0200, Jean Parpaillon a écrit :
  Hi all,
  I'm using NetworkManager from master branch.
  
  Running the following python code crash NetworkManager:
  
  ###
  import dbus
  import sys
  
  NM_DBUS_SERVICE = org.freedesktop.NetworkManager
  NM_MANAGER_PATH = /org/freedesktop/NetworkManager
  NM_MANAGER_IFACE = org.freedesktop.NetworkManager
  NM_DEVICE_IFACE = org.freedesktop.NetworkManager.Device
  
  bus = dbus.SystemBus()
  
  manager_proxy = bus.get_object(NM_DBUS_SERVICE, NM_MANAGER_PATH)
  manager_iface = dbus.Interface(manager_proxy,
  dbus_interface=NM_MANAGER_IFACE)
  
  for device_path in manager_iface.GetDevices():
  print Device: %s % device_path
  
  device_proxy = bus.get_object(NM_DBUS_SERVICE, device_path)
  
  ###
  
  In a few words, it crashes when I try to get dbus proxy object with a
  path I get from GetDevices() method.
  The crashes produces the following backtrace:
  Oct  4 14:01:17 tiflis NetworkManager[26393]: warn caught signal 11.
  Generating backtrace...
  Oct  4 14:01:17 tiflis NetworkManager[26393]: *** START
  **
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  0: /usr/sbin/NetworkManager (nm_logging_backtrace+0x3b) [0x45e3fb]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  1: /usr/sbin/NetworkManager (0x40+0x4470c1) [0x4470c1]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7fbdf74d9000+0x7fbdf74e8020)
  [0x7fbdf74e8020]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  3: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
  +0x7fbdf79469b0) [0x7fbdf79469b0]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  4: /lib/libglib-2.0.so.0 (g_hash_table_foreach+0x43) [0x7fbdf6017bd3]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  5: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
  +0x7fbdf794808c) [0x7fbdf794808c]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  6: /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x7fbdf76f5000+0x7fbdf7713371)
  [0x7fbdf7713371]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  7: /lib/x86_64-linux-gnu/libdbus-1.so.3 (dbus_connection_dispatch+0x380)
  [0x7fbdf7705270]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  8: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
  +0x7fbdf7945675) [0x7fbdf7945675]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  9: /lib/libglib-2.0.so.0 (g_main_context_dispatch+0x1f3)
  [0x7fbdf60284a3]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  10: /lib/libglib-2.0.so.0 (0x7fbdf5fe3000+0x7fbdf6028c80)
  [0x7fbdf6028c80]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  11: /lib/libglib-2.0.so.0 (g_main_loop_run+0x182) [0x7fbdf60292f2]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  12: /usr/sbin/NetworkManager (main+0x1155) [0x4220f5]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  13: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xfd)
  [0x7fbdf57f7ead]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
  14: /usr/sbin/NetworkManager (0x40+0x42224d) [0x42224d]
  Oct  4 14:01:17 tiflis NetworkManager[26393]: *** END
  **
  
  
  Any clue ?
  
  ___
  networkmanager-list mailing list
  networkmanager-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/networkmanager-list

NM dbus API bug ?

2011-10-04 Thread Jean Parpaillon
Hi all,
I'm using NetworkManager from master branch.

Running the following python code crash NetworkManager:

###
import dbus
import sys

NM_DBUS_SERVICE = org.freedesktop.NetworkManager
NM_MANAGER_PATH = /org/freedesktop/NetworkManager
NM_MANAGER_IFACE = org.freedesktop.NetworkManager
NM_DEVICE_IFACE = org.freedesktop.NetworkManager.Device

bus = dbus.SystemBus()

manager_proxy = bus.get_object(NM_DBUS_SERVICE, NM_MANAGER_PATH)
manager_iface = dbus.Interface(manager_proxy,
dbus_interface=NM_MANAGER_IFACE)

for device_path in manager_iface.GetDevices():
print Device: %s % device_path

device_proxy = bus.get_object(NM_DBUS_SERVICE, device_path)

###

In a few words, it crashes when I try to get dbus proxy object with a
path I get from GetDevices() method.
The crashes produces the following backtrace:
Oct  4 14:01:17 tiflis NetworkManager[26393]: warn caught signal 11.
Generating backtrace...
Oct  4 14:01:17 tiflis NetworkManager[26393]: *** START
**
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
0: /usr/sbin/NetworkManager (nm_logging_backtrace+0x3b) [0x45e3fb]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
1: /usr/sbin/NetworkManager (0x40+0x4470c1) [0x4470c1]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7fbdf74d9000+0x7fbdf74e8020)
[0x7fbdf74e8020]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
3: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
+0x7fbdf79469b0) [0x7fbdf79469b0]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
4: /lib/libglib-2.0.so.0 (g_hash_table_foreach+0x43) [0x7fbdf6017bd3]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
5: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
+0x7fbdf794808c) [0x7fbdf794808c]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
6: /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x7fbdf76f5000+0x7fbdf7713371)
[0x7fbdf7713371]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
7: /lib/x86_64-linux-gnu/libdbus-1.so.3 (dbus_connection_dispatch+0x380)
[0x7fbdf7705270]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
8: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
+0x7fbdf7945675) [0x7fbdf7945675]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
9: /lib/libglib-2.0.so.0 (g_main_context_dispatch+0x1f3)
[0x7fbdf60284a3]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
10: /lib/libglib-2.0.so.0 (0x7fbdf5fe3000+0x7fbdf6028c80)
[0x7fbdf6028c80]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
11: /lib/libglib-2.0.so.0 (g_main_loop_run+0x182) [0x7fbdf60292f2]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
12: /usr/sbin/NetworkManager (main+0x1155) [0x4220f5]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
13: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xfd)
[0x7fbdf57f7ead]
Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
14: /usr/sbin/NetworkManager (0x40+0x42224d) [0x42224d]
Oct  4 14:01:17 tiflis NetworkManager[26393]: *** END
**


Any clue ?

-- 
Jean Parpaillon
RD Engineer
http://mandriva.com
+33 6 30 10 92 86
xmpp: jean.parpail...@gmail.com


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NM dbus API bug ?

2011-10-04 Thread Jean Parpaillon
Hi again :)

I'm quite confused on using NetworkManager DBUS API on master branch.
1/ When getting the object with the path returned by
NetworkManager.GetDevices() method, NM crashes (path is of the
form: /org/freedesktop/NetworkManager/Devices/0)
2/ If I get the Device object with path
like /org/freedesktop/NetworkManager/Devices/eth0, I can get the object
but Introspectable interface gives me no interface at all on this
object. Strange...

It is WIP ? It is supposed to work right now ?
I can try to fix it, if someone gives me some hints :)

Regards,
Jean

Le mardi 04 octobre 2011 à 14:15 +0200, Jean Parpaillon a écrit :
 Hi all,
 I'm using NetworkManager from master branch.
 
 Running the following python code crash NetworkManager:
 
 ###
 import dbus
 import sys
 
 NM_DBUS_SERVICE = org.freedesktop.NetworkManager
 NM_MANAGER_PATH = /org/freedesktop/NetworkManager
 NM_MANAGER_IFACE = org.freedesktop.NetworkManager
 NM_DEVICE_IFACE = org.freedesktop.NetworkManager.Device
 
 bus = dbus.SystemBus()
 
 manager_proxy = bus.get_object(NM_DBUS_SERVICE, NM_MANAGER_PATH)
 manager_iface = dbus.Interface(manager_proxy,
 dbus_interface=NM_MANAGER_IFACE)
 
 for device_path in manager_iface.GetDevices():
 print Device: %s % device_path
 
 device_proxy = bus.get_object(NM_DBUS_SERVICE, device_path)
 
 ###
 
 In a few words, it crashes when I try to get dbus proxy object with a
 path I get from GetDevices() method.
 The crashes produces the following backtrace:
 Oct  4 14:01:17 tiflis NetworkManager[26393]: warn caught signal 11.
 Generating backtrace...
 Oct  4 14:01:17 tiflis NetworkManager[26393]: *** START
 **
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 0: /usr/sbin/NetworkManager (nm_logging_backtrace+0x3b) [0x45e3fb]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 1: /usr/sbin/NetworkManager (0x40+0x4470c1) [0x4470c1]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7fbdf74d9000+0x7fbdf74e8020)
 [0x7fbdf74e8020]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 3: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
 +0x7fbdf79469b0) [0x7fbdf79469b0]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 4: /lib/libglib-2.0.so.0 (g_hash_table_foreach+0x43) [0x7fbdf6017bd3]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 5: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
 +0x7fbdf794808c) [0x7fbdf794808c]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 6: /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x7fbdf76f5000+0x7fbdf7713371)
 [0x7fbdf7713371]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 7: /lib/x86_64-linux-gnu/libdbus-1.so.3 (dbus_connection_dispatch+0x380)
 [0x7fbdf7705270]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 8: /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x7fbdf793a000
 +0x7fbdf7945675) [0x7fbdf7945675]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 9: /lib/libglib-2.0.so.0 (g_main_context_dispatch+0x1f3)
 [0x7fbdf60284a3]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 10: /lib/libglib-2.0.so.0 (0x7fbdf5fe3000+0x7fbdf6028c80)
 [0x7fbdf6028c80]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 11: /lib/libglib-2.0.so.0 (g_main_loop_run+0x182) [0x7fbdf60292f2]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 12: /usr/sbin/NetworkManager (main+0x1155) [0x4220f5]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 13: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xfd)
 [0x7fbdf57f7ead]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: Frame
 14: /usr/sbin/NetworkManager (0x40+0x42224d) [0x42224d]
 Oct  4 14:01:17 tiflis NetworkManager[26393]: *** END
 **
 
 
 Any clue ?
 
 ___
 networkmanager-list mailing list
 networkmanager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list



-- 
Jean Parpaillon
RD Engineer
http://mandriva.com
+33 6 30 10 92 86
xmpp: jean.parpail...@gmail.com


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Changes to the proposed ModemManager DBus API

2011-10-01 Thread Aleksander Morgado

  Here is a set of changes to the proposed MM DBus API. Some of them were 
  already
  discussed some time ago in the following thread:
  https://mail.gnome.org/archives/networkmanager-list/2011-May/msg00162.html
  
  [PATCH 1/8] api: include ScanDevices() and SetLogging() in the new manager 
  API
  [PATCH 2/8] api: remove GetInfo() from the Modem API and use read-only 
  properties instead.
  [PATCH 3/8] api: let the Modem expose a 'Sim' property to link to a 
  specific SIM object
  [PATCH 4/8] api: let SignalQuality say if the given value was recently taken
  [PATCH 5/8] api: new SetAllowedModes() to be able to modify the allowed 
  mode in the modem
  [PATCH 6/8] api: new SetAllowedBands() to be able to modify the allowed 
  bands in the modem
  [PATCH 7/8] api: rename MM_MODEM_ALLOWED_MODE to MM_MODEM_MODE
 
 1 - 7 look fine to commit immediately.
 

Done.

-- 
Aleksander

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Changes to the proposed ModemManager DBus API

2011-09-30 Thread Aleksander Morgado
Here is a set of changes to the proposed MM DBus API. Some of them were already
discussed some time ago in the following thread:
https://mail.gnome.org/archives/networkmanager-list/2011-May/msg00162.html

[PATCH 1/8] api: include ScanDevices() and SetLogging() in the new manager API
[PATCH 2/8] api: remove GetInfo() from the Modem API and use read-only 
properties instead.
[PATCH 3/8] api: let the Modem expose a 'Sim' property to link to a specific 
SIM object
[PATCH 4/8] api: let SignalQuality say if the given value was recently taken
[PATCH 5/8] api: new SetAllowedModes() to be able to modify the allowed mode in 
the modem
[PATCH 6/8] api: new SetAllowedBands() to be able to modify the allowed bands 
in the modem
[PATCH 7/8] api: rename MM_MODEM_ALLOWED_MODE to MM_MODEM_MODE
[PATCH 8/8] api: Let MM_MODEM_MODE be a bitfield, and new PreferredMode property

Comments and suggestions welcome,

--
Aleksander
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Changes to the proposed ModemManager DBus API

2011-09-30 Thread Dan Williams
On Fri, 2011-09-30 at 15:01 +0200, Aleksander Morgado wrote:
 Here is a set of changes to the proposed MM DBus API. Some of them were 
 already
 discussed some time ago in the following thread:
 https://mail.gnome.org/archives/networkmanager-list/2011-May/msg00162.html
 
 [PATCH 1/8] api: include ScanDevices() and SetLogging() in the new manager API
 [PATCH 2/8] api: remove GetInfo() from the Modem API and use read-only 
 properties instead.
 [PATCH 3/8] api: let the Modem expose a 'Sim' property to link to a specific 
 SIM object
 [PATCH 4/8] api: let SignalQuality say if the given value was recently taken
 [PATCH 5/8] api: new SetAllowedModes() to be able to modify the allowed mode 
 in the modem
 [PATCH 6/8] api: new SetAllowedBands() to be able to modify the allowed bands 
 in the modem
 [PATCH 7/8] api: rename MM_MODEM_ALLOWED_MODE to MM_MODEM_MODE

1 - 7 look fine to commit immediately.

 [PATCH 8/8] api: Let MM_MODEM_MODE be a bitfield, and new PreferredMode 
 property

Lets continue discussion on this one for now.

Thanks!
Dan

 Comments and suggestions welcome,
 
 --
 Aleksander
 ___
 networkmanager-list mailing list
 networkmanager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list


___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Help with NM DBus API

2011-04-18 Thread David Rothlisberger
Hi,

I'm looking for some insight into how to use the NM DBus API. (I've
poked around a bit in the libnm-util and network-manager-applet
sources but my small brain is none the wiser.)

I have a single *system* connection (no user connections) and I want
to change the settings of this system connection.

Just looking at the interfaces, it seems I need to call
NetworkManagerSettings.ListConnections() on the
NetworkManagerSystemSettings service (this is NM 0.7/0.8) to get the
path of the connection object; and then call
NetworkManagerSettings.Connection.Update( ... ) on this object, with
the new settings. If this method call returns successfully (i.e. no
error, as it has no out arguments), what does it mean -- that the
connection is now active, or merely that the settings have been
applied (potentially disconnecting the connection)? Which signals
should I register for, to know when the new settings have successfully
taken effect?

My experiments sending some messages with D-Feet indicate that calling
Update() on the System Connection isn't allowed (Read-only
connections may not be modified) -- or is this merely a configuration
issue around DBus permissions?

Finally, any tips on tools for sending DBus messages? dbus-send
doesn't support nested containers (which are required by
Connection.Update()) and I haven't had much luck sending nested
container parameters with D-Feet either. Perhaps bindings to a
language like Python will be the way to go for quick exploration.

Many thanks,

David Röthlisberger
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: Help with NM DBus API

2011-04-18 Thread Jos Collin-ERS,HCLTech
 Just looking at the interfaces, it seems I need to call
 NetworkManagerSettings.ListConnections() on the
 NetworkManagerSystemSettings service (this is NM 0.7/0.8) to get the
 path of the connection object; and then call
 NetworkManagerSettings.Connection.Update( ... ) on this object, with
 the new settings. If this method call returns successfully (i.e. no
 error, as it has no out arguments), what does it mean -- that the
 connection is now active, or merely that the settings have been
 applied (potentially disconnecting the connection)?
This will just update your new settings for that connection. It won't make the 
connection active.

 Which signals
 should I register for, to know when the new settings have successfully
 taken effect?
org.freedesktop.NetworkManagerSettings.Connection.Updated

 My experiments sending some messages with D-Feet indicate that calling
 Update() on the System Connection isn't allowed (Read-only
 connections may not be modified) -- or is this merely a configuration
 issue around DBus permissions?
You should have root permissions to modify the Network Manager System Settings.

 Perhaps bindings to a
 language like Python will be the way to go for quick exploration.
Yes, this would be a better option. See the samples.
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python

::DISCLAIMER::
---

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and
attachments please check them for viruses and defect.

---
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Need help with the NetworkManager DBUS API

2011-02-15 Thread Jirka Klimes
On Monday 14 of February 2011 05:52:16 Anurup Raveendran wrote:
 i'm trying to establish a wireless network connection using the DBUS
 API but i have failed miserably. i have attached the code that I'm
 using.
 
 
 Regards,

Instead 'failed miserably' you should say what is the real problem ;)

And it is that the segmentation fault happens due to bad types of s_wireless 
properties. SSID is not string but a byte array (it can generaly contain 0) 
and the mode should be adhoc or infrastructure.
See corrected example in the attachment.

Jirka
/*
 * 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 2011 Red Hat, Inc.
 */

/*
 * The example shows how to call AddConnection() D-Bus method to add
 * a connection to system settings service. It uses dbus-glib and libnm-util
 * libraries.
 *
 * Compile with:
 *   gcc -Wall `pkg-config --libs --cflags glib-2.0 dbus-glib-1 libnm-util` add-wireless-connection-glib.c -o add-wireless-connection-glib
 */

#include glib.h
#include dbus/dbus-glib.h

#include nm-connection.h
#include nm-setting-connection.h
#include nm-setting-wireless.h
#include nm-setting-ip4-config.h
#include NetworkManager.h
#include nm-utils.h

#define DBUS_TYPE_G_MAP_OF_VARIANT  (dbus_g_type_get_map (GHashTable, G_TYPE_STRING, G_TYPE_VALUE))
#define DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT   (dbus_g_type_get_map (GHashTable, G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT))

static void
add_connection (DBusGProxy *proxy, const char *con_name)
{
	NMConnection *connection;
	NMSettingConnection *s_con;
	NMSettingWireless *s_wireless;
	NMSettingIP4Config *s_ip4;
	char *uuid;
	GHashTable *hash;
	GByteArray *ssid;
	const unsigned char ssid_data[] = { 'T', 'e', 's', 't' };
	GError *error = NULL;

	/* Create a new connection object */
	connection = (NMConnection *) nm_connection_new ();

	/* Build up the 'connection' Setting */
	s_con = (NMSettingConnection *) nm_setting_connection_new ();
	uuid = nm_utils_uuid_generate ();
	g_object_set (G_OBJECT (s_con),
	  NM_SETTING_CONNECTION_UUID, uuid,
	  NM_SETTING_CONNECTION_ID, con_name,
	  NM_SETTING_CONNECTION_TYPE, 802-11-wireless,
	  NULL);
	g_free (uuid);
	nm_connection_add_setting (connection, NM_SETTING (s_con));

	/* Build up the 'wireless' Setting */
	s_wireless = (NMSettingWireless *) nm_setting_wireless_new ();
	nm_connection_add_setting (connection, NM_SETTING (s_wireless));

	ssid = g_byte_array_sized_new (sizeof (ssid_data));
	g_byte_array_append (ssid, ssid_data, sizeof (ssid_data));

	g_object_set(s_wireless, NM_SETTING_WIRELESS_SSID, ssid, NULL);
	g_object_set(s_wireless, NM_SETTING_WIRELESS_MODE, adhoc, NULL);
	g_byte_array_free (ssid, TRUE);

	/* Build up the 'ipv4' Setting */
	s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
	g_object_set (G_OBJECT (s_ip4),
	  NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
	  NULL);
	nm_connection_add_setting (connection, NM_SETTING (s_ip4));

	hash = nm_connection_to_hash (connection);

	/* Call AddConnection with the hash as argument */
	dbus_g_proxy_call (proxy, AddConnection, error,
	   DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, hash,
	   G_TYPE_INVALID);

	g_hash_table_destroy (hash);
	g_object_unref (connection);
}


int main (int argc, char *argv[])
{
	DBusGConnection *bus;
	DBusGProxy *proxy;

	/* Initialize GType system */
	g_type_init ();

	/* Get system bus */
	bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);

	/* Create a D-Bus proxy; NM_DBUS_* defined in NetworkManager.h */
	proxy = dbus_g_proxy_new_for_name (bus,
	   NM_DBUS_SERVICE_SYSTEM_SETTINGS,
	   NM_DBUS_PATH_SETTINGS,
	   NM_DBUS_IFACE_SETTINGS);

	/* Add a connection */
	add_connection (proxy, __Test connection__);

	g_object_unref (proxy);
	dbus_g_connection_unref (bus);

	return 0;
}
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Need help with the NetworkManager DBUS API

2011-02-14 Thread Greg Suarez
If you're trying to establish a connection while nm-applet is running then
you have to add the connection information through gconf which nm-applet
will pickup and create a new connection through NetworkManager.

Hope this helps,

Greg

On Sun, Feb 13, 2011 at 8:52 PM, Anurup Raveendran 
anurupraveend...@gmail.com wrote:

 i'm trying to establish a wireless network connection using the DBUS
 API but i have failed miserably. i have attached the code that I'm
 using.


 Regards,


 --
 Anurup Raveendran
 Computer Science  Engineering(2007-2011)
 Model Engineering College, Cochin
 Mobile: +919895301078
 Landline : 0496-2503009
 E-mail id : anurupraveend...@gmail.com

 ___
 networkmanager-list mailing list
 networkmanager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list


___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: Need help with the NetworkManager DBUS API

2011-02-14 Thread Jos Collin-ERS,HCLTech
I don't know whether this will help Anurup or not. I see that instead of using 
gconf, you can add the connections to the nm-applet via dbus.

Regards,
Jos Collin

From: networkmanager-list-boun...@gnome.org 
[networkmanager-list-boun...@gnome.org] On Behalf Of Greg Suarez 
[gpsuarez2...@gmail.com]
Sent: Tuesday, February 15, 2011 10:02 AM
To: networkmanager-list@gnome.org
Subject: Re: Need help with the NetworkManager DBUS API

If you're trying to establish a connection while nm-applet is running then you 
have to add the connection information through gconf which nm-applet will 
pickup and create a new connection through NetworkManager.

Hope this helps,

Greg

On Sun, Feb 13, 2011 at 8:52 PM, Anurup Raveendran 
anurupraveend...@gmail.commailto:anurupraveend...@gmail.com wrote:
i'm trying to establish a wireless network connection using the DBUS
API but i have failed miserably. i have attached the code that I'm
using.


Regards,


--
Anurup Raveendran
Computer Science  Engineering(2007-2011)
Model Engineering College, Cochin
Mobile: +919895301078
Landline : 0496-2503009
E-mail id : anurupraveend...@gmail.commailto:anurupraveend...@gmail.com

___
networkmanager-list mailing list
networkmanager-list@gnome.orgmailto:networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list



::DISCLAIMER::
---

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and
attachments please check them for viruses and defect.

---
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Need help with the NetworkManager DBUS API

2011-02-13 Thread Anurup Raveendran
i'm trying to establish a wireless network connection using the DBUS
API but i have failed miserably. i have attached the code that I'm
using.


Regards,


-- 
Anurup Raveendran
Computer Science  Engineering(2007-2011)
Model Engineering College, Cochin
Mobile: +919895301078
Landline : 0496-2503009
E-mail id : anurupraveend...@gmail.com
/*
 * 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 2010 Red Hat, Inc.
 */

/*
 * The example shows how to call AddConnection() D-Bus method to add
 * a connection to system settings service. It uses dbus-glib and libnm-util
 * libraries.
 *
 * Compile with:
 *   gcc -Wall `pkg-config --libs --cflags glib-2.0 dbus-glib-1 libnm-util` add-connection-glib.c -o add-connection-glib
 */

#include glib.h
#include dbus/dbus-glib.h

#include nm-connection.h
#include nm-setting-connection.h
#include nm-setting-wireless.h
#include nm-setting-ip4-config.h
#include NetworkManager.h
#include nm-utils.h

#define DBUS_TYPE_G_MAP_OF_VARIANT  (dbus_g_type_get_map (GHashTable, G_TYPE_STRING, G_TYPE_VALUE))
#define DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT   (dbus_g_type_get_map (GHashTable, G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT))

static void
add_connection (DBusGProxy *proxy, const char *con_name)
{
	NMConnection *connection;
	NMSettingConnection *s_con;
	NMSettingWireless *s_wireless;
	NMSettingIP4Config *s_ip4;
	char *uuid;
	GHashTable *hash;
	GError *error = NULL;

	/* Create a new connection object */
	connection = (NMConnection *) nm_connection_new ();

	/* Build up the 'connection' Setting */
	s_con = (NMSettingConnection *) nm_setting_connection_new ();
	uuid = nm_utils_uuid_generate ();
	g_object_set (G_OBJECT (s_con),
	  NM_SETTING_CONNECTION_UUID, uuid,
	  NM_SETTING_CONNECTION_ID, con_name,
	  NM_SETTING_CONNECTION_TYPE, 802-11-wireless,
	  NULL);
	g_free (uuid);
	nm_connection_add_setting (connection, NM_SETTING (s_con));

	/* Build up the 'wireless' Setting */
	s_wireless = (NMSettingWireless *) nm_setting_wireless_new ();
	nm_connection_add_setting (connection, NM_SETTING (s_wireless));

	g_object_set(s_wireless, NM_SETTING_WIRELESS_SSID,Test, NULL);
	g_object_set(s_wireless, NM_SETTING_WIRELESS_MODE, Ad-Hoc, NULL);

	/* Build up the 'ipv4' Setting */
	s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
	g_object_set (G_OBJECT (s_ip4),
	  NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
	  NULL);
	nm_connection_add_setting (connection, NM_SETTING (s_ip4));

	hash = nm_connection_to_hash (connection);

	/* Call AddConnection with the hash as argument */
	dbus_g_proxy_call (proxy, AddConnection, error,
	   DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, hash,
	   G_TYPE_INVALID);

	g_hash_table_destroy (hash);
	g_object_unref (connection);
}


int main (int argc, char *argv[])
{
	DBusGConnection *bus;
	DBusGProxy *proxy;

	/* Initialize GType system */
	g_type_init ();

	/* Get system bus */
	bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);

	/* Create a D-Bus proxy; NM_DBUS_* defined in NetworkManager.h */
	proxy = dbus_g_proxy_new_for_name (bus,
	   NM_DBUS_SERVICE_SYSTEM_SETTINGS,
	   NM_DBUS_PATH_SETTINGS,
	   NM_DBUS_IFACE_SETTINGS);

	/* Add a connection */
	add_connection (proxy, __Test connection__);

	g_object_unref (proxy);
	dbus_g_connection_unref (bus);

	return 0;
}
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Add new conntion with DBus API

2010-05-05 Thread Pablo Martí Gamboa
On 6 May 2010 07:39, Nguyen Canh Toan toan...@viettel.com.vn wrote:

  Hi all,



 Currently, I have a purpose of programmatically add  remove connection
 configuration through DBus interface
 org.freedesktop.NetworkManagerSettings.Connection.

 I found an API Delete() on
 org.freedesktop.NetworkManagerSettings.Connection but I can’t find what
 function stuff to create new connection.



 Did anyone experience with this issue? Could you please to share it to me?


Hi Nguyen,

you'll need to create it via gconf. A connection is represented as a dict of
dicts in DBus or a dir of dirs in gconf. As gconf lacks a create this tree
atomically command, you'll need to set the values one by one. NMSettings
will send a NewConnection signal when it decides that the profile is
created/ready.

Pablo



 Thanks,

 Toan Nguyen

 ___
 networkmanager-list mailing list
 networkmanager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list




-- 
Pablo Martí
http://minimoesfuerzo.org
python -c print
'706d617267616d40676d61696c2e636f6d'.decode('hex')
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Add new conntion with DBus API

2010-05-05 Thread Jirka Klimes
On Thursday 06 of May 2010 07:39:07 Nguyen Canh Toan wrote:
 Hi all,
 
 
 
 Currently, I have a purpose of programmatically add  remove connection
 configuration through DBus interface
 org.freedesktop.NetworkManagerSettings.Connection.
 
 I found an API Delete() on
 org.freedesktop.NetworkManagerSettings.Connection but I can't find what
 function stuff to create new connection.
 
 
 
 Did anyone experience with this issue? Could you please to share it to me?
 
 
 
 Thanks,
 
 Toan Nguyen

You search for AddConnection() method of 
org.freedesktop.NetworkManagerSettings interface.

For a simple python example see:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/add-
system-connection.py

More complex example can be found here:
http://markmail.org/message/2xfwvjqjovu4fk2j

For specification of settings parameters 
see:http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html

Jirka
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Add new conntion with DBus API

2010-05-05 Thread Pablo Martí Gamboa
On 5 May 2010 10:53, Jirka Klimes jkli...@redhat.com wrote:

 On Thursday 06 of May 2010 07:39:07 Nguyen Canh Toan wrote:
  Hi all,
 
 
 
  Currently, I have a purpose of programmatically add  remove connection
  configuration through DBus interface
  org.freedesktop.NetworkManagerSettings.Connection.
 
  I found an API Delete() on
  org.freedesktop.NetworkManagerSettings.Connection but I can't find what
  function stuff to create new connection.
 
 
 
  Did anyone experience with this issue? Could you please to share it to
 me?
 
 
 
  Thanks,
 
  Toan Nguyen

 You search for AddConnection() method of
 org.freedesktop.NetworkManagerSettings interface.

 For a simple python example see:

 http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/add-
 system-connection.pyhttp://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/add-%0Asystem-connection.py

 More complex example can be found here:
 http://markmail.org/message/2xfwvjqjovu4fk2j

 For specification of settings parameters
 see:
 http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html


Wow, I didn't know about this one, thought that gconf was the only was to
edit the connection. When was this added?

-- 
Pablo Martí
http://minimoesfuerzo.org
python -c print '706d617267616d40676d61696c2e636f6d'.decode('hex')
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Add new conntion with DBus API

2010-05-05 Thread Jirka Klimes
On Wednesday 05 of May 2010 11:28:11 Pablo Martí Gamboa wrote:
 On 5 May 2010 10:53, Jirka Klimes jkli...@redhat.com wrote:
  On Thursday 06 of May 2010 07:39:07 Nguyen Canh Toan wrote:
   Hi all,
   
   
   
   Currently, I have a purpose of programmatically add  remove connection
   configuration through DBus interface
   org.freedesktop.NetworkManagerSettings.Connection.
   
   I found an API Delete() on
   org.freedesktop.NetworkManagerSettings.Connection but I can't find what
   function stuff to create new connection.
   
   
   
   Did anyone experience with this issue? Could you please to share it to
  
  me?
  
   Thanks,
   
   Toan Nguyen
  
  You search for AddConnection() method of
  org.freedesktop.NetworkManagerSettings interface.
  
  For a simple python example see:
  
  http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/p
  ython/add-
  system-connection.pyhttp://cgit.freedesktop.org/NetworkManager/NetworkM
  anager/tree/examples/python/add-%0Asystem-connection.py
  
  More complex example can be found here:
  http://markmail.org/message/2xfwvjqjovu4fk2j
  
  For specification of settings parameters
  see:
  http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html
 
 Wow, I didn't know about this one, thought that gconf was the only was to
 edit the connection. When was this added?

It's been there for some time now.
The commit is 0d69dfe39ef61b42b2024c7fbd8bbad9e9c6d164 from 23.7.2009.

Jirka
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Add new conntion with DBus API

2010-05-05 Thread Pablo Martí Gamboa
2010/5/5 Jirka Klimes jkli...@redhat.com

 On Wednesday 05 of May 2010 11:28:11 Pablo Martí Gamboa wrote:
  On 5 May 2010 10:53, Jirka Klimes jkli...@redhat.com wrote:
   On Thursday 06 of May 2010 07:39:07 Nguyen Canh Toan wrote:
Hi all,
   
   
   
Currently, I have a purpose of programmatically add  remove
 connection
configuration through DBus interface
org.freedesktop.NetworkManagerSettings.Connection.
   
I found an API Delete() on
org.freedesktop.NetworkManagerSettings.Connection but I can't find
 what
function stuff to create new connection.
   
   
   
Did anyone experience with this issue? Could you please to share it
 to
  
   me?
  
Thanks,
   
Toan Nguyen
  
   You search for AddConnection() method of
   org.freedesktop.NetworkManagerSettings interface.
  
   For a simple python example see:
  
  
 http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/p
   ython/add-
   system-connection.py
 http://cgit.freedesktop.org/NetworkManager/NetworkM
   anager/tree/examples/python/add-%0Asystem-connection.py
  
   More complex example can be found here:
   http://markmail.org/message/2xfwvjqjovu4fk2j
  
   For specification of settings parameters
   see:
  
 http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html
 
  Wow, I didn't know about this one, thought that gconf was the only was to
  edit the connection. When was this added?

 It's been there for some time now.
 The commit is 0d69dfe39ef61b42b2024c7fbd8bbad9e9c6d164 from 23.7.2009.


Thanks for the info!


-- 
Pablo Martí
http://minimoesfuerzo.org
python -c print '706d617267616d40676d61696c2e636f6d'.decode('hex')
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: Add new conntion with DBus API

2010-05-05 Thread Nguyen Canh Toan
Dear Jirka,

Thank for helping me,

When I try to run add-system-connection.py without/with root privileged, it
complain with messages as follow respectively:

dbus.exceptions.DBusException:
org.freedesktop.NetworkManagerSettings.System.NotPrivileged:
org.freedesktop.network-manager-settings.system.modify
auth_admin_keep_always

dbus.exceptions.DBusException:
org.freedesktop.NetworkManagerSettings.System.NotPrivileged: Error getting
information about caller: org.freedesktop.ConsoleKit.Manager.GeneralError:
Unable to lookup session information for process '22151'

Could you please explain it to me? It's very lack of information when google
it.

Thanks,
Toan Nguyen


-Original Message-
From: Jirka Klimes [mailto:jkli...@redhat.com] 
Sent: Wednesday, May 05, 2010 1:53 AM
To: networkmanager-list@gnome.org
Cc: Nguyen Canh Toan
Subject: Re: Add new conntion with DBus API

On Thursday 06 of May 2010 07:39:07 Nguyen Canh Toan wrote:
 Hi all,
 
 
 
 Currently, I have a purpose of programmatically add  remove connection
 configuration through DBus interface
 org.freedesktop.NetworkManagerSettings.Connection.
 
 I found an API Delete() on
 org.freedesktop.NetworkManagerSettings.Connection but I can't find what
 function stuff to create new connection.
 
 
 
 Did anyone experience with this issue? Could you please to share it to me?
 
 
 
 Thanks,
 
 Toan Nguyen

You search for AddConnection() method of 
org.freedesktop.NetworkManagerSettings interface.

For a simple python example see:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/pyth
on/add-
system-connection.py

More complex example can be found here:
http://markmail.org/message/2xfwvjqjovu4fk2j

For specification of settings parameters 
see:http://projects.gnome.org/NetworkManager/developers/settings-spec-08.htm
l

Jirka

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Add new conntion with DBus API

2010-05-04 Thread Nguyen Canh Toan
Hi all,

 

Currently, I have a purpose of programmatically add  remove connection
configuration through DBus interface
org.freedesktop.NetworkManagerSettings.Connection. 

I found an API Delete() on org.freedesktop.NetworkManagerSettings.Connection
but I can't find what function stuff to create new connection. 

 

Did anyone experience with this issue? Could you please to share it to me?

 

Thanks,

Toan Nguyen

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: Confusing about DBus API specification

2010-04-29 Thread Dan Williams
On Thu, 2010-04-29 at 21:33 -0700, Nguyen Canh Toan wrote:
 Dear Dan,
 
 I do understand these fundamental concepts. Thank for your useful tutorial
 anyway.
 
 I think my problem is I do not understand object as well as interface
 hierarchy exposed by NetworkManager DBus service.
 
 According to API spec here
 (http://projects.gnome.org/NetworkManager/developers/spec-07.html#org.freede
 sktop.NetworkManager) and
 (http://live.gnome.org/NetworkManager/SystemSetting). I understand it as
 below:
 
 1. Service DBus named org.freedesktop.NetworkManagerSystemSetting and
 org.freedesktop.NetworkManagerUserSetting is one which I need to connect to
 inorder to get connection configuration.

Right, these are the service names/bus names that you need to talk to.

 2. Get org.freedesktop.NetworkManagerSettings interface of service proxy

Correct; *both* services implement this common interface, since they
provide essentially the same information.  This way you only write the
code once, and you can talk to both services easily.

 3. Invoke ListConnection() on returned interface.

I think you mean ListConnections(), but yes.

 It seems that your API spec isn't very clear so newcomers, like me, get
 confused when doing with this.

Yeah, I think what would be helpful is a general overview in the spec or
such about how the pieces fit together, possibly with a diagram and some
code examples.  I've done a bit of that and I'm about to post something
to my blog, which we can then rework into some documentation.  There are
various pages around that explain things, but mostly general overviews
and concepts and not really with code examples.  Here's one I whipped up
yesterday:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/list-connections.py

There's a lot of improvement possible here, especially with examples.

 Please instruct me how to get used particularly this service. Or please make
 your spec more clearly.

I shall try.  Contributions and constructive criticism welcome, like
you've done above by pointing out that it's not clear how to talk to the
settings services.

Dan


___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Confusing about DBus API specification

2010-04-28 Thread Pablo Martí Gamboa
2010/4/29 Nguyen Canh Toan toan...@viettel.com.vn

  Hi all,



 After reading DBus API
 http://projects.gnome.org/NetworkManager/developers/spec-07.html#org.freedesktop.NetworkManager

 I try to list all connection setting by below interface specification

 * *

 *org.freedesktop.NetworkManagerSettings*

 The NetworkManagerSettings interface is provided by the service which
 provides connections to NetworkManager.

 Methods:

 ListConnections ( ) → ao

 List the connections stored by this Settings object.

 Returns



 connections - ao

 List of connections.



 Signals:

 NewConnection ( o: connection )

 Emitted when a new connection has been configured.

 Parameters



 connection - o

 Object path of the new connection.



 Interface has no properties.





 *Without success. *DBus service say:



 Traceback (most recent call last):

   File ./python_dbus_client, line 21, in module

 connections = manager.ListConnections()

   File /var/lib/python-support/python2.6/dbus/proxies.py, line 140, in
 __call__

 **keywords)

   File /var/lib/python-support/python2.6/dbus/connection.py, line 622, in
 call_blocking

 message, timeout)

 *dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
 Method ListConnections with signature  on interface
 org.freedesktop.NetworkManager doesn't exist*


That's because ListConnections is a method of the
org.freedesktop.NetworkManagerSettings
interface ;)

Try executing your method as:

connections = manager.ListConnections(dbus_interface=
org.freedesktop.NetworkManagerSettings)

Best regards,

-- 
Pablo Martí // http://minimoesfuerzo.org
python -c print '706d617267616d40676d61696c2e636f6d'.decode('hex')
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: Confusing about DBus API specification

2010-04-28 Thread Nguyen Canh Toan
Thank Pablo for quickly reply, 

 

I think I am misunderstanding something. I have rewritten my script as your
advice but I still error. Here is my short script:

 

 

#!/usr/bin/env python

 

import dbus

bus = dbus.SystemBus()

 

proxy = bus.get_object(org.freedesktop.NetworkManager,
/org/freedesktop/NetworkManager)

proxy_prop = dbus.Interface(proxy, org.freedesktop.DBus.Properties)

manager = dbus.Interface(proxy, org.freedesktop.NetworkManager)

settings = dbus.Interface(proxy, org.freedesktop.NetworkManagerSettings)

 

#active connection

connections = proxy_prop.Get(org.freedesktop.NetworkManager,
ActiveConnections)

print %d % proxy_prop.Get(org.freedesktop.NetworkManager,
WirelessHardwareEnabled)

print %d % proxy_prop.Get(org.freedesktop.NetworkManager,
WirelessEnabled)

print %d % proxy_prop.Get(org.freedesktop.NetworkManager, State)

for con in connections:

print  %s % con

con_obj = bus.get_object(org.freedesktop.NetworkManager, con)

 

print list connection 

connections =
manager.ListConnections(dbus_interface=org.freedesktop.NetworkManagerSettin
gs)

for con in connections: 

print %s % con

 

 

It till say:

toa...@vt_ttpm_rd_toannc5:~/Desktop$ ./python_dbus_client 

1

1

3

 /org/freedesktop/NetworkManager/ActiveConnection/1

list connection 

Traceback (most recent call last):

  File ./python_dbus_client, line 21, in module

connections =
manager.ListConnections(dbus_interface=org.freedesktop.NetworkManagerSettin
gs)

  File /var/lib/python-support/python2.6/dbus/proxies.py, line 140, in
__call__

**keywords)

  File /var/lib/python-support/python2.6/dbus/connection.py, line 622, in
call_blocking

message, timeout)

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method ListConnections with signature  on interface
org.freedesktop.NetworkManagerSettings doesn't exist

 

Please help.

  _  

From: Pablo Martí Gamboa [mailto:pma...@warp.es] 
Sent: Tuesday, April 27, 2010 11:41 PM
To: Nguyen Canh Toan
Cc: networkmanager-list@gnome.org
Subject: Re: Confusing about DBus API specification

 

 

2010/4/29 Nguyen Canh Toan toan...@viettel.com.vn

Hi all, 

 

After reading DBus API
http://projects.gnome.org/NetworkManager/developers/spec-07.html#org.freedes
ktop.NetworkManager

I try to list all connection setting by below interface specification

 

org.freedesktop.NetworkManagerSettings

The NetworkManagerSettings interface is provided by the service which
provides connections to NetworkManager.

Methods:

ListConnections ( ) → ao

List the connections stored by this Settings object.

Returns

 

connections - ao

List of connections. 

 

Signals:

NewConnection ( o: connection )

Emitted when a new connection has been configured.

Parameters

 

connection - o

Object path of the new connection. 

 

Interface has no properties.

 

 

Without success. DBus service say:

 

Traceback (most recent call last):

  File ./python_dbus_client, line 21, in module

connections = manager.ListConnections()

  File /var/lib/python-support/python2.6/dbus/proxies.py, line 140, in
__call__

**keywords)

  File /var/lib/python-support/python2.6/dbus/connection.py, line 622, in
call_blocking

message, timeout)

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method ListConnections with signature  on interface
org.freedesktop.NetworkManager doesn't exist


That's because ListConnections is a method of the
org.freedesktop.NetworkManagerSettings interface ;)

Try executing your method as:

connections =
manager.ListConnections(dbus_interface=org.freedesktop.NetworkManagerSettin
gs)

Best regards,

-- 
Pablo Martí // http://minimoesfuerzo.org
python -c print '706d617267616d40676d61696c2e636f6d'.decode('hex')

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Confusing about DBus API specification

2010-04-28 Thread Jirka Klimes
ListConnections() method is not provided by /org/freedesktop/NetworkManager 
service, rather /org/freedesktop/NetworkManagerSystemSettings and 
org.freedesktop.NetworkManagerUserSettings.
See inline comments to adapt your script.

On Thursday 29 of April 2010 11:05:13 Nguyen Canh Toan wrote:
 Thank Pablo for quickly reply,
 
 
 
 I think I am misunderstanding something. I have rewritten my script as your
 advice but I still error. Here is my short script:
 
 
 
 
 
 #!/usr/bin/env python
 
 
 
 import dbus
 
 bus = dbus.SystemBus()
 
 
 
 proxy = bus.get_object(org.freedesktop.NetworkManager,
 /org/freedesktop/NetworkManager)
 
add here
proxy1 = bus.get_object(org.freedesktop.NetworkManagerUserSettings, 
/org/freedesktop/NetworkManagerSettings)
for listing user connections or
proxy1 = bus.get_object(org.freedesktop.NetworkManagerSystemSettings, 
/org/freedesktop/NetworkManagerSettings)
for listing system-wide connections.

 proxy_prop = dbus.Interface(proxy, org.freedesktop.DBus.Properties)
 
 manager = dbus.Interface(proxy, org.freedesktop.NetworkManager)
 
 settings = dbus.Interface(proxy, org.freedesktop.NetworkManagerSettings)
You need to use proxy1 here instead of proxy.
settings = dbus.Interface(proxy1, org.freedesktop.NetworkManagerSettings)

 
 
 
 #active connection
 
 connections = proxy_prop.Get(org.freedesktop.NetworkManager,
 ActiveConnections)
 
 print %d % proxy_prop.Get(org.freedesktop.NetworkManager,
 WirelessHardwareEnabled)
 
 print %d % proxy_prop.Get(org.freedesktop.NetworkManager,
 WirelessEnabled)
 
 print %d % proxy_prop.Get(org.freedesktop.NetworkManager, State)
 
 for con in connections:
 
 print  %s % con
 
 con_obj = bus.get_object(org.freedesktop.NetworkManager, con)
 
 
 
 print list connection 
 
 connections =
 manager.ListConnections(dbus_interface=org.freedesktop.NetworkManagerSetti
 n gs)
this line should look like this:
connections = settings.ListConnections()

i.e. using settings interface and no arguments to ListConnections()

 
 for con in connections:
 
 print %s % con
 
 

Jirka
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: Confusing about DBus API specification

2010-04-28 Thread Nguyen Canh Toan
Dear Jirka, 

It's weird. After adjusting my script, it's still error: 

[Here is new script:]
#!/usr/bin/env python

import dbus
bus = dbus.SystemBus()

proxy = bus.get_object(org.freedesktop.NetworkManager,
/org/freedesktop/NetworkManager)
proxy_prop = dbus.Interface(proxy, org.freedesktop.DBus.Properties)
manager = dbus.Interface(proxy, org.freedesktop.NetworkManager)


#proxy_user_setting =
bus.get_object(org.freedesktop.NetworkManagerUserSettings,
/org/freedesktop/NetworkManagerUserSettings)
proxy_sys_setting =
bus.get_object(org.freedesktop.NetworkManagerSystemSettings,
/org/freedesktop/NetworkManagerSystemSettings)
settings = dbus.Interface(proxy_sys_setting,
org.freedesktop.NetworkManagerSettings)

print = active connection
connections = proxy_prop.Get(org.freedesktop.NetworkManager,
ActiveConnections)
print %d % proxy_prop.Get(org.freedesktop.NetworkManager,
WirelessHardwareEnabled)
print %d % proxy_prop.Get(org.freedesktop.NetworkManager,
WirelessEnabled)
print %d % proxy_prop.Get(org.freedesktop.NetworkManager, State)
for con in connections:
print  %s % con
con_obj = bus.get_object(org.freedesktop.NetworkManager, con)

print == list connection 
connections = settings.ListConnections()
for con in connections: 
print %s % con



[Here is log:]
toa...@vt_ttpm_rd_toannc5:~/Desktop$ ./python_dbus_client 
= active connection
1
1
3
== list connection 
Traceback (most recent call last):
  File ./python_dbus_client, line 25, in module
connections = settings.ListConnections()
  File /var/lib/python-support/python2.6/dbus/proxies.py, line 68, in
__call__
return self._proxy_method(*args, **keywords)
  File /var/lib/python-support/python2.6/dbus/proxies.py, line 140, in
__call__
**keywords)
  File /var/lib/python-support/python2.6/dbus/connection.py, line 622, in
call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method ListConnections with signature  on interface
org.freedesktop.NetworkManagerSettings doesn't exist


Please help.

-Original Message-
From: Jirka Klimes [mailto:jkli...@redhat.com] 
Sent: Wednesday, April 28, 2010 1:18 AM
To: networkmanager-list@gnome.org
Cc: Nguyen Canh Toan; 'Pablo Martí Gamboa'
Subject: Re: Confusing about DBus API specification

ListConnections() method is not provided by /org/freedesktop/NetworkManager 
service, rather /org/freedesktop/NetworkManagerSystemSettings and 
org.freedesktop.NetworkManagerUserSettings.
See inline comments to adapt your script.

On Thursday 29 of April 2010 11:05:13 Nguyen Canh Toan wrote:
 Thank Pablo for quickly reply,
 
 
 
 I think I am misunderstanding something. I have rewritten my script as
your
 advice but I still error. Here is my short script:
 
 
 
 
 
 #!/usr/bin/env python
 
 
 
 import dbus
 
 bus = dbus.SystemBus()
 
 
 
 proxy = bus.get_object(org.freedesktop.NetworkManager,
 /org/freedesktop/NetworkManager)
 
add here
proxy1 = bus.get_object(org.freedesktop.NetworkManagerUserSettings, 
/org/freedesktop/NetworkManagerSettings)
for listing user connections or
proxy1 = bus.get_object(org.freedesktop.NetworkManagerSystemSettings, 
/org/freedesktop/NetworkManagerSettings)
for listing system-wide connections.

 proxy_prop = dbus.Interface(proxy, org.freedesktop.DBus.Properties)
 
 manager = dbus.Interface(proxy, org.freedesktop.NetworkManager)
 
 settings = dbus.Interface(proxy, org.freedesktop.NetworkManagerSettings)
You need to use proxy1 here instead of proxy.
settings = dbus.Interface(proxy1, org.freedesktop.NetworkManagerSettings)

 
 
 
 #active connection
 
 connections = proxy_prop.Get(org.freedesktop.NetworkManager,
 ActiveConnections)
 
 print %d % proxy_prop.Get(org.freedesktop.NetworkManager,
 WirelessHardwareEnabled)
 
 print %d % proxy_prop.Get(org.freedesktop.NetworkManager,
 WirelessEnabled)
 
 print %d % proxy_prop.Get(org.freedesktop.NetworkManager, State)
 
 for con in connections:
 
 print  %s % con
 
 con_obj = bus.get_object(org.freedesktop.NetworkManager,
con)
 
 
 
 print list connection 
 
 connections =

manager.ListConnections(dbus_interface=org.freedesktop.NetworkManagerSetti
 n gs)
this line should look like this:
connections = settings.ListConnections()

i.e. using settings interface and no arguments to ListConnections()

 
 for con in connections:
 
 print %s % con
 
 

Jirka

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: Confusing about DBus API specification

2010-04-28 Thread Dan Williams
On Thu, 2010-04-29 at 06:08 -0700, Nguyen Canh Toan wrote:
 Dear Jirka, 
 
 It's weird. After adjusting my script, it's still error: 

D-Bus is simply an IPC mechanism, but it layers a few concepts on top of
pure message-passing, as explained below.  It did take me some time to
understand how the D-Bus object model really works, so don't worry about
it you don't completely understand how it all works yet.

1) 'service': a program that responds to requests from clients.  Each
service is identified by a bus name which clients use to find the
service and send requests to it.  The bus name usually looks like
org.foobar.Baz.  A program can claim more than one bus name; NM claims
org.freedesktop.NetworkManager and
org.freedesktop.NetworkManagerSystemSettings, each is a unique serivce
which provides different functionality to clients.

2) 'object': a method of organizing distinct entities, much like
programming languages have objects.  Each object is uniquely identified
by an object path (basically a pointer) that looks like
/org/foobar/Baz/235235. Each request sent to the service must be
directed to a specific object.  Many services have a base object with a
well-known path that you use to bootstrap your communication with the
service.

3) 'interface': each request belongs to an interface, which is simply a
way of logically separating different functionality.  The same way that
object-oriented languages like Java or C++ or GLib define an
interface; a specific API that different objects can implement, but
the caller doesn't need to know what type the object is, just the
interface.  Interface names often look like D-Bus service names, but
have no relation to them.

4) 'method call': a request for an operation or information that a
client sends to the service; method calls are defined by an Interface
and are sent to objects.

Say you have a binary called mcdonaldsd that provides a D-Bus service
called org.fastfood.McDonalds.  Clients that want to talk to this
service use org.fastfood.McDonalds to direct requests to mcdonaldsd.

mcdonaldsd provides a base object called /org/fastfood/McDonalds.
This object implements the org.fastfood.McDonalds interface, which
defines the method calls:

  - GetItems(void) - ao
  - Order(ao) - b

GetItems returns an array of object-paths representing all the things on
the menu that you can order.  So if you call it you'll get something
like this returned:

[ '/org/fastfood/McDonalds/Item/0', '/org/fastfood/McDonalds/Item/1' ]

Each of these returned object paths is a pointer to an object;
mcdonaldsd probably even implements these as objects internally using
Java or C++ or GObject or whatever.  These objects are probably
completely different (one may be a burger, one may be a drink) but they
all implement a common interface org.fastfood.McDonalds.Item.

The org.fastfood.McDonalds.Item interface has the following method
calls:

  - GetName
  - GetType  (either TYPE_BURGER, TYPE_DRINK, or TYPE_FRIES)
  - GetPrice
  - Consume

So even if you don't know what /org/fastfood/McDonalds/Item/0 is, you
still can get a lot of information about it, enough to decide whether
you want to order it or not.

Assume that item 0 is a BigMac and item 1 is Coke.  These are
clearly different objects, but each still has a name, a calorie count, a
price, and can be consumed.

Next, since each item is different (even though they all implement the
common org.fastfood.McDonalds.Item interface) each item type will
implement other interfaces that define functionality specific to that
type of item.

So item 0 (BigMac) implements the org.fastfood.McDonalds.Item.Burger
interface which has the following methods:

  - Unwrap
  - AddMustard
  - RemovePickle (nobody likes those stupid limp pickles anyway)

And item 1 (Coke) implements the org.fastfood.McDonalds.Item.Drink
interface which has the following methods:

  - PutLidOn
  - InsertStraw
  - RemoveStraw

Remember, since both objects *also* implement the base
org.fastfood.McDonalds.Item interface, you can use the Consume() method
to consume both items.  But clearly, you don't want to include the
InsertStraw() method on the generic org.fastfood.McDonalds.Item
interface, because all items implement that interface, and it would be
pretty funny if you tried to call InsertStraw() on the BigMac object.
People would stare.

So interfaces are about logically separating method calls that have
specific functionality, and thus any object that wants that
functionality can implement that interface, instead of having every
object type duplicate all the calls of that interface.

So, with pseudocode:

# Get local proxy for the remove mcdonaldsd service
bus = get_service(org.fastfood.McDonalds)
mcds = bus.get_object(org.fastfood.McDonalds, /org/fastfood/McDonalds)

burger_path = None
drink_path = None

# Lets read all the menu items
menu_items = mcds.GetItems()
for object_path in menu_items:
item = bus.get_object(org.fastfood.McDonalds.Item, object_path)
print Item: %s price 

RE: Confusing about DBus API specification

2010-04-28 Thread Nguyen Canh Toan

Dear Dan,

I do understand these fundamental concepts. Thank for your useful tutorial
anyway.

I think my problem is I do not understand object as well as interface
hierarchy exposed by NetworkManager DBus service.

According to API spec here
(http://projects.gnome.org/NetworkManager/developers/spec-07.html#org.freede
sktop.NetworkManager) and
(http://live.gnome.org/NetworkManager/SystemSetting). I understand it as
below:

1. Service DBus named org.freedesktop.NetworkManagerSystemSetting and
org.freedesktop.NetworkManagerUserSetting is one which I need to connect to
inorder to get connection configuration.
2. Get org.freedesktop.NetworkManagerSettings interface of service proxy
3. Invoke ListConnection() on returned interface.


It seems that your API spec isn't very clear so newcomers, like me, get
confused when doing with this.

Please instruct me how to get used particularly this service. Or please make
your spec more clearly.

Thank for your time  consideration.
Toan Nguyen 

-Original Message-
From: Dan Williams [mailto:d...@redhat.com] 
Sent: Wednesday, April 28, 2010 11:52 AM
To: Nguyen Canh Toan
Cc: jkli...@redhat.com; networkmanager-list@gnome.org
Subject: RE: Confusing about DBus API speciDan Williams
[d...@redhat.com]fication

On Thu, 2010-04-29 at 06:08 -0700, Nguyen Canh Toan wrote:
 Dear Jirka, 
 
 It's weird. After adjusting my script, it's still error: 

D-Bus is simply an IPC mechanism, but it layers a few concepts on top of
pure message-passing, as explained below.  It did take me some time to
understand how the D-Bus object model really works, so don't worry about
it you don't completely understand how it all works yet.

1) 'service': a program that responds to requests from clients.  Each
service is identified by a bus name which clients use to find the
service and send requests to it.  The bus name usually looks like
org.foobar.Baz.  A program can claim more than one bus name; NM claims
org.freedesktop.NetworkManager and
org.freedesktop.NetworkManagerSystemSettings, each is a unique serivce
which provides different functionality to clients.

2) 'object': a method of organizing distinct entities, much like
programming languages have objects.  Each object is uniquely identified
by an object path (basically a pointer) that looks like
/org/foobar/Baz/235235. Each request sent to the service must be
directed to a specific object.  Many services have a base object with a
well-known path that you use to bootstrap your communication with the
service.

3) 'interface': each request belongs to an interface, which is simply a
way of logically separating different functionality.  The same way that
object-oriented languages like Java or C++ or GLib define an
interface; a specific API that different objects can implement, but
the caller doesn't need to know what type the object is, just the
interface.  Interface names often look like D-Bus service names, but
have no relation to them.

4) 'method call': a request for an operation or information that a
client sends to the service; method calls are defined by an Interface
and are sent to objects.

Say you have a binary called mcdonaldsd that provides a D-Bus service
called org.fastfood.McDonalds.  Clients that want to talk to this
service use org.fastfood.McDonalds to direct requests to mcdonaldsd.

mcdonaldsd provides a base object called /org/fastfood/McDonalds.
This object implements the org.fastfood.McDonalds interface, which
defines the method calls:

  - GetItems(void) - ao
  - Order(ao) - b

GetItems returns an array of object-paths representing all the things on
the menu that you can order.  So if you call it you'll get something
like this returned:

[ '/org/fastfood/McDonalds/Item/0', '/org/fastfood/McDonalds/Item/1' ]

Each of these returned object paths is a pointer to an object;
mcdonaldsd probably even implements these as objects internally using
Java or C++ or GObject or whatever.  These objects are probably
completely different (one may be a burger, one may be a drink) but they
all implement a common interface org.fastfood.McDonalds.Item.

The org.fastfood.McDonalds.Item interface has the following method
calls:

  - GetName
  - GetType  (either TYPE_BURGER, TYPE_DRINK, or TYPE_FRIES)
  - GetPrice
  - Consume

So even if you don't know what /org/fastfood/McDonalds/Item/0 is, you
still can get a lot of information about it, enough to decide whether
you want to order it or not.

Assume that item 0 is a BigMac and item 1 is Coke.  These are
clearly different objects, but each still has a name, a calorie count, a
price, and can be consumed.

Next, since each item is different (even though they all implement the
common org.fastfood.McDonalds.Item interface) each item type will
implement other interfaces that define functionality specific to that
type of item.

So item 0 (BigMac) implements the org.fastfood.McDonalds.Item.Burger
interface which has the following methods:

  - Unwrap
  - AddMustard
  - RemovePickle (nobody likes those

Confusing about DBus API specification

2010-04-27 Thread Nguyen Canh Toan
Hi all, 

 

After reading DBus API
http://projects.gnome.org/NetworkManager/developers/spec-07.html#org.freedes
ktop.NetworkManager

I try to list all connection setting by below interface specification

 

org.freedesktop.NetworkManagerSettings

The NetworkManagerSettings interface is provided by the service which
provides connections to NetworkManager.

Methods:

ListConnections ( ) → ao

List the connections stored by this Settings object.

Returns

 

connections - ao

List of connections. 

 

Signals:

NewConnection ( o: connection )

Emitted when a new connection has been configured.

Parameters

 

connection - o

Object path of the new connection. 

 

Interface has no properties.

 

 

Without success. DBus service say:

 

Traceback (most recent call last):

  File ./python_dbus_client, line 21, in module

connections = manager.ListConnections()

  File /var/lib/python-support/python2.6/dbus/proxies.py, line 140, in
__call__

**keywords)

  File /var/lib/python-support/python2.6/dbus/connection.py, line 622, in
call_blocking

message, timeout)

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method ListConnections with signature  on interface
org.freedesktop.NetworkManager doesn't exist

 

 

My  pythons script run correctly with other interface. 

I am using NetworkManager version 0.7.0, ubuntu 9.04

 

Best Regards,

Toan Nguyen

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


dbus-api examples

2010-01-21 Thread kiran
Hi
   is there any dbus-send api examples for Network manager for dial-up
(pppd)  to connect and disconnect.

regards
kiran
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Writing a script to multiple versions of DBus API

2009-12-08 Thread Maxwell Chiareli Xandeco
Hi all,

I'm writing a simple python script to manage a broadband connection.

I'm using the Disconnect() method from Device interface to close
connection, that works fine with the 0.8 version, and on the 0.7 version
I need to use the DeactivateConnection ( o: active_connection ) method
from NetworkManager interface.

My question is, what is the best approach to verify API version and call
the correct method.

Cheers
Maxwell

 
Legal Disclaimer:
The information contained in this message may be privileged and confidential. 
It is intended to be read only by the individual or entity to whom it is 
addressed or by their designee. If the reader of this message is not the 
intended recipient, you are on notice that any distribution of this message, in 
any form, is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete or destroy any copy of this 
message

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Writing a script to multiple versions of DBus API

2009-12-08 Thread Jirka Klimes
On Tuesday 08 December 2009 12:55:21 Maxwell Chiareli Xandeco wrote:
 Hi all,
 
 I'm writing a simple python script to manage a broadband connection.
 
 I'm using the Disconnect() method from Device interface to close
 connection, that works fine with the 0.8 version, and on the 0.7 version
 I need to use the DeactivateConnection ( o: active_connection ) method
 from NetworkManager interface.
 
 My question is, what is the best approach to verify API version and call
 the correct method.
 
 Cheers
 Maxwell
 

I think currently there's no clean method as the version is not exported via 
DBus.
However a patch for it has been already proposed on this list:
http://markmail.org/message/fighzuuvfoyy2lzz

In that thread you can also find some hacks to distinguish versions.

Jirka
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] supplicant: switched to new supplicant's DBus API

2009-11-19 Thread Witold Sowa
Patch resent with a bug fix. There was a bug in adding a blob
procedure, witch caused to fail when adding an already added blob.
Fixed. Now NM tries to remove each blob before adding.
Corrected patch is below:

NetworkManager now uses the new DBus API of wpa_supplicant. It
changes interfaces and methods and signals names to, change some
signals to PropertyChanged signal and some method calls to property
Get calls in order to fit new API. General principle of operation
supplicant manager is not changed.
---
 src/NetworkManagerAP.c   |   14 +-
 src/nm-device-wifi.c |2 -
 src/supplicant-manager/nm-supplicant-interface.c |  579 +++---
 src/supplicant-manager/nm-supplicant-interface.h |3 +-
 src/supplicant-manager/nm-supplicant-manager.c   |2 +-
 src/supplicant-manager/nm-supplicant-manager.h   |6 +-
 6 files changed, 308 insertions(+), 298 deletions(-)

diff --git a/src/NetworkManagerAP.c b/src/NetworkManagerAP.c
index 9b95924..274862a 100644
--- a/src/NetworkManagerAP.c
+++ b/src/NetworkManagerAP.c
@@ -380,7 +380,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
if (G_VALUE_HOLDS_BOXED (variant)) {
GArray *array = g_value_get_boxed (variant);
 
-   if (!strcmp (key, ssid)) {
+   if (!strcmp (key, SSID)) {
guint32 len = MIN (IW_ESSID_MAX_SIZE, array-len);
GByteArray * ssid;
 
@@ -396,7 +396,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
g_byte_array_append (ssid, (const guint8 *) 
array-data, len);
nm_ap_set_ssid (ap, ssid);
g_byte_array_free (ssid, TRUE);
-   } else if (!strcmp (key, bssid)) {
+   } else if (!strcmp (key, BSSID)) {
struct ether_addr addr;
 
if (array-len != ETH_ALEN)
@@ -404,7 +404,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
memset (addr, 0, sizeof (struct ether_addr));
memcpy (addr, array-data, ETH_ALEN);
nm_ap_set_address (ap, addr);
-   } else if (!strcmp (key, wpaie)) {
+   } else if (!strcmp (key, WPAIE)) {
guint8 * ie = (guint8 *) array-data;
guint32 flags = nm_ap_get_wpa_flags (ap);
 
@@ -412,7 +412,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
return;
flags = nm_ap_add_security_from_ie (flags, ie, 
array-len);
nm_ap_set_wpa_flags (ap, flags);
-   } else if (!strcmp (key, rsnie)) {
+   } else if (!strcmp (key, RSNIE)) {
guint8 * ie = (guint8 *) array-data;
guint32 flags = nm_ap_get_rsn_flags (ap);
 
@@ -424,16 +424,16 @@ foreach_property_cb (gpointer key, gpointer value, 
gpointer user_data)
} else if (G_VALUE_HOLDS_INT (variant)) {
gint32 int_val = g_value_get_int (variant);
 
-   if (!strcmp (key, frequency)) {
+   if (!strcmp (key, Frequency)) {
nm_ap_set_freq (ap, (guint32) int_val);
-   } else if (!strcmp (key, maxrate)) {
+   } else if (!strcmp (key, MaxRate)) {
/* Supplicant reports as b/s, we use Kb/s internally */
nm_ap_set_max_bitrate (ap, int_val / 1000);
}
} else if (G_VALUE_HOLDS_UINT (variant)) {
guint32 val = g_value_get_uint (variant);
 
-   if (!strcmp (key, capabilities)) {
+   if (!strcmp (key, Capabilities)) {
if (val  IEEE80211_CAP_ESS) {
nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
} else if (val  IEEE80211_CAP_IBSS) {
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 6307ae6..b83e34d 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -208,7 +208,6 @@ static void supplicant_iface_scanned_ap_cb 
(NMSupplicantInterface * iface,
 NMDeviceWifi * self);
 
 static void supplicant_iface_scan_request_result_cb (NMSupplicantInterface * 
iface,
- gboolean success,
  NMDeviceWifi * self);
 
 static void supplicant_iface_scan_results_cb (NMSupplicantInterface * iface,
@@ -1782,7 +1781,6 @@ cancel_pending_scan (NMDeviceWifi *self)
 
 static void
 supplicant_iface_scan_request_result_cb (NMSupplicantInterface *iface,
- gboolean success,
  NMDeviceWifi *self)
 {
if (can_scan (self))
diff --git a/src/supplicant

Re: [PATCH] supplicant: switched to new supplicant's DBus API

2009-11-19 Thread Witold Sowa
One more bug fix, I hope it's the last one. Fixed reading
AP properties while calculating signal strength from
wpa_supplicant. Corrected patch is below:

NetworkManager now uses the new DBus API of wpa_supplicant. It
changes interfaces and methods and signals names to, change some
signals to PropertyChanged signal and some method calls to property
Get calls in order to fit new API. General principle of operation
supplicant manager is not changed.
---
 src/NetworkManagerAP.c   |   14 +-
 src/nm-device-wifi.c |   18 +-
 src/supplicant-manager/nm-supplicant-interface.c |  579 +++---
 src/supplicant-manager/nm-supplicant-interface.h |3 +-
 src/supplicant-manager/nm-supplicant-manager.c   |2 +-
 src/supplicant-manager/nm-supplicant-manager.h   |6 +-
 6 files changed, 316 insertions(+), 306 deletions(-)

diff --git a/src/NetworkManagerAP.c b/src/NetworkManagerAP.c
index 9b95924..274862a 100644
--- a/src/NetworkManagerAP.c
+++ b/src/NetworkManagerAP.c
@@ -380,7 +380,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
if (G_VALUE_HOLDS_BOXED (variant)) {
GArray *array = g_value_get_boxed (variant);
 
-   if (!strcmp (key, ssid)) {
+   if (!strcmp (key, SSID)) {
guint32 len = MIN (IW_ESSID_MAX_SIZE, array-len);
GByteArray * ssid;
 
@@ -396,7 +396,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
g_byte_array_append (ssid, (const guint8 *) 
array-data, len);
nm_ap_set_ssid (ap, ssid);
g_byte_array_free (ssid, TRUE);
-   } else if (!strcmp (key, bssid)) {
+   } else if (!strcmp (key, BSSID)) {
struct ether_addr addr;
 
if (array-len != ETH_ALEN)
@@ -404,7 +404,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
memset (addr, 0, sizeof (struct ether_addr));
memcpy (addr, array-data, ETH_ALEN);
nm_ap_set_address (ap, addr);
-   } else if (!strcmp (key, wpaie)) {
+   } else if (!strcmp (key, WPAIE)) {
guint8 * ie = (guint8 *) array-data;
guint32 flags = nm_ap_get_wpa_flags (ap);
 
@@ -412,7 +412,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
return;
flags = nm_ap_add_security_from_ie (flags, ie, 
array-len);
nm_ap_set_wpa_flags (ap, flags);
-   } else if (!strcmp (key, rsnie)) {
+   } else if (!strcmp (key, RSNIE)) {
guint8 * ie = (guint8 *) array-data;
guint32 flags = nm_ap_get_rsn_flags (ap);
 
@@ -424,16 +424,16 @@ foreach_property_cb (gpointer key, gpointer value, 
gpointer user_data)
} else if (G_VALUE_HOLDS_INT (variant)) {
gint32 int_val = g_value_get_int (variant);
 
-   if (!strcmp (key, frequency)) {
+   if (!strcmp (key, Frequency)) {
nm_ap_set_freq (ap, (guint32) int_val);
-   } else if (!strcmp (key, maxrate)) {
+   } else if (!strcmp (key, MaxRate)) {
/* Supplicant reports as b/s, we use Kb/s internally */
nm_ap_set_max_bitrate (ap, int_val / 1000);
}
} else if (G_VALUE_HOLDS_UINT (variant)) {
guint32 val = g_value_get_uint (variant);
 
-   if (!strcmp (key, capabilities)) {
+   if (!strcmp (key, Capabilities)) {
if (val  IEEE80211_CAP_ESS) {
nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
} else if (val  IEEE80211_CAP_IBSS) {
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 6307ae6..ab3b138 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -107,7 +107,7 @@ typedef enum {
 } NMWifiError;
 
 #define NM_WIFI_ERROR (nm_wifi_error_quark ())
-#define NM_TYPE_WIFI_ERROR (nm_wifi_error_get_type ()) 
+#define NM_TYPE_WIFI_ERROR (nm_wifi_error_get_type ())
 
 typedef struct SupplicantStateTask {
NMDeviceWifi *self;
@@ -156,7 +156,7 @@ struct _NMDeviceWifiPrivate {
NMAccessPoint *   current_ap;
guint32   rate;
gboolean  enabled; /* rfkilled or not */
-   
+
glong scheduled_scan_time;
guint8scan_interval; /* seconds */
guint pending_scan_id;
@@ -208,7 +208,6 @@ static void supplicant_iface_scanned_ap_cb 
(NMSupplicantInterface * iface,
 NMDeviceWifi * self);
 
 static void supplicant_iface_scan_request_result_cb (NMSupplicantInterface * 
iface

[PATCH] supplicant: switched to new supplicant's DBus API

2009-11-18 Thread Witold Sowa
NetworkManager now uses the new DBus API of wpa_supplicant. It
changes interfaces and methods and signals names to, change some
signals to PropertyChanged signal and some method calls to property
Get calls in order to fit new API. General principle of operation
supplicant manager is not changed.
---
 src/NetworkManagerAP.c   |   14 +-
 src/nm-device-wifi.c |1 -
 src/supplicant-manager/nm-supplicant-interface.c |  560 ++---
 src/supplicant-manager/nm-supplicant-interface.h |3 +-
 src/supplicant-manager/nm-supplicant-manager.c   |2 +-
 src/supplicant-manager/nm-supplicant-manager.h   |6 +-
 6 files changed, 279 insertions(+), 307 deletions(-)

diff --git a/src/NetworkManagerAP.c b/src/NetworkManagerAP.c
index 9b95924..274862a 100644
--- a/src/NetworkManagerAP.c
+++ b/src/NetworkManagerAP.c
@@ -380,7 +380,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
if (G_VALUE_HOLDS_BOXED (variant)) {
GArray *array = g_value_get_boxed (variant);
 
-   if (!strcmp (key, ssid)) {
+   if (!strcmp (key, SSID)) {
guint32 len = MIN (IW_ESSID_MAX_SIZE, array-len);
GByteArray * ssid;
 
@@ -396,7 +396,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
g_byte_array_append (ssid, (const guint8 *) 
array-data, len);
nm_ap_set_ssid (ap, ssid);
g_byte_array_free (ssid, TRUE);
-   } else if (!strcmp (key, bssid)) {
+   } else if (!strcmp (key, BSSID)) {
struct ether_addr addr;
 
if (array-len != ETH_ALEN)
@@ -404,7 +404,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
memset (addr, 0, sizeof (struct ether_addr));
memcpy (addr, array-data, ETH_ALEN);
nm_ap_set_address (ap, addr);
-   } else if (!strcmp (key, wpaie)) {
+   } else if (!strcmp (key, WPAIE)) {
guint8 * ie = (guint8 *) array-data;
guint32 flags = nm_ap_get_wpa_flags (ap);
 
@@ -412,7 +412,7 @@ foreach_property_cb (gpointer key, gpointer value, gpointer 
user_data)
return;
flags = nm_ap_add_security_from_ie (flags, ie, 
array-len);
nm_ap_set_wpa_flags (ap, flags);
-   } else if (!strcmp (key, rsnie)) {
+   } else if (!strcmp (key, RSNIE)) {
guint8 * ie = (guint8 *) array-data;
guint32 flags = nm_ap_get_rsn_flags (ap);
 
@@ -424,16 +424,16 @@ foreach_property_cb (gpointer key, gpointer value, 
gpointer user_data)
} else if (G_VALUE_HOLDS_INT (variant)) {
gint32 int_val = g_value_get_int (variant);
 
-   if (!strcmp (key, frequency)) {
+   if (!strcmp (key, Frequency)) {
nm_ap_set_freq (ap, (guint32) int_val);
-   } else if (!strcmp (key, maxrate)) {
+   } else if (!strcmp (key, MaxRate)) {
/* Supplicant reports as b/s, we use Kb/s internally */
nm_ap_set_max_bitrate (ap, int_val / 1000);
}
} else if (G_VALUE_HOLDS_UINT (variant)) {
guint32 val = g_value_get_uint (variant);
 
-   if (!strcmp (key, capabilities)) {
+   if (!strcmp (key, Capabilities)) {
if (val  IEEE80211_CAP_ESS) {
nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
} else if (val  IEEE80211_CAP_IBSS) {
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 6307ae6..76dafc8 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -1782,7 +1782,6 @@ cancel_pending_scan (NMDeviceWifi *self)
 
 static void
 supplicant_iface_scan_request_result_cb (NMSupplicantInterface *iface,
- gboolean success,
  NMDeviceWifi *self)
 {
if (can_scan (self))
diff --git a/src/supplicant-manager/nm-supplicant-interface.c 
b/src/supplicant-manager/nm-supplicant-interface.c
index 00f0c30..0b0f212 100644
--- a/src/supplicant-manager/nm-supplicant-interface.c
+++ b/src/supplicant-manager/nm-supplicant-interface.c
@@ -34,11 +34,11 @@
 #include nm-glib-compat.h
 
 #define WPAS_DBUS_IFACE_INTERFACE   WPAS_DBUS_INTERFACE .Interface
-#define WPAS_DBUS_IFACE_BSSID   WPAS_DBUS_INTERFACE .BSSID
-#define WPAS_DBUS_IFACE_NETWORKWPAS_DBUS_INTERFACE .Network
-#define WPAS_ERROR_INVALID_IFACEWPAS_DBUS_INTERFACE .InvalidInterface
-#define WPAS_ERROR_EXISTS_ERROR WPAS_DBUS_INTERFACE .ExistsError
-
+#define WPAS_DBUS_IFACE_BSS WPAS_DBUS_IFACE_INTERFACE .BSS

NM DBus API

2009-01-05 Thread Gabriel Joel Perez
Hi!

Where can I find the docs for the NM DBus API?
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NM DBus API

2009-01-05 Thread Tambet Ingo
On Thu, Jan 1, 2009 at 00:24, Gabriel Joel Perez gabrielj...@gmail.com wrote:
 Hi!

 Where can I find the docs for the NM DBus API?

Download NetworkManager sources, run configure with '--with-docs' flag
and then run make. That'll create the DBus API documentation file
docs/spec.html.

Tambet
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: problem with networkmanager dbus api

2008-10-29 Thread Dan Williams
On Tue, 2008-10-28 at 22:45 +0100, Sebastian Dransfeld wrote:
 Sebastian Dransfeld wrote:
  Sebastian Dransfeld wrote:
  Hi,
 
  I try to use the org.freedesktop.DBus.Properties.GetAll() method call 
  with networkmanager like this (change device to one you got):
 
  dbus-send --system --print-reply --type=method_call \
  --dest=org.freedesktop.NetworkManager \
  /org/freedesktop/Hal/devices/net_00_01_6c_ea_69_1b \
  org.freedesktop.DBus.Properties.GetAll \
  string:org.freedesktop.NetworkManager.Device
 
  This will return nothing, as libdbus-glib maps dbus properties to 
  gobject properties. In networkmanager these do not match:
 
  gobjectdbus
  udiUdi
  interfaceInterface
  driverDriver
  capabilitiesCapabilities
  ip4-addressIp4Address
  etc.
 
  The gobject properties do however have a nick which matches the dbus 
  property name.
 
  Where should this problem be solved? networkmamager or dbus-glib?
 
  If someone can suggest a solution, I can try to create a patch.
  
  And of course:
  OS:
  - Ubuntu 8.10
  Packages:
  - libdbus-glib-1-2  0.76-1
  - network-manager   0.7~~svn20081018t105859-0ubuntu1
 
 And fixed it. Missing _dbus_gutils_wincaps_to_uscore() in dbus-glib's 
 getall implementation. Where should I send this patch?

It's been in dbus-glib since June, right after the release of 0.76:

http://gitweb.freedesktop.org/?p=dbus/dbus-glib.git;a=blobdiff;h=ee760113af2d89ac526ac247f25552f90239972f;hp=3744d8439b461957040df4dd1ba555906bbedc54;hb=d1b80d803a0268bd4b3dd5b9a9522230461f2947;f=dbus/dbus-gobject.c

maybe that means time for another dbus-glib release Colin?

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: problem with networkmanager dbus api

2008-10-29 Thread Colin Walters
On Wed, Oct 29, 2008 at 6:50 AM, Dan Williams [EMAIL PROTECTED] wrote:

 It's been in dbus-glib since June, right after the release of 0.76:

 http://gitweb.freedesktop.org/?p=dbus/dbus-glib.git;a=blobdiff;h=ee760113af2d89ac526ac247f25552f90239972f;hp=3744d8439b461957040df4dd1ba555906bbedc54;hb=d1b80d803a0268bd4b3dd5b9a9522230461f2947;f=dbus/dbus-gobject.c

 maybe that means time for another dbus-glib release Colin?

There are a couple of patches queued that would be good to get in
first, but should be soon.
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


problem with networkmanager dbus api

2008-10-28 Thread Sebastian Dransfeld

Hi,

I try to use the org.freedesktop.DBus.Properties.GetAll() method call 
with networkmanager like this (change device to one you got):


dbus-send --system --print-reply --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/Hal/devices/net_00_01_6c_ea_69_1b \
org.freedesktop.DBus.Properties.GetAll \
string:org.freedesktop.NetworkManager.Device

This will return nothing, as libdbus-glib maps dbus properties to 
gobject properties. In networkmanager these do not match:


gobject dbus
udi Udi
interface   Interface
driver  Driver
capabilitiesCapabilities
ip4-address Ip4Address
etc.

The gobject properties do however have a nick which matches the dbus 
property name.


Where should this problem be solved? networkmamager or dbus-glib?

If someone can suggest a solution, I can try to create a patch.

Best regards
Sebastian Dransfeld

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: problem with networkmanager dbus api

2008-10-28 Thread Sebastian Dransfeld

Sebastian Dransfeld wrote:

Hi,

I try to use the org.freedesktop.DBus.Properties.GetAll() method call 
with networkmanager like this (change device to one you got):


dbus-send --system --print-reply --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/Hal/devices/net_00_01_6c_ea_69_1b \
org.freedesktop.DBus.Properties.GetAll \
string:org.freedesktop.NetworkManager.Device

This will return nothing, as libdbus-glib maps dbus properties to 
gobject properties. In networkmanager these do not match:


gobjectdbus
udiUdi
interfaceInterface
driverDriver
capabilitiesCapabilities
ip4-addressIp4Address
etc.

The gobject properties do however have a nick which matches the dbus 
property name.


Where should this problem be solved? networkmamager or dbus-glib?

If someone can suggest a solution, I can try to create a patch.


And of course:
OS:
- Ubuntu 8.10
Packages:
- libdbus-glib-1-2  0.76-1
- network-manager   0.7~~svn20081018t105859-0ubuntu1

Best regards
Sebastian Dransfeld
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: problem with networkmanager dbus api

2008-10-28 Thread Sebastian Dransfeld

Sebastian Dransfeld wrote:

Sebastian Dransfeld wrote:

Hi,

I try to use the org.freedesktop.DBus.Properties.GetAll() method call 
with networkmanager like this (change device to one you got):


dbus-send --system --print-reply --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/Hal/devices/net_00_01_6c_ea_69_1b \
org.freedesktop.DBus.Properties.GetAll \
string:org.freedesktop.NetworkManager.Device

This will return nothing, as libdbus-glib maps dbus properties to 
gobject properties. In networkmanager these do not match:


gobjectdbus
udiUdi
interfaceInterface
driverDriver
capabilitiesCapabilities
ip4-addressIp4Address
etc.

The gobject properties do however have a nick which matches the dbus 
property name.


Where should this problem be solved? networkmamager or dbus-glib?

If someone can suggest a solution, I can try to create a patch.


And of course:
OS:
- Ubuntu 8.10
Packages:
- libdbus-glib-1-2  0.76-1
- network-manager   0.7~~svn20081018t105859-0ubuntu1


And fixed it. Missing _dbus_gutils_wincaps_to_uscore() in dbus-glib's 
getall implementation. Where should I send this patch?


Best regards
Sebastian Dransfeld
--- dbus/dbus-gobject.c.orig	2008-10-28 22:42:36.0 +0100
+++ dbus/dbus-gobject.c	2008-10-28 22:42:39.0 +0100
@@ -796,6 +796,7 @@
 {
   const char *prop_ifname;
   const char *prop_name;
+  char *gobject_prop_name;
   GParamSpec *pspec;
   GType value_gtype;
   GValue value = {0, };
@@ -815,7 +816,9 @@
 p++;
   p++;
 
-  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), prop_name);
+  gobject_prop_name = _dbus_gutils_wincaps_to_uscore (prop_name);
+  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), gobject_prop_name);
+  g_free (gobject_prop_name);
   if (pspec == NULL)
 {
   g_warning (introspection data references non-existing property %s, prop_name);
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-28 Thread Will Stephenson
On Thursday 28 February 2008 03:09:27 Dan Williams wrote:
 Committed with a few cleanups, thanks!

Nice!

I've got some documentation for the various Settings keys and types here in my 
git - documentation progress hasn't stopped, but I need to make some progress 
here on my KDE 4 client before tidying it up for you.

Will

-- 
Will Stephenson
IRC: Bille
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-27 Thread Dan Williams
On Mon, 2008-02-11 at 23:07 +0100, Will Stephenson wrote:
 On Monday 11 February 2008 17:27:53 Dan Williams wrote:
  On Mon, 2008-02-11 at 17:26 +0100, Will Stephenson wrote:
   On Friday 08 February 2008, Dan Williams said:
So a simple patch to dbus-binding-tool to make it ignore namespaced
nodes and attributes will allow us to use the TP namespace within the
existing introspection XML files and avoid the extra step of spec/*.
   
   Ack, maybe it does so already - but is the extra spec/* step really worse 
 than 
   having all of downstream have to use a patched dbus-binding-tool?
  
  The patch for dbus-glib is the right thing to do anyway; and I don't
  think there's a really good reason to have the extra step either.  If
  the fix does get into dbus-glib, we'd just have to rework the spec
  generation code again, so we might as well do it right the first time
  IMHO.
 
 I'm still not quite sure it's good to pass around extended introspection xml. 
  
 Are you able to you check the python bindings' behaviour?  I'll see what the 
 Qt tools do.
 
If you're still willing to work on this, I'd love a patch that would run
the XSLT stuff over the introspection/*.xml (feel free to add all.xml to
introspection/* if you like) and generate the HTML docs.
   
I don't think it would be to much work to modify the makefile stuff to
rip out the bits that convert spec/* - introspection/* and just
preserve the bits that do introspection/* - HTML, right?
   
   It's trivial - will post a patch shortly.
 
 Patch attached.

Committed with a few cleanups, thanks!

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-11 Thread Dan Williams
On Mon, 2008-02-11 at 23:07 +0100, Will Stephenson wrote:
 On Monday 11 February 2008 17:27:53 Dan Williams wrote:
  On Mon, 2008-02-11 at 17:26 +0100, Will Stephenson wrote:
   On Friday 08 February 2008, Dan Williams said:
So a simple patch to dbus-binding-tool to make it ignore namespaced
nodes and attributes will allow us to use the TP namespace within the
existing introspection XML files and avoid the extra step of spec/*.
   
   Ack, maybe it does so already - but is the extra spec/* step really worse 
 than 
   having all of downstream have to use a patched dbus-binding-tool?
  
  The patch for dbus-glib is the right thing to do anyway; and I don't
  think there's a really good reason to have the extra step either.  If
  the fix does get into dbus-glib, we'd just have to rework the spec
  generation code again, so we might as well do it right the first time
  IMHO.
 
 I'm still not quite sure it's good to pass around extended introspection xml. 
  
 Are you able to you check the python bindings' behaviour?  I'll see what the 
 Qt tools do.

Well, remember that dbus-glib _doesn't_ take the *.xml verbatim and pass
it through the bus.  The *.xml files are processed into a custom syntax
and stuffed into the C code.  You don't really need the property types
for example, because the glib code is able to introspect the property
types directly from the GObject itself.

So I'm not sure why other bindings are relevant here, because none of
the namespaced stuff should ever go over the bus at all.

If you're still willing to work on this, I'd love a patch that would run
the XSLT stuff over the introspection/*.xml (feel free to add all.xml to
introspection/* if you like) and generate the HTML docs.
   
I don't think it would be to much work to modify the makefile stuff to
rip out the bits that convert spec/* - introspection/* and just
preserve the bits that do introspection/* - HTML, right?
   
   It's trivial - will post a patch shortly.
 
 Patch attached.

Will review, thanks!

Dan

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-11 Thread Dan Williams
On Mon, 2008-02-11 at 17:26 +0100, Will Stephenson wrote:
 On Friday 08 February 2008, Dan Williams said:
  So a simple patch to dbus-binding-tool to make it ignore namespaced
  nodes and attributes will allow us to use the TP namespace within the
  existing introspection XML files and avoid the extra step of spec/*.
 
 Ack, maybe it does so already - but is the extra spec/* step really worse 
 than 
 having all of downstream have to use a patched dbus-binding-tool?

The patch for dbus-glib is the right thing to do anyway; and I don't
think there's a really good reason to have the extra step either.  If
the fix does get into dbus-glib, we'd just have to rework the spec
generation code again, so we might as well do it right the first time
IMHO.

  If you're still willing to work on this, I'd love a patch that would run
  the XSLT stuff over the introspection/*.xml (feel free to add all.xml to
  introspection/* if you like) and generate the HTML docs.
 
  I don't think it would be to much work to modify the makefile stuff to
  rip out the bits that convert spec/* - introspection/* and just
  preserve the bits that do introspection/* - HTML, right?
 
 It's trivial - will post a patch shortly.

Great!

  Thanks!
 
 You're welcome.  And this time, I trained my spam filter on your mail ;).

It is nice to have a unified overview of the API.  Thanks again.

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-08 Thread Will Stephenson
On Tuesday 05 February 2008 22:27:28 Dan Williams wrote:
 We definitely need the docs, the only question is how exactly to go
 about getting them.

Sorry, I just found your replies now in my spam trap after Marcel's response 
indicated you'd replied...

I'm working on reading the code and adding documentation to it as I go now.  
It's taking a while but I hope to have a patch in the next couple of days.

Will


-- 
Will Stephenson
IRC: Bille
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-08 Thread Will Stephenson
On Wednesday 06 February 2008 15:56:32 Dan Williams wrote:
 On Wed, 2008-02-06 at 09:20 +0100, Will Stephenson wrote:
  On Tuesday 05 February 2008 20:55:33 Marcel Holtmann wrote:
   Hi Will,
  
 I must agree here. Something that generate the introspection is not
 helpful at all. It is hard enough to keep external introspection
 XML files in sync with the actual runtime introspection.
   
Surely the glib binding generators create the runtime introspection
from the xml files?  That's the way the Qt bindings work.
  
   no they don't. In the dbus-glib case you have the a pre-processing step
   that uses the XML file to generate glue code. You attach this to a
   GObject and then the bindings generate the runtime introspection from
   the runtime information of the object. You could do it without the XML
   file if you really want to.
 
  As far as I can tell looking at dbus-glib, the xml returned by
  Introspect() is generated at runtime from object info statically
  generated in the glue code from the introspection xml files.  Therefore
  the introspection xml files are the original source of the interfaces
  offered by the objects, therefore these are the places where
  documentation is most effective.
 
   I'm trying to document the actual implementation of NM 0.7.  I'm aware
  that it's possible to do all this by hand or write a program that doesn't
  actually implement the interface it advertises but those are just
  hypothetical counter-examples.

 Yeah; the docs, the introspection data, and the generated bindings all
 need to come from the same place, and that all needs to be done
 automatically.  I don't want to manually update 3 places.  Where do the
 current introspection/*.xml files go in your scheme?  The diff removes
 them but doesn't apparently add anything back that would describe the
 interfaces.

The files in introspection/*.xml move to spec/

Will



-- 
Will Stephenson
IRC: Bille
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-08 Thread Will Stephenson
On Friday 08 February 2008 17:52:22 Dan Williams wrote:
 On Tue, 2008-02-05 at 15:46 +0100, Will Stephenson wrote:
  Here's a patch that adds api documentation generation to the NM build
  system. The code is taken from the Telepathy project.

 I think as others have expressed, I think that process adds an extra,
 unnecessary step.  I think I'd rather see the following:

 1) annotate the introspection/*.xml files using the many-times-proposed
 org.freedesktop.DBus.Doc annotation name which was designed just for
 this.  You'd end up with stuff looking like this:

 interface name=org.freedesktop.NetworkManager.Device
   method name=Deactivate
 annotation name=org.freedesktop.DBus.GLib.CSymbol
 value=impl_device_deactivate/ annotation
 name=org.freedesktop.DBus.Doc
   Deactivates the device, removing applicable routes, IP addresses, and
 marking the device down. /annotation
   /method

   property name=Udi type=s access=read
 annotation name=org.freedesktop.DBus.Doc
   The HAL Unique Device Identifier for this device.
 /annotation
   /property
 ...
 /interface

Google knows exactly one hit for org.freedesktop.DBus.Doc, that doesn't say 
much.  Where is this documented?  From this example it seems to be less 
descriptive than Telepathy's format, but I'll reserve judgement until I've 
had a look at it.

If you've got an archive of the dbus list, look for the thread documentation 
and introspection from Nov 2006 where Simon McVittie compares the tp doc 
format and another namespaced doc proposal.


 2) Assuming dbus-glib's binding tool ignores annotations it doesn't
 recognize (and if it doesn't, we fix it to do so), the binding tool will
 just continue as normal creating the glue and bindings file.

It should ignore namespaces it doesn't recognise too, making tp: namespaced 
introspection xml safe even without the (IMO trivial) extra xslt step that 
removes them.

 3) The optional document generation step (enabled at configure-time with
 --enable-docs or something) can run xslt or something on the
 introspection XML and generate the HTML documentation.

Right, this is how the tp system works too.

 There are some bits of the code that could stand extra documentation
 that aren't part of the D-Bus API directly, like the NMSettings
 subclasses.  They are of course D-Bus dictionaries, and the key/value
 pairs and types are firmly defined.  While that spec doesn't live in
 SVN, it really should live there, and it really should be pulled into
 the autogenerated docs for consistency.

tp uses similar settings dictionaries, and defines their key ranges in these 
types' docstrings.  Have a look at http://telepathy.freedesktop.org/spec.html 
for its output.

Will
-- 
Will Stephenson
IRC: Bille
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-05 Thread Tambet Ingo
On Feb 5, 2008 8:46 AM, Will Stephenson [EMAIL PROTECTED] wrote:
snip
 I haven't actually added any api documentation yet.  I'm working on supporting
 NM 0.7 in KDE 4 and would do so as I grok 0.7.  The patch just replicates the
 status quo with the ability to add api docs.  The system can also add a make
 check target to assure the docu generation is working but I haven't
 adapted/copied that yet.

 Another question is, are you interested in async glib binding support?  The
 system can apparently generate separate async introspection xml but I haven't
 adapted that either yet as I'm not familiar with the glib bindings.

 I've tested this locally.  Dan, Tambet: what do you think about integrating
 it?  It would make NM client developement much easier.

While I'd like to have always up to date documentation, I'm not sure I
like this. The patch you sent only removes the introspection XML we
currently have and adds some XSLT which I can't read (and thus
maintain). It'll make development easier only if someone actually
writes that documentation, just converting to more magic makes things
harder to understand. And again, I like having documentation as much
as anyone,  but since we have two developers in total (who are busy
with maintenance work for a lot of time), I personally would rather
write code. So if anyone wants to help with documentation, it could
live in a text file for now. When it has enough information, and if
Dan feels comfortable maintaining XSLT, I wouldn't have anything
against the proposed solution.

Tambet
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] NM DBUS api documentation build system

2008-02-05 Thread Marcel Holtmann
Hi Tambet,

  I haven't actually added any api documentation yet.  I'm working on 
  supporting
  NM 0.7 in KDE 4 and would do so as I grok 0.7.  The patch just replicates 
  the
  status quo with the ability to add api docs.  The system can also add a make
  check target to assure the docu generation is working but I haven't
  adapted/copied that yet.
 
  Another question is, are you interested in async glib binding support?  The
  system can apparently generate separate async introspection xml but I 
  haven't
  adapted that either yet as I'm not familiar with the glib bindings.
 
  I've tested this locally.  Dan, Tambet: what do you think about integrating
  it?  It would make NM client developement much easier.
 
 While I'd like to have always up to date documentation, I'm not sure I
 like this. The patch you sent only removes the introspection XML we
 currently have and adds some XSLT which I can't read (and thus
 maintain). It'll make development easier only if someone actually
 writes that documentation, just converting to more magic makes things
 harder to understand. And again, I like having documentation as much
 as anyone,  but since we have two developers in total (who are busy
 with maintenance work for a lot of time), I personally would rather
 write code. So if anyone wants to help with documentation, it could
 live in a text file for now. When it has enough information, and if
 Dan feels comfortable maintaining XSLT, I wouldn't have anything
 against the proposed solution.

I must agree here. Something that generate the introspection is not
helpful at all. It is hard enough to keep external introspection XML
files in sync with the actual runtime introspection. Why should we have
another thing to maintain. If you could generate the introspection files
from within the source code, that is a different story. Something in
combination with Doxygen.

Regards

Marcel


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NM DBus API

2007-10-06 Thread Dan Williams
On Fri, 2007-10-05 at 10:15 -0600, Pat Sissons wrote:
 Not really, there have been a few of us who have documented what we
 discovered as we make our way through the source, but there is no
 official DBus API documentation.  There was talk a little while back
 about someone setting up a wiki where we could submit our findings,
 but it never seemed to develop.  I'm sure if someone can create a wiki
 for the information to be stored others will contribute, I know I
 would.

Pretty much anyone can get a user on the live.gnome.org wiki and just
start adding stuff...

Dan

 On 10/4/07, Scott Robinson [EMAIL PROTECTED] wrote:
  Is there a place where the NM DBus and VPN APIs are documented?
 
  (besides the code)
 
  --
  Scott Robinson | http://quadhome.com/
 
  Q: Why are my replies five sentences or less?
  A: http://five.sentenc.es/
 
  -BEGIN PGP SIGNATURE-
  Version: GnuPG v1.4.2.2 (GNU/Linux)
 
  iEYEARECAAYFAkcFnDkACgkQ2wcaZqTSGsQ9LQCg0SYedxkCbP0TWHTj2Sf4xaW4
  AKAAn3bi/T4/8RnCwOA/IJXZ9XJtMw+M
  =w3f8
  -END PGP SIGNATURE-
 
  ___
  NetworkManager-list mailing list
  NetworkManager-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/networkmanager-list
 
 
 
 

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NM DBus API

2007-10-05 Thread Pat Sissons
Not really, there have been a few of us who have documented what we
discovered as we make our way through the source, but there is no
official DBus API documentation.  There was talk a little while back
about someone setting up a wiki where we could submit our findings,
but it never seemed to develop.  I'm sure if someone can create a wiki
for the information to be stored others will contribute, I know I
would.

On 10/4/07, Scott Robinson [EMAIL PROTECTED] wrote:
 Is there a place where the NM DBus and VPN APIs are documented?

 (besides the code)

 --
 Scott Robinson | http://quadhome.com/

 Q: Why are my replies five sentences or less?
 A: http://five.sentenc.es/

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.2.2 (GNU/Linux)

 iEYEARECAAYFAkcFnDkACgkQ2wcaZqTSGsQ9LQCg0SYedxkCbP0TWHTj2Sf4xaW4
 AKAAn3bi/T4/8RnCwOA/IJXZ9XJtMw+M
 =w3f8
 -END PGP SIGNATURE-

 ___
 NetworkManager-list mailing list
 NetworkManager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list




-- 
Pat
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


NM DBus API

2007-10-04 Thread Scott Robinson
Is there a place where the NM DBus and VPN APIs are documented?

(besides the code)

-- 
Scott Robinson | http://quadhome.com/

Q: Why are my replies five sentences or less?
A: http://five.sentenc.es/


signature.asc
Description: Digital signature
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


DBus API

2007-03-07 Thread Nick Hughart
Is there a more up to date copy of the DBus API for NetworkManager then
the one I have found here:

http://people.redhat.com/dcbw/NetworkManager/NetworkManager%20DBUS%20API.txt

I am trying to create an application that communicates with
NetworkManager and have not been able to find any good documentation on
its DBus interface.
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: DBus API

2007-03-07 Thread Will Stephenson
On Wednesday 07 March 2007 16:11:22 Nick Hughart wrote:
 Is there a more up to date copy of the DBus API for NetworkManager then
 the one I have found here:

 http://people.redhat.com/dcbw/NetworkManager/NetworkManager%20DBUS%20API.tx
t

 I am trying to create an application that communicates with
 NetworkManager and have not been able to find any good documentation on
 its DBus interface.

It's not good documentation, but my rough notes for the 0.6.x API the same 
purpose might help:

http://websvn.kde.org/trunk/KDE/kdebase/runtime/solid/networkmanager/org.freedesktop.NetworkManager.xml.notes?revision=640298view=markup

Northern birdies told me the API might be getting regularised and made more 
sane for 0.7, is there any truth to that?

Will
-- 
Will Stephenson
IRC: Bille
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: DBUS API documentation strategies?

2005-12-08 Thread David Zeuthen
On Thu, 2005-12-08 at 11:35 -0500, Dan Williams wrote:
 Hi,
 
 So in the interest of making NM easier to use, does anyone have
 suggestions on exactly how to document the DBUS APIs that NetworkManager
 exposes?  Can we do this automatically with doxygen or somesuch?  Since
 the dbus calls aren't actually C calls, that seems a bit obscure to me.
 But I think it would be great if we had a strategy for this.
 
 Suggestions?

Make NM support D-BUS introspection along with some annotations?

Ideally we'd just use glib bindings for this but you may implement the
introspection interfaces yourself.

Cheers,
David


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list