@Override public OFMessage instantiate() { return new OFEchoRequest(); } }), ECHO_REPLY(3, OFEchoReply.class, new Instantiable<OFMessage>() {
void processOFEchoRequest(final ControllerChannelHandler h, final OFEchoRequest m) throws IOException { final OFEchoReply reply = (OFEchoReply) BasicFactory.getInstance() .getMessage(OFType.ECHO_REPLY); reply.setXid(m.getXid()); reply.setPayload(m.getPayload()); reply.setLengthU(m.getLengthU()); h.channel.write(Collections.singletonList(reply)); }
OFEchoReply echoReply = (OFEchoReply) factory.getMessage(OFType.ECHO_REPLY); byte []payload = ((OFEchoRequest)msg).getPayload(); if (payload != null && payload.length != 0 ) {
@Override public void readFrom(final ChannelBuffer bb) { super.readFrom(bb); final int datalen = this.getLengthU() - OFEchoRequest.MINIMUM_LENGTH; if (datalen > 0) { this.payload = new byte[datalen]; bb.readBytes(this.payload); } }
/** * Processes OpenFlow echo request message. * * @param h the switch channel handler * @param m the echo request message * @throws IOException TODO */ void processOFEchoRequest(final SwitchChannelHandler h, final OFEchoRequest m) throws IOException { final OFEchoReply reply = (OFEchoReply) BasicFactory.getInstance() .getMessage(OFType.ECHO_REPLY); reply.setXid(m.getXid()); reply.setPayload(m.getPayload()); reply.setLengthU(m.getLengthU()); h.channel.write(Collections.singletonList(reply)); }