本文整理汇总了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);
}
}
}
示例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();
}
}
示例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);
}
示例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);
}
}
}
示例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));
}
}
示例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));
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例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();
}
}
示例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());
}
示例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;
}
}
示例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());
}
}
示例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;
}
}
}
示例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);
}