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

WvInterface Class Reference

#include <wvinterface.h>

Collaboration diagram for WvInterface:

[legend]
List of all members.

Detailed Description

A WvInterface manages a particular network interface.

It is _allowed_ to have more than one WvInterface instance referring to the same physical interface, because that is more convenient.

Definition at line 24 of file wvinterface.h.

Public Member Functions

 WvInterface (WvStringParm _name)
 ~WvInterface ()
void rescan ()
 forget all stored information about the address(es) of this interface
const WvAddr & hwaddr ()
 get the hardware address of this interface
const WvIPNet & ipaddr ()
 get the local IP net of this interface
const WvIPAddr dstaddr ()
 get the point-to-point IP address of this interface
int getflags ()
 get the current kernel flags
int setflags (int clear, int set)
 toggle kernel flags on this netdevice.
bool isup ()
 set the interface state up or down.
void up (bool enable)
bool ispromisc ()
 turn promiscuous (see-all-packets) mode on or off.
void promisc (bool enable)
int setipaddr (const WvIPNet &addr)
 Sets the local address, netmask, and broadcast of this interface and set a route to the local net.
int setmtu (int mtu)
 Sets the MTU of the interface.
int sethwaddr (const WvAddr &addr)
 Set the hardware address of this interface.
int addroute (const WvIPNet &dest, int metric=0, WvStringParm table="default")
 add a route to the given network through this interface.
int addroute (const WvIPNet &dest, const WvIPAddr &gw, const WvIPAddr &src, int metric=0, WvStringParm table="default")
int delroute (const WvIPNet &dest, int metric=0, WvStringParm table="default")
 delete a route to the given network through this interface.
int delroute (const WvIPNet &dest, const WvIPAddr &gw, int metric=0, WvStringParm table="default")
bool isarp ()
 add an ARP entry on this interface
int addarp (const WvIPNet &proto, const WvAddr &hw, bool proxy)
int req (int ioctl_num, struct ifreq *ifr)
 get/set information about an interface
int req (int ioctl_num, struct iwreq *ifr)
 get/set information about a wireless interface

Public Attributes

WvString name
bool valid


Constructor & Destructor Documentation

WvInterface::WvInterface (  WvStringParm  _name  ) 
 

Definition at line 31 of file wvinterface.cc.

References valid, and WvStringParm.

WvInterface::~WvInterface (   ) 
 

Definition at line 39 of file wvinterface.cc.

References rescan().


Member Function Documentation

int WvInterface::addarp (  const WvIPNet &  proto,
const WvAddr &  hw,
bool  proxy
) 
 

Definition at line 516 of file wvinterface.cc.

References ATF_COM, ATF_NETMASK, ATF_PERM, ATF_PUBL, WvIPNet::is_host(), min, name, WvIPNet::netmask(), WvIPNet::network(), WvLog::perror(), WvAddr::sockaddr(), WvIPAddr::sockaddr(), WvAddr::sockaddr_len(), and WvIPAddr::sockaddr_len().

int WvInterface::addroute (  const WvIPNet &  dest,
const WvIPAddr &  gw,
const WvIPAddr &  src,
int  metric = 0,
WvStringParm  table = "default"
) 
 

Definition at line 422 of file wvinterface.cc.

References delroute(), and WvStringParm.

int WvInterface::addroute (  const WvIPNet &  dest,
int  metric = 0,
WvStringParm  table = "default"
) 
 

add a route to the given network through this interface.

Definition at line 449 of file wvinterface.cc.

References WvStringParm.

int WvInterface::delroute (  const WvIPNet &  dest,
const WvIPAddr &  gw,
int  metric = 0,
WvStringParm  table = "default"
) 
 

Definition at line 456 of file wvinterface.cc.

References WvSubProc::estatus, WvIPNet::is_default(), name, WvLog::perror(), WvSubProc::startv(), WvSubProc::wait(), and WvStringParm.

int WvInterface::delroute (  const WvIPNet &  dest,
int  metric = 0,
WvStringParm  table = "default"
) 
 

delete a route to the given network through this interface.

Definition at line 509 of file wvinterface.cc.

References WvStringParm.

Referenced by addroute().

const WvIPAddr WvInterface::dstaddr (   ) 
 

get the point-to-point IP address of this interface

Definition at line 130 of file wvinterface.cc.

References getflags(), and req().

int WvInterface::getflags (   ) 
 

get the current kernel flags

Definition at line 141 of file wvinterface.cc.

References req(), and valid.

Referenced by dstaddr(), isarp(), ispromisc(), and isup().

const WvAddr & WvInterface::hwaddr (   ) 
 

get the hardware address of this interface

Definition at line 95 of file wvinterface.cc.

References WvAddr::gen(), and req().

Referenced by WvInterfaceDict::islocal(), and WvInterfaceDict::update().

const WvIPNet & WvInterface::ipaddr (   ) 
 

get the local IP net of this interface

Definition at line 111 of file wvinterface.cc.

References req().

Referenced by WvInterfaceDict::islocal(), WvInterfaceDict::on_local_net(), and setipaddr().

bool WvInterface::isarp (   ) 
 

add an ARP entry on this interface

Definition at line 558 of file wvinterface.cc.

References getflags().

bool WvInterface::ispromisc (   ) 
 

turn promiscuous (see-all-packets) mode on or off.

Definition at line 189 of file wvinterface.cc.

References getflags().

bool WvInterface::isup (   ) 
 

set the interface state up or down.

Definition at line 177 of file wvinterface.cc.

References getflags(), and valid.

Referenced by WvInterfaceDict::on_local_net(), and sethwaddr().

void WvInterface::promisc (  bool  enable  ) 
 

Definition at line 183 of file wvinterface.cc.

References setflags().

int WvInterface::req (  int  ioctl_num,
struct iwreq *  ifr
) 
 

get/set information about a wireless interface

Definition at line 61 of file wvinterface.cc.

References name.

int WvInterface::req (  int  ioctl_num,
struct ifreq *  ifr
) 
 

get/set information about an interface

Definition at line 45 of file wvinterface.cc.

References name.

Referenced by dstaddr(), getflags(), hwaddr(), ipaddr(), setflags(), sethwaddr(), and setmtu().

void WvInterface::rescan (   ) 
 

forget all stored information about the address(es) of this interface

Definition at line 78 of file wvinterface.cc.

Referenced by sethwaddr(), setipaddr(), up(), WvInterfaceDict::update(), and ~WvInterface().

int WvInterface::setflags (  int  clear,
int  set
) 
 

toggle kernel flags on this netdevice.

Be careful!

Definition at line 151 of file wvinterface.cc.

References name, WvLog::perror(), and req().

Referenced by promisc(), and up().

int WvInterface::sethwaddr (  const WvAddr &  addr  ) 
 

Set the hardware address of this interface.

Returns 0 on success, else an error code.

Definition at line 274 of file wvinterface.cc.

References isup(), name, WvLog::perror(), req(), rescan(), WvAddr::sockaddr(), WvAddr::sockaddr_len(), and up().

int WvInterface::setipaddr (  const WvIPNet &  addr  ) 
 

Sets the local address, netmask, and broadcast of this interface and set a route to the local net.

Returns 0 on success, else an error code.

Definition at line 195 of file wvinterface.cc.

References WvIPNet::base(), WvIPNet::bits(), WvIPNet::broadcast(), ipaddr(), min, name, WvIPNet::netmask(), WvLog::perror(), rescan(), WvIPAddr::sockaddr(), and WvIPAddr::sockaddr_len().

int WvInterface::setmtu (  int  mtu  ) 
 

Sets the MTU of the interface.

Returns 0 on success, else an error code.

Definition at line 263 of file wvinterface.cc.

References name, WvLog::perror(), and req().

void WvInterface::up (  bool  enable  ) 
 

Definition at line 170 of file wvinterface.cc.

References rescan(), and setflags().

Referenced by sethwaddr().


Member Data Documentation

WvString WvInterface::name
 

Definition at line 41 of file wvinterface.h.

Referenced by addarp(), delroute(), req(), setflags(), sethwaddr(), setipaddr(), and setmtu().

bool WvInterface::valid
 

Definition at line 42 of file wvinterface.h.

Referenced by getflags(), WvInterfaceDict::islocal(), isup(), WvInterfaceDict::on_local_net(), WvInterfaceDict::update(), and WvInterface().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 15:08:19 2004 for WvStreams by  doxygen 1.3.9.1