Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

WvInterface Class Reference

#include <wvinterface.h>

List of all members.

Public Methods

 WvInterface (const WvString &_name)
 ~WvInterface ()
void rescan ()
const WvAddrhwaddr ()
const WvIPNetipaddr ()
const WvIPAddr dstaddr ()
int getflags ()
int setflags (int clear, int set)
bool isup ()
void up (bool enable)
bool ispromisc ()
void promisc (bool enable)
int setipaddr (const WvIPNet &addr)
int setmtu (int mtu)
int addroute (const WvIPNet &dest, int metric=0, const WvString &table="default")
int addroute (const WvIPNet &dest, const WvIPAddr &gw, int metric=0, const WvString &table="default")
int delroute (const WvIPNet &dest, int metric=0, const WvString &table="default")
int delroute (const WvIPNet &dest, const WvIPAddr &gw, int metric=0, const WvString &table="default")
bool isarp ()
int addarp (const WvIPNet &proto, const WvAddr &hw, bool proxy)
 WvInterface (const WvString &_name)
 ~WvInterface ()
void rescan ()
const WvAddrhwaddr ()
const WvIPNetipaddr ()
const WvIPAddr dstaddr ()
int getflags ()
int setflags (int clear, int set)
bool isup ()
void up (bool enable)
bool ispromisc ()
void promisc (bool enable)
int setipaddr (const WvIPNet &addr)
int setmtu (int mtu)
int addroute (const WvIPNet &dest, int metric=0, const WvString &table="default")
int addroute (const WvIPNet &dest, const WvIPAddr &gw, int metric=0, const WvString &table="default")
int delroute (const WvIPNet &dest, int metric=0, const WvString &table="default")
int delroute (const WvIPNet &dest, const WvIPAddr &gw, int metric=0, const WvString &table="default")
bool isarp ()
int addarp (const WvIPNet &proto, const WvAddr &hw, bool proxy)

Public Attributes

WvString name
bool valid

Private Methods

int getinfo (struct ifreq *ifr, int ioctl_num)
void fill_rte (struct rtentry *rte, char *ifname, const WvIPNet &dest, const WvIPAddr &gw, int metric)
int getinfo (struct ifreq *ifr, int ioctl_num)
void fill_rte (struct rtentry *rte, char *ifname, const WvIPNet &dest, const WvIPAddr &gw, int metric)

Private Attributes

WvAddrmy_hwaddr
WvIPNetmy_ipaddr
WvLog err
WvAddrmy_hwaddr
WvIPNetmy_ipaddr


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 21 of file include/wvinterface.h.


Constructor & Destructor Documentation

WvInterface::WvInterface const WvString   _name
 

Definition at line 28 of file wvinterface.cc.

References my_hwaddr, my_ipaddr, name, WvString::unique(), and valid.

WvInterface::~WvInterface  
 

Definition at line 37 of file wvinterface.cc.

References rescan().

WvInterface::WvInterface const WvString   _name
 

WvInterface::~WvInterface  
 


Member Function Documentation

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

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

Definition at line 471 of file wvinterface.cc.

References err, 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,
int    metric = 0,
const WvString   table = "default"
 

int WvInterface::addroute const WvIPNet   dest,
int    metric = 0,
const WvString   table = "default"
 

add a route to the given network through this interface.

int WvInterface::addroute const WvIPNet   dest,
const WvIPAddr   gw,
int    metric = 0,
const WvString   table = "default"
 

Definition at line 343 of file wvinterface.cc.

References WvLog::Debug2, err, WvSubProc::estatus, fill_rte(), WvIPNet::is_default(), isup(), name, WvLog::perror(), WvSubProc::startv(), and WvSubProc::wait().

int WvInterface::addroute const WvIPNet   dest,
int    metric = 0,
const WvString   table = "default"
 

add a route to the given network through this interface.

Definition at line 404 of file wvinterface.cc.

Referenced by WvIPRouteList::set_kernel().

int WvInterface::delroute const WvIPNet   dest,
const WvIPAddr   gw,
int    metric = 0,
const WvString   table = "default"
 

int WvInterface::delroute const WvIPNet   dest,
int    metric = 0,
const WvString   table = "default"
 

delete a route to the given network through this interface.

int WvInterface::delroute const WvIPNet   dest,
const WvIPAddr   gw,
int    metric = 0,
const WvString   table = "default"
 

Definition at line 411 of file wvinterface.cc.

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

int WvInterface::delroute const WvIPNet   dest,
int    metric = 0,
const WvString   table = "default"
 

delete a route to the given network through this interface.

Definition at line 464 of file wvinterface.cc.

Referenced by WvIPRouteList::set_kernel().

const WvIPAddr WvInterface::dstaddr  
 

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

const WvIPAddr WvInterface::dstaddr  
 

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

Definition at line 110 of file wvinterface.cc.

References getflags(), and getinfo().

void WvInterface::fill_rte struct rtentry *    rte,
char *    ifname,
const WvIPNet   dest,
const WvIPAddr   gw,
int    metric
[private]
 

used by addroute()/delroute()

void WvInterface::fill_rte struct rtentry *    rte,
char *    ifname,
const WvIPNet   dest,
const WvIPAddr   gw,
int    metric
[private]
 

used by addroute()/delroute()

Referenced by addroute(), and delroute().

int WvInterface::getflags  
 

get the current kernel flags

int WvInterface::getflags  
 

get the current kernel flags

Definition at line 120 of file wvinterface.cc.

References name, and valid.

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

int WvInterface::getinfo struct ifreq *    ifr,
int    ioctl_num
[private]
 

get/set information about an interface

int WvInterface::getinfo struct ifreq *    ifr,
int    ioctl_num
[private]
 

get/set information about an interface

Definition at line 43 of file wvinterface.cc.

References name.

Referenced by dstaddr(), hwaddr(), and ipaddr().

const WvAddr& WvInterface::hwaddr  
 

get the hardware address of this interface

const WvAddr & WvInterface::hwaddr  
 

get the hardware address of this interface

Definition at line 76 of file wvinterface.cc.

References WvAddr::gen(), getinfo(), my_hwaddr, and WvEncap::Unknown.

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

const WvIPNet& WvInterface::ipaddr  
 

get the local IP net of this interface

const WvIPNet & WvInterface::ipaddr  
 

get the local IP net of this interface

Definition at line 93 of file wvinterface.cc.

References getinfo(), and my_ipaddr.

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

bool WvInterface::isarp  
 

add an ARP entry on this interface

bool WvInterface::isarp  
 

add an ARP entry on this interface

Definition at line 513 of file wvinterface.cc.

References getflags().

bool WvInterface::ispromisc  
 

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

bool WvInterface::ispromisc  
 

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

Definition at line 201 of file wvinterface.cc.

References getflags().

bool WvInterface::isup  
 

set the interface state up or down.

bool WvInterface::isup  
 

set the interface state up or down.

Definition at line 189 of file wvinterface.cc.

References getflags(), and valid.

Referenced by addroute(), WvIPAliaser::Alias::Alias(), and WvInterfaceDict::on_local_net().

void WvInterface::promisc bool    enable
 

void WvInterface::promisc bool    enable
 

Definition at line 195 of file wvinterface.cc.

References setflags().

void WvInterface::rescan  
 

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

void WvInterface::rescan  
 

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

Definition at line 59 of file wvinterface.cc.

References my_hwaddr, and my_ipaddr.

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

int WvInterface::setflags int    clear,
int    set
 

toggle kernel flags on this netdevice. Be careful!

int WvInterface::setflags int    clear,
int    set
 

toggle kernel flags on this netdevice. Be careful!

Definition at line 144 of file wvinterface.cc.

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

Referenced by promisc(), and up().

int WvInterface::setipaddr const WvIPNet   addr
 

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

int WvInterface::setipaddr const WvIPNet   addr
 

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

Definition at line 207 of file wvinterface.cc.

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

Referenced by WvIPAliaser::Alias::Alias().

int WvInterface::setmtu int    mtu
 

Set the MTU of the interface.

int WvInterface::setmtu int    mtu
 

Set the MTU of the interface.

Definition at line 275 of file wvinterface.cc.

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

void WvInterface::up bool    enable
 

void WvInterface::up bool    enable
 

Definition at line 182 of file wvinterface.cc.

References rescan(), and setflags().

Referenced by WvIPAliaser::Alias::Alias(), and WvIPAliaser::Alias::~Alias().


Member Data Documentation

WvLog WvInterface::err [private]
 

Definition at line 26 of file ipstreams/wvinterface.h.

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

WvAddr* WvInterface::my_hwaddr [private]
 

Definition at line 23 of file ipstreams/wvinterface.h.

WvAddr* WvInterface::my_hwaddr [private]
 

Definition at line 23 of file include/wvinterface.h.

Referenced by hwaddr(), rescan(), and WvInterface().

WvIPNet* WvInterface::my_ipaddr [private]
 

Definition at line 24 of file ipstreams/wvinterface.h.

WvIPNet* WvInterface::my_ipaddr [private]
 

Definition at line 24 of file include/wvinterface.h.

Referenced by ipaddr(), rescan(), and WvInterface().

WvString WvInterface::name
 

Definition at line 41 of file ipstreams/wvinterface.h.

Referenced by addarp(), addroute(), delroute(), getflags(), getinfo(), setflags(), setipaddr(), setmtu(), and WvInterface().

bool WvInterface::valid
 

Definition at line 42 of file ipstreams/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 Fri Apr 5 15:16:55 2002 for WvStreams by doxygen1.2.15