Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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 outputGateForProtocol (int protocol)

Private Types

typedef std::vector< EntryEntries

Private Attributes

Entries entries

Classes

struct  Entry


Member Typedef Documentation

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


Constructor & Destructor Documentation

ProtocolMapping::ProtocolMapping  )  [inline]
 

00043 {}

ProtocolMapping::~ProtocolMapping  )  [inline]
 

00044 {}


Member Function Documentation

int ProtocolMapping::outputGateForProtocol int  protocol  ) 
 

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

void ProtocolMapping::parseProtocolMapping const char *  s  ) 
 

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


Member Data Documentation

Entries ProtocolMapping::entries [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Oct 19 18:22:27 2006 for INET Framework for OMNeT++/OMNEST by  doxygen 1.4.0