#include <ProtocolMap.h>
Classes | |
| struct | Entry |
Public Member Functions | |
| ProtocolMapping () | |
| ~ProtocolMapping () | |
| void | parseProtocolMapping (const char *s) |
| int | getOutputGateForProtocol (int protocol) |
Protected Types | |
| typedef std::vector< Entry > | Entries |
Protected Attributes | |
| Entries | entries |
Maps protocol numbers to output gates
Definition at line 28 of file ProtocolMap.h.
typedef std::vector<Entry> ProtocolMapping::Entries [protected] |
Definition at line 38 of file ProtocolMap.h.
| ProtocolMapping::ProtocolMapping | ( | ) | [inline] |
Definition at line 42 of file ProtocolMap.h.
{}
| ProtocolMapping::~ProtocolMapping | ( | ) | [inline] |
Definition at line 43 of file ProtocolMap.h.
{}
| int ProtocolMapping::getOutputGateForProtocol | ( | int | protocol | ) |
Definition at line 58 of file ProtocolMap.cc.
Referenced by IPv6::handleReceivedICMP(), IP::handleReceivedICMP(), IPv6::isLocalAddress(), and IP::reassembleAndDeliver().
| void ProtocolMapping::parseProtocolMapping | ( | const char * | s | ) |
Definition at line 23 of file ProtocolMap.cc.
Referenced by IPv6::initialize(), and IP::initialize().
{
while (isspace(*s)) s++;
while (*s)
{
Entry entry;
if (!isdigit(*s))
throw cRuntimeError("syntax error: protocol number expected");
entry.protocolNumber = atoi(s);
while (isdigit(*s)) s++;
if (*s++!=':')
throw cRuntimeError("syntax error: colon expected");
while (isspace(*s)) s++;
if (!isdigit(*s))
throw cRuntimeError("syntax error in script: output gate index expected");
entry.outGateIndex = atoi(s);
while (isdigit(*s)) s++;
// add
entries.push_back(entry);
// skip delimiter
while (isspace(*s)) s++;
if (!*s) break;
if (*s++!=',')
throw cRuntimeError("syntax error: comma expected");
while (isspace(*s)) s++;
}
}
Entries ProtocolMapping::entries [protected] |
Definition at line 39 of file ProtocolMap.h.
Referenced by getOutputGateForProtocol(), and parseProtocolMapping().
1.7.1