159 InterfaceEntry *ie =
nullptr;
162 while (ifconfigFile[charpointer] !=
'\0') {
164 if (
streq(ifconfigFile + charpointer,
"name:")) {
166 char *name =
parseEntry(ifconfigFile,
"name:", charpointer, buf);
169 throw cRuntimeError(
"Error in routing file: interface name `%s' not registered by any L2 module", name);
171 throw cRuntimeError(
"Error in routing file: interface name `%s' doesn't have IPv4 data fields", name);
177 if (
streq(ifconfigFile + charpointer,
"encap:")) {
179 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
181 parseEntry(ifconfigFile,
"encap:", charpointer, buf);
186 if (
streq(ifconfigFile + charpointer,
"HWaddr:")) {
188 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
190 parseEntry(ifconfigFile,
"HWaddr:", charpointer, buf);
195 if (
streq(ifconfigFile + charpointer,
"inet_addr:")) {
197 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
198 ie->ipv4Data()->setIPAddress(IPv4Address(
parseEntry(ifconfigFile,
"inet_addr:", charpointer, buf)));
203 if (
streq(ifconfigFile + charpointer,
"Bcast:")) {
205 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
207 parseEntry(ifconfigFile,
"Bcast:", charpointer, buf);
212 if (
streq(ifconfigFile + charpointer,
"Mask:")) {
214 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
215 ie->ipv4Data()->setNetmask(IPv4Address(
parseEntry(ifconfigFile,
"Mask:", charpointer, buf)));
220 if (
streq(ifconfigFile + charpointer,
"Groups:")) {
222 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
223 char *grStr =
parseEntry(ifconfigFile,
"Groups:", charpointer, buf);
229 if (
streq(ifconfigFile + charpointer,
"MTU:")) {
231 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
232 ie->setMtu(atoi(
parseEntry(ifconfigFile,
"MTU:", charpointer, buf)));
237 if (
streq(ifconfigFile + charpointer,
"Metric:")) {
239 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
240 ie->ipv4Data()->setMetric(atoi(
parseEntry(ifconfigFile,
"Metric:", charpointer, buf)));
245 if (
streq(ifconfigFile + charpointer,
"BROADCAST")) {
247 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
248 ie->setBroadcast(
true);
249 charpointer += strlen(
"BROADCAST");
255 if (
streq(ifconfigFile + charpointer,
"MULTICAST")) {
257 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
258 ie->setMulticast(
true);
259 charpointer += strlen(
"MULTICAST");
265 if (
streq(ifconfigFile + charpointer,
"POINTTOPOINT")) {
267 throw cRuntimeError(
"Error in routing file: missing the `name:' entry");
268 ie->setPointToPoint(
true);
269 charpointer += strlen(
"POINTTOPOINT");
virtual void parseMulticastGroups(char *groupStr, InterfaceEntry *)
Definition: RoutingTableParser.cc:294
static int streq(const char *str1, const char *str2)
Definition: RoutingTableParser.cc:47
virtual InterfaceEntry * getInterfaceByName(const char *name) const =0
Returns an interface given by its name.
virtual char * parseEntry(char *ifconfigFile, const char *tokenStr, int &charpointer, char *destStr)
Definition: RoutingTableParser.cc:279
IInterfaceTable * ift
Definition: RoutingTableParser.h:43
const int MAX_ENTRY_STRING_SIZE
Definition: RoutingTableParser.cc:37
static void skipBlanks(char *str, int &charptr)
Definition: RoutingTableParser.cc:61