The plokami Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The plokami Reference Manual

This is the plokami Reference Manual, version 1.5, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 05:52:41 2022 GMT+0.

Table of Contents


1 Introduction

PLOKAMI is a lispy interface to libpcap built on top of a CFFI portability
layer. Complete bindings to every function in libpcap are in pcap.lisp
and a higher level interface in plokami.lisp.

* Features
  - Realtime network packet capture
  - Injection
  - PCAP dumpfile read/write
  - BPF
  - Timeouts and operation in non-blocking mode
  - Full support for Windows through WinPCAP

The library has been tested on SBCL (linux/darwin), ClozureCL and 
LispWorks (darwin/win32) but should work on every platform that 
CFFI supports.

* Performance
Minimal overhead over plain libpcap.

* License
The code comes with a BSD-style license so you can basically do with it
whatever you want.

* Documentation
[[https://atomontage.github.io/plokami]]

* Author
xristos (AT) sdf (DOT) org


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 plokami

Common Lisp PCAP interface.

Author

<xristos@sdf.org>

Home Page

https://atomontage.github.io/plokami

Source Control

(GIT https://github.com/atomontage/plokami)

Bug Tracker

https://github.com/atomontage/plokami/issues

License

BSD

Version

1.5

Dependencies
  • uiop (system).
  • cffi (system).
Source

plokami.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 plokami/plokami.asd

Source

plokami.asd.

Parent Component

plokami (system).

ASDF Systems

plokami.


3.1.2 plokami/packages.lisp

Source

plokami.asd.

Parent Component

plokami (system).

Packages

plokami.


3.1.3 plokami/pcap.lisp

Dependency

packages.lisp (file).

Source

plokami.asd.

Parent Component

plokami (system).

Public Interface

*pcap-version* (special variable).

Internals

3.1.4 plokami/plokami.lisp

Dependency

pcap.lisp (file).

Source

plokami.asd.

Parent Component

plokami (system).

Public Interface
Internals

Previous: , Up: Lisp   [Contents][Index]

3.1.5 plokami/utils.lisp

Dependency

plokami.lisp (file).

Source

plokami.asd.

Parent Component

plokami (system).


4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 plokami

Source

packages.lisp.

Use List
  • cffi.
  • common-lisp.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


Next: , Previous: , Up: Public Interface   [Contents][Index]

5.1.1 Special variables

Special Variable: *pcap-version*

Version of native libpcap library.

Package

plokami.

Source

pcap.lisp.


5.1.2 Macros

Macro: with-pcap-interface ((live iface &rest options) &body body)

Call ‘MAKE-PCAP-LIVE’ using IFACE, OPTIONS as arguments and store
the resulting instance in LIVE. Forms in body are wrapped in an ‘UNWIND-PROTECT’ form that takes care of deallocating resources on error and also returns packet capture statistics when possible. A restart is also automatically invoked when ‘PACKET-FILTER-ERROR’ is signaled, skipping the filter setup.

Package

plokami.

Source

plokami.lisp.

Macro: with-pcap-reader ((reader file &rest options) &body body)

Call ‘MAKE-PCAP-READER’ using FILE, OPTIONS as arguments and store the resulting instance in READER. Forms in body are wrapped in an UNWIND-PROTECT form that takes care of deallocating resources on error. A restart is also automatically invoked when ‘PACKET-FILTER-ERROR’ is signaled,
skipping the filter setup.

Package

plokami.

Source

plokami.lisp.

Macro: with-pcap-writer ((writer file &rest options) &body body)

Call ‘MAKE-PCAP-WRITER’ using FILE, OPTIONS as arguments and store the resulting instance in WRITER. Forms in body are wrapped in an ‘UNWIND-PROTECT’ form that takes care of deallocating resources on error.

Package

plokami.

Source

plokami.lisp.


5.1.3 Ordinary functions

Function: find-all-devs ()

Return a list of all network devices that can be opened for capture. Result list mirrors layout explained in pcap_findalldevs(3).
NIL is returned when no interfaces are available, possibly due to permission issues.

Signals ‘NETWORK-INTERFACE-ERROR’ on errors.

Package

plokami.

Source

plokami.lisp.

Function: make-pcap-live (interface &key promisc nbio timeout snaplen)

Creates and returns a ‘PCAP-LIVE’ instance that is used for live packet capture from a network interface.

INTERFACE is a string that defines the network interface to use for capture.

PROMISC should be T for promiscuous mode, NIL otherwise.

NBIO should be T when non-blocking operation is required. NIL otherwise (default).

TIMEOUT should hold read timeout in milliseconds. 0 will wait forever. Only used when in blocking mode and only in platforms
that support it. No guarantee of actually returning within TIMEOUT is made. Use non-blocking mode if that is not adequate.

SNAPLEN should contain the number of bytes captured per packet. Default is 68 which should be enough for headers.

‘NETWORK-INTERFACE-ERROR’ or ‘BLOCK-MODE-ERROR’ is signaled on errors.

Package

plokami.

Source

plokami.lisp.

Function: make-pcap-reader (file &key snaplen)

Creates and returns a ‘PCAP-READER’ instance that is used for reading packets from a pcap dumpfile.

FILE is the filename (namestring or pathname) to open and read packets from.

SNAPLEN should contain the number of bytes read per packet captured. Default is 68 which should be enough for headers.

‘CAPTURE-FILE-READ-ERROR’ is signaled on errors.

Package

plokami.

Source

plokami.lisp.

Function: make-pcap-writer (file &key datalink snaplen)

Creates and returns a ‘PCAP-WRITER’ instance that is used to write packets to a pcap dumpfile.

FILE is the filename (namestring or pathname) to open and write packets to.

DATALINK should contain a string that represents the datalink protocol of the network interface used to capture the packets. Default is Ethernet.

SNAPLEN should contain the number of bytes read per packet captured and should be the same as the one used when capturing/reading the packets.

‘CAPTURE-FILE-WRITE-ERROR’ is signaled on errors.

Package

plokami.

Source

plokami.lisp.


5.1.4 Generic functions

Generic Function: capture (pcap-process-mixin packets handler)

Only works for ‘PCAP-LIVE’ or ‘PCAP-READER’ instances.
Captures and processes maximum number of PACKETS. Minimum is
zero. Return 0 when no packets available (did not pass installed packet filter, end of file for dumpfiles, read timeout expired before packets arrive,
no packets available at the time of the call if in non-blocking-mode) otherwise return number of packets processed which can be fewer than the maximum given
in PACKETS (due to internal libpcap buffer).

A count of -1 in PACKETS processes all the packets received so far when live capturing, or all the packets in a file when reading a pcap dumpfile.

Handler must be a user defined function that accepts five arguments and will
get called once for every packet received. The values passed are SEC, USEC, CAPLEN, LEN and BUFFER.

SEC and USEC correspond to seconds/microseconds since the UNIX epoch
(timeval structure in C) at the time of capture.

CAPLEN corresponds to the number of bytes captured.

LEN corresponds to the number of bytes originally present in the packet but
not necessarily captured.

BUFFER is a statically allocated byte vector (via ‘CFFI:MAKE-SHAREABLE-BYTE-VECTOR’) with the contents of the captured packet. This means that successive calls of the packet handler will overwrite its contents and if packet persistence is required, contents of BUFFER should be copied somewhere else from within HANDLER.

If an error occurs, ‘PACKET-CAPTURE-ERROR’ is signaled for live
interfaces and ‘CAPTURE-FILE-READ-ERROR’ for pcap dumpfiles (reading).

For more details on callback handling, see CFFI callback ‘PCAP-HANDLER’.

Package

plokami.

Source

plokami.lisp.

Methods
Method: capture ((cap pcap-process-mixin) (packets integer) (phandler function))
Generic Function: dump (pcap-writer data sec usec &key length origlength)

Writes contents of byte vector DATA to ‘PCAP-WRITER’
instance (which corresponds to a pcap dumpfile).

LENGTH is the number of bytes to write and is set to the size of DATA
when omitted.

ORIGLENGTH should be set to the number of bytes originally present in
the packet and is set to LENGTH when omitted.

SEC and USEC should be set to seconds/microseconds since the UNIX epoch
at the time of capture (timeval structure in C).

If you are using your own source buffer (instead of the one used by PLOKAMI), it should be allocated with ‘CFFI:MAKE-SHAREABLE-BYTE-VECTOR’. As LIBPCAP does not return a useful value on pcap_dump(), no PLOKAMI specific conditions, beyond simple assertions of argument checks, are raised by this function.

Package

plokami.

Source

plokami.lisp.

Methods
Method: dump ((writer pcap-writer) (buffer vector) (sec integer) (usec integer) &key length origlength)
Generic Function: inject (pcap-live buffer &key length)

Injects LENGTH bytes to a live pcap interface
(size of BUFFER if omitted). Return number of bytes injected on success.
For performance reasons BUFFER should be a byte vector allocated with ‘CFFI:MAKE-SHAREABLE-BYTE-VECTOR’. ‘PACKET-INJECT-ERROR’ is signaled on failure.

Package

plokami.

Source

plokami.lisp.

Methods
Method: inject ((cap pcap-live) (buffer vector) &key length)
Generic Reader: pcap-live-alive-p (object)
Package

plokami.

Methods
Reader Method: pcap-live-alive-p ((pcap-live pcap-live))

automatically generated reader method

Source

plokami.lisp.

Target Slot

live.

Package

plokami.

Methods

automatically generated reader method

Source

plokami.lisp.

Target Slot

datalink.

Generic Reader: pcap-live-descriptor (object)
Package

plokami.

Methods
Reader Method: pcap-live-descriptor ((pcap-live pcap-live))

File descriptor that can be used with epoll/kqueue/select.

Source

plokami.lisp.

Target Slot

descriptor.

Generic Reader: pcap-live-interface (object)
Package

plokami.

Methods
Reader Method: pcap-live-interface ((pcap-live pcap-live))

Interface to capture packets from.

Source

plokami.lisp.

Target Slot

interface.

Generic Reader: pcap-live-promisc-p (object)
Package

plokami.

Methods
Reader Method: pcap-live-promisc-p ((pcap-live pcap-live))

True if capturing in promiscuous mode.

Source

plokami.lisp.

Target Slot

promisc.

Generic Reader: pcap-live-snaplen (object)
Package

plokami.

Methods
Reader Method: pcap-live-snaplen ((pcap-live pcap-live))

automatically generated reader method

Source

plokami.lisp.

Target Slot

snaplen.

Generic Reader: pcap-live-timeout (object)
Package

plokami.

Methods
Reader Method: pcap-live-timeout ((pcap-live pcap-live))

Read timeout in milliseconds. 0 will wait forever.
Only works in blocking mode/platforms that support it. No guarantee of returning within timeout.

Source

plokami.lisp.

Target Slot

timeout.

Generic Reader: pcap-reader-alive-p (object)
Package

plokami.

Methods
Reader Method: pcap-reader-alive-p ((pcap-reader pcap-reader))

automatically generated reader method

Source

plokami.lisp.

Target Slot

live.

Package

plokami.

Methods

automatically generated reader method

Source

plokami.lisp.

Target Slot

datalink.

Generic Reader: pcap-reader-file (object)
Package

plokami.

Methods
Reader Method: pcap-reader-file ((pcap-reader pcap-reader))

File (native namestring) to read packets from.
Represents a pathname using the native conventions of the operating system.

Source

plokami.lisp.

Target Slot

file.

Generic Reader: pcap-reader-major (object)
Package

plokami.

Methods
Reader Method: pcap-reader-major ((pcap-reader pcap-reader))

Major version of savefile.

Source

plokami.lisp.

Target Slot

major.

Generic Reader: pcap-reader-minor (object)
Package

plokami.

Methods
Reader Method: pcap-reader-minor ((pcap-reader pcap-reader))

Minor version of savefile.

Source

plokami.lisp.

Target Slot

minor.

Generic Reader: pcap-reader-snaplen (object)
Package

plokami.

Methods
Reader Method: pcap-reader-snaplen ((pcap-reader pcap-reader))

automatically generated reader method

Source

plokami.lisp.

Target Slot

snaplen.

Generic Reader: pcap-reader-swapped-p (object)
Package

plokami.

Methods
Reader Method: pcap-reader-swapped-p ((pcap-reader pcap-reader))

Savefile uses different byte order from host system.

Source

plokami.lisp.

Target Slot

swapped.

Generic Reader: pcap-writer-alive-p (object)
Package

plokami.

Methods
Reader Method: pcap-writer-alive-p ((pcap-writer pcap-writer))

automatically generated reader method

Source

plokami.lisp.

Target Slot

live.

Package

plokami.

Methods

automatically generated reader method

Source

plokami.lisp.

Target Slot

datalink.

Generic Reader: pcap-writer-file (object)
Package

plokami.

Methods
Reader Method: pcap-writer-file ((pcap-writer pcap-writer))

File (native namestring) to write packets to.
Represents a pathname using the native conventions of the operating system.

Source

plokami.lisp.

Target Slot

file.

Generic Reader: pcap-writer-snaplen (object)
Package

plokami.

Methods
Reader Method: pcap-writer-snaplen ((pcap-writer pcap-writer))

automatically generated reader method

Source

plokami.lisp.

Target Slot

snaplen.

Generic Reader: plokami-error-text (condition)
Package

plokami.

Methods
Reader Method: plokami-error-text ((condition plokami-error))
Source

plokami.lisp.

Target Slot

text.

Generic Function: set-filter (pcap-process-mixin string)

Sets a packet filter on a ‘PCAP-LIVE’ or ‘PCAP-READER’
instance. The filter should be given as a bpf expression in STRING. ‘PACKET-FILTER-ERROR’ is signaled on failure. A restart, ‘CONTINUE-NO-FILTER’ is installed that can be invoked to continue on error.

Package

plokami.

Source

plokami.lisp.

Methods
Method: set-filter ((cap pcap-reader) (filter string))
Method: set-filter ((cap pcap-live) (filter string))
Generic Function: set-non-block (pcap-live block-mode)

Sets non-blocking mode if BLOCK-MODE is T, blocking
mode if NIL. ‘BLOCK-MODE-ERROR’ is signaled on failure and a restart, ‘CONTINUE-BLOCK-MODE’ is installed, that can be invoked to continue.

Package

plokami.

Source

plokami.lisp.

Methods
Method: set-non-block ((cap pcap-live) (block-mode (eql nil)))
Method: set-non-block ((cap pcap-live) (block-mode (eql t)))
Generic Function: stats (pcap-live)

Returns packet capture statistics from the start of the run
to the time of the call for live interface capture only. Statistics are returned as multiple values and correspond to packets received, packets dropped and packets dropped by interface (in this order). ‘NETWORK-INTERFACE-ERROR’ is signaled on failure.

Package

plokami.

Source

plokami.lisp.

Methods
Method: stats ((cap pcap-live))
Generic Function: stop (pcap-mixin)

Deallocates resources for ‘PCAP-LIVE’, ‘PCAP-READER’, ‘PCAP-WRITER’ instance.

Package

plokami.

Source

plokami.lisp.

Method Combination

progn.

Options

:most-specific-first

Methods
Method: stop progn ((cap pcap-writer))
Method: stop progn ((cap pcap-process-mixin))
Method: stop progn ((cap pcap-mixin))

5.1.5 Standalone methods

Method: initialize-instance :after ((cap pcap-live) &key)
Source

plokami.lisp.

Method: initialize-instance :after ((cap pcap-writer) &key)
Source

plokami.lisp.

Method: initialize-instance :after ((cap pcap-reader) &key)
Source

plokami.lisp.


5.1.6 Conditions

Condition: block-mode-error

Signaled on error when changing blocking mode.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

plokami-error.

Condition: capture-file-read-error

Signaled on all pcap readfile errors.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

plokami-error.

Condition: capture-file-write-error

Signaled on all pcap dumpfile errors.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

plokami-error.

Condition: network-interface-error

Signaled on all network interface errors.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

plokami-error.

Condition: packet-capture-error

Signaled on error during live packet capture.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

plokami-error.

Condition: packet-filter-error

Signaled when a berkeley packet filter could not be established.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

plokami-error.

Condition: packet-inject-error

Signaled on errors during packet injection.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

plokami-error.

Condition: plokami-error

Generic condition for this package.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

error.

Direct subclasses
Direct methods

plokami-error-text.

Direct slots
Slot: text
Initargs

:text

Readers

plokami-error-text.

Writers

This slot is read-only.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Constants

Constant: +dlt_802_11+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_en10mb+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_null+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_ppp+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_ppp_bsdos1+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_ppp_bsdos2+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_ppp_ether+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_ppp_pppd+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_ppp_serial+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_slip+
Package

plokami.

Source

pcap.lisp.

Constant: +dlt_usb_linux+
Package

plokami.

Source

pcap.lisp.

Constant: +error-buffer-size+
Package

plokami.

Source

pcap.lisp.

Constant: +pcap_if_loopback+
Package

plokami.

Source

pcap.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.2 Special variables

Special Variable: *callbacks*
Package

plokami.

Source

plokami.lisp.

Special Variable: *compile-mutex*
Package

plokami.

Source

plokami.lisp.

Special Variable: *concurrent-pcap*
Package

plokami.

Source

plokami.lisp.

Special Variable: *concurrent-pcap-mutex*
Package

plokami.

Source

plokami.lisp.

Package

plokami.

Source

pcap.lisp.


5.2.3 Macros

Macro: with-error-buffer ((error-buffer) &body body)
Package

plokami.

Source

plokami.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.4 Ordinary functions

Function: %inet-ntop (af src dst size)
Package

plokami.

Source

pcap.lisp.

Package

plokami.

Source

pcap.lisp.

Function: %memcpy (dst src len)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-breakloop (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-close (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-compile (pcap_t fp str optimize netmask)
Package

plokami.

Source

pcap.lisp.

Package

plokami.

Source

pcap.lisp.

Package

plokami.

Source

pcap.lisp.

Package

plokami.

Source

pcap.lisp.

Package

plokami.

Source

pcap.lisp.

Function: %pcap-dispatch (pcap_t cnt callback user)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-dump (user header sp)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-dump-close (dumper)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-dump-flush (dumper)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-dump-ftell (dumper)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-dump-open (pcap_t fname)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-fileno (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-findalldevs (alldevsp errbuf)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-freealldevs (alldevs)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-freecode (fp)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-get-selectable-fd (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-geterr (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-getnonblock (pcap_t errbuf)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-inject (pcap_t buf size)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-is-swapped (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-lib-version ()
Package

plokami.

Source

pcap.lisp.

Package

plokami.

Source

pcap.lisp.

Function: %pcap-lookupdev (errbuf)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-lookupnet (device netp maskp errbuf)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-loop (pcap_t cnt callback user)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-major-version (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-minor-version (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-next (pcap_t header)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-next-ex (pcap_t headerp datap)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-open-dead (linktype snaplen)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-open-live (device snaplen promisc to_ms errbuf)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-open-offline (filename errbuf)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-perror (pcap_t prefix)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-sendpacket (pcap_t buf size)
Package

plokami.

Source

pcap.lisp.

Package

plokami.

Source

pcap.lisp.

Function: %pcap-setdirection (pcap_t d)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-setfilter (pcap_t fp)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-setnonblock (pcap_t nonblock errbuf)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-snapshot (pcap_t)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-stats (pcap_t ps)
Package

plokami.

Source

pcap.lisp.

Function: %pcap-strerror (error)
Package

plokami.

Source

pcap.lisp.

Function: clear-error-buffer (foreign-buffer)

Set FOREIGN-BUFFER to the empty string.

Package

plokami.

Source

plokami.lisp.

Function: error-buffer-to-lisp (foreign-buffer)

Return FOREIGN-BUFFER as a lisp string.

Package

plokami.

Source

plokami.lisp.

Function: free-error-buffer (foreign-buffer)

Free memory held by FOREIGN-BUFFER.

Package

plokami.

Source

plokami.lisp.

Function: make-error-buffer ()

Allocate and return foreign char array to hold error string.

Package

plokami.

Source

plokami.lisp.


5.2.5 Classes

Class: bpf_insn-tclass
Package

plokami.

Source

pcap.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: bpf_program-tclass
Package

plokami.

Source

pcap.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: pcap-live

Class for live packet capture.

Package

plokami.

Source

plokami.lisp.

Direct superclasses
Direct methods
Direct slots
Slot: interface

Interface to capture packets from.

Initargs

:if

Readers

pcap-live-interface.

Writers

This slot is read-only.

Slot: promisc

True if capturing in promiscuous mode.

Initargs

:promisc

Readers

pcap-live-promisc-p.

Writers

This slot is read-only.

Slot: non-block

True if pcap descriptor is in non-blocking mode.

Initargs

:nbio

Slot: timeout

Read timeout in milliseconds. 0 will wait forever.
Only works in blocking mode/platforms that support it. No guarantee of returning within timeout.

Initform

100

Initargs

:timeout

Readers

pcap-live-timeout.

Writers

This slot is read-only.

Slot: descriptor

File descriptor that can be used with epoll/kqueue/select.

Readers

pcap-live-descriptor.

Writers

This slot is read-only.

Slot: live
Readers

pcap-live-alive-p.

Writers

This slot is read-only.

Readers

pcap-live-datalink.

Writers

This slot is read-only.

Slot: snaplen
Initargs

:snaplen

Readers

pcap-live-snaplen.

Writers

This slot is read-only.

Class: pcap-mixin

Internal class used as a mixin for all classes with pcap functionality.

Package

plokami.

Source

plokami.lisp.

Direct subclasses
Direct methods

stop.

Direct slots
Slot: pcap_t

Foreign pointer to pcap structure.

Datalink protocol for this device.

Slot: snaplen

How many bytes to capture per packet received.

Initform

68

Slot: live

Packet capture object is live.

Class: pcap-process-mixin

Internal class, mixed in packet processing (‘PCAP-LIVE’, ‘PCAP-READER’).

Package

plokami.

Source

plokami.lisp.

Direct subclasses
Direct methods
Direct slots
Slot: buffer

Packet buffer to hold captured packets.

Slot: handler

Lisp packet handler for capture. Invoked by callback.

Slot: hashkey

Hashtable key for this instance.

Slot: hashkey-pointer

Foreign pointer to hashkey, passed in callback.

Class: pcap-reader

Class for reading packets from a dumpfile.

Package

plokami.

Source

plokami.lisp.

Direct superclasses
Direct methods
Direct slots
Slot: file

File (native namestring) to read packets from.
Represents a pathname using the native conventions of the operating system.

Initform

(error "must supply filename to read packets from.")

Initargs

:file

Readers

pcap-reader-file.

Writers

This slot is read-only.

Slot: swapped

Savefile uses different byte order from host system.

Readers

pcap-reader-swapped-p.

Writers

This slot is read-only.

Slot: major

Major version of savefile.

Readers

pcap-reader-major.

Writers

This slot is read-only.

Slot: minor

Minor version of savefile.

Readers

pcap-reader-minor.

Writers

This slot is read-only.

Slot: live
Readers

pcap-reader-alive-p.

Writers

This slot is read-only.

Readers

pcap-reader-datalink.

Writers

This slot is read-only.

Slot: snaplen
Initargs

:snaplen

Readers

pcap-reader-snaplen.

Writers

This slot is read-only.

Class: pcap-writer

Class for writing packets to a dumpfile.

Package

plokami.

Source

plokami.lisp.

Direct superclasses

pcap-mixin.

Direct methods
Direct slots
Slot: file

File (native namestring) to write packets to.
Represents a pathname using the native conventions of the operating system.

Initform

(error "must supply file to write packets to.")

Initargs

:file

Readers

pcap-writer-file.

Writers

This slot is read-only.

Slot: dumper

Foreign packet dumper object.

Initform

"en10mb"

Initargs

:datalink

Readers

pcap-writer-datalink.

Writers

This slot is read-only.

Slot: live
Readers

pcap-writer-alive-p.

Writers

This slot is read-only.

Slot: snaplen
Initargs

:snaplen

Readers

pcap-writer-snaplen.

Writers

This slot is read-only.

Class: pcap_addr_t-tclass
Package

plokami.

Source

pcap.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: pcap_if_t-tclass
Package

plokami.

Source

pcap.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: pcap_pkthdr-tclass
Package

plokami.

Source

pcap.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: pcap_stat-tclass
Package

plokami.

Source

pcap.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: sockaddr-tclass
Package

plokami.

Source

pcap.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: timeval-tclass
Package

plokami.

Source

pcap.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %  
C   D   E   F   G   I   M   P   S   W  
Index Entry  Section

%
%inet-ntop: Private ordinary functions
%link-ntoa: Private ordinary functions
%memcpy: Private ordinary functions
%pcap-breakloop: Private ordinary functions
%pcap-close: Private ordinary functions
%pcap-compile: Private ordinary functions
%pcap-datalink: Private ordinary functions
%pcap-datalink-name-to-val: Private ordinary functions
%pcap-datalink-val-to-description: Private ordinary functions
%pcap-datalink-val-to-name: Private ordinary functions
%pcap-dispatch: Private ordinary functions
%pcap-dump: Private ordinary functions
%pcap-dump-close: Private ordinary functions
%pcap-dump-flush: Private ordinary functions
%pcap-dump-ftell: Private ordinary functions
%pcap-dump-open: Private ordinary functions
%pcap-fileno: Private ordinary functions
%pcap-findalldevs: Private ordinary functions
%pcap-freealldevs: Private ordinary functions
%pcap-freecode: Private ordinary functions
%pcap-get-selectable-fd: Private ordinary functions
%pcap-geterr: Private ordinary functions
%pcap-getnonblock: Private ordinary functions
%pcap-inject: Private ordinary functions
%pcap-is-swapped: Private ordinary functions
%pcap-lib-version: Private ordinary functions
%pcap-list-datalinks: Private ordinary functions
%pcap-lookupdev: Private ordinary functions
%pcap-lookupnet: Private ordinary functions
%pcap-loop: Private ordinary functions
%pcap-major-version: Private ordinary functions
%pcap-minor-version: Private ordinary functions
%pcap-next: Private ordinary functions
%pcap-next-ex: Private ordinary functions
%pcap-open-dead: Private ordinary functions
%pcap-open-live: Private ordinary functions
%pcap-open-offline: Private ordinary functions
%pcap-perror: Private ordinary functions
%pcap-sendpacket: Private ordinary functions
%pcap-set-datalink: Private ordinary functions
%pcap-setdirection: Private ordinary functions
%pcap-setfilter: Private ordinary functions
%pcap-setnonblock: Private ordinary functions
%pcap-snapshot: Private ordinary functions
%pcap-stats: Private ordinary functions
%pcap-strerror: Private ordinary functions

C
capture: Public generic functions
capture: Public generic functions
clear-error-buffer: Private ordinary functions

D
dump: Public generic functions
dump: Public generic functions

E
error-buffer-to-lisp: Private ordinary functions

F
find-all-devs: Public ordinary functions
free-error-buffer: Private ordinary functions
Function, %inet-ntop: Private ordinary functions
Function, %link-ntoa: Private ordinary functions
Function, %memcpy: Private ordinary functions
Function, %pcap-breakloop: Private ordinary functions
Function, %pcap-close: Private ordinary functions
Function, %pcap-compile: Private ordinary functions
Function, %pcap-datalink: Private ordinary functions
Function, %pcap-datalink-name-to-val: Private ordinary functions
Function, %pcap-datalink-val-to-description: Private ordinary functions
Function, %pcap-datalink-val-to-name: Private ordinary functions
Function, %pcap-dispatch: Private ordinary functions
Function, %pcap-dump: Private ordinary functions
Function, %pcap-dump-close: Private ordinary functions
Function, %pcap-dump-flush: Private ordinary functions
Function, %pcap-dump-ftell: Private ordinary functions
Function, %pcap-dump-open: Private ordinary functions
Function, %pcap-fileno: Private ordinary functions
Function, %pcap-findalldevs: Private ordinary functions
Function, %pcap-freealldevs: Private ordinary functions
Function, %pcap-freecode: Private ordinary functions
Function, %pcap-get-selectable-fd: Private ordinary functions
Function, %pcap-geterr: Private ordinary functions
Function, %pcap-getnonblock: Private ordinary functions
Function, %pcap-inject: Private ordinary functions
Function, %pcap-is-swapped: Private ordinary functions
Function, %pcap-lib-version: Private ordinary functions
Function, %pcap-list-datalinks: Private ordinary functions
Function, %pcap-lookupdev: Private ordinary functions
Function, %pcap-lookupnet: Private ordinary functions
Function, %pcap-loop: Private ordinary functions
Function, %pcap-major-version: Private ordinary functions
Function, %pcap-minor-version: Private ordinary functions
Function, %pcap-next: Private ordinary functions
Function, %pcap-next-ex: Private ordinary functions
Function, %pcap-open-dead: Private ordinary functions
Function, %pcap-open-live: Private ordinary functions
Function, %pcap-open-offline: Private ordinary functions
Function, %pcap-perror: Private ordinary functions
Function, %pcap-sendpacket: Private ordinary functions
Function, %pcap-set-datalink: Private ordinary functions
Function, %pcap-setdirection: Private ordinary functions
Function, %pcap-setfilter: Private ordinary functions
Function, %pcap-setnonblock: Private ordinary functions
Function, %pcap-snapshot: Private ordinary functions
Function, %pcap-stats: Private ordinary functions
Function, %pcap-strerror: Private ordinary functions
Function, clear-error-buffer: Private ordinary functions
Function, error-buffer-to-lisp: Private ordinary functions
Function, find-all-devs: Public ordinary functions
Function, free-error-buffer: Private ordinary functions
Function, make-error-buffer: Private ordinary functions
Function, make-pcap-live: Public ordinary functions
Function, make-pcap-reader: Public ordinary functions
Function, make-pcap-writer: Public ordinary functions

G
Generic Function, capture: Public generic functions
Generic Function, dump: Public generic functions
Generic Function, inject: Public generic functions
Generic Function, pcap-live-alive-p: Public generic functions
Generic Function, pcap-live-datalink: Public generic functions
Generic Function, pcap-live-descriptor: Public generic functions
Generic Function, pcap-live-interface: Public generic functions
Generic Function, pcap-live-promisc-p: Public generic functions
Generic Function, pcap-live-snaplen: Public generic functions
Generic Function, pcap-live-timeout: Public generic functions
Generic Function, pcap-reader-alive-p: Public generic functions
Generic Function, pcap-reader-datalink: Public generic functions
Generic Function, pcap-reader-file: Public generic functions
Generic Function, pcap-reader-major: Public generic functions
Generic Function, pcap-reader-minor: Public generic functions
Generic Function, pcap-reader-snaplen: Public generic functions
Generic Function, pcap-reader-swapped-p: Public generic functions
Generic Function, pcap-writer-alive-p: Public generic functions
Generic Function, pcap-writer-datalink: Public generic functions
Generic Function, pcap-writer-file: Public generic functions
Generic Function, pcap-writer-snaplen: Public generic functions
Generic Function, plokami-error-text: Public generic functions
Generic Function, set-filter: Public generic functions
Generic Function, set-non-block: Public generic functions
Generic Function, stats: Public generic functions
Generic Function, stop: Public generic functions

I
initialize-instance: Public standalone methods
initialize-instance: Public standalone methods
initialize-instance: Public standalone methods
inject: Public generic functions
inject: Public generic functions

M
Macro, with-error-buffer: Private macros
Macro, with-pcap-interface: Public macros
Macro, with-pcap-reader: Public macros
Macro, with-pcap-writer: Public macros
make-error-buffer: Private ordinary functions
make-pcap-live: Public ordinary functions
make-pcap-reader: Public ordinary functions
make-pcap-writer: Public ordinary functions
Method, capture: Public generic functions
Method, dump: Public generic functions
Method, initialize-instance: Public standalone methods
Method, initialize-instance: Public standalone methods
Method, initialize-instance: Public standalone methods
Method, inject: Public generic functions
Method, pcap-live-alive-p: Public generic functions
Method, pcap-live-datalink: Public generic functions
Method, pcap-live-descriptor: Public generic functions
Method, pcap-live-interface: Public generic functions
Method, pcap-live-promisc-p: Public generic functions
Method, pcap-live-snaplen: Public generic functions
Method, pcap-live-timeout: Public generic functions
Method, pcap-reader-alive-p: Public generic functions
Method, pcap-reader-datalink: Public generic functions
Method, pcap-reader-file: Public generic functions
Method, pcap-reader-major: Public generic functions
Method, pcap-reader-minor: Public generic functions
Method, pcap-reader-snaplen: Public generic functions
Method, pcap-reader-swapped-p: Public generic functions
Method, pcap-writer-alive-p: Public generic functions
Method, pcap-writer-datalink: Public generic functions
Method, pcap-writer-file: Public generic functions
Method, pcap-writer-snaplen: Public generic functions
Method, plokami-error-text: Public generic functions
Method, set-filter: Public generic functions
Method, set-filter: Public generic functions
Method, set-non-block: Public generic functions
Method, set-non-block: Public generic functions
Method, stats: Public generic functions
Method, stop: Public generic functions
Method, stop: Public generic functions
Method, stop: Public generic functions

P
pcap-live-alive-p: Public generic functions
pcap-live-alive-p: Public generic functions
pcap-live-datalink: Public generic functions
pcap-live-datalink: Public generic functions
pcap-live-descriptor: Public generic functions
pcap-live-descriptor: Public generic functions
pcap-live-interface: Public generic functions
pcap-live-interface: Public generic functions
pcap-live-promisc-p: Public generic functions
pcap-live-promisc-p: Public generic functions
pcap-live-snaplen: Public generic functions
pcap-live-snaplen: Public generic functions
pcap-live-timeout: Public generic functions
pcap-live-timeout: Public generic functions
pcap-reader-alive-p: Public generic functions
pcap-reader-alive-p: Public generic functions
pcap-reader-datalink: Public generic functions
pcap-reader-datalink: Public generic functions
pcap-reader-file: Public generic functions
pcap-reader-file: Public generic functions
pcap-reader-major: Public generic functions
pcap-reader-major: Public generic functions
pcap-reader-minor: Public generic functions
pcap-reader-minor: Public generic functions
pcap-reader-snaplen: Public generic functions
pcap-reader-snaplen: Public generic functions
pcap-reader-swapped-p: Public generic functions
pcap-reader-swapped-p: Public generic functions
pcap-writer-alive-p: Public generic functions
pcap-writer-alive-p: Public generic functions
pcap-writer-datalink: Public generic functions
pcap-writer-datalink: Public generic functions
pcap-writer-file: Public generic functions
pcap-writer-file: Public generic functions
pcap-writer-snaplen: Public generic functions
pcap-writer-snaplen: Public generic functions
plokami-error-text: Public generic functions
plokami-error-text: Public generic functions

S
set-filter: Public generic functions
set-filter: Public generic functions
set-filter: Public generic functions
set-non-block: Public generic functions
set-non-block: Public generic functions
set-non-block: Public generic functions
stats: Public generic functions
stats: Public generic functions
stop: Public generic functions
stop: Public generic functions
stop: Public generic functions
stop: Public generic functions

W
with-error-buffer: Private macros
with-pcap-interface: Public macros
with-pcap-reader: Public macros
with-pcap-writer: Public macros

Jump to:   %  
C   D   E   F   G   I   M   P   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *   +  
B   C   D   F   H   I   L   M   N   P   S   T  
Index Entry  Section

*
*callbacks*: Private special variables
*compile-mutex*: Private special variables
*concurrent-pcap*: Private special variables
*concurrent-pcap-mutex*: Private special variables
*pcap-version*: Public special variables
*supported-datalinks*: Private special variables

+
+dlt_802_11+: Private constants
+dlt_en10mb+: Private constants
+dlt_null+: Private constants
+dlt_ppp+: Private constants
+dlt_ppp_bsdos1+: Private constants
+dlt_ppp_bsdos2+: Private constants
+dlt_ppp_ether+: Private constants
+dlt_ppp_pppd+: Private constants
+dlt_ppp_serial+: Private constants
+dlt_slip+: Private constants
+dlt_usb_linux+: Private constants
+error-buffer-size+: Private constants
+pcap_if_loopback+: Private constants

B
buffer: Private classes

C
Constant, +dlt_802_11+: Private constants
Constant, +dlt_en10mb+: Private constants
Constant, +dlt_null+: Private constants
Constant, +dlt_ppp+: Private constants
Constant, +dlt_ppp_bsdos1+: Private constants
Constant, +dlt_ppp_bsdos2+: Private constants
Constant, +dlt_ppp_ether+: Private constants
Constant, +dlt_ppp_pppd+: Private constants
Constant, +dlt_ppp_serial+: Private constants
Constant, +dlt_slip+: Private constants
Constant, +dlt_usb_linux+: Private constants
Constant, +error-buffer-size+: Private constants
Constant, +pcap_if_loopback+: Private constants

D
datalink: Private classes
datalink: Private classes
datalink: Private classes
datalink: Private classes
descriptor: Private classes
dumper: Private classes

F
file: Private classes
file: Private classes

H
handler: Private classes
hashkey: Private classes
hashkey-pointer: Private classes

I
interface: Private classes

L
live: Private classes
live: Private classes
live: Private classes
live: Private classes

M
major: Private classes
minor: Private classes

N
non-block: Private classes

P
pcap_t: Private classes
promisc: Private classes

S
Slot, buffer: Private classes
Slot, datalink: Private classes
Slot, datalink: Private classes
Slot, datalink: Private classes
Slot, datalink: Private classes
Slot, descriptor: Private classes
Slot, dumper: Private classes
Slot, file: Private classes
Slot, file: Private classes
Slot, handler: Private classes
Slot, hashkey: Private classes
Slot, hashkey-pointer: Private classes
Slot, interface: Private classes
Slot, live: Private classes
Slot, live: Private classes
Slot, live: Private classes
Slot, live: Private classes
Slot, major: Private classes
Slot, minor: Private classes
Slot, non-block: Private classes
Slot, pcap_t: Private classes
Slot, promisc: Private classes
Slot, snaplen: Private classes
Slot, snaplen: Private classes
Slot, snaplen: Private classes
Slot, snaplen: Private classes
Slot, swapped: Private classes
Slot, text: Public conditions
Slot, timeout: Private classes
snaplen: Private classes
snaplen: Private classes
snaplen: Private classes
snaplen: Private classes
Special Variable, *callbacks*: Private special variables
Special Variable, *compile-mutex*: Private special variables
Special Variable, *concurrent-pcap*: Private special variables
Special Variable, *concurrent-pcap-mutex*: Private special variables
Special Variable, *pcap-version*: Public special variables
Special Variable, *supported-datalinks*: Private special variables
swapped: Private classes

T
text: Public conditions
timeout: Private classes

Jump to:   *   +  
B   C   D   F   H   I   L   M   N   P   S   T  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   B   C   F   N   P   S   T   U  
Index Entry  Section

B
block-mode-error: Public conditions
bpf_insn-tclass: Private classes
bpf_program-tclass: Private classes

C
capture-file-read-error: Public conditions
capture-file-write-error: Public conditions
Class, bpf_insn-tclass: Private classes
Class, bpf_program-tclass: Private classes
Class, pcap-live: Private classes
Class, pcap-mixin: Private classes
Class, pcap-process-mixin: Private classes
Class, pcap-reader: Private classes
Class, pcap-writer: Private classes
Class, pcap_addr_t-tclass: Private classes
Class, pcap_if_t-tclass: Private classes
Class, pcap_pkthdr-tclass: Private classes
Class, pcap_stat-tclass: Private classes
Class, sockaddr-tclass: Private classes
Class, timeval-tclass: Private classes
Condition, block-mode-error: Public conditions
Condition, capture-file-read-error: Public conditions
Condition, capture-file-write-error: Public conditions
Condition, network-interface-error: Public conditions
Condition, packet-capture-error: Public conditions
Condition, packet-filter-error: Public conditions
Condition, packet-inject-error: Public conditions
Condition, plokami-error: Public conditions

F
File, packages.lisp: The plokami/packages․lisp file
File, pcap.lisp: The plokami/pcap․lisp file
File, plokami.asd: The plokami/plokami․asd file
File, plokami.lisp: The plokami/plokami․lisp file
File, utils.lisp: The plokami/utils․lisp file

N
network-interface-error: Public conditions

P
Package, plokami: The plokami package
packages.lisp: The plokami/packages․lisp file
packet-capture-error: Public conditions
packet-filter-error: Public conditions
packet-inject-error: Public conditions
pcap-live: Private classes
pcap-mixin: Private classes
pcap-process-mixin: Private classes
pcap-reader: Private classes
pcap-writer: Private classes
pcap.lisp: The plokami/pcap․lisp file
pcap_addr_t-tclass: Private classes
pcap_if_t-tclass: Private classes
pcap_pkthdr-tclass: Private classes
pcap_stat-tclass: Private classes
plokami: The plokami system
plokami: The plokami package
plokami-error: Public conditions
plokami.asd: The plokami/plokami․asd file
plokami.lisp: The plokami/plokami․lisp file

S
sockaddr-tclass: Private classes
System, plokami: The plokami system

T
timeval-tclass: Private classes

U
utils.lisp: The plokami/utils․lisp file

Jump to:   B   C   F   N   P   S   T   U