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 URI& uri, bool is_pattern = false);
00053
00058 virtual bool match(const EndpointIDPattern& pattern,
00059 const EndpointID& eid);
00060
00064 virtual singleton_info_t is_singleton(const URI& uri);
00065
00066
00067
00068
00069
00070
00071
00072 static bool parse(const std::string& ssp, eth_addr_t* addr);
00073
00081 static char* to_string(u_int8_t* addr, char* outstring);
00082
00083 private:
00084 friend class oasys::Singleton<EthernetScheme>;
00085 EthernetScheme() {}
00086 };
00087
00088 }
00089
00090
00091 #endif
00092
00093 #endif