00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _ETHERNET_SCHEME_H_
00018 #define _ETHERNET_SCHEME_H_
00019
00020 #ifdef __linux__
00021
00022 #include "Scheme.h"
00023 #include <sys/types.h>
00024 #include <netinet/in.h>
00025 #include <oasys/compat/inttypes.h>
00026 #include <oasys/util/Singleton.h>
00027
00028 namespace dtn {
00029
00030 #ifndef ETHER_ADDR_LEN
00031 #define ETHER_ADDR_LEN 6
00032 #endif
00033
00034 typedef struct ether_addr {
00035 u_char octet[ETHER_ADDR_LEN];
00036 } eth_addr_t;
00037
00043 class EthernetScheme : public Scheme, public oasys::Singleton<EthernetScheme> {
00044 public:
00052 virtual bool validate(const std::string& ssp, bool is_pattern = false);
00053
00058 virtual bool match(const EndpointIDPattern& pattern,
00059 const EndpointID& eid);
00060
00061
00062
00063
00064
00065
00066
00067 static bool parse(const std::string& ssp, eth_addr_t* addr);
00068
00076 static char* to_string(u_int8_t* addr, char* outstring);
00077
00078 private:
00079 friend class oasys::Singleton<EthernetScheme>;
00080 EthernetScheme() {}
00081 };
00082
00083 }
00084
00085
00086 #endif
00087
00088 #endif