Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Opie::Net::ONetworkInterface Class Reference

A network interface wrapper. More...

#include </home/clem/local/src/opie/libopie2/opienet/onetwork.h>

Inheritance diagram for Opie::Net::ONetworkInterface:

Inheritance graph
[legend]
Collaboration diagram for Opie::Net::ONetworkInterface:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ONetworkInterface (QObject *parent, const char *name)
virtual ~ONetworkInterface ()
void setMonitoring (OMonitoringInterface *monitoring)
OMonitoringInterfacemonitoring () const
bool setPromiscuousMode (bool)
bool promiscuousMode () const
bool setUp (bool)
bool isUp () const
bool isLoopback () const
bool isWireless () const
void setIPV4Address (const QHostAddress &addr)
OHostAddress ipV4Address () const
void setMacAddress (const OMacAddress &addr)
OMacAddress macAddress () const
void setIPV4Netmask (const QHostAddress &netmask)
OHostAddress ipV4Netmask () const
int dataLinkType () const
ONetworkInterfaceDriverInfo driverInfo () const

Protected Member Functions

ifreq & ifr () const
virtual void init ()
bool ioctl (int call) const
bool ioctl (int call, struct ifreq &) const

Protected Attributes

const int _sfd
ifreq _ifr
OMonitoringInterface_mon

Private Attributes

Private * d

Friends

class OMonitoringInterface
class OCiscoMonitoringInterface
class OWlanNGMonitoringInterface
class OHostAPMonitoringInterface
class OOrinocoMonitoringInterface

Detailed Description

A network interface wrapper.

This class provides a wrapper for a network interface. All the cumbersume details of Linux ioctls are hidden under a convenient high-level interface.

Warning:
Most of the setting methods contained in this class require the appropriate process permissions to work.
Author:
Michael 'Mickey' Lauer <mickey@vanille.de>

Definition at line 141 of file onetwork.h.


Constructor & Destructor Documentation

Opie::Net::ONetworkInterface::ONetworkInterface QObject *  parent,
const char *  name
 

Constructor. Normally you don't create ONetworkInterface objects yourself, but access them via ONetwork::interface().

Definition at line 182 of file onetwork.cpp.

References init(), odebug, and oendl.

Opie::Net::ONetworkInterface::~ONetworkInterface  )  [virtual]
 

Destructor.

Definition at line 338 of file onetwork.cpp.

References _sfd, odebug, and oendl.


Member Function Documentation

int Opie::Net::ONetworkInterface::dataLinkType  )  const
 

Returns:
the data link type currently associated with the interface.
See also:
#include <net/if_arp.h> for possible values.

Definition at line 312 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by Opie::Net::OWirelessNetworkInterface::mode().

ONetworkInterfaceDriverInfo Opie::Net::ONetworkInterface::driverInfo  )  const
 

Returns:
a ONetworkInterfaceDriverInfo driver information block
Note:
This operation needs root privileges
Warning:
This is not supported by all drivers

Definition at line 367 of file onetwork.cpp.

References _ifr, and ioctl().

struct ifreq & Opie::Net::ONetworkInterface::ifr  )  const [protected]
 

Definition at line 191 of file onetwork.cpp.

References _ifr.

void Opie::Net::ONetworkInterface::init  )  [protected, virtual]
 

Reimplemented in Opie::Net::OWirelessNetworkInterface.

Definition at line 197 of file onetwork.cpp.

References _ifr, _sfd, name, odebug, and oendl.

Referenced by ONetworkInterface().

bool Opie::Net::ONetworkInterface::ioctl int  call,
struct ifreq & 
const [protected]
 

Definition at line 210 of file onetwork.cpp.

References _sfd, ioctl(), Opie::Net::Internal::DebugMapper::map(), name, odebug, and oendl.

bool Opie::Net::ONetworkInterface::ioctl int  call  )  const [protected]
 

Definition at line 227 of file onetwork.cpp.

References _ifr, and name.

Referenced by Opie::Net::OWirelessNetworkInterface::associatedAP(), Opie::Net::OWirelessNetworkInterface::buildInformation(), dataLinkType(), driverInfo(), ioctl(), ipV4Address(), ipV4Netmask(), isLoopback(), isUp(), isWireless(), macAddress(), promiscuousMode(), setIPV4Address(), setIPV4Netmask(), setMacAddress(), setPromiscuousMode(), setUp(), and Opie::Net::OWirelessNetworkInterface::wioctl().

OHostAddress Opie::Net::ONetworkInterface::ipV4Address  )  const
 

Returns:
the IPv4 address associated with the interface.

Definition at line 267 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by IfaceIPAddress::IfaceIPAddress(), IfaceIPAddress::returnPressed(), and OpieStumbler::slotCheckDHCP().

OHostAddress Opie::Net::ONetworkInterface::ipV4Netmask  )  const
 

Returns:
the IPv4 netmask associated with the interface.

Definition at line 305 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by IfaceIPAddress::returnPressed().

bool Opie::Net::ONetworkInterface::isLoopback  )  const
 

Returns:
true if the interface is a loopback interface.

Definition at line 234 of file onetwork.cpp.

References _ifr, and ioctl().

bool Opie::Net::ONetworkInterface::isUp  )  const
 

Returns:
true if the interface is up.

Definition at line 250 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by IfaceUpDownButton::clicked().

bool Opie::Net::ONetworkInterface::isWireless  )  const
 

Returns:
true if the interface is featuring supports the wireless extension protocol.

Definition at line 361 of file onetwork.cpp.

References ioctl().

Referenced by Wellenreiter::Wellenreiter().

OMacAddress Opie::Net::ONetworkInterface::macAddress  )  const
 

Returns:
the MAC address associated with the interface.

Definition at line 282 of file onetwork.cpp.

References _ifr, ioctl(), and Opie::Net::OMacAddress::unknown.

OMonitoringInterface * Opie::Net::ONetworkInterface::monitoring  )  const
 

Returns:
the currently associated monitoring interface or 0, if no monitoring is associated.

Definition at line 332 of file onetwork.cpp.

References _mon.

bool Opie::Net::ONetworkInterface::promiscuousMode  )  const
 

Returns:
true if the interface is set to promiscuous mode.

Definition at line 354 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by Wellenreiter::Wellenreiter().

void Opie::Net::ONetworkInterface::setIPV4Address const QHostAddress &  addr  ) 
 

Associate the IP address @ addr with the interface.

Definition at line 257 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by IfaceIPAddress::returnPressed().

void Opie::Net::ONetworkInterface::setIPV4Netmask const QHostAddress &  netmask  ) 
 

Associate the IPv4 netmask with the interface.

Definition at line 295 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by IfaceIPAddress::returnPressed().

void Opie::Net::ONetworkInterface::setMacAddress const OMacAddress addr  ) 
 

Associate the MAC address addr with the interface.

Note:
It can be necessary to shut down the interface prior to calling this method.

This operation needs root privileges

Warning:
This is not supported by all drivers.

Definition at line 274 of file onetwork.cpp.

References _ifr, ioctl(), and Opie::Net::OMacAddress::native().

void Opie::Net::ONetworkInterface::setMonitoring OMonitoringInterface monitoring  ) 
 

Associates a monitoring interface with this network interface.

Note:
This is currently only useful with OWirelessNetworkInterface objects.

Definition at line 325 of file onetwork.cpp.

References _mon, name, odebug, and oendl.

Referenced by Opie::Net::OCiscoMonitoringInterface::OCiscoMonitoringInterface(), Opie::Net::OHostAPMonitoringInterface::OHostAPMonitoringInterface(), Opie::Net::OOrinocoMonitoringInterface::OOrinocoMonitoringInterface(), Opie::Net::OWlanNGMonitoringInterface::OWlanNGMonitoringInterface(), and Wellenreiter::startClicked().

bool Opie::Net::ONetworkInterface::setPromiscuousMode bool   ) 
 

Setting an interface to promiscuous mode enables the device to receive all packets on the shared medium - as opposed to packets which are addressed to this interface.

Definition at line 345 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by Wellenreiter::stopClicked(), and Wellenreiter::Wellenreiter().

bool Opie::Net::ONetworkInterface::setUp bool   ) 
 

Setting an interface to up enables it to receive packets.

Definition at line 241 of file onetwork.cpp.

References _ifr, and ioctl().

Referenced by IfaceUpDownButton::clicked(), OpieStumbler::slotJoinNetwork(), and Stumbler::start().


Friends And Related Function Documentation

friend class OCiscoMonitoringInterface [friend]
 

Reimplemented in Opie::Net::OWirelessNetworkInterface.

Definition at line 144 of file onetwork.h.

friend class OHostAPMonitoringInterface [friend]
 

Reimplemented in Opie::Net::OWirelessNetworkInterface.

Definition at line 146 of file onetwork.h.

friend class OMonitoringInterface [friend]
 

Reimplemented in Opie::Net::OWirelessNetworkInterface.

Definition at line 143 of file onetwork.h.

friend class OOrinocoMonitoringInterface [friend]
 

Reimplemented in Opie::Net::OWirelessNetworkInterface.

Definition at line 147 of file onetwork.h.

friend class OWlanNGMonitoringInterface [friend]
 

Reimplemented in Opie::Net::OWirelessNetworkInterface.

Definition at line 145 of file onetwork.h.


Member Data Documentation

ifreq Opie::Net::ONetworkInterface::_ifr [mutable, protected]
 

Definition at line 234 of file onetwork.h.

Referenced by Opie::Net::OWirelessNetworkInterface::associatedAP(), dataLinkType(), driverInfo(), ifr(), init(), ioctl(), ipV4Address(), ipV4Netmask(), isLoopback(), isUp(), macAddress(), promiscuousMode(), setIPV4Address(), setIPV4Netmask(), setMacAddress(), setPromiscuousMode(), and setUp().

OMonitoringInterface* Opie::Net::ONetworkInterface::_mon [protected]
 

Definition at line 235 of file onetwork.h.

Referenced by monitoring(), Opie::Net::OWirelessNetworkInterface::setChannel(), Opie::Net::OWirelessNetworkInterface::setMode(), and setMonitoring().

const int Opie::Net::ONetworkInterface::_sfd [protected]
 

Definition at line 233 of file onetwork.h.

Referenced by Opie::Net::OWirelessNetworkInterface::buildInformation(), init(), ioctl(), Opie::Net::OWirelessNetworkInterface::wioctl(), and ~ONetworkInterface().

Private* Opie::Net::ONetworkInterface::d [private]
 

Reimplemented in Opie::Net::OWirelessNetworkInterface.

Definition at line 243 of file onetwork.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 18:01:37 2005 for OPIE by  doxygen 1.4.2