Controlling KVpnc using DBUS
========================

DBUS use is not so much simple than dcop but similar:
dbus-send --session --type=method_call --print-reply=literal --dest=org.kde.kvpnc-<pid> /kvpnc/MainWindow_1 org.kde.kvpnc.MainWindow_1.<command>

The PID (process identifier number) can be obtained by:
ps ax | grep kvpnc | grep -v grep

The first number in line is the PID. 
Hint: You can use kdbus or d-feet for browsing the applications which can be controlled and their functions.

KVpnc provides the following functions:
--------------------------------------------------
Array of [String] interfaces()
Array of [String] functions()
String getVersion()
void doConnect()
void doDisconnect()
UInt32 getConnectedTime()
String getStatus()
String getCurrentProfile()
void setProfile(QString profilename)
void createNewProfile()
void createNewProfileWithWizard()
void deleteCurrentProfile()
void openPreferences()
void doImportCert()
void doImportPcf()
void doImportPcf(QString file)
void doImportOpenvpnConfig()
void doImportOpenvpnConfig(QString file)
Array of [String] profiles()
Array of [String] toolinfo()
void doQuit()
void doGenerateOpenvpnKey()
void doSendFeedbackMail()
Array of [String] getProfileTypes()

Return and parameter data types:
-------------------------------------------
String text - text
Array of [String] array of text - list of text
UInt32 unsigned int - number
void empty - no return value

Examples:
-------------
1. List all profile names 
	root@linux# dbus-send --session --type=method_call --print-reply=literal --dest=org.kde.kvpnc-3957 /kvpnc/MainWindow_1 org.kde.kvpnc.MainWindow_1.profiles
 array [
 profile1 profile2 profile3 ]

2. Get information about tools 
	root@linux# dbus-send --session --type=method_call --print-reply=literal --dest=org.kde.kvpnc-3957 /kvpnc/MainWindow_1 org.kde.kvpnc.MainWindow_1.toolinfo
	array [ vpnc,Found,0.3.3,full, 
	gnome-ssh-askpass,Found,No info,full, 
	ksshaskpass,Found,0.4.1,full, 
	ssh,Found,5.1p1,full, 
	tail,Found,6.10,full, 
	cisco_cert_mgr,Found,4.8.01 (0640),full, 
	vtund,Not found,No info,none, 
	bash,Found,No info,full, 
	pkcs11-tool,Found,No info,full, 
	route,Found,1.98,full, 
	ifconfig,Found,1.42,full, 
	ip,Found,iproute2-ss080725,full, 
	ping,Found,iputils-sss20071127,full, 
	killall,Found,22.6,full, 
	kill,Found,3.2.7,full, 
	openvpn,Found,2.1_rc11,full, 
	openssl,Found,0.9.8g,full, 
	iptables,Found,v1.4.1.1,full, 
	setkey,Found,0.7.1,full, 
	openl2tpd,Found,No info,full, 
	xl2tpd,Found,xl2tpd-1.2.0,full, 
	l2tpd,Not found,No info,none, 
	pptp,Found,1.7.2,full, 
	pppd,Found,2.4.4,full, 
	ipsec,Found,strongSwan U4.2.4,full, 
	racoonctl,Found,No info,full, 
	vpnclient,Found,4.8.01 (0640),full, ] 


3. change current profile to hs_harz 
	dbus-send --session --type=method_call --print-reply=literal --dest=org.kde.kvpnc-1043 /kvpnc/MainWindow_1 org.kde.kvpnc.MainWindow_1.setProfile string:'hs_harz' 