/usr/include/wvstreams/wvinterface.h is in libwvstreams-dev 4.6.1-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | /* -*- Mode: C++ -*-
* Worldvisions Weaver Software:
* Copyright (C) 1997-2005 Net Integration Technologies, Inc.
*
* Provides support for managing network interfaces.
*/
#ifndef __WVINTERFACE_H
#define __WVINTERFACE_H
#include "wvaddr.h"
#include "wvhashtable.h"
#include "wvlog.h"
struct ifreq;
struct iwreq;
struct rtentry;
/**
* 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.
*/
class WvInterface
{
WvAddr *my_hwaddr;
WvIPNet *my_ipaddr;
WvLog err;
/** used by addroute()/delroute() */
void fill_rte(struct rtentry *rte, char ifname[17],
const WvIPNet &dest, const WvIPAddr &gw,
int metric);
int really_addroute(const WvIPNet &dest, const WvIPAddr &gw,
const WvIPAddr &src, int metric,
WvStringParm table, bool shutup);
public:
WvString name;
bool valid;
WvInterface(WvStringParm _name);
~WvInterface();
/** forget all stored information about the address(es) of this interface */
void rescan();
/** get the hardware address of this interface */
const WvAddr &hwaddr();
/** get the local IP net of this interface */
const WvIPNet &ipaddr();
/** get the point-to-point IP address of this interface */
const WvIPAddr dstaddr();
/** get the current kernel flags */
int getflags();
/** toggle kernel flags on this netdevice. Be careful! */
int setflags(int clear, int set);
/** set the interface state up or down. */
bool isup();
void up(bool enable);
/** turn promiscuous (see-all-packets) mode on or off. */
bool ispromisc();
void promisc(bool enable);
/** turn point-to-point mode on or off.*/
int ptp(bool enable, 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.
*/
int setipaddr(const WvIPNet &addr);
/**
* Sets the MTU of the interface.
*
* Returns 0 on success, else an error code.
*/
int setmtu(int mtu);
/**
* Set the hardware address of this interface
*
* Returns 0 on success, else an error code.
*/
int sethwaddr(const WvAddr &addr);
/** add a route to the given network through this interface. */
int addroute(const WvIPNet &dest, int metric = 0,
WvStringParm table = "default");
int addroute(const WvIPNet &dest, const WvIPAddr &gw,
const WvIPAddr &src, int metric = 0,
WvStringParm table = "default");
/** delete a route to the given network through this interface. */
int delroute(const WvIPNet &dest, int metric = 0,
WvStringParm table = "default");
int delroute(const WvIPNet &dest, const WvIPAddr &gw, int metric = 0,
WvStringParm table = "default");
/** add an ARP entry on this interface */
bool isarp();
int addarp(const WvIPNet &proto, const WvAddr &hw, bool proxy);
/** get/set information about an interface */
int req(int ioctl_num, struct ifreq *ifr);
/** get/set information about a wireless interface */
int req(int ioctl_num, struct iwreq *ifr);
};
DeclareWvDict2(WvInterfaceDictBase, WvInterface, WvString, name);
class WvInterfaceDict
{
public:
WvLog log;
static WvInterfaceDictBase slist;
static int links;
class Iter : public WvInterfaceDictBase::Iter
{
public:
Iter(WvInterfaceDict &l)
: WvInterfaceDictBase::Iter(l.slist)
{ }
};
class Sorter : public WvInterfaceDictBase::Sorter
{
public:
Sorter(WvInterfaceDict &l,
WvInterfaceDictBase::Sorter::RealCompareFunc *f)
: WvInterfaceDictBase::Sorter(l.slist, f)
{ }
};
WvInterfaceDict();
~WvInterfaceDict();
void update();
WvString islocal(const WvAddr &addr);
bool on_local_net(const WvIPNet &addr);
WvInterface *operator[] (WvStringParm str)
{ return slist[str]; }
//operator WvInterfaceDictBase ()
// { return slist; }
};
#endif // __WVINTERFACE_H
|