• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PacketResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opendaylight.controller.sal.packet.PacketResult的典型用法代码示例。如果您正苦于以下问题:Java PacketResult类的具体用法?Java PacketResult怎么用?Java PacketResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PacketResult类属于org.opendaylight.controller.sal.packet包,在下文中一共展示了PacketResult类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: receiveDataPacket

import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
    if (inPkt == null) {
        return PacketResult.IGNORED;
    }
    logger.trace("Received a frame of size: {}",
                    inPkt.getPacketData().length);
    Packet formattedPak = this.dataPacketService.decodeDataPacket(inPkt);
    if (formattedPak instanceof Ethernet) {
        Object nextPak = formattedPak.getPayload();
        if (nextPak instanceof IPv4) {
            handlePuntedIPPacket((IPv4) nextPak, inPkt
                    .getIncomingNodeConnector());
            logger.trace("Handled IP packet");
        }
        if (nextPak instanceof ARP) {
            handleARPPacket((Ethernet) formattedPak, (ARP) nextPak, inPkt
                    .getIncomingNodeConnector());
            logger.trace("Handled ARP packet");
        }
    }
    return PacketResult.IGNORED;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:24,代码来源:ArpHandler.java


示例2: receiveDataPacket

import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
    log.trace("Received data packet.");

    // Convert packet to JSON representation.
    String jsonStr = pktToJSON(inPkt).toString();
            
    // Send notification to JMS topic.
    TextMessage message;
    try {
        if (session != null && publisher != null) {
            message = session.createTextMessage(jsonStr);
            setMsgProperties(message, inPkt);
            log.trace("Publishing the following packet-in event: " + jsonStr);
            publisher.send(message);
        } else {
            log.error("Cannot publish packet-in event. JMS not setup.");
        }
    } catch (JMSException e) {
        log.error("Error while publishing packet-in event: " + e.getMessage());
        return PacketResult.IGNORED;
    }
    
    // Also let other message handlers process this packet. 
    // If you don't want these services, remove them from
    // the OpenDaylight configuration.
    return PacketResult.KEEP_PROCESSING;
}
 
开发者ID:duerrfk,项目名称:sdn-mq,代码行数:29,代码来源:PacketHandler.java


示例3: receiveDataPacket

import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的package包/类
public PacketResult receiveDataPacket(RawPacket inPkt) {
    PacketResult result = PacketResult.IGNORED;

    // Let's only do this for OF nodeTypes... IOFMessageListener only understand OF
    if(packetInListeners.size() > 0 &&
        inPkt.getIncomingNodeConnector().getNode().getType() == Node.NodeIDType.OPENFLOW) {
        /*
         * Looked in org.sdnplatform.devicemanager.internal.DeviceManagerImpl.processPacketInMessage()
         * and it appears to only need the OFPacketIn.data and OFPacketIn.inport
         * additionally it seems to only need IOFSwitch.getID() and IOFSwitch.getStringID()
         */
        // Create a new OFPacketIn
        OFPacketIn in = new OFPacketIn();
        // Set its data
        in.setPacketData(inPkt.getPacketData());
        // Set its inport
        in.setInPort(toOFPort(inPkt.getIncomingNodeConnector()));

        // Create a new Ethernet and deserialize the packet data into it
        Ethernet eth = new Ethernet();
        eth.deserialize(in.getPacketData(), 0,
        in.getPacketData().length);
        // Add the Ethernet to the ListenerContext
        ListenerContext ctx = new ListenerContext();
        ctx.getStorage().put(IControllerService.CONTEXT_PI_PAYLOAD, eth);

        // Create a new OFSwitchAdaptor and set its id

        OFSwitchAdaptor sw = new OFSwitchAdaptor();
        sw.setId((Long) inPkt.getIncomingNodeConnector().getNode().getID());

        // Send OFPacketIn to all IOFMessageListeners
        for(IOFMessageListener packetInListener: this.packetInListeners) {
            packetInListener.receive(sw, in, ctx);
        }
        result = PacketResult.KEEP_PROCESSING;
    }

    return result;
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:41,代码来源:ControllerServiceAdaptor.java


示例4: dispatchPacket

import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的package包/类
/**
 * Loop for processing Received packets
 */
private void dispatchPacket(RawPacket pkt) {

    // for now we treat all listeners as serial listeners
    for (List<DataPacketListener> serialListeners : listenDataPacket) {
        for (DataPacketListener l : serialListeners) {

            // TODO: possibly deal with read-only and read-write packet
            // copies
            IListenDataPacket s = (l == null ? null : l.listener);
            if (s != null) {
                try {
                    // TODO Make sure to filter based on the match too,
                    // later on
                    PacketResult res = s.receiveDataPacket(pkt);
                    increaseStat("RXPacketSuccess");
                    if (res.equals(PacketResult.CONSUME)) {
                        increaseStat("RXPacketSerialExit");
                        break;
                    }
                } catch (Exception e) {
                    increaseStat("RXPacketFailedForException");
                }
            }
        }
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:30,代码来源:DataPacketService.java


示例5: receiveDataPacket

import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
    if (inPkt.getIncomingNodeConnector() == null) {
        increaseStat("nullIncomingNodeConnector");
        return PacketResult.IGNORED;
    }

    // send the packet off to be processed by listeners
    this.dispatchPacket(inPkt);

    // Walk the chain of listener going first throw all the
    // parallel ones and for each parallel in serial
    return PacketResult.IGNORED;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:15,代码来源:DataPacketService.java


示例6: receiveDataPacket

import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
	NodeConnector inport = inPkt.getIncomingNodeConnector();
	RawPacket outPkt = null;
	IPv4 ipv4 = new IPv4();
	ipv4.setDiffServ((byte) 4);
	outPkt = this.dataPacketService.encodeDataPacket(ipv4);
	outPkt.setOutgoingNodeConnector(inport);
	this.dataPacketService.transmitDataPacket(outPkt);
	// outPkt.setOutgoingNodeConnector(outgoingNodeConnector);
	return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:13,代码来源:QoSHandler.java


示例7: receiveDataPacket

import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
    if (inPkt == null) {
        logger.debug("Ignoring null packet");
        return PacketResult.IGNORED;
    }

    byte[] data = inPkt.getPacketData();
    if (data.length <= 0) {
        logger.trace("Ignoring zero length packet");
        return PacketResult.IGNORED;
    }

    if (!inPkt.getEncap().equals(LinkEncap.ETHERNET)) {
        logger.trace("Ignoring non ethernet packet");
        return PacketResult.IGNORED;
    }

    NodeConnector nodeConnector = inPkt.getIncomingNodeConnector();
    if (((Short) nodeConnector.getID()).equals(NodeConnector.SPECIALNODECONNECTORID)) {
        logger.trace("Ignoring ethernet packet received on special port: "
                + inPkt.getIncomingNodeConnector().toString());
        return PacketResult.IGNORED;
    }

    if (!connectionOutService.isLocal(nodeConnector.getNode())) {
        logger.debug("Discoery packets will not be processed from {} in a non-master controller", nodeConnector.toString());
        return PacketResult.IGNORED;
    }

    Ethernet ethPkt = new Ethernet();
    try {
        ethPkt.deserialize(data, 0, data.length * NetUtils.NumBitsInAByte);
    } catch (Exception e) {
        logger.warn("Failed to decode LLDP packet from {}: {}", inPkt.getIncomingNodeConnector(), e);
        return PacketResult.IGNORED;
    }

    if (ethPkt.getPayload() instanceof LLDP) {
        NodeConnector dst = inPkt.getIncomingNodeConnector();
        if (isEnabled(dst)) {
            if (!processDiscoveryPacket(dst, ethPkt)) {
                // Snoop the discovery pkt if not generated from us
                snoopDiscoveryPacket(dst, ethPkt);
            }
            return PacketResult.CONSUME;
        }
    }
    return PacketResult.IGNORED;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:51,代码来源:DiscoveryService.java


示例8: receiveDataPacket

import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的package包/类
/**
 * Dispatch received data packet
 *
 * @param inPkt
 *            The incoming raw packet
 * @return Possible results for Data packet processing handler
 */
public PacketResult receiveDataPacket(RawPacket inPkt);
 
开发者ID:lbchen,项目名称:ODL,代码行数:9,代码来源:IDataPacketListen.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CtAssignment类代码示例发布时间:2022-05-23
下一篇:
Java JavaCompilerImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap