This page defines the library-level contract that is intended to stay stable at v1.0. It complements the function docstrings and provides one place for arguments, return shapes, and error behavior.
Public API namespaces:
paclo.corepaclo.decode-extInternal namespaces (non-API surface):
paclo.pcappaclo.parsepaclo.proto.*paclo.corebpfSignature:
(bpf form)
Input contract:
nil => returns nilstring => returns the same stringkeyword => protocol keyword (:udp, :tcp, :icmp, :icmp6, :arp, :ip, :ipv4, :ip6, :ipv6)vector => DSL form (:and, :or, :not, :proto, host/net/port operators)Output:
Errors:
ex-info for unsupported form/operator/keywordpacketsSignature:
(packets opts)
Core options:
{:path "..."}{:device "..."}:filter accepts BPF string or BPF DSL (keyword / vector):decode? true annotates each packet with either :decoded or :decode-error:xform accepts a transducer and is applied via sequencePassthrough options:
paclo.pcap/capture->seqcapture->seq defaults (:max, :max-time-ms, :idle-max-ms)Output:
Decoded packet behavior:
:decoded map is attached:decode-error string is attached:decoded is present, paclo.decode-ext/apply! is invokedErrors:
ex-info when :filter has an unsupported typewrite-pcap!Signature:
(write-pcap! packets out-path)
Input contract:
packets is a seq of:
byte-array, or{:bytes <byte-array> :sec <long> :usec <long>} (timestamp keys optional)out-path is required and must be non-blankOutput:
bytes-seq->pcap! (successful side effect is PCAP file creation)Errors:
ex-info when output path is missing/blankex-info when packet map entries do not contain :byteslist-devicesSignature:
(list-devices)
Output:
{:name "en0" :desc "Wi-Fi"}Errors:
-main (repository convenience entrypoint)Signature:
(-main & _)
Behavior:
clojure -M:run non-failingpaclo.decode-extregister!Signature:
(register! k f)
Input contract:
k: hook key (typically namespaced keyword)f: (fn [m] m') where m is a packet mapBehavior:
Output:
kunregister!Signature:
(unregister! k)
Behavior:
Output:
nilinstalledSignature:
(installed)
Output:
apply!Signature:
(apply! m)
Execution guard:
m is a map:decoded exists:decode-error is absentHook behavior:
Output:
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |