Check network ethernet type whitelist instead of hard-coded ethernet types.

This commit is contained in:
Adam Ierymenko 2013-08-28 16:01:27 -04:00
parent 8e1b897f0a
commit 55616388ea
5 changed files with 83 additions and 28 deletions

View file

@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <string>
@ -460,6 +461,38 @@ public:
#endif
}
// String to int converters (and hex string to int)
static inline unsigned int stoui(const char *s)
throw()
{
return (unsigned int)strtoul(s,(char **)0,10);
}
static inline unsigned long stoul(const char *s)
throw()
{
return strtoul(s,(char **)0,10);
}
static inline unsigned long long stoull(const char *s)
throw()
{
return strtoull(s,(char **)0,10);
}
static inline unsigned int hstoui(const char *s)
throw()
{
return (unsigned int)strtoul(s,(char **)0,16);
}
static inline unsigned long hstoul(const char *s)
throw()
{
return strtoul(s,(char **)0,16);
}
static inline unsigned long long hstoull(const char *s)
throw()
{
return strtoull(s,(char **)0,16);
}
/**
* Perform a safe C string copy
*