Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
Qt Extended Network Services are defined by files that allow the configuration of Linux system networking services. Once the Network Service is defined the user customizes and starts the Network Service they require via using the Internet Settings application.
The Qt Extended network support can be configured via Network configuration files in $HOME/Applications/Network/config. The structure and type of these configuration files determines the type of the network.
The following keys are generic to all network types:
The QtopiaNetworkInterface class defines the general interface for plug-ins. The following plug-ins are provided by Qt Extended:
Unfortunately there is no common way how Linux distributions handle the configuration of network devices. To accomodate for this case the Qt Extended network configuration is split into two parts. Each network plug-in handles the generation of configuration parameters and then passes the information on to a network script called <type>-network. This script must be implementated by device integrators in order to enable Qt Extended to write its configuration to device specific configuration files. By default, Qt Extended provides network script for busybox and SuSE v9.3 systems. If none of the provided scripts is suitable for the target device the template scripts in the plug-in directories can be used as a starting point for new scripts.
The network scripts need root permissions. If Qt Extended is started without root permissions a combination of sudo and setuid bit must be used.
The Dialup plug-in:
The Dialup plug-in makes use of keys in the Network Service configuration file. For further information refer to pppd documentation or the pppd man page.
In addition to the network configuration file each dial-up interface is associated with a couple of files which guide the dial-up process or give reports about the state of the connection.
General Packet Radio Service (GPRS) is a GSM data transmission technique that transmits and receives data in packets rather than via a continuous channel.
Qt Extended uses the Dialup network plug-in to establishing a connection see : $QPEDIR/src/plugins/networking/dialing/
In the ideal case
An outline of the mechanism to establish a GPRS connection is provided in the following section. It is assumed that the application Setting->Internet has been used to create a valid GPRS configuration. The following code walkthrough applies to connections which are established via the internal phone modem only. Any other type of serial connection (e.g. via PCMCIA modem cards) does not use the Qt Extended phone library and hence uses a slightly different approach.
QtopiaNetwork::startInterface( ifaceHandle, param )
which sends a QCop message on the QPE/Network channel. The param parameter is optional and can be used to pass additional startup parameter to the network plug-in. Note that not all network plug-ins support additional parameter and will simply ignore them.
QtopiaNetworkServer::activateInterface( appName, ifaceHandle, options )
The appName represents the name of the application that requested the start of the interface. This information is used for network session management.
QtopiaNetworkInterface* plugin = QtopiaNetwork::loadPlugin( ifaceHandle ); plugin->status() plugin->start( param );
QDialOptions pppd; pppd.setIpModule( true ); pppd.setIpProgramName( "/sbin/sbin/pppd" ); pppd.setIpConnectScript( connect-chat ); pppd.setIpDisconnectScript( disconnect-chat ); pppd.setIpDemandDialing( ... ); pppd.setIpArgs( pppdArgs ); ... QPhoneCall dataCall = callManager->create("IP"); dataCall.dial( pppd );
If the serial network device is an external device, the Dialup plug-in will directly start pppd directly by calling
QProcess::execute(Qtopia::qtopiaDir()+"bin/ppp-network", pppdArgs)
File location: $QPEDIR/src/plugins/network/dialing/dialup.cpp
pppdManager->start( dataCall )
File location: $QPEDIR/src/libraries/qtopiaphone/qpppdmanager.cpp.
For detailed description of pppd, please refer to man pppd.
By default the Dialup plug-in uses the following minimal dial string for GPRS connections:
dialstring = "AT+CGDCONT=1,\"IP\",\"" + <provider APN> + "\"" + " OK " "AT+CGATT=1 OK " "OK ATD*99***1#";
This string is not necessarily suitable for all modems. If a GPRS data connection cannot be started this string has to be adjusted to the requirements of the particular modem. It may be necessary to contact the modem manufacturer to determine the dial string that should be used. The dialstring can be customized in $QPEDIR/src/plugins/network/dialing/dialstring.cpp.
The dial-up plug-in uses the system dependent configuration script ppp-network. This script must be provided by system integrators. Whenever the dial-up plug-in requests a system dependent operation it calls ppp-network. It must support the following interface/command line options in order to allow interaction with Qt Extended:
Starts pppd using the given cmd line arguments. This call requires installed peers files (see install option) and is called by Qt Extended whenever the user whishes to initiate the pppd connection.
Stops the pppd process that is responsible for the given interface (e.g. ppp0)
In general this option is called when the user makes some adjustments to the interface configuration. By using this option Qt Extended ensures that the underlying system configuration reflects these adjustments.
Installs the given peer file to /etc/ppp/peers.
DNS1 and DNS2 are installed as first and secondary DNS server. If no IP address is passed it is implied that DHCP must be used to obtain the DNS server addresses. This function called when a new interface comes online or when an explicit change of the default gateway has been requested.
Deletes <peerfile>.
Reverts any DNS changes.
PPP_IFACE becomes the default gateway for packages. Any existing default route will be implicitly removed.
The LAN plug-in:
If wireless support is not required the define NO_WIRELESS_LAN can be used to exclude the feature (see Hardware Configuration).
The (W)LAN plug-in makes use of the following keys in the Network Service configuration file. Please note that these entries are stored using QSettings' read/write array support (QSettings::beginReadArray()).
In addition to these fields the WirelessNetworks group can contain the following entries which are the same for all wireless networks. There main purpose is to determine the roaming behavior.
The lan plug-in uses the system dependent network script lan-network. This script must be provided by system integrators. Whenever the lan plug-in requests a system dependent operation it calls ppp-network. It must support the following interface/command line options in order to allow interaction with Qt Extended:
IFACE is the name of the network interface. Typical interface names are wlan0 or eth1.
This option is called when the user makes some adjustments to the interface configuration. By using this option Qt Extended ensures that the underlying system configuration reflects these adjustments. If a configuration for IFACE already exists, this command must override the existing values. This option is only called when the configuration changes. Therefore it must store these values to the appropriate configuration files so that any following start command for IFACE can be executed without further config changes.
This parameter supports the following subparameter:
DNS1 and DNS2 are installed as first and secondary DNS server. If no IP address is passed it is implied that DHCP must be used to obtain the DNS server addresses. This function called when a new interface comes online or when an explicit change of the default gateway has been requested.
The IP, subnet mask, broadcast address and the gateway must be obtained via dhcp.
If no DHCP is used Qt Extended requires that the user enters the IP details manually. This parameter writes the details out to the system configuration.
The wireless option is used to pass wireless LAN details. The parameter is made up of a combination of the following options:
ESSID of the WLAN to be used.
This parameter specifies the mode of the WLAN connection.
MAC is the MacAddress of the access point that the user wants to connect to.
BITRATE represents the bit rate which should be used for the connection. The unit for this value is MBit.
NICKNAME is the nick name for the WLAN.
CHANNEL is used by Ad-Hoc networks or Master devices only. If CHANNEL is zero and automatic value is requested.
The length of the WEP key in bit. If the encryption mechanism is not WEP this parameter can be ignored.
AUTHPARAM can be one of the following parameter:
The wireless lan uses KEY1 to KEY4 for open/shared WEP encryption. DEFAULTKEY is a value between 1 and 4.
The WLAN uses open/shared WEP encruption with a passphrase.
The WLAN uses open/shared WEP encryption without any password.
The WLAN uses WPA-PSK as encryption. PASSWORD is used for the encryption algorithm. The last parameter determines what encryption algorithm is chosen. This determines whether WPA-PSK or WPA-PSK2 is used.
The WLAN uses WPA-EAP as encryption. The authentication is done via TLS.
The WLAN uses WPA-EAP as encryption. The authentication is done via either PEAP or TTLS.
This command stops the running interface with name IFACE.
This command starts the actual interface. It cann be assumed the the neccessary configuration options for IFACE have been written to the appropriate files as the LAN plug-in always ensures that install has been called prior to start.
This command is used when the user deletes a network interface. It may be used to cleanup some configuration files. However since the install option overides any existing configuration it is not absolutely necessary to provide an implementation for this command.
IFACE becomes the default gateway for packages. Any existing default route will be implicitly removed.
The Bluetooth dial-up plug-in:
Note that this plug-in only provides the client side of Bluetooth dial-up network. the Qt Extended Bluetooth dial-up networking server is provides by a separate server task.
The Bluetooth dial-up network script is called btdun-network and is almost identical to the dialup network script.
The Dialup and LAN plug-ins share a proxies page. The settings for this page are defined in the configuration as:
Applications which are interested in the state of network interfaces should use QtopiaNetwork::online(). If more detailed information are required an application can use the QNetworkState or QNetworkDevice classes.
In order to integrate new plugins into the QNetworkState/QNetworkDevice monitoring system a few requirements must be fulfilled. Each interface must post its state transitions into the network value space. The network value space for a plugin can be found under /Network/Interfaces/<ident>. <ident> is the hash value of the interface handle associated with the particular instance of the plugin. The following entries must be published by the plugin:
Qt Extended stores WAP settings in $HOME/Applications/Network/wap. Every WAP related application must use these configuration settings. They have several groups, with the following keys:
The Info group provides a short summary of the WAP profile.
General settings for browser applications. Any custom implementation of a WAP browser must comply with these settings.
MMS server details
WAP server details
The QWapAccount class may be used as an alternative to directly reading the configuration files.
Qt Extended can handle OTA network configuration messages. These messages contain details like WAP/MMS server and login details. Every received message is handled by the Internet Settings application and will eventually be stored as a WAP/Internet configuration file.
The Qt Extended network server provides a session manager. This is used to ensure that a network interface is shutdown when there is no need for it. If an application starts a network interface the interface will remain active for the life time of the application. This means that network interfaces are stopped if an application crashes or quits. If two applications were to request the same interface the interface will stay active until the last application closes.
To cater for more flexibility the network server can extend the session life time beyond the life time of applications. By default every interface which has been started manually will remain active until it is turned off by the user or the interface times out (e.g. timeout on pppd sessions).
The dial-up process uses chat files. These chat files may need some customization in order to work flawless with particular modems. The chat files are stored in $HOME/Applications/Network/chat. Each interface has a connect and a disconnect chat file. The following two chat files represent rather generic chat files for a GPRS connection.
ABORT "NO CARRIER" ABORT "NO DIALTONE" ABORT BUSY # Change the word internet to the name of your providers APN "" "AT+CGDCONT=1,\"IP\",\"internet\"" OK "AT+CGATT=1" OK "ATDT*99***1#"
\d+++\d\c OK ATH0 OK
#!/bin/sh # # Start a pppd session via GPRS # # Usage: # startpppd.sh [PPP peer to call] # # The following notes apply to the pppd options used. See the pppd man page for more details # ttyS0 : change to the device that modem is connected to # 115200 : lower modem speed if required # noipdefault: pppd must not propose any IP address to the peer! # ipcp-accept-local : Accept peers idea of our local address # modem : use modem control lines; change modem to local if required # novj : Disable all compression # record /tmp/ppp-all-text.log : record all traffic to file shown set -x if [ -z "$1" ]; then /usr/sbin/pppd \ ttyS0 \ 115200 \ connect 'chat -s -v -f connect-chat' \ disconnect 'chat -s -v -- -f disconnect-chat' \ crtscts \ defaultroute \ replacedefaultroute \ noipdefault \ ipcp-accept-local \ modem \ usepeerdns \ demand \ connect-delay 5000 \ idle 120 \ nodetach \ lcp-echo-failure 0 \ lcp-echo-interval 0 \ novj \ nobsdcomp \ novjccomp \ nopcomp \ noaccomp \ debug else # call the specified peer /usr/sbin/pppd call $1 \ connect 'chat -s -v -f connect-chat' \ disconnect 'chat -s -v -- -f disconnect-chat' \ record /tmp/ppp-all-text.log \ debug fi
In order to activate the Qt Extended internal network logging facilities you may have to edit $QPEDIR/etc/default/Trolltech/Log.conf or $HOME/Settings/Trolltech/Log.conf. For network debugging you may enable Network and AtChat logging.
By default a packet size of 1500 will be used by pppd for GPRS traffic. In cases of poor signal quality it may be necessary to decrease the "mru" and "mtu" packet size being used by pppd, to for 512. See the pppd man page for details on setting mru and mtu values.
debug record /tmp/ppp-all-text.log
ping 216.239.39.99
The following can help to isolate any GPRS issues.
Run the following commands to ping local and non-local resources:
ping <some IP address on your local network> ping 66.102.7.99 ping <some host on your local network> ping www.google.com
It might be necessary to specify the network interface that the ping command should use. If you have more than one network interface and suspect routing issues use:
ping -I <iface-name> <host>
If one or less of the above tests fail then provide the output of the following commands :
/sbin/ifconfig -a /sbin/ifstatus eth0 /sbin/route cat /etc/resolv.conf cat /etc/ppp/resolv.conf
If you have a firewall in use, check that the route uses the correct gateway address and that the firewall is not blocking IP traffic from the device. Lastly it may helpful to compare the results of running the above commands with results given by running the same commands on a development machine.
If support is needed please ensure that your support request contains the following items:
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |