ROFL-pipeline  v0.6.0dev
matching_algorithms.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 
6 #ifndef MATCHING_ALGORITHMS_H_
7 #define MATCHING_ALGORITHMS_H_
8 
27 #include "rofl.h"
28 #include "../of1x_flow_entry.h"
29 #include "../of1x_statistics.h"
30 #include "../of1x_utils.h"
31 #include "available_ma.h"
32 
33 /*
34  * forward declarations
35  */
36 struct of1x_flow_table;
37 enum of1x_mutex_acquisition_required;
38 
39 #define OF1X_MATCHING_ALGORITHMS_MAX_DESCRIPTION_LENGTH 256
40 
44 #define OF1X_REGISTER_MATCHING_ALGORITHM(NAME)\
45  struct of1x_matching_algorithm_functions of1x_matching_algorithm_##NAME##_maf
46 
47 
54 
64  rofl_result_t
65  (*init_hook)(struct of1x_flow_table *const table);
66 
78  rofl_result_t
79  (*destroy_hook)(struct of1x_flow_table *const table); //Mutual exclusion will already be taken by the of1x_flow_table destructor
80 
81 
82  // flow management
101  (*add_flow_entry_hook)(struct of1x_flow_table *const table,
102  of1x_flow_entry_t *const entry,
103  bool check_overlap,
104  bool reset_counts);
105 
106 
127  rofl_result_t
128  (*modify_flow_entry_hook)(struct of1x_flow_table *const table,
129  of1x_flow_entry_t *const entry,
130  const enum of1x_flow_removal_strictness strict,
131  bool reset_counts);
132 
133 
154  rofl_result_t
155  (*remove_flow_entry_hook)(struct of1x_flow_table *const table,
156  of1x_flow_entry_t *const entry,
157  of1x_flow_entry_t *const specific_entry,
158  const enum of1x_flow_removal_strictness strict,
159  uint32_t out_port,
160  uint32_t out_group,
162  of1x_mutex_acquisition_required_t mutex_acquired);
163 
164 
165 
166  //Packet matching lookup
179  (*find_best_match_hook)(unsigned tid, struct of1x_flow_table *const table,
180  packet_matches_t *const pkt_matches);
181 
182 
183 
184  // flow stats
190  rofl_result_t
191  (*get_flow_stats_hook)(struct of1x_flow_table *const table,
192  uint64_t cookie,
193  uint64_t cookie_mask,
194  uint32_t out_port,
195  uint32_t out_group,
196  of1x_match_group_t *const matches,
197  of1x_stats_flow_msg_t* msg);
198 
199 
200 
206  rofl_result_t
208  uint64_t cookie,
209  uint64_t cookie_mask,
210  uint32_t out_port,
211  uint32_t out_group,
212  of1x_match_group_t *const matches,
214 
215 
227  (*find_entry_using_group_hook)(struct of1x_flow_table *const table,
228  const unsigned int group_id);
229 
230 
231  // dump flow table
240  void
241  (*dump_hook)(struct of1x_flow_table *const table, bool raw_nbo);
242 
243 
249  char description[OF1X_MATCHING_ALGORITHMS_MAX_DESCRIPTION_LENGTH];
251 
255 extern of1x_matching_algorithms_functions_t of1x_matching_algorithms[];
256 
260 void __of1x_generate_matching_algorithm_list(void);
261 
262 #endif /* MATCHING_ALGORITHMS_H_ */
OpenFlow v1.0, 1.2 and 1.3.2 flow entry structure.
enum of1x_flow_remove_reason of1x_flow_remove_reason_t
Flow remove reasons (enum ofp_flow_removed_reason)
rofl_result_t(* get_flow_stats_hook)(struct of1x_flow_table *const table, uint64_t cookie, uint64_t cookie_mask, uint32_t out_port, uint32_t out_group, of1x_match_group_t *const matches, of1x_stats_flow_msg_t *msg)
Retrieves flow stats according to spec The operation MUST comply with the behaviour defined in the Op...
rofl_of1x_fm_result_t(* add_flow_entry_hook)(struct of1x_flow_table *const table, of1x_flow_entry_t *const entry, bool check_overlap, bool reset_counts)
Adds a flow entry to the table.
OpenFlow v1.0, 1.2 and 1.3.2 flow table abstraction.
of1x_flow_removal_strictness
Flow removal operations strictness.
struct of1x_matching_algorithm_functions of1x_matching_algorithms_functions_t
Set of functions calls to be implemented in order to extend Matching algorithms for OF versions 1...
Set of functions calls to be implemented in order to extend Matching algorithms for OF versions 1...
rofl_result_t(* remove_flow_entry_hook)(struct of1x_flow_table *const table, of1x_flow_entry_t *const entry, of1x_flow_entry_t *const specific_entry, const enum of1x_flow_removal_strictness strict, uint32_t out_port, uint32_t out_group, of1x_flow_remove_reason_t reason, of1x_mutex_acquisition_required_t mutex_acquired)
Removes one or more flow entries in the table.
rofl_result_t(* get_flow_aggregate_stats_hook)(struct of1x_flow_table *const table, uint64_t cookie, uint64_t cookie_mask, uint32_t out_port, uint32_t out_group, of1x_match_group_t *const matches, of1x_stats_flow_aggregate_msg_t *msg)
Retrieves aggregate flow stats according to spec The operation MUST comply with the behaviour defined...
rofl_result_t(* modify_flow_entry_hook)(struct of1x_flow_table *const table, of1x_flow_entry_t *const entry, const enum of1x_flow_removal_strictness strict, bool reset_counts)
Modifies a set of flow entries in the table.
Linked list containing all the individual flow stats.
enum rofl_of1x_fm_result rofl_of1x_fm_result_t
Extended flowmod return codes.
rofl_result_t(* destroy_hook)(struct of1x_flow_table *const table)
Allows to destroy matching algorithm table state.
rofl_result_t(* init_hook)(struct of1x_flow_table *const table)
Allows to initialize matching algorithm table state.
void(* dump_hook)(struct of1x_flow_table *const table, bool raw_nbo)
Dump hook.
Aggregated flow stats message.
char description[OF1X_MATCHING_ALGORITHMS_MAX_DESCRIPTION_LENGTH]
Description of the matching algorithm.