当前位置: 首页>>代码示例>>Java>>正文


Java OFEchoReply.setXid方法代码示例

本文整理汇总了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));
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:10,代码来源:OFChannelHandler.java

示例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));
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:17,代码来源:SwitchChannelHandler.java

示例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));
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:10,代码来源:ControllerChannelHandler.java

示例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);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:53,代码来源:SimpleController.java


注:本文中的org.openflow.protocol.OFEchoReply.setXid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。