ROFL-pipeline  v0.6.0dev
of1x_switch.h
Go to the documentation of this file.
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 #ifndef __OF1X_SWITCH_H__
6 #define __OF1X_SWITCH_H__
7 
8 #include <stdlib.h>
9 #include <string.h>
10 #include "rofl.h"
11 #include "../of_switch.h"
12 #include "pipeline/of1x_pipeline.h"
13 
22 #define OF1XP_NO_BUFFER 0xffffffff
23 
28 typedef struct of1x_switch{
29 
30  //General switch instance information
31 
32  /* This part is common and MUST be at the very beginning */
33  of_version_t of_ver;
34  uint64_t dpid;
35  char name[LOGICAL_SWITCH_MAX_LEN_NAME];
36  unsigned int max_ports;
37  unsigned int num_of_ports;
38 
39  //Switch logical ports
40  logical_switch_port_t logical_ports[LOGICAL_SWITCH_MAX_LOG_PORTS];
41 
42  //Platform agnostic pointer
43  of_switch_platform_state_t* platform_state;
44  /* End of common part */
45 
46  //pipeline
47  of1x_pipeline_t pipeline;
48 
49  //Mutex
50  platform_mutex_t* mutex;
51 
53 
58 
59 //C++ extern C
60 ROFL_BEGIN_DECLS
61 
62 /* Initializer and destroyer */
63 
73 of1x_switch_t* of1x_init_switch(const char* name, of_version_t version, uint64_t dpid, unsigned int num_of_tables, enum of1x_matching_algorithm_available* ma_list);
74 
75 /* Reconfigures the pipeline to behave as an OF specific version pipeline. Warning: this function may DELETE all the entries in the tables, timers and group entries of the switch */
76 rofl_result_t __of1x_reconfigure_switch(of1x_switch_t* sw, of_version_t version);
77 
78 rofl_result_t __of1x_destroy_switch(of1x_switch_t* sw);
79 
80 /* Port management */
81 rofl_result_t __of1x_attach_port_to_switch_at_port_num(of1x_switch_t* sw, unsigned int port_num, switch_port_t* port);
82 rofl_result_t __of1x_attach_port_to_switch(of1x_switch_t* sw, switch_port_t* port, unsigned int* port_num);
83 rofl_result_t __of1x_detach_port_from_switch_by_port_num(of1x_switch_t* sw, unsigned int port_num);
84 rofl_result_t __of1x_detach_port_from_switch(of1x_switch_t* sw, switch_port_t* port);
85 rofl_result_t __of1x_detach_all_ports_from_switch(of1x_switch_t* sw);
86 
87 /* Dump */
94 void of1x_dump_switch(of1x_switch_t* sw, bool nbo);
101 void of1x_full_dump_switch(of1x_switch_t* sw, bool nbo);
102 
103 //Creates a snapshot of the running of LSI
104 of1x_switch_snapshot_t* __of1x_switch_get_snapshot(of1x_switch_t* sw);
105 
106 //Destroy a previously generated snapshot
107 void __of1x_switch_destroy_snapshot(of1x_switch_snapshot_t* snapshot);
108 
109 
110 //C++ extern C
111 ROFL_END_DECLS
112 
113 #endif //OF1X_SWITCH
OpenFlow v1.0, 1.2 and 1.3.2 pipeline abstraction.
OpenFlow-enabled v1.0, 1.2 and 1.3.2 switch abstraction.
Definition: of1x_switch.h:28
struct of1x_switch of1x_switch_t
OpenFlow-enabled v1.0, 1.2 and 1.3.2 switch abstraction.
of1x_switch_t of1x_switch_snapshot_t
Switch snapshot.
Definition: of1x_switch.h:57
ROFL_BEGIN_DECLS of1x_switch_t * of1x_init_switch(const char *name, of_version_t version, uint64_t dpid, unsigned int num_of_tables, enum of1x_matching_algorithm_available *ma_list)
Creates an OpenFlow v1.0, 1.2 and 1.3.2 forwarding instance.
Definition: of1x_switch.c:12
Port abstraction.
Definition: switch_port.h:145
void of1x_dump_switch(of1x_switch_t *sw, bool nbo)
Dumps the OpenFlow v1.0, 1.2 and 1.3.2 forwarding instance, for debugging purposes.
Definition: of1x_switch.c:245
OpenFlow v1.0, 1.2 and 1.3.2 pipeline abstraction data structure.
Definition: of1x_pipeline.h:50
void of1x_full_dump_switch(of1x_switch_t *sw, bool nbo)
Dumps the OpenFlow v1.0, 1.2 and 1.3.2 forwarding instance, for debugging purposes.
Definition: of1x_switch.c:255