IBR-DTNSuite  0.12
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 
30  void raiseExpired() const;
31 
35  bool equals(const StaticRoute &route) const;
36 
44 
49  const std::string toString() const;
50 
51  private:
52  dtn::data::EID _dest;
53  std::string _regex_str;
54  regex_t _regex;
55  bool _invalid;
56  const dtn::data::Timestamp _expire;
57  };
58  }
59 }
60 
61 #endif /* STATICREGEXROUTE_H_ */