Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
gre_matches.h
1 /*
2  * gre_matches.h
3  *
4  * Created on: 23.09.2014
5  * Author: andreas
6  */
7 
8 #ifndef GRE_MATCHES_H_
9 #define GRE_MATCHES_H_
10 
11 #include <rofl/common/openflow/coxmatch.h>
12 
13 namespace rofl {
14 namespace openflow {
15 namespace experimental {
16 namespace gre {
17 
18 static uint16_t const OFPXMC_EXPERIMENTER = 0xffff;
19 
20 /* OXM Flow match field types for OpenFlow Experimental */
21 enum oxm_ofx_match_fields {
22  /* GRE related extensions */
23  OFPXMT_OFX_GRE_VERSION = 37, /* GRE version */
24  OFPXMT_OFX_GRE_PROT_TYPE = 38, /* GRE protocol type */
25  OFPXMT_OFX_GRE_KEY = 39, /* GRE key */
26 };
27 
28 /* OXM Flow match field types for OpenFlow basic class. */
29 enum oxm_tlv_match_fields {
30  OXM_TLV_EXPR_GRE_VERSION = (OFPXMC_EXPERIMENTER << 16) | (OFPXMT_OFX_GRE_VERSION << 9) | 2,
31  OXM_TLV_EXPR_GRE_VERSION_MASK = (OFPXMC_EXPERIMENTER << 16) | (OFPXMT_OFX_GRE_VERSION << 9) | 4 | HAS_MASK_FLAG,
32  OXM_TLV_EXPR_GRE_PROT_TYPE = (OFPXMC_EXPERIMENTER << 16) | (OFPXMT_OFX_GRE_PROT_TYPE << 9) | 2,
33  OXM_TLV_EXPR_GRE_PROT_TYPE_MASK = (OFPXMC_EXPERIMENTER << 16) | (OFPXMT_OFX_GRE_PROT_TYPE << 9) | 4 | HAS_MASK_FLAG,
34  OXM_TLV_EXPR_GRE_KEY = (OFPXMC_EXPERIMENTER << 16) | (OFPXMT_OFX_GRE_KEY << 9) | 4,
35  OXM_TLV_EXPR_GRE_KEY_MASK = (OFPXMC_EXPERIMENTER << 16) | (OFPXMT_OFX_GRE_KEY << 9) | 8 | HAS_MASK_FLAG,
36 };
37 
38 
43 public:
45  uint16_t version) :
46  coxmatch(OXM_TLV_EXPR_GRE_VERSION, version) {};
48  uint16_t version, uint16_t mask) :
49  coxmatch(OXM_TLV_EXPR_GRE_VERSION_MASK, version, mask) {};
51  coxmatch const& oxm) :
52  coxmatch(oxm) {};
53  virtual
55  friend std::ostream&
56  operator<< (std::ostream& os, coxmatch_ofx_gre_version const& oxm) {
57  os << dynamic_cast<coxmatch const&>(oxm);
58  os << indent(2) << "<gre-version: "
59  << (int)oxm.get_u16value() << "/" << (int)oxm.get_u16mask()
60  << " >" << std::endl;
61  return os;
62  };
63 };
64 
65 
70 public:
72  uint16_t prot_type) :
73  coxmatch(OXM_TLV_EXPR_GRE_PROT_TYPE, prot_type) {};
75  uint16_t prot_type, uint16_t mask) :
76  coxmatch(OXM_TLV_EXPR_GRE_PROT_TYPE_MASK, prot_type, mask) {};
78  coxmatch const& oxm) :
79  coxmatch(oxm) {};
80  virtual
82  friend std::ostream&
83  operator<< (std::ostream& os, coxmatch_ofx_gre_prot_type const& oxm) {
84  os << dynamic_cast<coxmatch const&>(oxm);
85  os << indent(2) << "<gre-prot-type: "
86  << (int)oxm.get_u16value() << "/" << (int)oxm.get_u16mask()
87  << " >" << std::endl;
88  return os;
89  };
90 };
91 
92 
97 public:
99  uint32_t key) :
100  coxmatch(OXM_TLV_EXPR_GRE_KEY, key) {};
102  uint32_t key, uint32_t mask) :
103  coxmatch(OXM_TLV_EXPR_GRE_KEY_MASK, key, mask) {};
105  coxmatch const& oxm) :
106  coxmatch(oxm) {};
107  virtual
108  ~coxmatch_ofx_gre_key() {};
109  friend std::ostream&
110  operator<< (std::ostream& os, coxmatch_ofx_gre_key const& oxm) {
111  os << dynamic_cast<coxmatch const&>(oxm);
112  os << indent(2) << "<gre-key: "
113  << (int)oxm.get_u32value() << "/" << (int)oxm.get_u32mask()
114  << " >" << std::endl;
115  return os;
116  };
117 };
118 
119 
120 
121 }; // end of namespace gre
122 }; // end of namespace experimental
123 }; // end of namespace openflow
124 }; // end of namespace rofl
125 
126 #endif /* GRE_MATCHES_H_ */
Definition: coxmatch.h:49
Definition: logging.h:76