-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitchs2.h
More file actions
71 lines (49 loc) · 2.14 KB
/
switchs2.h
File metadata and controls
71 lines (49 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef _SWITCHS2_H_
#define _SWITCHS2_H_
#include <string>
//#include "openflow-default.hh"
#include "flow.hh"
#include "ofp-msg-event.hh"
#include "flowmod.hh"
#include "datapath-join.hh"
#include "../../../oflib/ofl-actions.h"
#include "../../../oflib/ofl-messages.h"
#include "switch13.h"
namespace pfswitch13{
using namespace vigil;
class SwitchS2:public Switch13{
private:
unsigned pid;
unsigned out_port;
public:
SwitchS2(const vigil::datapathid dpid,const std::string &name,
const SwitchData &data):Switch13(dpid,name,data){}
SwitchS2(const unsigned dpid,const std::string &name,
const SwitchData &data):Switch13(dpid,name,data){}
SwitchS2(const uint64_t dpid,const std::string &name,
const SwitchData &data):Switch13(dpid,name,data){}
virtual void configure(unsigned _tnum=0,enum of_tmod_cmd cmd=OFTM_ADD){
tnum=_tnum;
//std::cerr<<self.to_string()<<"\n";
Actions *acts=new Actions();
acts->CreateOutput(data.out_port);
Instruction *inst=new Instruction();
inst->CreateApply(acts);
FlowMod *mod = new FlowMod(0x00ULL,0x00ULL,tnum,
toFlowCmd(cmd), //OFPFC_ADD, // cf if-fel eldonteni
OFP_FLOW_PERMANENT,
OFP_FLOW_PERMANENT,
OFP_DEFAULT_PRIORITY, //tnum
0,
OFPP_ANY,OFPG_ANY,ofd_flow_mod_flags());
mod->AddMatch(&self.match);
mod->AddInstructions(inst);
nox::send_openflow_msg(dpid,(struct ofl_msg_header *)&mod->fm_msg,0,true);
//delete inst; delete acts;
}
virtual void switchWeights(unsigned*,enum of_tmod_cmd=OFTM_MODIFY){
// nothing to do
}
}; // class SwitchS2
}; // namespace pfswitch13
#endif // _SWITCHS2_H_