16 #include "rofl/common/ciosrv.h"
17 #include "rofl/common/cmemory.h"
18 #include "rofl/common/logging.h"
19 #include "rofl/common/crofchan.h"
20 #include "rofl/common/ctransactions.h"
21 #include "rofl/common/croflexception.h"
22 #include "rofl/common/csocket.h"
23 #include "rofl/common/cmemory.h"
24 #include "rofl/common/cdptid.h"
25 #include "rofl/common/cauxid.h"
26 #include "rofl/common/cdpid.h"
27 #include "rofl/common/crofqueue.h"
29 #include "rofl/common/openflow/cofports.h"
30 #include "rofl/common/openflow/coftables.h"
31 #include "rofl/common/openflow/openflow.h"
32 #include "rofl/common/openflow/messages/cofmsg.h"
33 #include "rofl/common/openflow/cofflowmod.h"
34 #include "rofl/common/openflow/cofgroupmod.h"
35 #include "rofl/common/openflow/cofhelloelemversionbitmap.h"
36 #include "rofl/common/openflow/cofasyncconfig.h"
37 #include "rofl/common/openflow/cofrole.h"
38 #include "rofl/common/openflow/cofmeterstats.h"
39 #include "rofl/common/openflow/cofmeterconfig.h"
40 #include "rofl/common/openflow/cofmeterfeatures.h"
41 #include "rofl/common/openflow/cofpacketqueue.h"
42 #include "rofl/common/openflow/cofmeterbands.h"
77 static std::set<crofdpt_env*> rofdpt_envs;
84 { crofdpt_env::rofdpt_envs.insert(
this); };
91 { crofdpt_env::rofdpt_envs.erase(
this); };
978 enum crofdpt_timer_t {
979 TIMER_RUN_ENGINE = 0,
982 enum crofdpt_state_t {
984 STATE_DISCONNECTED = 1,
986 STATE_FEATURES_RCVD = 3,
987 STATE_GET_CONFIG_RCVD = 4,
988 STATE_TABLE_FEATURES_RCVD = 5,
989 STATE_ESTABLISHED = 6,
992 enum crofdpt_event_t {
994 EVENT_DISCONNECTED = 1,
996 EVENT_CONN_TERMINATED = 3,
997 EVENT_CONN_REFUSED = 4,
998 EVENT_CONN_FAILED = 5,
999 EVENT_FEATURES_REPLY_RCVD = 6,
1000 EVENT_FEATURES_REQUEST_EXPIRED = 7,
1001 EVENT_GET_CONFIG_REPLY_RCVD = 8,
1002 EVENT_GET_CONFIG_REQUEST_EXPIRED = 9,
1003 EVENT_TABLE_STATS_REPLY_RCVD = 10,
1004 EVENT_TABLE_STATS_REQUEST_EXPIRED = 11,
1005 EVENT_TABLE_FEATURES_STATS_REPLY_RCVD = 12,
1006 EVENT_TABLE_FEATURES_STATS_REQUEST_EXPIRED = 13,
1007 EVENT_PORT_DESC_STATS_REPLY_RCVD = 14,
1008 EVENT_PORT_DESC_STATS_REQUEST_EXPIRED = 15,
1011 enum crofdpt_flag_t {
1012 FLAG_ENGINE_IS_RUNNING = (1 << 0),
1051 bool remove_on_channel_close,
1056 rofchan(this, versionbitmap),
1058 remove_on_channel_close(remove_on_channel_close),
1060 hwaddr(
cmacaddr(
"00:00:00:00:00:00")),
1067 crofdpt::rofdpts[dptid] =
this;
1068 rofl::logging::debug <<
"[rofl-common][crofdpt] "
1069 <<
"instance created, dptid: " << dptid.str() << std::endl;
1079 rofl::logging::debug <<
"[rofl-common][crofdpt] "
1080 <<
"instance destroyed, dptid: " << dptid.str() << std::endl;
1081 crofdpt::rofdpts.erase(dptid);
1083 transactions.clear();
1117 std::list<rofl::cauxid>
1119 {
return rofchan.get_conn_index(); };
1141 enum rofl::csocket::socket_type_t socket_type,
1145 transactions.clear();
1149 rofchan.
add_conn(auxid, socket_type, socket_params);
1163 rofchan.drop_conn(auxid);
1206 {
return rofchan.is_established(); };
1215 {
return rofchan.get_version(); };
1224 {
return rofchan.get_versionbitmap(); };
1231 {
return remove_on_channel_close; };
1241 {
return rofchan.get_conn(auxid).get_rofsocket().get_socket().get_raddr(); };
1278 {
return n_buffers; };
1287 {
return n_tables; };
1296 {
return capabilities; };
1314 {
return miss_send_len; };
1369 uint32_t group_id = 1;
1370 while (groupids.find(group_id) != groupids.end()) {
1373 groupids.insert(group_id);
1384 { groupids.erase(group_id); };
1391 { groupids.clear(); };
1435 uint32_t inport = rofl::openflow::OFPP_CONTROLLER) {
1494 uint16_t stats_flags,
1513 uint16_t stats_type,
1514 uint16_t stats_flags,
1515 uint8_t *body = NULL,
1532 uint16_t stats_flags,
1548 uint16_t stats_flags,
1584 uint16_t stats_flags = 0,
1601 uint16_t stats_flags,
1619 uint16_t stats_flags,
1637 uint16_t stats_flags,
1654 uint16_t stats_flags = 0,
1670 uint16_t stats_flags,
1686 uint16_t stats_flags,
1705 uint16_t stats_flags,
1725 uint16_t stats_flags,
1743 uint16_t stats_flags,
1760 uint16_t stats_flags,
1782 uint8_t *data = NULL,
1783 size_t datalen = 0);
1879 uint32_t advertise);
1895 uint16_t miss_send_len);
1979 uint8_t* data = NULL,
1980 size_t datalen = 0);
2000 uint8_t *body = NULL,
2015 bool operator() (
const crofdpt* rofdpt) {
2027 bool operator() (
const std::pair<cdptid, crofdpt*>& p) {
2028 return (p.second->get_dpid().get_uint64_t() == dpid);
2034 friend std::ostream&
2035 operator<< (std::ostream& os,
const crofdpt& dpt) {
2036 os <<
indent(0) <<
"<crofdpt >";
2039 switch (dpt.state) {
2041 os << indent(2) <<
"<state: -INIT- >" << std::endl;
2043 case STATE_CONNECTED: {
2044 os << indent(2) <<
"<state: -CONNECTED- >" << std::endl;
2046 case STATE_DISCONNECTED: {
2047 os << indent(2) <<
"<state: -DISCONNECTED- >" << std::endl;
2049 case STATE_ESTABLISHED: {
2050 os << indent(2) <<
"<state: -ESTABLISHED- >" << std::endl;
2052 case STATE_FEATURES_RCVD: {
2053 os << indent(2) <<
"<state: -FEATURES-RCVD- >" << std::endl;
2055 case STATE_GET_CONFIG_RCVD: {
2056 os << indent(2) <<
"<state: -GET-CONFIG-RCVD- >" << std::endl;
2058 case STATE_TABLE_FEATURES_RCVD: {
2059 os << indent(2) <<
"<state: -TABLE-FEATURES-RCVD- >" << std::endl;
2062 os << indent(2) <<
"<state: -UNKNOWN- >" << std::endl;
2065 os << indent(2) <<
"<hwaddr: " << dpt.hwaddr.str() <<
" >" << std::endl;
2066 os << indent(2) <<
"<#buffers: " << (int)dpt.n_buffers <<
" >" << std::endl;
2067 os << indent(2) <<
"<#tables: " << (int)dpt.n_tables <<
" >" << std::endl;
2068 os << indent(2) <<
"<capabilities: " << std::hex << (int)dpt.capabilities << std::dec <<
" >" << std::endl;
2069 os << indent(2) <<
"<config: " << std::hex << (int)dpt.config << std::dec <<
" >" << std::endl;
2070 os << indent(2) <<
"<miss-send-len: " << (int)dpt.miss_send_len <<
" >" << std::endl;
2074 os << dpt.transactions;
2083 std::stringstream ss;
2084 ss <<
"dpid: " <<
get_dpid().str() <<
" ";
2087 ss <<
"state: -init- ";
2089 case STATE_CONNECTED: {
2090 ss <<
"state: -connected- ";
2092 case STATE_DISCONNECTED: {
2093 ss <<
"state: -disconnected- ";
2095 case STATE_ESTABLISHED: {
2096 ss <<
"state: -established- ";
2098 case STATE_FEATURES_RCVD: {
2099 ss <<
"state: -features-rcvd- ";
2101 case STATE_GET_CONFIG_RCVD: {
2102 ss <<
"state: -get-config-rcvd- ";
2104 case STATE_TABLE_FEATURES_RCVD: {
2105 ss <<
"state: -table-features-rcvd- ";
2108 ss <<
"state: -unknown- ";
2118 if (crofdpt_env::rofdpt_envs.find(env) == crofdpt_env::rofdpt_envs.end()) {
2119 throw eRofDptNotFound(
"rofl::crofdpt::call_env() environment not found");
2125 handle_conn_established(
2128 rofl::logging::info <<
"[rofl-common][crofdpt] dptid: " << dptid.str()
2129 <<
" control connection established, auxid: " << auxid.str() << std::endl;
2134 rofl::logging::info <<
"[rofl-common][crofdpt] dpid: " << std::hex <<
get_dpid().str() << std::dec
2135 <<
" OFP control channel established, " << chan.str() << std::endl;
2136 push_on_eventqueue(EVENT_CONNECTED);
2141 handle_conn_terminated(
2144 rofl::logging::info <<
"[rofl-common][crofdpt] dptid: " << dptid.str()
2145 <<
" control connection terminated, auxid: " << auxid.str() << std::endl;
2147 rofl::RwLock rwlock(conns_terminated_rwlock, rofl::RwLock::RWLOCK_WRITE);
2148 conns_terminated.push_back(auxid);
2149 push_on_eventqueue(EVENT_CONN_TERMINATED);
2152 rofl::logging::info <<
"[rofl-common][crofdpt] dptid: " << dptid.str()
2153 <<
" OFP control channel terminated, " << chan.str() << std::endl;
2154 transactions.clear();
2155 push_on_eventqueue(EVENT_DISCONNECTED);
2160 handle_conn_refused(
2163 rofl::RwLock rwlock(conns_refused_rwlock, rofl::RwLock::RWLOCK_WRITE);
2164 conns_refused.push_back(auxid);
2165 push_on_eventqueue(EVENT_CONN_REFUSED);
2172 rofl::RwLock rwlock(conns_failed_rwlock, rofl::RwLock::RWLOCK_WRITE);
2173 conns_failed.push_back(auxid);
2174 push_on_eventqueue(EVENT_CONN_FAILED);
2178 handle_write(crofchan& chan,
const rofl::cauxid& auxid)
2185 get_async_xid(crofchan& chan)
2186 {
return transactions.get_async_xid(); };
2189 get_sync_xid(crofchan& chan, uint8_t msg_type = 0, uint16_t msg_sub_type = 0)
2190 {
return transactions.add_ta(cclock(5), msg_type, msg_sub_type); };
2193 release_sync_xid(crofchan& chan, uint32_t xid)
2194 {
return transactions.drop_ta(xid); };
2205 int opaque,
void *data = (
void*)0);
2211 enum crofdpt_event_t event = EVENT_NONE) {
2212 if (EVENT_NONE != event) {
2213 events.push_back(event);
2215 if (not flags.test(FLAG_ENGINE_IS_RUNNING)) {
2221 work_on_eventqueue();
2224 event_disconnected();
2230 event_conn_terminated();
2233 event_conn_refused();
2236 event_conn_failed();
2239 event_features_reply_rcvd();
2242 event_features_request_expired(
2246 event_get_config_reply_rcvd();
2249 event_get_config_request_expired(
2253 event_table_stats_reply_rcvd();
2256 event_table_stats_request_expired(
2260 event_table_features_stats_reply_rcvd();
2263 event_table_features_stats_request_expired(
2267 event_port_desc_reply_rcvd();
2270 event_port_desc_request_expired(
2284 features_reply_rcvd(
2288 get_config_reply_rcvd(
2292 multipart_reply_rcvd(
2296 desc_stats_reply_rcvd(
2300 table_stats_reply_rcvd(
2304 port_stats_reply_rcvd(
2308 flow_stats_reply_rcvd(
2312 aggregate_stats_reply_rcvd(
2316 queue_stats_reply_rcvd(
2320 group_stats_reply_rcvd(
2324 group_desc_stats_reply_rcvd(
2328 group_features_stats_reply_rcvd(
2332 meter_stats_reply_rcvd(
2336 meter_config_stats_reply_rcvd(
2340 meter_features_stats_reply_rcvd(
2344 table_features_stats_reply_rcvd(
2348 port_desc_stats_reply_rcvd(
2352 experimenter_stats_reply_rcvd(
2380 queue_get_config_reply_rcvd(
2384 get_async_config_reply_rcvd(
2389 static std::map<rofl::cdptid, crofdpt*> rofdpts;
2400 bool remove_on_channel_close;
2402 std::set<uint32_t> groupids;
2413 uint32_t capabilities;
2419 uint16_t miss_send_len;
2422 std::deque<enum crofdpt_event_t>
2425 PthreadRwLock conns_terminated_rwlock;
2426 std::list<rofl::cauxid> conns_terminated;
2427 PthreadRwLock conns_refused_rwlock;
2428 std::list<rofl::cauxid> conns_refused;
2429 PthreadRwLock conns_failed_rwlock;
2430 std::list<rofl::cauxid> conns_failed;
2432 std::bitset<32> flags;
2436 static const time_t DEFAULT_REQUEST_TIMEOUT = 5;
Definition: cofmsg_barrier.h:125
virtual void handle_port_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_port_stats_reply &msg)
OpenFlow Port-Stats-Reply message received.
Definition: crofdpt.h:377
virtual void handle_table_features_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_table_features_stats_reply &msg)
OpenFlow Table-Features-Stats-Reply message received.
Definition: crofdpt.h:667
Definition: cofmsg_meter_stats.h:146
Definition: cofmsg_config.h:115
uint32_t send_queue_get_config_request(const rofl::cauxid &auxid, uint32_t port, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Queue-Get-Config-Request message to attached datapath element.
Definition: crofdpt.cc:1736
virtual void handle_group_features_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_group_features_stats_reply &msg)
OpenFlow Group-Features-Stats-Reply message received.
Definition: crofdpt.h:551
cauxid const & get_aux_id() const
Return auxialiary_id.
Definition: crofconn.h:334
const rofl::caddress_ll & get_hwaddr() const
Returns the datapath element's hardware address.
Definition: crofdpt.h:1268
virtual void handle_barrier_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Barrier-Reply message.
Definition: crofdpt.h:784
virtual void handle_aggregate_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Aggregate-Stats-Reply message.
Definition: crofdpt.h:451
virtual void handle_group_desc_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_group_desc_stats_reply &msg)
OpenFlow Group-Desc-Stats-Reply message received.
Definition: crofdpt.h:522
Definition: cofmsg_role.h:131
virtual void handle_error_message(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_error &msg)
OpenFlow Error message received.
Definition: crofdpt.h:854
virtual void handle_chan_terminated(rofl::crofdpt &dpt)
Called after termination of associated OpenFlow control channel.
Definition: crofdpt.h:124
Predicate for finding a rofl::crofdpt instance by its rofl::cdptid.
Definition: crofdpt.h:2011
Definition: caddress.h:152
virtual void handle_meter_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Meter-Stats-Reply message.
Definition: crofdpt.h:596
void flow_mod_reset()
Removes all flow-table entries from the attached datapath element.
Definition: crofdpt.cc:699
const rofl::openflow::cofports & get_ports() const
Returns const reference to the datapath element's port list.
Definition: crofdpt.h:1327
Definition: cofmsg_flow_stats.h:164
const rofl::cdptid & get_dptid() const
Returns rofl-common's internal rofl::cdptid identifier for this instance.
Definition: crofdpt.h:1092
Definition: cofgroupmod.h:24
Definition: cofmsg_experimenter.h:19
Definition: cofmsg_port_stats.h:156
uint32_t send_flow_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::openflow::cofflow_stats_request &flow_stats_request, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Flow-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:892
virtual void handle_experimenter_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Experimenter message.
Definition: crofdpt.h:884
uint32_t get_next_idle_group_id()
Returns the next idle group table identifier.
Definition: crofdpt.h:1368
crofdpt(rofl::crofdpt_env *env, const rofl::cdptid &dptid, bool remove_on_channel_close, const rofl::openflow::cofhello_elem_versionbitmap &versionbitmap, const rofl::cdpid &dpid=rofl::cdpid(0))
crofdpt constructor
Definition: crofdpt.h:1048
uint16_t get_config() const
Returns the datapath element's configuration.
Definition: crofdpt.h:1304
virtual void handle_group_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Group-Stats-Reply message.
Definition: crofdpt.h:509
uint32_t send_experimenter_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, uint32_t exp_id, uint32_t exp_type, const cmemory &body, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Experimenter-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:1273
rofl::caddress get_peer_addr(const rofl::cauxid &auxid) const
Returns caddress of connected remote entity for given connection identifier.
Definition: crofdpt.h:1239
Definition: cofmsg_stats.h:264
virtual void handle_queue_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Queue-Stats-Reply message.
Definition: crofdpt.h:480
virtual void handle_desc_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Desc-Stats-Reply message.
Definition: crofdpt.h:335
void drop_buffer(const rofl::cauxid &auxid, uint32_t buffer_id, uint32_t inport=rofl::openflow::OFPP_CONTROLLER)
Drops packet identified by buffer-id from the attached datapath element.
Definition: crofdpt.h:1432
Definition: cofhelloelemversionbitmap.h:22
rofl-common's internal remote datapath handle.
Definition: cdptid.h:24
virtual void handle_experimenter_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_experimenter_stats_reply &msg)
OpenFlow Experimenter-Stats-Reply message received.
Definition: crofdpt.h:725
virtual void handle_experimenter_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Experimenter-Stats-Reply message.
Definition: crofdpt.h:741
Definition: caddress.h:30
virtual void handle_group_desc_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Group-Desc-Stats-Reply message.
Definition: crofdpt.h:538
uint32_t send_desc_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Desc-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:855
uint32_t send_meter_mod_message(const rofl::cauxid &auxid, uint16_t command, uint16_t flags, uint32_t meter_id, const rofl::openflow::cofmeter_bands &meter_bands)
Sends OpenFlow Meter-Mod message to attached datapath element.
Definition: crofdpt.cc:1843
const rofl::cdpid & get_dpid() const
Returns OpenFlow datapath identifier for this instance.
Definition: crofdpt.h:1259
Definition: cofmsg_desc_stats.h:121
virtual void handle_desc_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_desc_stats_reply &msg)
OpenFlow Desc-Stats-Reply message received.
Definition: crofdpt.h:319
uint32_t send_get_async_config_request(const rofl::cauxid &auxid, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Get-Async-Config-Request message to attached datapath element.
Definition: crofdpt.cc:1773
void group_mod_reset()
Removes all group-table entries from the attached datapath element.
Definition: crofdpt.cc:723
virtual void handle_flow_removed(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_flow_removed &msg)
OpenFlow Flow-Removed message received.
Definition: crofdpt.h:797
Definition: cofactions.h:22
virtual void handle_role_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_role_reply &msg)
OpenFlow Role-Reply message received.
Definition: crofdpt.h:897
Definition: cofmeterbands.h:24
void release_group_id(uint32_t group_id)
Releases a previously allocated group table identifier.
Definition: crofdpt.h:1383
virtual void handle_group_features_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Group-Features-Stats-Reply message.
Definition: crofdpt.h:567
uint32_t send_experimenter_message(const rofl::cauxid &auxid, uint32_t exp_id, uint32_t exp_type, uint8_t *body=NULL, size_t bodylen=0, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Experimenter message to attached datapath element.
Definition: crofdpt.cc:1921
uint32_t send_stats_request(const rofl::cauxid &auxid, uint16_t stats_type, uint16_t stats_flags, uint8_t *body=NULL, size_t bodylen=0, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Stats-Request message to attached datapath element.
Definition: crofdpt.cc:812
Definition: cofmsg_error.h:21
Environment expected by a rofl::crofchan instance.
Definition: crofchan.h:40
Definition: cofmsg_packet_in.h:21
std::string str() const
Returns a one-liner string with basic information about this instance.
Definition: crofdpt.h:2082
virtual void handle_flow_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Flow-Stats-Reply message.
Definition: crofdpt.h:422
virtual void handle_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_stats_reply &msg)
OpenFlow Stats-Reply message received.
Definition: crofdpt.h:288
virtual void handle_table_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_table_stats_reply &msg)
OpenFlow Table-Stats-Reply message received.
Definition: crofdpt.h:348
virtual void handle_features_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_features_reply &msg)
OpenFlow Features-Reply message received.
Definition: crofdpt.h:230
Definition: cofmsg_table_features_stats.h:161
Definition: cofmsg_queue_stats.h:144
Definition: cofasyncconfig.h:24
A single OpenFlow control connection.
Definition: crofconn.h:145
const rofl::openflow::cofhello_elem_versionbitmap & get_versions_available() const
Returns the defined OpenFlow version bitmap for this instance.
Definition: crofdpt.h:1223
virtual void handle_meter_config_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_meter_config_stats_reply &msg)
OpenFlow Meter-Config-Stats-Reply message received.
Definition: crofdpt.h:609
Definition: cofmsg_group_stats.h:152
uint32_t send_get_config_request(const rofl::cauxid &auxid, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Get-Config-Request message to attached datapath element.
Definition: crofdpt.cc:779
virtual void handle_queue_get_config_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Table-Stats-Reply message.
Definition: crofdpt.h:841
Definition: cofmsg_port_desc_stats.h:123
Definition: cofmsg_group_features_stats.h:120
Definition: cofmsg_port_status.h:20
uint32_t send_flow_mod_message(const rofl::cauxid &auxid, const rofl::openflow::cofflowmod &flowmod)
Sends OpenFlow Flow-Mod message to attached datapath element.
Definition: crofdpt.cc:1547
virtual void handle_queue_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_queue_stats_reply &msg)
OpenFlow Queue-Stats-Reply message received.
Definition: crofdpt.h:464
void connect(const rofl::cauxid &auxid, enum rofl::csocket::socket_type_t socket_type, const rofl::cparams &socket_params)
Establishes a new control connection to a remote datapath element with the given control connection i...
Definition: crofdpt.h:1139
uint32_t send_table_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags=0, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Table-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:970
virtual void handle_conn_failed(rofl::crofdpt &dpt, const rofl::cauxid &auxid)
Called when an attempt to establish a control connection has been failed.
Definition: crofdpt.h:179
Definition: cofmsg_aggr_stats.h:147
uint32_t send_table_features_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Table-Features-Stats-Request message to attached datapath element. ...
Definition: crofdpt.cc:1199
virtual void handle_get_async_config_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_get_async_config_reply &msg)
OpenFlow Get-Async-Config-Reply message received.
Definition: crofdpt.h:926
virtual void handle_port_status(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_port_status &msg)
OpenFlow Port-Status-Reply message received.
Definition: crofdpt.h:811
virtual void clear()
Definition: coftables.cc:74
virtual void handle_chan_established(rofl::crofdpt &dpt)
Called after establishing the associated OpenFlow control channel.
Definition: crofdpt.h:110
bool is_established() const
Returns true, when the control handshake (HELLO) has been completed.
Definition: crofdpt.h:1205
virtual void handle_port_desc_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Port-Desc-Stats-Reply message.
Definition: crofdpt.h:712
Definition: ctransaction.h:17
Definition: cofmsg_async_config.h:115
virtual void handle_role_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Role-Reply message.
Definition: crofdpt.h:913
Definition: cofmsg_queue_get_config.h:152
virtual void handle_barrier_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_barrier_reply &msg)
OpenFlow Barrier-Reply message received.
Definition: crofdpt.h:768
uint16_t get_miss_send_len() const
Returns the datapath element's current miss_send_len parameter.
Definition: crofdpt.h:1313
const rofl::ctimerid & register_timer(int opaque, const rofl::ctimespec ×pec)
Installs a new timer to fire in t seconds.
Definition: ciosrv.h:698
Definition: cofgroupstats.h:23
uint32_t send_group_mod_message(const rofl::cauxid &auxid, const rofl::openflow::cofgroupmod &groupmod)
Sends OpenFlow Group-Mod message to attached datapath element.
Definition: crofdpt.cc:1582
virtual void handle_packet_in(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_packet_in &msg)
OpenFlow Packet-In message received.
Definition: crofdpt.h:754
uint32_t send_port_desc_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Port-Desc-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:1236
void clear_group_ids()
Resets the pool of all previously allocated group table identifiers.
Definition: crofdpt.h:1390
virtual void handle_conn_terminated(rofl::crofdpt &dpt, const rofl::cauxid &auxid)
Called when a control connection (main or auxiliary) has been terminated by the peer entity...
Definition: crofdpt.h:147
uint32_t send_group_desc_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags=0, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Group-Desc-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:1124
Definition: cofports.h:22
Definition: thread_helper.h:88
const rofl::openflow::coftables & get_tables() const
Returns const reference to the datapath element's tables list.
Definition: crofdpt.h:1341
void add_connection(crofconn *conn)
Add an existing rofl::crofconn instance created on heap to this object.
Definition: crofdpt.h:1180
virtual void handle_queue_get_config_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_queue_get_config_reply &msg)
OpenFlow Queue-Get-Config-Reply message received.
Definition: crofdpt.h:825
Definition: coftables.h:27
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
Definition: cofmsg_features.h:118
uint32_t send_queue_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::openflow::cofqueue_stats_request &queue_stats_request, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Queue-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:1046
uint32_t get_n_buffers() const
Returns the datapath element's number of buffers for storing data packets.
Definition: crofdpt.h:1277
uint32_t send_group_features_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Group-Features-Stats-Request message to attached datapath element. ...
Definition: crofdpt.cc:1162
uint32_t send_port_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::openflow::cofport_stats_request &port_stats_request, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Port-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:1007
virtual void handle_get_async_config_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Get-Async-Config-Reply message.
Definition: crofdpt.h:942
Definition: cofportstats.h:24
virtual void handle_meter_features_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Meter-Features-Stats-Reply message.
Definition: crofdpt.h:654
virtual void handle_table_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Table-Stats-Reply message.
Definition: crofdpt.h:364
virtual void handle_meter_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_meter_stats_reply &msg)
OpenFlow Meter-Stats-Reply message received.
Definition: crofdpt.h:580
virtual void handle_meter_features_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_meter_features_stats_reply &msg)
OpenFlow Meter-Features-Stats-Reply message received.
Definition: crofdpt.h:638
std::list< rofl::cauxid > get_conn_index() const
Returns a list of connection identifiers of all existing control connections.
Definition: crofdpt.h:1118
uint32_t send_meter_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::openflow::cofmeter_stats_request &meter_stats_request, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Meter-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:1316
Predicate for finding a rofl::crofdpt instance by its rofl::cdpid.
Definition: crofdpt.h:2023
uint32_t send_meter_features_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Meter-Features-Stats-Request message to attached datapath element. ...
Definition: crofdpt.cc:1394
virtual void handle_group_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_group_stats_reply &msg)
OpenFlow Group-Stats-Reply message received.
Definition: crofdpt.h:493
crofdpt_env()
rofl::crofdpt_env constructor
Definition: crofdpt.h:83
virtual void handle_get_config_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Get-Config-Reply message.
Definition: crofdpt.h:275
uint32_t send_barrier_request(const rofl::cauxid &auxid, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Barrier-Request message to attached datapath element.
Definition: crofdpt.cc:1475
Definition: crofqueue.h:20
virtual void handle_aggregate_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_aggr_stats_reply &msg)
OpenFlow Aggregate-Stats-Reply message received.
Definition: crofdpt.h:435
Definition: cofmsg_meter_features_stats.h:88
Definition: cofflowmod.h:31
uint32_t send_features_request(const rofl::cauxid &auxid, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Features-Request message to attached datapath element.
Definition: crofdpt.cc:746
virtual void handle_experimenter_message(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_experimenter &msg)
OpenFlow Experimenter message received.
Definition: crofdpt.h:868
Base class for IO services.
Definition: ciosrv.h:491
uint64_t get_dpid() const
Returns data path id assigned to this connection.
Definition: crofconn.h:327
Definition: cofmsg_group_desc_stats.h:123
void disconnect(rofl::cauxid auxid)
Terminates an existing control connection with given identifier.
Definition: crofdpt.h:1161
uint32_t send_aggr_stats_request(const rofl::cauxid &auxid, uint16_t flags, const rofl::openflow::cofaggr_stats_request &aggr_stats_request, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Aggregate-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:931
Time specification used by class rofl::ctimer object.
Definition: ctimespec.h:25
uint32_t send_port_mod_message(const rofl::cauxid &auxid, uint32_t port_no, const rofl::caddress_ll &hwaddr, uint32_t config, uint32_t mask, uint32_t advertise)
Sends OpenFlow Port-Mod message to attached datapath element.
Definition: crofdpt.cc:1654
uint32_t send_packet_out_message(const rofl::cauxid &auxid, uint32_t buffer_id, uint32_t in_port, const rofl::openflow::cofactions &actions, uint8_t *data=NULL, size_t datalen=0)
Sends OpenFlow Packet-Out message to attached datapath element.
Definition: crofdpt.cc:1431
Definition: cofmsg_table_stats.h:132
uint8_t get_version_negotiated() const
Returns the OpenFlow protocol version used for this control connection.
Definition: crofdpt.h:1214
virtual ~crofdpt()
crofdpt destructor
Definition: crofdpt.h:1078
Definition: ctransactions.h:27
virtual void handle_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid, uint8_t stats_type)
Timer expired while waiting for OpenFlow Stats-Reply message.
Definition: crofdpt.h:305
Class representing a remote datapath element.
Definition: crofdpt.h:973
uint32_t send_meter_config_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::openflow::cofmeter_config_request &meter_config_stats_request, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Meter-Config-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:1355
Definition: cofmsg_flow_removed.h:20
uint8_t get_n_tables() const
Returns the datapath element's number of tables in the OpenFlow pipeline.
Definition: crofdpt.h:1286
Definition: cofaggrstats.h:21
uint32_t send_role_request(const rofl::cauxid &auxid, const rofl::openflow::cofrole &role, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Role-Request message to attached datapath element.
Definition: crofdpt.cc:1510
virtual void handle_features_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Features-Reply message.
Definition: crofdpt.h:246
Definition: cofmsg_meter_config_stats.h:147
virtual void handle_conn_writable(rofl::crofdpt &dpt, const rofl::cauxid &auxid)
Called when a congestion situation on the control connection has been solved.
Definition: crofdpt.h:201
virtual void handle_table_features_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Table-Features-Stats-Reply message.
Definition: crofdpt.h:683
bool remove_on_channel_termination() const
Returns true, when this instance should be destroyed when its crofchan has closed.
Definition: crofdpt.h:1230
uint32_t send_set_config_message(const rofl::cauxid &auxid, uint16_t flags, uint16_t miss_send_len)
Sends OpenFlow Set-Config message to attached datapath element.
Definition: crofdpt.cc:1699
Environment expected by a rofl::crofdpt instance.
Definition: crofdpt.h:75
uint32_t send_group_stats_request(const rofl::cauxid &auxid, uint16_t stats_flags, const rofl::openflow::cofgroup_stats_request &group_stats_request, const rofl::cclock &timeout=rofl::cclock(DEFAULT_REQUEST_TIMEOUT))
Sends OpenFlow Group-Stats-Request message to attached datapath element.
Definition: crofdpt.cc:1085
void send_error_message(const rofl::cauxid &auxid, uint32_t xid, uint16_t type, uint16_t code, uint8_t *data=NULL, size_t datalen=0)
Sends OpenFlow Error message to attached datapath element.
Definition: crofdpt.cc:1884
virtual void handle_flow_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_flow_stats_reply &msg)
OpenFlow Flow-Stats-Reply message received.
Definition: crofdpt.h:406
virtual void handle_conn_established(rofl::crofdpt &dpt, const rofl::cauxid &auxid)
Called when a control connection (main or auxiliary) has been established.
Definition: crofdpt.h:135
virtual ~crofdpt_env()
rofl::crofdpt_env destructor
Definition: crofdpt.h:90
virtual void handle_meter_config_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Meter-Config-Stats-Reply message.
Definition: crofdpt.h:625
uint32_t send_set_async_config_message(const rofl::cauxid &auxid, const rofl::openflow::cofasync_config &async_config)
Sends OpenFlow Set-Async-Config message to attached datapath element.
Definition: crofdpt.cc:1808
An OpenFlow control channel grouping multiple control connections.
Definition: crofchan.h:154
Definition: cofqueuestats.h:22
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
crofconn & add_conn(const cauxid &aux_id, enum rofl::csocket::socket_type_t socket_type, cparams const &socket_params)
Add a new connection while creating a new crofconn instance and do a socket connect.
Definition: crofchan.cc:69
virtual void handle_port_desc_stats_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_port_desc_stats_reply &msg)
OpenFlow Port-Desc-Stats-Reply message received.
Definition: crofdpt.h:696
Definition: cofmeterconfig.h:23
virtual void handle_conn_refused(rofl::crofdpt &dpt, const rofl::cauxid &auxid)
Called when an attempt to establish a control connection has been refused.
Definition: crofdpt.h:163
uint32_t get_capabilities() const
Returns the datapath element's capabilities.
Definition: crofdpt.h:1295
virtual void handle_port_stats_reply_timeout(rofl::crofdpt &dpt, uint32_t xid)
Timer expired while waiting for OpenFlow Port-Stats-Reply message.
Definition: crofdpt.h:393
Definition: ctransactions.h:35
uint32_t send_table_mod_message(const rofl::cauxid &auxid, uint8_t table_id, uint32_t config)
Sends OpenFlow Table-Mod message to attached datapath element.
Definition: crofdpt.cc:1617
Definition: croflexception.h:27
Definition: cofflowstats.h:26
Definition: cofmsg_experimenter_stats.h:184
Definition: cofmeterstats.h:23
virtual void handle_get_config_reply(rofl::crofdpt &dpt, const rofl::cauxid &auxid, rofl::openflow::cofmsg_get_config_reply &msg)
OpenFlow Get-Config-Reply message received.
Definition: crofdpt.h:259