This is the plokami Reference Manual, version 1.5, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:18:17 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
plokami
Common Lisp PCAP interface.
(GIT https://github.com/atomontage/plokami)
BSD
1.5
uiop
(system).
cffi
(system).
packages.lisp
(file).
pcap.lisp
(file).
plokami.lisp
(file).
utils.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
plokami/pcap.lisp
packages.lisp
(file).
plokami
(system).
*pcap-version*
(special variable).
%inet-ntop
(function).
%link-ntoa
(function).
%memcpy
(function).
%pcap-breakloop
(function).
%pcap-close
(function).
%pcap-compile
(function).
%pcap-datalink
(function).
%pcap-datalink-name-to-val
(function).
%pcap-datalink-val-to-description
(function).
%pcap-datalink-val-to-name
(function).
%pcap-dispatch
(function).
%pcap-dump
(function).
%pcap-dump-close
(function).
%pcap-dump-flush
(function).
%pcap-dump-ftell
(function).
%pcap-dump-open
(function).
%pcap-fileno
(function).
%pcap-findalldevs
(function).
%pcap-freealldevs
(function).
%pcap-freecode
(function).
%pcap-get-selectable-fd
(function).
%pcap-geterr
(function).
%pcap-getnonblock
(function).
%pcap-inject
(function).
%pcap-is-swapped
(function).
%pcap-lib-version
(function).
%pcap-list-datalinks
(function).
%pcap-lookupdev
(function).
%pcap-lookupnet
(function).
%pcap-loop
(function).
%pcap-major-version
(function).
%pcap-minor-version
(function).
%pcap-next
(function).
%pcap-next-ex
(function).
%pcap-open-dead
(function).
%pcap-open-live
(function).
%pcap-open-offline
(function).
%pcap-perror
(function).
%pcap-sendpacket
(function).
%pcap-set-datalink
(function).
%pcap-setdirection
(function).
%pcap-setfilter
(function).
%pcap-setnonblock
(function).
%pcap-snapshot
(function).
%pcap-stats
(function).
%pcap-strerror
(function).
*supported-datalinks*
(special variable).
+dlt_802_11+
(constant).
+dlt_en10mb+
(constant).
+dlt_null+
(constant).
+dlt_ppp+
(constant).
+dlt_ppp_bsdos1+
(constant).
+dlt_ppp_bsdos2+
(constant).
+dlt_ppp_ether+
(constant).
+dlt_ppp_pppd+
(constant).
+dlt_ppp_serial+
(constant).
+dlt_slip+
(constant).
+dlt_usb_linux+
(constant).
+error-buffer-size+
(constant).
+pcap_if_loopback+
(constant).
bpf_insn-tclass
(class).
bpf_program-tclass
(class).
pcap_addr_t-tclass
(class).
pcap_if_t-tclass
(class).
pcap_pkthdr-tclass
(class).
pcap_stat-tclass
(class).
sockaddr-tclass
(class).
timeval-tclass
(class).
plokami/plokami.lisp
pcap.lisp
(file).
plokami
(system).
block-mode-error
(condition).
capture
(generic function).
capture-file-read-error
(condition).
capture-file-write-error
(condition).
dump
(generic function).
find-all-devs
(function).
initialize-instance
(method).
initialize-instance
(method).
initialize-instance
(method).
inject
(generic function).
make-pcap-live
(function).
make-pcap-reader
(function).
make-pcap-writer
(function).
network-interface-error
(condition).
packet-capture-error
(condition).
packet-filter-error
(condition).
packet-inject-error
(condition).
pcap-live-alive-p
(reader method).
pcap-live-datalink
(reader method).
pcap-live-descriptor
(reader method).
pcap-live-interface
(reader method).
pcap-live-promisc-p
(reader method).
pcap-live-snaplen
(reader method).
pcap-live-timeout
(reader method).
pcap-reader-alive-p
(reader method).
pcap-reader-datalink
(reader method).
pcap-reader-file
(reader method).
pcap-reader-major
(reader method).
pcap-reader-minor
(reader method).
pcap-reader-snaplen
(reader method).
pcap-reader-swapped-p
(reader method).
pcap-writer-alive-p
(reader method).
pcap-writer-datalink
(reader method).
pcap-writer-file
(reader method).
pcap-writer-snaplen
(reader method).
plokami-error
(condition).
plokami-error-text
(reader method).
set-filter
(generic function).
set-non-block
(generic function).
stats
(generic function).
stop
(generic function).
with-pcap-interface
(macro).
with-pcap-reader
(macro).
with-pcap-writer
(macro).
*callbacks*
(special variable).
*compile-mutex*
(special variable).
*concurrent-pcap*
(special variable).
*concurrent-pcap-mutex*
(special variable).
clear-error-buffer
(function).
error-buffer-to-lisp
(function).
free-error-buffer
(function).
make-error-buffer
(function).
pcap-live
(class).
pcap-mixin
(class).
pcap-process-mixin
(class).
pcap-reader
(class).
pcap-writer
(class).
with-error-buffer
(macro).
Packages are listed by definition order.
plokami
cffi
.
common-lisp
.
*pcap-version*
(special variable).
block-mode-error
(condition).
capture
(generic function).
capture-file-read-error
(condition).
capture-file-write-error
(condition).
dump
(generic function).
find-all-devs
(function).
inject
(generic function).
make-pcap-live
(function).
make-pcap-reader
(function).
make-pcap-writer
(function).
network-interface-error
(condition).
packet-capture-error
(condition).
packet-filter-error
(condition).
packet-inject-error
(condition).
pcap-live-alive-p
(generic reader).
pcap-live-datalink
(generic reader).
pcap-live-descriptor
(generic reader).
pcap-live-interface
(generic reader).
pcap-live-promisc-p
(generic reader).
pcap-live-snaplen
(generic reader).
pcap-live-timeout
(generic reader).
pcap-reader-alive-p
(generic reader).
pcap-reader-datalink
(generic reader).
pcap-reader-file
(generic reader).
pcap-reader-major
(generic reader).
pcap-reader-minor
(generic reader).
pcap-reader-snaplen
(generic reader).
pcap-reader-swapped-p
(generic reader).
pcap-writer-alive-p
(generic reader).
pcap-writer-datalink
(generic reader).
pcap-writer-file
(generic reader).
pcap-writer-snaplen
(generic reader).
plokami-error
(condition).
plokami-error-text
(generic reader).
set-filter
(generic function).
set-non-block
(generic function).
stats
(generic function).
stop
(generic function).
with-pcap-interface
(macro).
with-pcap-reader
(macro).
with-pcap-writer
(macro).
%inet-ntop
(function).
%link-ntoa
(function).
%memcpy
(function).
%pcap-breakloop
(function).
%pcap-close
(function).
%pcap-compile
(function).
%pcap-datalink
(function).
%pcap-datalink-name-to-val
(function).
%pcap-datalink-val-to-description
(function).
%pcap-datalink-val-to-name
(function).
%pcap-dispatch
(function).
%pcap-dump
(function).
%pcap-dump-close
(function).
%pcap-dump-flush
(function).
%pcap-dump-ftell
(function).
%pcap-dump-open
(function).
%pcap-fileno
(function).
%pcap-findalldevs
(function).
%pcap-freealldevs
(function).
%pcap-freecode
(function).
%pcap-get-selectable-fd
(function).
%pcap-geterr
(function).
%pcap-getnonblock
(function).
%pcap-inject
(function).
%pcap-is-swapped
(function).
%pcap-lib-version
(function).
%pcap-list-datalinks
(function).
%pcap-lookupdev
(function).
%pcap-lookupnet
(function).
%pcap-loop
(function).
%pcap-major-version
(function).
%pcap-minor-version
(function).
%pcap-next
(function).
%pcap-next-ex
(function).
%pcap-open-dead
(function).
%pcap-open-live
(function).
%pcap-open-offline
(function).
%pcap-perror
(function).
%pcap-sendpacket
(function).
%pcap-set-datalink
(function).
%pcap-setdirection
(function).
%pcap-setfilter
(function).
%pcap-setnonblock
(function).
%pcap-snapshot
(function).
%pcap-stats
(function).
%pcap-strerror
(function).
*callbacks*
(special variable).
*compile-mutex*
(special variable).
*concurrent-pcap*
(special variable).
*concurrent-pcap-mutex*
(special variable).
*supported-datalinks*
(special variable).
+dlt_802_11+
(constant).
+dlt_en10mb+
(constant).
+dlt_null+
(constant).
+dlt_ppp+
(constant).
+dlt_ppp_bsdos1+
(constant).
+dlt_ppp_bsdos2+
(constant).
+dlt_ppp_ether+
(constant).
+dlt_ppp_pppd+
(constant).
+dlt_ppp_serial+
(constant).
+dlt_slip+
(constant).
+dlt_usb_linux+
(constant).
+error-buffer-size+
(constant).
+pcap_if_loopback+
(constant).
bpf_insn-tclass
(class).
bpf_program-tclass
(class).
clear-error-buffer
(function).
error-buffer-to-lisp
(function).
free-error-buffer
(function).
make-error-buffer
(function).
pcap-live
(class).
pcap-mixin
(class).
pcap-process-mixin
(class).
pcap-reader
(class).
pcap-writer
(class).
pcap_addr_t-tclass
(class).
pcap_if_t-tclass
(class).
pcap_pkthdr-tclass
(class).
pcap_stat-tclass
(class).
sockaddr-tclass
(class).
timeval-tclass
(class).
with-error-buffer
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
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.
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.
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.
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.
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.
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.
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.
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’.
pcap-process-mixin
) (packets integer
) (phandler function
)) ¶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.
pcap-writer
) (buffer vector
) (sec integer
) (usec integer
) &key length origlength) ¶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.
pcap-reader
)) ¶automatically generated reader method
live
.
pcap-reader
)) ¶automatically generated reader method
pcap-reader
)) ¶File (native namestring) to read packets from.
Represents a pathname using the native conventions of the operating system.
file
.
pcap-reader
)) ¶Major version of savefile.
pcap-reader
)) ¶Minor version of savefile.
pcap-reader
)) ¶automatically generated reader method
pcap-reader
)) ¶Savefile uses different byte order from host system.
pcap-writer
)) ¶automatically generated reader method
live
.
pcap-writer
)) ¶automatically generated reader method
pcap-writer
)) ¶File (native namestring) to write packets to.
Represents a pathname using the native conventions of the operating system.
file
.
pcap-writer
)) ¶automatically generated reader method
plokami-error
)) ¶text
.
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.
pcap-reader
) (filter string
)) ¶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.
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.
Deallocates resources for ‘PCAP-LIVE’, ‘PCAP-READER’, ‘PCAP-WRITER’ instance.
progn
.
:most-specific-first
pcap-writer
)) ¶pcap-process-mixin
)) ¶pcap-mixin
)) ¶pcap-writer
) &key) ¶pcap-reader
) &key) ¶Signaled on error when changing blocking mode.
Signaled on all pcap readfile errors.
Signaled on all pcap dumpfile errors.
Signaled on all network interface errors.
Signaled on error during live packet capture.
Signaled when a berkeley packet filter could not be established.
Signaled on errors during packet injection.
Generic condition for this package.
error
.
:text
This slot is read-only.
Set FOREIGN-BUFFER to the empty string.
Return FOREIGN-BUFFER as a lisp string.
Free memory held by FOREIGN-BUFFER.
Allocate and return foreign char array to hold error string.
Class for live packet capture.
Interface to capture packets from.
:if
This slot is read-only.
True if capturing in promiscuous mode.
:promisc
This slot is read-only.
True if pcap descriptor is in non-blocking mode.
:nbio
Read timeout in milliseconds. 0 will wait forever.
Only works in blocking mode/platforms that support it. No guarantee of
returning within timeout.
100
:timeout
This slot is read-only.
File descriptor that can be used with epoll/kqueue/select.
This slot is read-only.
This slot is read-only.
This slot is read-only.
:snaplen
This slot is read-only.
Internal class used as a mixin for all classes with pcap functionality.
Internal class, mixed in packet processing (‘PCAP-LIVE’, ‘PCAP-READER’).
Packet buffer to hold captured packets.
Lisp packet handler for capture. Invoked by callback.
Hashtable key for this instance.
Foreign pointer to hashkey, passed in callback.
Class for reading packets from a dumpfile.
File (native namestring) to read packets from.
Represents a pathname using the native conventions of the operating system.
(error "must supply filename to read packets from.")
:file
This slot is read-only.
Savefile uses different byte order from host system.
This slot is read-only.
Major version of savefile.
This slot is read-only.
Minor version of savefile.
This slot is read-only.
This slot is read-only.
This slot is read-only.
:snaplen
This slot is read-only.
Class for writing packets to a dumpfile.
File (native namestring) to write packets to.
Represents a pathname using the native conventions of the operating system.
(error "must supply file to write packets to.")
:file
This slot is read-only.
Foreign packet dumper object.
"en10mb"
:datalink
This slot is read-only.
This slot is read-only.
:snaplen
This slot is read-only.
Jump to: | %
C D E F G I M P S W |
---|
Jump to: | %
C D E F G I M P S W |
---|
Jump to: | *
+
B C D F H I L M N P S T |
---|
Jump to: | *
+
B C D F H I L M N P S T |
---|
Jump to: | B C F N P S T U |
---|
Jump to: | B C F N P S T U |
---|