|
int | readEntry (istream &) |
| Read a table entry from an input stream and add it to the table. More...
|
|
|
int | maxIf |
| largest interface number
|
|
int | defaultIf |
| default interface
|
|
Entry * | ift |
| ift[i]=data for interface i
|
|
ListPair * | ifaces |
| in-use and available iface numbers
|
|
Definition at line 20 of file IfaceTable.h.
bool forest::IfaceTable::addEntry |
( |
int |
iface, |
|
|
ipa_t |
ipa, |
|
|
ipp_t |
ipp, |
|
|
RateSpec & |
rs |
|
) |
| |
Allocate and initialize a new interface table entry.
- Parameters
-
iface | is an interface number for an unused interface |
ipa | is the IP address to be associated with the interface |
ipp | is the port number to be associated with the interface |
rs | is the rate spec for the interface (up corresponds to in) |
Definition at line 31 of file IfaceTable.cpp.
string & forest::IfaceTable::entry2string |
( |
int |
iface) | |
const |
Create a string representation of an entry.
- Parameters
-
iface | is the number of the interface to be written |
- Returns
- the string
- Parameters
-
iface | is the number of the interface to be written |
s | is a reference to a string inwhich result is returned |
- Returns
- a reference to s
Definition at line 108 of file IfaceTable.cpp.
int forest::IfaceTable::firstIface |
( |
) | |
const |
|
inline |
Get the "first" interface number.
This method used to iterate through all the interfaces. The choice of which interface is first is arbitrary and programs should not rely on any particular iterface being the first.
- Returns
- the interface number of the first interface, or 0 if no interfaces have been defined for this router
Definition at line 88 of file IfaceTable.h.
int forest::IfaceTable::getDefaultIface |
( |
) | |
const |
|
inline |
Get the number of the default interface.
At the time the first interface is added, the default interface is initialized with the same interface number. The default interface can be changed using the setDefaultIface() method.
- Returns
- the interface number of the default interface, or 0 if there is no default interface
Definition at line 111 of file IfaceTable.h.
Get a table entry.
- Parameters
-
iface | is a valid interface number |
- Returns
- a reference to the interface table entry
Definition at line 127 of file IfaceTable.h.
int forest::IfaceTable::getFreeIface |
( |
) | |
const |
|
inline |
Get an an unused interface number.
- Returns
- the number of an interface that is not yet in use, or 0 if there are no available interface numbers
Definition at line 119 of file IfaceTable.h.
int forest::IfaceTable::nextIface |
( |
int |
iface) | |
const |
|
inline |
Get the "next" interface number.
This method used to iterate through all the interfaces. The order of the interfaces is arbitrary and programs should not rely on any particular order.
- Parameters
-
iface | is a valid interface number |
- Returns
- the next interface number following iface, or 0 if there is no next interface, or iface is not valid
Definition at line 100 of file IfaceTable.h.
bool forest::IfaceTable::read |
( |
istream & |
in) | |
|
Read interface table entries from the input.
The first line must contain an integer, giving the number of entries to be read. The input may include blank lines and comment lines (any text starting with '#'). Each entry must be on a line by itself (possibly with a trailing comment). If the operation fails, a message is sent to cerr, identifying the interface that triggered the failure
- Parameters
-
in | is an open input stream |
- Returns
- true on success, false on failure
Definition at line 89 of file IfaceTable.cpp.
int forest::IfaceTable::readEntry |
( |
istream & |
in) | |
|
|
private |
Read a table entry from an input stream and add it to the table.
The input stream is assumed to be positioned at the start of an interface table entry. An entry is consists of an interface number, an IP address followed by a colon and port number, a maximum bit rate (in Kb/s) and a maximum packet rate (in p/s). Each field is separated by one or more spaces. Comments in the input stream are ignored. A comment starts with a # sign and continues to the end of the line. Non-blank lines that do not start with a comment are expected to contain a complete entry. If the input is formatted incorrectly, or the interface number specified in the input is already in use, the operation will fail.
- Parameters
-
in | is an open input stream |
- Returns
- the number of the new interface or 0, if the operation failed
Definition at line 65 of file IfaceTable.cpp.
void forest::IfaceTable::removeEntry |
( |
int |
iface) | |
|
Remove an interface from the table.
- Parameters
-
iface | is the number of the interface to be removed No action is taken if the specified interface number is not valid |
Definition at line 46 of file IfaceTable.cpp.
void forest::IfaceTable::setDefaultIface |
( |
int |
iface) | |
|
|
inline |
Set the default interface.
- Parameters
-
iface | is the number of a valid existing interface |
Definition at line 139 of file IfaceTable.h.
string & forest::IfaceTable::toString |
( |
) | |
const |
Create a string representation of the interface table.
The output format matches the format expected by the read method.
- Returns
- the string
The output format matches the format expected by the read method.
- Parameters
-
s | is a reference to a string in which result is returned |
- Returns
- a reference to s
Definition at line 120 of file IfaceTable.cpp.
bool forest::IfaceTable::valid |
( |
int |
iface) | |
const |
|
inline |
Check an interface number for validity.
- Parameters
-
iface | is the interface to be checked |
- Returns
- true if iface is a valid interface number, else false
Definition at line 77 of file IfaceTable.h.
The documentation for this class was generated from the following files: