Qt API | Qtopia API | Qtopia Documentation |

# NetworkInterface Class Reference

The NetworkInterface class allows plugin network services. More...

`#include <qtopia/networkinterface.h>`

List of all member functions.

## Public Members

- virtual bool doProperties ( QWidget * parent, Config & cfg ) = 0
- virtual bool create ( Config & cfg ) = 0
- virtual bool remove ( Config & ) = 0
- virtual QString device ( Config & cfg ) const
- virtual QString cardType ( Config & cfg ) const
- virtual bool isActive ( Config & cfg ) const
- virtual bool isAvailable ( Config & cfg ) const
- virtual bool start ( Config & cfg ) = 0
- virtual bool start ( Config & cfg, const QString & password )
- virtual bool stop ( Config & cfg ) = 0
- virtual bool needPassword ( Config & cfg ) const
- virtual QWidget * addStateWidget ( QWidget * parent, Config & cfg ) const

## Detailed Description

The NetworkInterface class allows plugin network services.

The Qtopia Network facilities are defined by the configurations in the Qtopia etc/network/ directory. For example, the generic DialUp.conf configuration looks like this (the actual file is encoded in UTF-8):

    [Info]
    Name = Dial-up - PPP
    Type = dialup
    Layer = TCP/IP
    [Help]
    Help = For dial-up connections through a modem and plain telephone line.
    Help[de] = Für Wählverbindungen mit Modem und Telefon.
    [Properties]
    Auto = 0
    Device = ppp
    CardType = serial

To add a network service that is merely a specific dialup service, you need only provide another configuration files, for example:

    [Info]
    Name = SuperNet ISP
    Type = dialup
    Layer = TCP/IP
    [Help]
    Help = Connect to your local SuperNet(tm) point-of-presence.
    [Properties]
    Auto = 0
    Device = ppp
    CardType = serial
    password = secret
    phone = 555555555
    speed = 115200
    username = customer

However, to add a service beyond the scope of the existing services, you can define your own network service Type, by creating a NetworkInterface plugin.

## Member Function Documentation

### QWidget * NetworkInterface::addStateWidget ( QWidget * parent, Config & cfg ) const`[virtual]`

Returns a widget, with parent as its parent, that shows the state of the network service defined by cfg.

By default, 0 is returned (no state widget).

### QString NetworkInterface::cardType ( Config & cfg ) const`[virtual]`

Returns the pcmcia card type associated with this service.

By default, the Properties.CardType value in cfg is returned.

### bool NetworkInterface::create ( Config & cfg )`[pure virtual]`

Performs any system state changes required for the network service defined by cfg. This is called only when the service is first added by the user.

### QString NetworkInterface::device ( Config & cfg ) const`[virtual]`

Returns the network device which is used for the connection.

By default, the Properties.Device value in cfg is returned.

### bool NetworkInterface::doProperties ( QWidget * parent, Config & cfg )`[pure virtual]`

Prompts the user to manipulate the properties of the network service defined by cfg, using a modal dialog which has the given parent. Returns TRUE on success, of FALSE if the user cancels the interaction.

### bool NetworkInterface::isActive ( Config & cfg ) const`[virtual]`

Returns TRUE if the service defined by cfg is active.

By default, the device() is searched for in /proc/net/dev.

### bool NetworkInterface::isAvailable ( Config & cfg ) const`[virtual]`

Returns TRUE is the network service defined by cfg is available to be started.

By default, the cardType() is searched for in the system pcmcia tables.

### bool NetworkInterface::needPassword ( Config & cfg ) const`[virtual]`

Returns TRUE if the network service defined by cfg requires a password.

### bool NetworkInterface::remove ( Config & )`[pure virtual]`

Reverts any system state changes made in create().

### bool NetworkInterface::start ( Config & cfg )`[pure virtual]`

Starts the network service defined by cfg, returning TRUE on success.

There is no default implementation.

### bool NetworkInterface::start ( Config & cfg, const QString & password )`[virtual]`

Starts the network service defined by cfg, using the given password, returning TRUE on success.

By default, the start() method without a password is called.

### bool NetworkInterface::stop ( Config & cfg )`[pure virtual]`

Stops the network service defined by cfg, returning TRUE on success.

There is no default implementation.

This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.