Package org.jnetpcap

Examples of org.jnetpcap.Pcap.loop()


    }

    final PcapPacketArrayList list =
        new PcapPacketArrayList((int) new File(file).length() / 100);

    pcap.loop(Pcap.LOOP_INFINATE, list, null);

    pcap.close();

    return list;
  }
View Full Code Here


    Pcap pcap = Pcap.openOffline(L2TP, errbuf);
    if (pcap == null) {
      throw new IOException(errbuf.toString());
    }

    assertTrue(pcap.loop(Pcap.LOOP_INFINATE, new PcapPacketHandler<Pcap>() {
      Ip4 ip1 = new Ip4();

      Ip4 ip2 = new Ip4();

      int i = 0;
View Full Code Here

    StringBuilder errbuf = new StringBuilder();
    Pcap pcap = Pcap.openOffline(TestUtils.HTTP, errbuf);

    assertNotNull(errbuf.toString(), pcap);

    pcap.loop(Pcap.LOOP_INFINATE, new PcapPacketHandler<String>() {
      Ip4 ip = new Ip4();

      Tcp tcp = new Tcp();

      // public void nextPacket(PcapHeader header, JBuffer buffer, String user)
View Full Code Here

    StringBuilder errbuf = new StringBuilder();
    Pcap pcap = Pcap.openOffline(HTTP_IP6, errbuf);

    assertNotNull(errbuf.toString(), pcap);

    pcap.loop(Pcap.LOOP_INFINATE, new PcapPacketHandler<String>() {
      Ip6 ip = new Ip6();

      Tcp tcp = new Tcp();

      public void nextPacket(PcapPacket packet, String user) {
View Full Code Here

    StringBuilder errbuf = new StringBuilder();
    Pcap pcap = Pcap.openOffline(HTTP_IP6, errbuf);

    assertNotNull(errbuf.toString(), pcap);

    pcap.loop(Pcap.LOOP_INFINATE, new PcapPacketHandler<String>() {
      Ip6 ip = new Ip6();

      Udp udp = new Udp();

      public void nextPacket(PcapPacket packet, String user) {
View Full Code Here

    final JScanner scanner = new JScanner();

    long start = System.currentTimeMillis();
    final TextFormatter out = new TextFormatter();

    pcap.loop(Pcap.LOOP_INFINATE, new ByteBufferHandler<String>() {
      int i = 0;

      public void nextPacket(PcapHeader header, ByteBuffer buffer, String user) {

        if (i == 200) {
View Full Code Here

    StringBuilder errbuf = new StringBuilder();
    Pcap pcap = Pcap.openOffline(TestTcpIp.VLAN, errbuf);

    assertNotNull(errbuf.toString(), pcap);

    pcap.loop(Pcap.LOOP_INFINATE, new PcapPacketHandler<String>() {
      Ip4 ip = new Ip4();

      Icmp icmp = new Icmp();

      public void nextPacket(PcapPacket packet, String user) {
View Full Code Here

    final JScanner scanner = new JScanner();

    long start = System.currentTimeMillis();
    final TextFormatter out = new TextFormatter();

    pcap.loop(Pcap.LOOP_INFINATE, new JBufferHandler<String>() {
      int i = 0;

      public void nextPacket(PcapHeader header, JBuffer buffer, String user) {

        if (i == 200) {
View Full Code Here

    @SuppressWarnings("unused")
    final TextFormatter out = new TextFormatter();
    @SuppressWarnings("unused")
    final JScanner scanner = new JScanner();

    pcap.loop(Pcap.LOOP_INFINATE, JProtocol.ETHERNET_ID,
        new JPacketHandler<String>() {
          @SuppressWarnings("unused")
          int i = 0;

          public void nextPacket(JPacket packet, String user) {
View Full Code Here

      for (final String fname : files) {
        Pcap pcap = Pcap.openOffline(DIR.toString() + "/" + fname, errbuf);
        assertNotNull(errbuf.toString(), pcap);

        pcap.loop(Pcap.LOOP_INFINATE, new JPacketHandler<Pcap>() {

          public void nextPacket(JPacket packet, Pcap user) {
            assertNotNull(packet);

            count++;
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.