Examples of Checksum()


Examples of org.jnetpcap.protocol.network.Ip4.checksum()

    assertEquals(3, icmp.type());
    assertEquals(3, icmp.code());
    assertEquals(0x2731, icmp.checksum());
    assertEquals(0, unreach.reserved());

    assertEquals(0x8724, ip.checksum());
    assertEquals(440, ip.length());

    // Devil's advocate
    assertFalse(icmp.hasSubHeader(IcmpType.ECHO_REPLY.getId()));
    assertFalse(icmp.hasSubHeader(IcmpType.PARAM_PROBLEM.getId()));
View Full Code Here

Examples of org.jnetpcap.protocol.network.Ip4.checksum()

    Tcp tcp = packet.getHeader(new Tcp());

    ip.destination(dst.getAddress());
    ip.source(src.getAddress());

    ip.checksum(ip.calculateChecksum());
    tcp.checksum(tcp.calculateChecksum());
    packet.scan(Ethernet.ID);

    System.out.println(packet);
    List<PcapIf> alldevs = new ArrayList<PcapIf>(); // Will be filled with NICs
View Full Code Here

Examples of org.jnetpcap.protocol.tcpip.Tcp.checksum()

    ip.destination(dst.getAddress());
    ip.source(src.getAddress());

    ip.checksum(ip.calculateChecksum());
    tcp.checksum(tcp.calculateChecksum());
    packet.scan(Ethernet.ID);

    System.out.println(packet);
    List<PcapIf> alldevs = new ArrayList<PcapIf>(); // Will be filled with NICs
    StringBuilder errbuf = new StringBuilder(); // For any error msgs
View Full Code Here

Examples of org.jnetpcap.protocol.tcpip.Tcp.checksum()

        assertTrue("#" + f, packet.hasHeader(ip));

        final int crc =
            Checksum.pseudoTcp(packet, ip.getOffset(), tcp.getOffset());

        if (crc != 0 && tcp.checksum() != crc) {
          System.out.println(tcp);
          System.out.printf("#%d: tcp.crc=%x computed=%x\n", f, tcp.checksum(),
              crc);
          // System.out.println(ip.toHexdump());
          // System.out.println(tcp.toHexdump());
View Full Code Here

Examples of org.jnetpcap.protocol.tcpip.Tcp.checksum()

        final int crc =
            Checksum.pseudoTcp(packet, ip.getOffset(), tcp.getOffset());

        if (crc != 0 && tcp.checksum() != crc) {
          System.out.println(tcp);
          System.out.printf("#%d: tcp.crc=%x computed=%x\n", f, tcp.checksum(),
              crc);
          // System.out.println(ip.toHexdump());
          // System.out.println(tcp.toHexdump());
          System.exit(0);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.