Examples of checksum()


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

    ip.flags(0);
    ip.tos(0);
    ip.source(new byte[] {(byte) 192, (byte) 168, 18, (byte) 218});
    ip.setByteArray(16, new byte[] {(byte) 192,(byte) 168, 18, (byte) 219});
   
    ip.checksum(0);
    System.out.printf("crc=0x%X ip.len=%d\n", Checksum.inChecksum(ip, 0, ip.size()), ip.size());
    ip.checksum(Checksum.inChecksum(ip, 0, ip.size()));
    System.out.println(packet.getState().toDebugString());
   
    System.out.printf("crc=0x%X\n", Checksum.inChecksum(ip, 0, ip.size()));
View Full Code Here

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

    ip.source(new byte[] {(byte) 192, (byte) 168, 18, (byte) 218});
    ip.setByteArray(16, new byte[] {(byte) 192,(byte) 168, 18, (byte) 219});
   
    ip.checksum(0);
    System.out.printf("crc=0x%X ip.len=%d\n", Checksum.inChecksum(ip, 0, ip.size()), ip.size());
    ip.checksum(Checksum.inChecksum(ip, 0, ip.size()));
    System.out.println(packet.getState().toDebugString());
   
    System.out.printf("crc=0x%X\n", Checksum.inChecksum(ip, 0, ip.size()));
   
    JBuffer b = new JBuffer(4);
View Full Code Here

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

    int computed = Checksum.inChecksum(ip, 0, ip.size());

    System.out.printf("1chunk=%x\n", computed);
    System.out.printf("shoudbe=%x checksum=%x\n", Checksum.inChecksumShouldBe(
        ip.checksum(), computed), ip.checksum());

    assertTrue(ip.isChecksumValid());
  }

  /**
 
View Full Code Here

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

    int computed = Checksum.inChecksum(ip, 0, ip.size());

    System.out.printf("1chunk=%x\n", computed);
    System.out.printf("shoudbe=%x checksum=%x\n", Checksum.inChecksumShouldBe(
        ip.checksum(), computed), ip.checksum());

    assertTrue(ip.isChecksumValid());
  }

  /**
 
View Full Code Here

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

  public void testIp4CRC16Pkt2() {

    JPacket packet = super.getPcapPacket(TestUtils.L2TP, 1);
    Ip4 ip = packet.getHeader(new Ip4());

    assertEquals(ip.calculateChecksum(), ip.checksum());
  }

  /**
   * Test ip4 cr c16 pkt50.
   */
 
View Full Code Here

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

    JPacket packet = super.getPcapPacket(TestUtils.L2TP, 46 - 1);
    Ip4 ip = packet.getHeader(new Ip4());

    int crc;
    assertEquals(ip.checksum(), ip.calculateChecksum());

    // System.out.printf("ip.crc=%x computed=%x\n", ip.checksum(), crc);
  }

  /**
 
View Full Code Here

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

      assertTrue(packet.hasHeader(ip));

      assertEquals(20, ip.size());
      final int crc = ip.calculateChecksum();

      if (ip.checksum() != crc) {
        try {
          System.out.println(packet.getState().toDebugString());
          System.out.println(packet);
        } catch (Exception e) {
          System.out.println(packet.getState().toDebugString());
View Full Code Here

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

        } catch (Exception e) {
          System.out.println(packet.getState().toDebugString());
          e.printStackTrace();
        }
        System.out
            .printf("#%d: ip.crc=%x computed=%x\n", f, ip.checksum(), crc);
        System.out.println(ip.toHexdump());
      }

      assertEquals("Frame #" + f, ip.checksum(), crc);
    }
View Full Code Here

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

        System.out
            .printf("#%d: ip.crc=%x computed=%x\n", f, ip.checksum(), crc);
        System.out.println(ip.toHexdump());
      }

      assertEquals("Frame #" + f, ip.checksum(), crc);
    }
  }

  /**
   * Test ip4 cr c16 using handler.
View Full Code Here

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

      System.out.println(ip1);
      System.out.println(ip2);

      assertEquals(c1, ip1.checksum());
      assertEquals(c2, ip2.checksum());

      assertEquals(c1, c2);
    }

  }
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.