本文整理汇总了Java中org.openflow.protocol.OFEchoReply.setXid方法的典型用法代码示例。如果您正苦于以下问题:Java OFEchoReply.setXid方法的具体用法?Java OFEchoReply.setXid怎么用?Java OFEchoReply.setXid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.OFEchoReply
的用法示例。
在下文中一共展示了OFEchoReply.setXid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processOFEchoRequest
import org.openflow.protocol.OFEchoReply; //导入方法依赖的package包/类
void processOFEchoRequest(OFChannelHandler h, OFEchoRequest m)
throws IOException {
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));
}
示例2: processOFEchoRequest
import org.openflow.protocol.OFEchoReply; //导入方法依赖的package包/类
/**
* 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));
}
示例3: processOFEchoRequest
import org.openflow.protocol.OFEchoReply; //导入方法依赖的package包/类
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));
}
示例4: handleSwitchEvent
import org.openflow.protocol.OFEchoReply; //导入方法依赖的package包/类
protected void handleSwitchEvent(SelectionKey key, SocketChannel sock) {
OFSwitch sw = switchSockets.get(sock);
OFMessageAsyncStream stream = sw.getStream();
try {
if (key.isReadable()) {
List<OFMessage> msgs = stream.read();
if (msgs == null) {
key.cancel();
switchSockets.remove(sock);
return;
}
for (OFMessage m : msgs) {
switch (m.getType()) {
case PACKET_IN:
sw.handlePacketIn((OFPacketIn) m);
break;
case HELLO:
System.err.println("GOT HELLO from " + sw);
break;
case ECHO_REQUEST:
OFEchoReply reply = (OFEchoReply) stream
.getMessageFactory().getMessage(
OFType.ECHO_REPLY);
reply.setXid(m.getXid());
stream.write(reply);
break;
default:
System.err.println("Unhandled OF message: "
+ m.getType() + " from "
+ sock.socket().getInetAddress());
}
}
}
if (key.isWritable()) {
stream.flush();
}
/**
* Only register for interest in R OR W, not both, causes stream
* deadlock after some period of time
*/
if (stream.needsFlush())
key.interestOps(SelectionKey.OP_WRITE);
else
key.interestOps(SelectionKey.OP_READ);
} catch (IOException e) {
// if we have an exception, disconnect the switch
key.cancel();
switchSockets.remove(sock);
}
}