ProtocolMapping Class Reference

#include <ProtocolMap.h>

List of all members.


Detailed Description

Maps protocol numbers to output gates

Public Member Functions

 ProtocolMapping ()
 ~ProtocolMapping ()
void parseProtocolMapping (const char *s)
int getOutputGateForProtocol (int protocol)

Protected Types

typedef std::vector< EntryEntries

Protected Attributes

Entries entries

Classes

struct  Entry

Member Typedef Documentation

typedef std::vector<Entry> ProtocolMapping::Entries [protected]


Constructor & Destructor Documentation

ProtocolMapping::ProtocolMapping (  )  [inline]

00042 {}

ProtocolMapping::~ProtocolMapping (  )  [inline]

00043 {}


Member Function Documentation

void ProtocolMapping::parseProtocolMapping ( const char *  s  ) 

Referenced by IPv6::initialize(), and IP::initialize().

00024 {
00025     while (isspace(*s)) s++;
00026 
00027     while (*s)
00028     {
00029         Entry entry;
00030 
00031         if (!isdigit(*s))
00032             throw cRuntimeError("syntax error: protocol number expected");
00033         entry.protocolNumber = atoi(s);
00034         while (isdigit(*s)) s++;
00035 
00036         if (*s++!=':')
00037             throw cRuntimeError("syntax error: colon expected");
00038 
00039         while (isspace(*s)) s++;
00040         if (!isdigit(*s))
00041             throw cRuntimeError("syntax error in script: output gate index expected");
00042         entry.outGateIndex = atoi(s);
00043         while (isdigit(*s)) s++;
00044 
00045         // add
00046         entries.push_back(entry);
00047 
00048         // skip delimiter
00049         while (isspace(*s)) s++;
00050         if (!*s) break;
00051         if (*s++!=',')
00052             throw cRuntimeError("syntax error: comma expected");
00053         while (isspace(*s)) s++;
00054     }
00055 
00056 }

int ProtocolMapping::getOutputGateForProtocol ( int  protocol  ) 

Referenced by IPv6::handleReceivedICMP(), IP::handleReceivedICMP(), IPv6::isLocalAddress(), and IP::reassembleAndDeliver().

00059 {
00060     for (Entries::iterator i=entries.begin();i!=entries.end();++i)
00061         if (i->protocolNumber==protocol)
00062             return i->outGateIndex;
00063     opp_error("No output gate defined in protocolMapping for protocol number %d", protocol);
00064     return -1;
00065 }


Member Data Documentation


The documentation for this class was generated from the following files:

Generated on Fri Mar 20 18:51:20 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5