On Fri, 2008-12-05 at 09:43 +0500, Ambreen Sheikh wrote: > i am basically trying to write a code , through which i will be able > to disconnect myself from one wireless network and connect myself to > another without letting the user find out about it.
The user will eventually find out about it when the status icon indicates that NM is attempting to connect to another network. Not really possible to do it completely silent, and that's probably a *good* thing. Keeping the user informed as to what exactly is happening is almost always the right thing to do. However... > so before actually writing the code i tried to perform the same > operation through the command line, but still have no success. > > i was trying if some how i could find out, how network manager > connects to a particular network when we click on its applet and > select a particular network. > like for example what are the API's called by the network manager or > what are the steps performed by the network manager. > i have gone through the network manager's source code, but i am unable > to extract the required information. NetworkManager provides a D-Bus interface which other applications like the applet (which has the menu) make requests of. D-Bus is a lightweight IPC mechanism. NetworkManager exports a number of method calls and interfaces through its D-Bus service. When you click on a network in the menu, the applet tries to match that AP up with saved connection details. If saved details exist and are compatible with the AP you've clicked on, the applet calls the ActivateConnection method of the NetworkManager object using D-Bus. This pops into the NetworkManager code in src/nm-manager.c:impl_manager_activate_connection(). The applet tells NM about the object path of the connection details it wants to activate, and the settings service which provides those details, and the specific access point object (if any) that wants NM to connect to. Each bundle of connection details (simply called a "connection") is just a bunch of key/value pairs that describe a connection to a specific network. Things like the IP address for the connection, or to use DHCP, what the SSID is, what the encryption method should be, the connection's human-readable name, etc. Each connection is provided by a settings service, of which there are two: nm-applet (or knetworkmanager), and nm-system-settings. These are also D-Bus services, communicating with clients over D-Bus IPC. nm-applet/knetworkmanager are "user" settings services, which mean that the connections they provide are user-specific and disappear when the user logs out. This is appropriate for things like VPN connections that you don't want to give other users access to. nm-system-settings is the "system" settings service, and usually provides connections converted from the distributions normal network config files. These connections are "system wide" and available to all users, and can be activated at system boot time before anyone has logged in. Dan _______________________________________________ NetworkManager-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/networkmanager-list
