sb.append(((TCP) payload).getSourcePort()); sb.append("\ntp_dst: "); sb.append(((TCP) payload).getDestinationPort());
@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()); } }
TCP tcpPacket = (TCP) ipv4Packet.getPayload(); portSrc = tcpPacket.getSourcePort(); portDst = tcpPacket.getDestinationPort(); } else if (protocol == IPv4.PROTOCOL_UDP) { UDP udpPacket = (UDP) ipv4Packet.getPayload();