NetworkManager (NM) exposes a DBUS service and API for two purposes: for programs to obtain information about the network state and network devices, and for programs or users to alter the network state in limited ways. This API is currently unstable and is likely to change in the future. Any methods or objects NOT described in this document are not part of the official API, are not meant for general use, and are not supported in any way.
There are three types of "objects" that NM allows other programs to interact with: the NetworkManager object, Device objects, and Network objects. There is only one NetworkManager object as it performs system-wide networking functions and controls each Device. There can be a arbitrary number of Devices, including no Devices at all, each of which represent a network device present in the system. A Network is the representation of a wireless network, of which each Device object may have an arbitrary number (as long as it is a wireless device).
Object structure:
NetworkManager
/ \
Device Device
/ \ (no networks)
Network Network
The NetworkManager object
-------------------------
The following constants are used to uniquely refer to the NetworkManager object when making DBUS method calls against NetworkManager:
Name: WirelessNetworkAppeared Signals that a device found a new wireless network
Args: 1) Device object (DBUS_TYPE_STRING) - The device which noticed the wireless network
2) Network object (DBUS_TYPE_STRING) - The new wireless network's identifier
Name: WirelessNetworkDisappeared Signals that a device lost a new wireless network
Args: 1) Device object (DBUS_TYPE_STRING) - The device which lost the wireless network
2) Network object (DBUS_TYPE_STRING) - The no-longer-visible wireless network's identifier
The Device object
-----------------
The Device object is the NM representation of a network device. To refer to a NM Device, you must use the following constants when creating your DBUS message:
Note that there is no DBUS Object Path listed above, the object path will always the NM Device identfier returned from such methods as "getActiveDevice" and "getDevices".
Name: getName Returns the system device name of the Device object (i.e. eth0)
Args: (none)
Returns: DBUS_TYPE_STRING The system device name
Name: getType Returns the type of the device (ie wired, wireless, isdn, bluetooth, etc)
Args: (none)
Returns: DBUS_TYPE_INT32 0 - unknown type
1 - Wired ethernet
2 - Wireless (802.11a/b/g)
Name: getHalUdi Returns the HAL UDI of the device
Args: (none)
Returns: DBUS_TYPE_STRING
Name: getIP4Address Returns the IPv4 address of the device
Args: (none)
Returns: DBUS_TYPE_UINT32 The IPv4 address in network byte order
Name: getLinkActive Returns the link state of the device
Args: (none)
Returns: DBUS_TYPE_BOOLEAN TRUE - the device has a valid network link
Wired: cable is plugged in
Wireless: good link to a base station
FALSE - the device has no network link
Wired: no cable plugged in
Wireless: no base station, or bad encryption key
Name: getActiveNetwork (Wireless only) Returns the Network object indentifier of the wireless network
this device is currently associated with, if any
Args: (none)
Returns: DBUS_TYPE_STRING
Name: getNetworks (Wireless only) Returns a list of Network objects this device knows about
Args: (none)
Returns: DBUS String Array Each item in the array is a Network object identifier
The Network object
------------------
Each Device object that is of type 2 (Wireless device) keeps a list of Network objects that it knows about. Use the following constants to specify a Network object when creating DBUS method calls:
Again, note that there is no DBUS Object Path above, since the object path used for the method call will be the Network object indentifier returned from a Device object's "getActiveNetwork" or "getNetworks" methods.
Methods:
Name: getName Return the name of the network (ESSID)
Args: (none)
Returns: DBUS_TYPE_STRING
Name: getAddress Returns the hardware address of the base station this wireless network belongs to.
NOTE: this may change in the near future to an array of addresses.