Namespace clj-net-pcap.core

clj-net-pcap is a wrapper/adapter/facade (whatever) around jNetPcap that enables and ease...

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.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.
clj-net-pcap.sniffer
Convenience functions for easing the implementation of a working sniffer.
Index Page
Alphabetic Var Index

Public Vars

Usage Documentation

Show/Hide
clj-net-pcap is a wrapper/adapter/facade (whatever) around jNetPcap that 
          enables and eases packet capturing with Clojure.

          The core namespace contains the external API. For most use-cases the 
          functionality provided in core should be sufficient.
Back to top

Details of Public Vars

Dynamic Var: *bulk-size*

  No docs attached.
Back to top View Source

Dynamic Var: *emit-raw-data*

  No docs attached.
Back to top View Source

Dynamic Var: *forward-exceptions*

  No docs attached.
Back to top View Source

Dynamic Var: *queue-size*

  No docs attached.
Back to top View Source

Dynamic Var: *use-intermediate-buffer*

  No docs attached.
Back to top View Source

Constructor: ->BufferRecord

Arglists:
=========

  (->BufferRecord s us cl wl buf)

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

  Positional factory function for class clj_net_pcap.core.BufferRecord.
Back to top View Source

Function: add-filter

Arglists:
=========

  (add-filter cljnetpcap filter-expr)

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

  Add filter to a running pcap instance.
Back to top View Source

Function: create-and-start-online-cljnetpcap

Arglists:
=========

  (create-and-start-online-cljnetpcap forwarder-fn)
  (create-and-start-online-cljnetpcap forwarder-fn device)
  (create-and-start-online-cljnetpcap forwarder-fn device filter-expr)

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

  Convenience function for performing live online capturing.
   forwarder-fn will be called for each captured packet.
   Capturing can be influenced via the optional device and filter-expression arguments.
   By default the 'any' device is used for capturing with no filter being applied.
   Please note that the returned handle should be stored as it is needed for stopping the capture.
Back to top View Source

Function: create-buffer-record

Arglists:
=========

  (create-buffer-record buf ph)

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

  Create a BufferRecord.
   The BufferRecord contains the values of the PcapHeader and a directly allocated
   deep-copy of the ByteBuffer.
Back to top View Source

Function: create-packet-processing-handler

Arglists:
=========

  (create-packet-processing-handler
   out-queue
   out-queued-counter
   out-drop-counter
   force-put
   running
   forward-exceptions)

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

  Create handler for processing packets.
   Processing packets includes scanning (decoding) them.
Back to top View Source

Function: create-raw-bulk-handler

Arglists:
=========

  (create-raw-bulk-handler
   out-queue
   out-queued-counter
   out-drop-counter
   bulk-size
   force-put
   running
   use-intermediate-buffer)

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

  Create handler for raw bulk data.
Back to top View Source

Function: create-raw-handler

Arglists:
=========

  (create-raw-handler
   out-queue
   out-queued-counter
   out-drop-counter
   force-put
   running)

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

  Create handler for raw data of individual packets.
Back to top View Source

Function: deep-copy

Arglists:
=========

  (deep-copy buf)
  (deep-copy buf ph)

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

  Creates a deep-copy of the supplied data.
   We differentiate two cases:
   When only a ByteBuffer is supplied the content is copied to a directly allocated ByteBuffer.
   This copy is primarily intended for being directly peered with a PcapPacket instance.
   When a ByteBuffer and a PcapHeader is supplied the field values of the PcapHeader
   are prepended to the deep copy of the ByteBuffer.
   This is intended for being transferred as byte array.
Back to top View Source

Macro: enqueue-data

Arglists:
=========

  (enqueue-data queue op force-put queued-cntr dropped-cntr)

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

  No docs attached.
Back to top View Source

Macro: enqueue-data-put

Arglists:
=========

  (enqueue-data-put queue op force-put queued-cntr dropped-cntr)

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

  No docs attached.
Back to top View Source

Function: extract-beans-from-pcap-file

Arglists:
=========

  (extract-beans-from-pcap-file file-name)

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

  Convenience function to extract the data from a pcap file in bean format.
   Please note that all data will be stored in memory.
   So this is not suited for large amounts of data.
   Returns a vector that contains the extracted beans.
Back to top View Source

Function: extract-byte-arrays-from-pcap-file

Arglists:
=========

  (extract-byte-arrays-from-pcap-file file-name)

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

  Convenience function to extract the raw data from a pcap file as byte arrays.
   Please note that all data will be stored in memory.
   So this is not suited for large amounts of data.
   Returns a vector that contains the extracted raw-data.
Back to top View Source

Function: extract-data-from-pcap-file

Arglists:
=========

  (extract-data-from-pcap-file file-name format-fn)

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

  Function to extract the data from a pcap file.
   The data will be formatted with format-fn.
   Please note that all data will be stored in memory.
   So this is not suited for large amounts of data.
   Returns a vector that contains the extracted maps.

   See also:
   extract-nested-maps-from-pcap-file
   extract-maps-from-pcap-file
   extract-beans-from-pcap-file
Back to top View Source

Function: extract-maps-from-pcap-file

Arglists:
=========

  (extract-maps-from-pcap-file file-name)

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

  Convenience function to extract the data from a pcap file in flat map format.
   Please note that all data will be stored in memory.
   So this is not suited for large amounts of data.
   Returns a vector that contains the extracted maps.
Back to top View Source

Function: extract-nested-maps-from-pcap-file

Arglists:
=========

  (extract-nested-maps-from-pcap-file file-name)

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

  Convenience function to extract the data from a pcap file in nested map format.
   Please note that all data will be stored in memory.
   So this is not suited for large amounts of data.
   Returns a vector that contains the extracted maps.
Back to top View Source

Function: get-filters

Arglists:
=========

  (get-filters cljnetpcap)

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

  Returns the vector containing all currently applied filter sub-expressions.
Back to top View Source

Function: get-stats

Arglists:
=========

  (get-stats cljnetpcap)

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

  Given a handle as returned by, e.g., create-and-start-online-cljnetpcap or process-pcap-file,
   this function emits a map with statistical data about the capture process.
Back to top View Source

Function: map->BufferRecord

Arglists:
=========

  (map->BufferRecord m__7972__auto__)

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

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

Function: peer-packet

Arglists:
=========

  (peer-packet bufrec)

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

  Create a new PcapPacket instance and fill/peer it with the data from the supplied BufferRecord.
Back to top View Source

Function: process-pcap-file

Arglists:
=========

  (process-pcap-file file-name handler-fn)
  (process-pcap-file file-name handler-fn _)

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

  Convenience function to process data stored in pcap files.
   Arguments are the file-name of the pcap file, the handler-fn that is executed for each read packet, and optional user data.
   handler-fn takes two arguments, the first is the org.jnetpcap.packet.PcapPacket instance, the second is the user data.
   By default nil is used as user data.
Back to top View Source

Function: remove-all-filters

Arglists:
=========

  (remove-all-filters cljnetpcap)

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

  Removes all filter expressions.
Back to top View Source

Function: remove-filter

Arglists:
=========

  (remove-filter cljnetpcap filter-expr)

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

  Remove the matching filter.
Back to top View Source

Function: remove-last-filter

Arglists:
=========

  (remove-last-filter cljnetpcap)

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

  Remove the last filter expression.
Back to top View Source

Function: replace-filter

Arglists:
=========

  (replace-filter cljnetpcap old-filter new-filter)

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

  Replace old-filter expression with new-filter expression.
Back to top View Source

Function: scan-packet

Arglists:
=========

  (scan-packet pkt)

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

  Scan the supplied packet and return it.
Back to top View Source

Function: send-bytes-packet

Arglists:
=========

  (send-bytes-packet pcap pkt-ba)
  (send-bytes-packet pcap pkt-ba rep)
  (send-bytes-packet pcap pkt-ba rep d)

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

  Send the packet as given in the byte array pkt-ba packets via the Pcap instance pcap.
   Optionally a repetition count rep as well as a delay d can be given.
Back to top View Source

Function: set-up-and-start-cljnetpcap

Arglists:
=========

  (set-up-and-start-cljnetpcap pcap forwarder-fn filter-expr force-put)

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

  Takes a pcap instance, sets up the capture pipe line, and starts the capturing and processing.
   This is not intended to be used directly.
   It is recommended to use: create-and-start-online-cljnetpcap or process-pcap-file
Back to top View Source

Function: stop-cljnetpcap

Arglists:
=========

  (stop-cljnetpcap cljnetpcap)

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

  Stops a running capture. Argument is the handle as returned, e.g.,
   by create-and-start-online-cljnetpcap or process-pcap-file.
Back to top View Source

Var: trace-level

  No docs attached.
Back to top View Source