| Home · All Classes · Annotated · Functions |
Qtopia 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.
Qtopia's 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. Two plug-ins are provided with Qtopia:
Unfortunately there is no common way how Linux distributions handle the configuration of network devices. To accomodate for this case Qtopia's 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 Qtopia to write its configuration to device specific configuration files. By default, Qtopia 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 Qtopia 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 recieves data in packets rather than via a continuous channel.
Qtopia 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 Qtopia phone library and hence uses a slightly different approach.
Network::createServer(s);
File location: $QPEDIR/src/server/main.cpp
void QtopiaNetwork::createServer(QObject* parent)
{
if ( !netServer )
netServer = new QtopiaNetworkServer(parent);
}
File location: $QPEDIR/src/libraries/qtopia/qtopianetwork.cpp.
void startInterface(...)
QtopiaNetworkServer::activateInterface(config)
QtopiaNetworkInterface* plugin = QtopiaNetwork::loadPlugin(config);
plugin->status()
plugin->start(...);
DialupImpl::start(...)
QPPPdOptions pppd;
pppd.setConnectScript( connect-chat );
pppd.setDisconnectScript( disconnect-chat );
pppd.setArgs( <pppd cmd line args> );
...
PhoneLine line;
...
line.startData(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
Statement line.startData(...)
PhoneLineAt::startData(pppdOptions)
pppdManager->start(pppdOptions)
File location: $QPEDIR/src/libraries/qtopiaphone/qphoneat.cpp.
mux->channel( "data" )->run( pppdArgs, ... )
File location: $QPEDIR/src/libraries/qtopiaphone/qpppdmanager.cpp.
This connect script interacts with Qtopia via QCop messages to QPE/pppd
QPPPdManager::pppdListen(...)
handles the message. It executes the connect chat and diverts all incomming packages to pppd.
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 Qtopia:
Starts pppd using the given cmd line arguments. This call requires installed peers files (see install option) and is called by Qtopia 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 Qtopia 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 LAN plug-in makes use of the following keys in the Network Service configuration file.
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 Qtopia:
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 Qtopia 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 Qtopia requires that the user enters the IP details manually. This parameter writes the detailsi 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.
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 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 devices network interfaces should either use QtopiaNetwork::startOnline(). If more detailed information are required an application can either use the QNetworkState class or it can subscribe to the channel QPE/NetworkState. Please note that the QPE/NetworkState channel is obsolete and will be removed in future releases of Qtopia. The QPE/NetworkState channel supports the following messages which provide information about the state of each individual interface:
If the network server receives this message, it will iterate through the list of known interfaces and collects their state. The result is posted on the QPE/NetworkState channel.
The list contains all network interfaces which are condidered to be online at the time (represented by their configuration file). If the device is offline the down() message is sent instead.
This message is sent whenever the state of the network changes from Offline to Online.
This message is sent whenever the state of the network changes from Online to Offline or available(QStringList) is empty.
This message is sent when the default gateway for tcp packages changes. The string parameter is a pointer to the interface which acts as default gateway.
This message whenever WAP settings may have changed.
Please see $QPEDIR/src/libraries/qtopia/qtopianetwork.cpp for implementation details.
Qtopia 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
Qtopia 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 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 Qtopia's 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 © 2006 Trolltech | Trademarks | Qtopia 4.1.7 |