Namespace clj-net-pcap.sniffer

Convenience functions for easing the implementation of a working sniffer.

Other Namespaces

Show/Hide
clj-net-pcap.CljNetPcapJavaAdapter
Adapter class to enable usage of clj-net-pcap from Java.
clj-net-pcap.byte-array-extraction-dsl
A simple DSL for extracting data from packets that are represented as byte arrays.
clj-net-pcap.core
clj-net-pcap is a wrapper/adapter/facade (whatever) around jNetPcap that enables and ease...
clj-net-pcap.dsl.transformation
Transformation functions for the simple DSL for extracting data from packets that are represented as...
clj-net-pcap.main
Main class and method for launching a simple clj-net-pcap based sniffer that prints some i...
clj-net-pcap.native
Functions etc. for extracting, loading etc. native libraries from the jar file.
clj-net-pcap.packet-gen
The packet-gen namespace contains functionality for generating and sending packets.
clj-net-pcap.packet-offsets
Common offsets of header fields etc.
clj-net-pcap.pcap
Functions for handling functionality related to org.jnetpcap.Pcap such as listing network ...
clj-net-pcap.pcap-data
Convenience functions for processing pcap data like packets and headers.
clj-net-pcap.self-adaptive-dsl-adjustment
A simple proof of concept for adjusting DSL statements with self-adaptivity.
Index Page
Alphabetic Var Index

Public Vars

Usage Documentation

Show/Hide
Convenience functions for easing the implementation of a working
          sniffer. Please see the simple data flow diagram in the documentation
          for more details about the data flow and interaction.
Back to top

Details of Public Vars

Constructor: ->Packet

Arglists:
=========

  (->Packet pcap-packet user-data)

Docstring:
==========

  Positional factory function for class clj_net_pcap.sniffer.Packet.
Back to top View Source

Function: clone-packet

Arglists:
=========

  (clone-packet p)

Docstring:
==========

  No docs attached.
Back to top View Source

Function: create-and-start-forwarder

Arglists:
=========

  (create-and-start-forwarder queue forwarder-fn forward-exceptions)

Docstring:
==========

  Creates a thread in which the actual processing of the received packets is
   supposed to happen. 
   This function accepts a queue that is an instance of 
   java.util.concurrent.BlockingQueue and executes forwarder-fn for each packet
   taken from the queue passing the packet instance to forwarder-fn.
   When no packets are in the queue the execution of forwarder-fn blocks until
   new packets are available for being processed.
Back to top View Source

Function: create-and-start-sniffer

Arglists:
=========

  (create-and-start-sniffer pcap handler-fn)
  (create-and-start-sniffer pcap handler-fn user-data)
  (create-and-start-sniffer
   pcap
   bulk-size
   use-intermediate-buffer
   handler-fn
   user-data)

Docstring:
==========

  Creates a thread in which Pcap.loop() is called with Pcap/LOOP_INFINITE set.
   Each received packet is passed to the supplied handler-fn. 
   handler-fn needs to be a function accepting two parameters from which the
   first is the received PcapPacket and the second is the user-data passed to
   create-and-start-sniffer that got forwarded via the Pcap sniffing loop.
   If no user data is passed nil is used as user data.
   Please note that the sniffer must be explicitly stopped using the 
   stop-sniffer function. Stopping the sniffer also takes care of closing pcap.
Back to top View Source

Function: create-packet

Arglists:
=========

  (create-packet pcap-packet)
  (create-packet pcap-packet user-data)

Docstring:
==========

  Convenience function for creating a Packet instance. It creates a deep copy
   of the PcapPacket instance passed as parameter.
   Note: the current implementation clones the optional user data if this is 
   passed (using Object.clone()). This may affect the performance negatively.
Back to top View Source

Function: map->Packet

Arglists:
=========

  (map->Packet m__7972__auto__)

Docstring:
==========

  Factory function for class clj_net_pcap.sniffer.Packet, taking a map of keywords to field values.
Back to top View Source

Function: stop-forwarder

Arglists:
=========

  (stop-forwarder forwarder)

Docstring:
==========

  Stops the given forwarder.
Back to top View Source

Function: stop-sniffer

Arglists:
=========

  (stop-sniffer sniffer)

Docstring:
==========

  Convenience function for stopping a sniffer that has been created with 
   create-and-start-sniffer.
Back to top View Source