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


Java PacketContext.inPacket方法代码示例

本文整理汇总了Java中org.onosproject.net.packet.PacketContext.inPacket方法的典型用法代码示例。如果您正苦于以下问题:Java PacketContext.inPacket方法的具体用法?Java PacketContext.inPacket怎么用?Java PacketContext.inPacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.net.packet.PacketContext的用法示例。


在下文中一共展示了PacketContext.inPacket方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {

    if (context.isHandled()) {
        return;
    }

    InboundPacket pkt = context.inPacket();
    Ethernet ethernet = pkt.parsed();
    log.trace("Rcvd pktin: {}", ethernet);
    if (ethernet.getEtherType() == Ethernet.TYPE_ARP) {
        arpHandler.processPacketIn(pkt);
    } else if (ethernet.getEtherType() == Ethernet.TYPE_IPV4) {
        IPv4 ipPacket = (IPv4) ethernet.getPayload();
        ipHandler.addToPacketBuffer(ipPacket);
        if (ipPacket.getProtocol() == IPv4.PROTOCOL_ICMP) {
            icmpHandler.processPacketIn(pkt);
        } else {
            ipHandler.processPacketIn(pkt);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:SegmentRoutingManager.java

示例2: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
	if (context.isHandled()) {
		return;
	}
	InboundPacket pkt = context.inPacket();
	Ethernet ethPkt = pkt.parsed();

	if (ethPkt == null) {
		return;
	}

	if (ethPkt.getEtherType() == EtherType.ARP.ethType().toShort()) {
		context.treatmentBuilder().setOutput(PortNumber.FLOOD);
		context.send();
	}
}
 
开发者ID:ShakhMoves,项目名称:ShakhSDVPN,代码行数:18,代码来源:ARPHandler.java

示例3: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
    // Stop processing if the packet has been handled, since we
    // can't do any more to it.
    if (context.isHandled()) {
        return;
    }
    // If IPv6 NDP is disabled, don't handle IPv6 frames.
    InboundPacket pkt = context.inPacket();
    Ethernet ethPkt = pkt.parsed();
    if (ethPkt == null) {
        return;
    }
    if (!ipv6NeighborDiscovery && (ethPkt.getEtherType() == Ethernet.TYPE_IPV6)) {
        return;
    }
    //handle the arp packet.
    proxyArpService.handlePacket(context);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:20,代码来源:ProxyArp.java

示例4: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {

    if (context.isHandled()) {
        return;
    }

    InboundPacket pkt = context.inPacket();
    Ethernet ethernet = pkt.parsed();

    if (ethernet.getEtherType() == Ethernet.TYPE_ARP) {
        arpHandler.processPacketIn(pkt);
    } else if (ethernet.getEtherType() == Ethernet.TYPE_IPV4) {
        IPv4 ipPacket = (IPv4) ethernet.getPayload();
        ipHandler.addToPacketBuffer(ipPacket);
        if (ipPacket.getProtocol() == IPv4.PROTOCOL_ICMP) {
            icmpHandler.processPacketIn(pkt);
        } else {
            ipHandler.processPacketIn(pkt);
        }
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:23,代码来源:SegmentRoutingManager.java

示例5: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
    if (context.isHandled()) {
        return;
    }

    Set<DeviceId> gateways = osNodeService.completeNodes(GATEWAY)
            .stream().map(OpenstackNode::intgBridge)
            .collect(Collectors.toSet());

    if (!gateways.contains(context.inPacket().receivedFrom().deviceId())) {
        // return if the packet is not from gateway nodes
        return;
    }

    InboundPacket pkt = context.inPacket();
    Ethernet ethernet = pkt.parsed();
    if (ethernet != null &&
            ethernet.getEtherType() == Ethernet.TYPE_ARP) {
        eventExecutor.execute(() -> processArpPacket(context, ethernet));
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:23,代码来源:OpenstackRoutingArpHandler.java

示例6: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
    Set<DeviceId> gateways = osNodeService.completeNodes(GATEWAY)
            .stream().map(OpenstackNode::intgBridge)
            .collect(Collectors.toSet());

    if (context.isHandled()) {
        return;
    } else if (!gateways.contains(context.inPacket().receivedFrom().deviceId())) {
        // return if the packet is not from gateway nodes
        return;
    }

    InboundPacket pkt = context.inPacket();
    Ethernet ethernet = pkt.parsed();
    if (ethernet == null || ethernet.getEtherType() == Ethernet.TYPE_ARP) {
        return;
    }

    IPv4 iPacket = (IPv4) ethernet.getPayload();
    if (iPacket.getProtocol() == IPv4.PROTOCOL_ICMP) {
        eventExecutor.execute(() -> processIcmpPacket(context, ethernet));
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:25,代码来源:OpenstackRoutingIcmpHandler.java

示例7: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {

    if (context.isHandled()) {
        return;
    }
    InboundPacket pkt = context.inPacket();
    Ethernet ethPkt = pkt.parsed();
    if (ethPkt == null) {
        return;
    }
    if (ethPkt.getEtherType() == TYPE_ARP) {
        //handle the arp packet.
        handlePacket(context);
    } else {
        return;
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:CastorArpManager.java

示例8: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
    if (context.isHandled()) {
        return;
    }

    // Ensure packet is IPv6 Solicited RA
    InboundPacket pkt = context.inPacket();
    Ethernet ethernet = pkt.parsed();
    if ((ethernet == null) || (ethernet.getEtherType() != Ethernet.TYPE_IPV6)) {
        return;
    }
    IPv6 ipv6Packet = (IPv6) ethernet.getPayload();
    if (ipv6Packet.getNextHeader() != IPv6.PROTOCOL_ICMP6) {
        return;
    }
    ICMP6 icmp6Packet = (ICMP6) ipv6Packet.getPayload();
    if (icmp6Packet.getIcmpType() != ICMP6.ROUTER_SOLICITATION) {
        return;
    }

    // Start solicited-RA handling thread
    SolicitedRAWorkerThread sraWorkerThread = new SolicitedRAWorkerThread(pkt);
    executors.schedule(sraWorkerThread, 0, TimeUnit.SECONDS);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:RouterAdvertisementManager.java

示例9: json

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
/**
 * Returns a JSON representation of the given packet context.
 *
 * @param  context the packet context
 * @return         the inbound packetjson message
 */
public static JsonObject json(PacketContext context) {
    JsonObject jo = new JsonObject();
    InboundPacket pkt = context.inPacket();
    // parse connection host
    jo.addProperty(SWITCH_ID, pkt.receivedFrom().deviceId().toString());
    jo.addProperty(IN_PORT, pkt.receivedFrom().port().name());
    jo.addProperty(LOGICAL, pkt.receivedFrom().port().isLogical());
    jo.addProperty(RECEIVED, new Date(context.time()).toString());
    jo.addProperty(MSG_TYPE, PKT_TYPE);
    // parse ethernet
    jo.addProperty(SUB_MSG_TYPE,
            EthType.EtherType.lookup(pkt.parsed().getEtherType()).name());
    jo.addProperty(ETH_TYPE, pkt.parsed().getEtherType());
    jo.addProperty(SRC_MAC_ADDR, pkt.parsed().getSourceMAC().toString());
    jo.addProperty(DEST_MAC_ADDR, pkt.parsed().getDestinationMAC().toString());
    jo.addProperty(VLAN_ID, pkt.parsed().getVlanID());
    jo.addProperty(B_CAST, pkt.parsed().isBroadcast());
    jo.addProperty(M_CAST, pkt.parsed().isMulticast());
    jo.addProperty(PAD, pkt.parsed().isPad());
    jo.addProperty(PRIORITY_CODE, pkt.parsed().getPriorityCode());
    // parse bytebuffer
    jo.addProperty(DATA_LEN, pkt.unparsed().array().length);
    jo.addProperty(PAYLOAD, pkt.unparsed().asCharBuffer().toString());
    return jo;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:32,代码来源:MQUtil.java

示例10: handlePacket

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
private void handlePacket(PacketContext context) {
    InboundPacket pkt = context.inPacket();
    Ethernet ethPkt = pkt.parsed();

    NeighbourMessageContext msgContext =
            DefaultNeighbourMessageContext.createContext(ethPkt, pkt.receivedFrom(), actions);

    if (msgContext == null) {
        return;
    }

    if (handleMessage(msgContext)) {
        context.block();
    }

}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:NeighbourResolutionManager.java

示例11: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
    // Stop processing if the packet has been handled, since we
    // can't do any more to it.
    log.debug("Received trigger for label DB sync.");
    if (context.isHandled()) {
        return;
    }

    InboundPacket pkt = context.inPacket();
    if (pkt == null) {
        return;
    }

    Ethernet ethernet = pkt.parsed();
    if (ethernet == null || ethernet.getEtherType() != Ethernet.TYPE_IPV4) {
        return;
    }

    IPv4 ipPacket = (IPv4) ethernet.getPayload();
    if (ipPacket == null || ipPacket.getProtocol() != IPv4.PROTOCOL_TCP) {
        return;
    }

    TCP tcp = (TCP) ipPacket.getPayload();
    if (tcp == null || tcp.getDestinationPort() != PCEP_PORT) {
        return;
    }

    syncLabelDb(pkt.receivedFrom().deviceId());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:PceManager.java

示例12: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
    InboundPacket pkt = context.inPacket();
    ConnectPoint connectPoint = pkt.receivedFrom();
    DeviceId deviceId = connectPoint.deviceId();
    Ethernet ethPkt = pkt.parsed();
    if (ethPkt == null) {
        return;
    }
    if (ethPkt.getEtherType() == Ethernet.TYPE_ARP) {
        ARP arpPacket = (ARP) ethPkt.getPayload();
        if ((arpPacket.getOpCode() == ARP.OP_REQUEST)) {
            arprequestProcess(arpPacket, deviceId);
        } else if (arpPacket.getOpCode() == ARP.OP_REPLY) {
            arpresponceProcess(arpPacket, deviceId);
        }
    } else if (ethPkt.getEtherType() == Ethernet.TYPE_IPV4) {
        if (ethPkt.getDestinationMAC().isMulticast()) {
            return;
        }
        IPv4 ip = (IPv4) ethPkt.getPayload();
        upStreamPacketProcessor(ip, deviceId);

    } else {
        return;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:VtnManager.java

示例13: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
    if (context.isHandled()) {
        return;
    }

    InboundPacket pkt = context.inPacket();
    Ethernet ethernet = pkt.parsed();

    if (ethernet != null && ethernet.getEtherType() == Ethernet.TYPE_ARP) {
        arpHandler.processPacketIn(pkt, openstackPortInfoMap.values());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:OpenstackSwitchingManager.java

示例14: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {
    // Stop processing if the packet has been handled, since we
    // can't do any more to it.
    if (context.isHandled()) {
        return;
    }

    InboundPacket pkt = context.inPacket();
    Ethernet ethPkt = pkt.parsed();
    if (ethPkt == null) {
        return;
    }

    if (ethPkt.getEtherType() == TYPE_ARP) {
        //handle the arp packet.
        proxyArpService.handlePacket(context);
    } else if (ipv6NeighborDiscovery && ethPkt.getEtherType() == TYPE_IPV6) {
        IPv6 ipv6Pkt = (IPv6) ethPkt.getPayload();
        if (ipv6Pkt.getNextHeader() == IPv6.PROTOCOL_ICMP6) {
            ICMP6 icmp6Pkt = (ICMP6) ipv6Pkt.getPayload();
            if (icmp6Pkt.getIcmpType() == NEIGHBOR_SOLICITATION ||
                icmp6Pkt.getIcmpType() == NEIGHBOR_ADVERTISEMENT) {
                // handle ICMPv6 solicitations and advertisements
                proxyArpService.handlePacket(context);
            }
        }
    }

    // FIXME why were we listening to IPv4 frames at all?
    // Do not ARP for multicast packets.  Let mfwd handle them.
    if (ethPkt.getEtherType() == Ethernet.TYPE_IPV4) {
        if (ethPkt.getDestinationMAC().isMulticast()) {
            return;
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:38,代码来源:ProxyArp.java

示例15: process

import org.onosproject.net.packet.PacketContext; //导入方法依赖的package包/类
@Override
public void process(PacketContext context) {

    // return if this packet has already been handled
    if (context.isHandled()) {
        return;
    }

    // get the inbound packet
    InboundPacket pkt = context.inPacket();
    if (pkt == null) {
        // problem getting the inbound pkt.  Log it debug to avoid spamming log file
        log.debug("Could not retrieve packet from context");
        return;
    }

    // Get the ethernet header
    Ethernet eth = pkt.parsed();
    if (eth == null) {
        // problem getting the ethernet pkt.  Log it debug to avoid spamming log file
        log.debug("Could not retrieve ethernet packet from the parsed packet");
        return;
    }

    // Get the PIM Interface the packet was received on.
    PimInterface pimi = pimInterfaceManager.getPimInterface(pkt.receivedFrom());
    if (pimi == null) {
        return;
    }

    /*
     * Pass the packet processing off to the PIMInterface for processing.
     *
     * TODO: Is it possible that PIM interface processing should move to the
     * PIMInterfaceManager directly?
     */
    pimPacketHandler.processPacket(eth, pimi);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:PimApplication.java


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