20 #include <rofl/common/crofbase.h>
21 #include <rofl/common/crofdpt.h>
22 #include <rofl/common/caddress.h>
24 #include "cflowentry.h"
67 if (cflowtable::flowtables.find(dptid) != cflowtable::flowtables.end()) {
68 delete cflowtable::flowtables[dptid];
69 cflowtable::flowtables.erase(dptid);
72 return *(cflowtable::flowtables[dptid]);
88 if (cflowtable::flowtables.find(dptid) == cflowtable::flowtables.end()) {
91 return *(cflowtable::flowtables[dptid]);
108 if (cflowtable::flowtables.find(dptid) == cflowtable::flowtables.end()) {
111 return *(cflowtable::flowtables.at(dptid));
123 if (cflowtable::flowtables.find(dptid) == cflowtable::flowtables.end()) {
126 delete cflowtable::flowtables[dptid];
127 cflowtable::flowtables.erase(dptid);
139 return (not (cflowtable::flowtables.find(dptid) == cflowtable::flowtables.end()));
157 for (std::map<
rofl::caddress_ll, std::map<rofl::caddress_ll, cflowentry*> >::iterator
158 it = ftable.begin(); it != ftable.end(); ++it) {
159 for (std::map<rofl::caddress_ll, cflowentry*>::iterator
160 jt = it->second.begin(); jt != it->second.end(); ++jt) {
186 if (ftable[src].find(dst) != ftable[src].end()) {
189 ftable[src][dst] =
new cflowentry(
this, dptid, src, dst, portno);
190 return *(ftable[src][dst]);
212 if (ftable[src].find(dst) == ftable[src].end()) {
213 ftable[src][dst] =
new cflowentry(
this, dptid, src, dst, portno);
215 return *(ftable[src][dst]);
236 if (ftable[src].find(dst) == ftable[src].end()) {
239 return *(ftable[src][dst]);
260 if (ftable.at(src).find(dst) == ftable.at(src).end()) {
263 return *(ftable.at(src).at(dst));
276 if (ftable[src].find(dst) == ftable[src].end()) {
280 ftable[src].erase(dst);
292 return (not (ftable.at(src).find(dst) == ftable.at(src).end()));
305 cflowtable::flowtables[dptid] =
this;
314 cflowtable::flowtables.erase(dptid);
324 const cflowentry& entry) {
334 operator<< (std::ostream& os, cflowtable
const& flowtable) {
339 os <<
rofl::indent(0) <<
"<cflowtable dptid:" << flowtable.dptid <<
" >" << std::endl;
342 for (std::map<
rofl::caddress_ll, std::map<rofl::caddress_ll, cflowentry*> >::const_iterator
343 it = flowtable.ftable.begin(); it != flowtable.ftable.end(); ++it) {
344 for (std::map<rofl::caddress_ll, cflowentry*>::const_iterator
345 jt = it->second.begin(); jt != it->second.end(); ++jt) {
355 std::map<rofl::caddress_ll, std::map<rofl::caddress_ll, cflowentry*> > ftable;
356 static std::map<rofl::cdptid, cflowtable*> flowtables;
static void drop_flowtable(const rofl::cdptid &dptid)
Removes an existing cflowtable instance.
Definition: cflowtable.h:121
Element not found.
Definition: cflowentry.h:54
Definition: caddress.h:152
void drop_flow_entry(const rofl::caddress_ll &src, const rofl::caddress_ll &dst)
Removes an existing cflowentry for given source and destination hardware address. ...
Definition: cflowtable.h:273
static const cflowtable & get_flowtable(const rofl::cdptid &dptid)
Returns const reference to existing cflowtable instance or throws exception.
Definition: cflowtable.h:106
Defines the environment expected by an instance of class cflowentry.
Definition: cflowentry.h:71
bool is_multicast() const
Check for multicast bit in hardware address.
Definition: caddress.cc:74
rofl-common's internal remote datapath handle.
Definition: cdptid.h:24
const rofl::cdpid & get_dpid() const
Returns OpenFlow datapath identifier for this instance.
Definition: crofdpt.h:1259
cflowentry & set_flow_entry(const rofl::caddress_ll &src, const rofl::caddress_ll &dst)
Returns reference to existing cflowentry instance for given hardware address.
Definition: cflowtable.h:230
bool is_null() const
Check for null hardware address.
Definition: caddress.cc:94
Invalid parameter specified.
Definition: cflowentry.h:43
Stores an active flow entry.
Definition: cflowentry.h:109
void clear()
Deletes all entries stored in this cflowtable instance.
Definition: cflowtable.h:156
static cflowtable & set_flowtable(const rofl::cdptid &dptid)
Returns reference to existing cflowtable instance or creates a new empty one.
Definition: cflowtable.h:86
static bool has_flowtable(const rofl::cdptid &dptid)
Checks existence of cflowtable for given identifier.
Definition: cflowtable.h:137
cflowentry & add_flow_entry(const rofl::caddress_ll &src, const rofl::caddress_ll &dst, uint32_t portno)
Returns reference to empty cflowentry instance for given hardware address.
Definition: cflowtable.h:179
cflowentry & set_flow_entry(const rofl::caddress_ll &src, const rofl::caddress_ll &dst, uint32_t portno)
Returns reference to existing cflowentry instance for given hardware address.
Definition: cflowtable.h:205
Flow Table of active flows.
Definition: cflowtable.h:46
const cflowentry & get_flow_entry(const rofl::caddress_ll &src, const rofl::caddress_ll &dst) const
Returns const reference to existing cflowentry instance for given hardware address.
Definition: cflowtable.h:254
static cflowtable & add_flowtable(const rofl::cdptid &dptid)
Returns reference to new or existing and resetted cflowtable instance.
Definition: cflowtable.h:65
bool has_flow_entry(const rofl::caddress_ll &src, const rofl::caddress_ll &dst) const
Checks whether a cflowentry exists for given source and destination hardware address.
Definition: cflowtable.h:291
static rofl::crofdpt & get_dpt(const rofl::cdptid &dptid)
Returns reference to rofl::crofdpt instance identified by rofl-common's internal identifier.
Definition: crofdpt.cc:17