Package org.pcap4j.packet

Examples of org.pcap4j.packet.IpV4Packet$IpV4Header


        if (srcBuf.getLinkLayerHeader().getDestinationAddress().isBroadcast()) {
            return;
        }

        // Gets the original IP header
        final IPv4Header origIpHdr = (IPv4Header) srcBuf.getNetworkLayerHeader();

        // Do not respond to networklayer broadcast/multicast messages
        if (origIpHdr.getDestination().isBroadcast() || origIpHdr.getDestination().isMulticast()) {
            return;
        }

        final int tos = 0;
        final int ttl = 0xFF;
        final IPv4Address dstAddr = origIpHdr.getSource();

        // Build the response ICMP header
        final ICMPHeader icmpHdr = new ICMPUnreachableHeader(code);
        // Build the response IP header
        final IPv4Header ipHdr = new IPv4Header(tos, ttl, IPv4Constants.IPPROTO_ICMP, dstAddr, 0);

        // Unpull the original transportlayer header
        srcBuf.unpull(srcBuf.getTransportLayerHeader().getLength());

        // Unpull the original IP header
View Full Code Here


      }
    }

    for (Short id: ipV4Packets.keySet()) {
      List<IpV4Packet> list = ipV4Packets.get(id);
      final IpV4Packet defragmentedIpV4Packet = IpV4Helper.defragment(list);

      Packet.Builder builder = originalPackets.get(id).getBuilder();
      builder.getOuterOf(IpV4Packet.Builder.class)
        .payloadBuilder(new SimpleBuilder(defragmentedIpV4Packet));
View Full Code Here

TOP

Related Classes of org.pcap4j.packet.IpV4Packet$IpV4Header

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.