IBR-DTNSuite  0.10
StaticRegexRoute.h
Go to the documentation of this file.
1 /*
2  * StaticRegexRoute.h
3  *
4  * Created on: 28.11.2012
5  * Author: morgenro
6  */
7 
8 #ifndef STATICREGEXROUTE_H_
9 #define STATICREGEXROUTE_H_
10 
11 #include "routing/StaticRoute.h"
12 #include <regex.h>
13 
14 namespace dtn
15 {
16  namespace routing
17  {
18  class StaticRegexRoute : public StaticRoute {
19  public:
20  StaticRegexRoute(const std::string &regex, const dtn::data::EID &dest);
21  virtual ~StaticRegexRoute();
22 
23  bool match(const dtn::data::EID &eid) const;
24  const dtn::data::EID& getDestination() const;
25  const dtn::data::Timestamp& getExpiration() const;
26 
34 
39  const std::string toString() const;
40 
41  private:
42  dtn::data::EID _dest;
43  std::string _regex_str;
44  regex_t _regex;
45  bool _invalid;
46  const dtn::data::Timestamp _expire;
47  };
48  }
49 }
50 
51 #endif /* STATICREGEXROUTE_H_ */