void SimpleController::flood(Channel *channel, const PacketIn *msg) { log_debug("flood"); ActionList actions; actions.add(AT_OUTPUT{OFPP_FLOOD}); PacketOutBuilder packetOut; packetOut.setBufferId(msg->bufferId()); packetOut.setInPort(msg->inPort()); packetOut.setActions(actions); packetOut.send(channel); }
void SimpleController::addFlow(Channel *channel, const PacketIn *msg, const EnetFrame *frame, UInt32 outPort) { MatchBuilder match; match.add(OFB_IN_PORT{msg->inPort()}); match.add(OFB_ETH_DST{frame->dst}); match.add(OFB_ETH_SRC{frame->src}); ActionList actions; actions.add(AT_OUTPUT{outPort}); InstructionList instructions; instructions.add(IT_APPLY_ACTIONS{&actions}); FlowModBuilder flowMod; flowMod.setMatch(match); flowMod.setInstructions(instructions); flowMod.setIdleTimeout(10); flowMod.setHardTimeout(30); flowMod.setPriority(0x7FFF); flowMod.setBufferId(msg->bufferId()); flowMod.send(channel); }