Liking cljdoc? Tell your friends :D

clj-ebpf.net.tcp

TCP packet parsing and manipulation helpers for eBPF programs.

TCP packet parsing and manipulation helpers for eBPF programs.
raw docstring

get-payload-ptrclj

(get-payload-ptr payload-reg tcp-hdr-reg tcp-hlen-reg)

Calculate pointer to TCP payload. Requires knowing TCP header length (data offset).

payload-reg: Register to store payload pointer tcp-hdr-reg: Register pointing to TCP header tcp-hlen-reg: Register containing TCP header length in bytes

Calculate pointer to TCP payload.
Requires knowing TCP header length (data offset).

payload-reg: Register to store payload pointer
tcp-hdr-reg: Register pointing to TCP header
tcp-hlen-reg: Register containing TCP header length in bytes
sourceraw docstring

is-ackclj

(is-ack flags-reg ack-label)

Check if TCP ACK flag is set.

flags-reg: Register containing TCP flags ack-label: Label offset to jump to if ACK

Check if TCP ACK flag is set.

flags-reg: Register containing TCP flags
ack-label: Label offset to jump to if ACK
sourceraw docstring

is-dportclj

(is-dport dport-reg port match-label)

Check if destination port matches (network byte order comparison).

dport-reg: Register containing destination port (network order) port: Port number (will be converted to network order) match-label: Label to jump to if ports match

Check if destination port matches (network byte order comparison).

dport-reg: Register containing destination port (network order)
port: Port number (will be converted to network order)
match-label: Label to jump to if ports match
sourceraw docstring

is-finclj

(is-fin flags-reg fin-label)

Check if TCP FIN flag is set.

flags-reg: Register containing TCP flags fin-label: Label offset to jump to if FIN

Check if TCP FIN flag is set.

flags-reg: Register containing TCP flags
fin-label: Label offset to jump to if FIN
sourceraw docstring

is-pshclj

(is-psh flags-reg psh-label)

Check if TCP PSH flag is set.

flags-reg: Register containing TCP flags psh-label: Label offset to jump to if PSH

Check if TCP PSH flag is set.

flags-reg: Register containing TCP flags
psh-label: Label offset to jump to if PSH
sourceraw docstring

is-rstclj

(is-rst flags-reg rst-label)

Check if TCP RST flag is set.

flags-reg: Register containing TCP flags rst-label: Label offset to jump to if RST

Check if TCP RST flag is set.

flags-reg: Register containing TCP flags
rst-label: Label offset to jump to if RST
sourceraw docstring

is-sportclj

(is-sport sport-reg port match-label)

Check if source port matches (network byte order comparison).

sport-reg: Register containing source port (network order) port: Port number (will be converted to network order) match-label: Label to jump to if ports match

Check if source port matches (network byte order comparison).

sport-reg: Register containing source port (network order)
port: Port number (will be converted to network order)
match-label: Label to jump to if ports match
sourceraw docstring

is-synclj

(is-syn flags-reg syn-label)

Check if TCP SYN flag is set. Jumps to syn-label if SYN is set, falls through otherwise.

flags-reg: Register containing TCP flags syn-label: Label offset to jump to if SYN

Check if TCP SYN flag is set.
Jumps to syn-label if SYN is set, falls through otherwise.

flags-reg: Register containing TCP flags
syn-label: Label offset to jump to if SYN
sourceraw docstring

is-syn-ackclj

(is-syn-ack flags-reg scratch-reg syn-ack-label)

Check if SYN and ACK flags are both set.

flags-reg: Register containing TCP flags scratch-reg: Scratch register syn-ack-label: Label offset to jump to if SYN+ACK

Check if SYN and ACK flags are both set.

flags-reg: Register containing TCP flags
scratch-reg: Scratch register
syn-ack-label: Label offset to jump to if SYN+ACK
sourceraw docstring

is-syn-onlyclj

(is-syn-only flags-reg scratch-reg syn-only-label)

Check if only SYN flag is set (connection initiation). Jumps to syn-only-label if SYN is set and ACK is not.

flags-reg: Register containing TCP flags scratch-reg: Scratch register syn-only-label: Label offset to jump to if SYN-only

Check if only SYN flag is set (connection initiation).
Jumps to syn-only-label if SYN is set and ACK is not.

flags-reg: Register containing TCP flags
scratch-reg: Scratch register
syn-only-label: Label offset to jump to if SYN-only
sourceraw docstring

load-ack-seqclj

(load-ack-seq dst-reg tcp-hdr-reg)

Load TCP acknowledgment number into dst-reg (network byte order).

dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header

Load TCP acknowledgment number into dst-reg (network byte order).

dst-reg: Destination register
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-data-offsetclj

(load-data-offset dst-reg tcp-hdr-reg)

Load TCP data offset (header length in 32-bit words) into dst-reg.

dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header

Load TCP data offset (header length in 32-bit words) into dst-reg.

dst-reg: Destination register
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-dportclj

(load-dport dst-reg tcp-hdr-reg)

Load TCP destination port into dst-reg (network byte order).

dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header

Load TCP destination port into dst-reg (network byte order).

dst-reg: Destination register
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-fieldclj

(load-field dst-reg tcp-hdr-reg field size)

Load a TCP header field into dst-reg.

dst-reg: Destination register tcp-hdr-reg: Register pointing to start of TCP header field: Field keyword (:sport, :dport, :seq, etc.) size: :b (byte), :h (half-word), :w (word)

Load a TCP header field into dst-reg.

dst-reg: Destination register
tcp-hdr-reg: Register pointing to start of TCP header
field: Field keyword (:sport, :dport, :seq, etc.)
size: :b (byte), :h (half-word), :w (word)
sourceraw docstring

load-flagsclj

(load-flags dst-reg tcp-hdr-reg)

Load TCP flags byte into register.

dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header

Load TCP flags byte into register.

dst-reg: Destination register
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-header-lenclj

(load-header-len dst-reg tcp-hdr-reg)

Load TCP header length in bytes into dst-reg.

dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header

Load TCP header length in bytes into dst-reg.

dst-reg: Destination register
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-portsclj

(load-ports sport-reg dport-reg tcp-hdr-reg)

Load TCP source and destination ports. Ports are loaded in network byte order.

sport-reg: Register for source port dport-reg: Register for destination port tcp-hdr-reg: Register pointing to TCP header

Load TCP source and destination ports.
Ports are loaded in network byte order.

sport-reg: Register for source port
dport-reg: Register for destination port
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-ports-hostclj

(load-ports-host sport-reg dport-reg tcp-hdr-reg)

Load TCP source and destination ports in host byte order.

sport-reg: Register for source port (host order) dport-reg: Register for destination port (host order) tcp-hdr-reg: Register pointing to TCP header

Load TCP source and destination ports in host byte order.

sport-reg: Register for source port (host order)
dport-reg: Register for destination port (host order)
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-seqclj

(load-seq dst-reg tcp-hdr-reg)

Load TCP sequence number into dst-reg (network byte order).

dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header

Load TCP sequence number into dst-reg (network byte order).

dst-reg: Destination register
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-sportclj

(load-sport dst-reg tcp-hdr-reg)

Load TCP source port into dst-reg (network byte order).

dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header

Load TCP source port into dst-reg (network byte order).

dst-reg: Destination register
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

load-windowclj

(load-window dst-reg tcp-hdr-reg)

Load TCP window size into dst-reg (network byte order).

dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header

Load TCP window size into dst-reg (network byte order).

dst-reg: Destination register
tcp-hdr-reg: Register pointing to TCP header
sourceraw docstring

parse-tcp-headerclj

(parse-tcp-header tcp-hdr-reg
                  data-end-reg
                  sport-reg
                  dport-reg
                  fail-label
                  scratch-reg)

Parse TCP header and check bounds. Returns instructions that:

  1. Check bounds for minimum TCP header (20 bytes)
  2. Load source and destination ports

tcp-hdr-reg: Register pointing to TCP header start data-end-reg: Register containing data_end pointer sport-reg: Register to store source port dport-reg: Register to store destination port fail-label: Label to jump to on bounds failure scratch-reg: Scratch register for bounds check

Parse TCP header and check bounds.
Returns instructions that:
1. Check bounds for minimum TCP header (20 bytes)
2. Load source and destination ports

tcp-hdr-reg: Register pointing to TCP header start
data-end-reg: Register containing data_end pointer
sport-reg: Register to store source port
dport-reg: Register to store destination port
fail-label: Label to jump to on bounds failure
scratch-reg: Scratch register for bounds check
sourceraw docstring

store-dportclj

(store-dport tcp-hdr-reg port-reg)

Store TCP destination port (expects network byte order).

tcp-hdr-reg: Register pointing to TCP header port-reg: Register containing port (network order)

Store TCP destination port (expects network byte order).

tcp-hdr-reg: Register pointing to TCP header
port-reg: Register containing port (network order)
sourceraw docstring

store-fieldclj

(store-field tcp-hdr-reg field src-reg size)

Store value to TCP header field.

tcp-hdr-reg: Register pointing to TCP header start field: Field keyword src-reg: Register containing value to store size: :b, :h, or :w

Store value to TCP header field.

tcp-hdr-reg: Register pointing to TCP header start
field: Field keyword
src-reg: Register containing value to store
size: :b, :h, or :w
sourceraw docstring

store-port-hostclj

(store-port-host tcp-hdr-reg field port-reg scratch-reg)

Store TCP port from host byte order value.

tcp-hdr-reg: Register pointing to TCP header field: :sport or :dport port-reg: Register containing port (host order) scratch-reg: Scratch register for byte order conversion

Store TCP port from host byte order value.

tcp-hdr-reg: Register pointing to TCP header
field: :sport or :dport
port-reg: Register containing port (host order)
scratch-reg: Scratch register for byte order conversion
sourceraw docstring

store-sportclj

(store-sport tcp-hdr-reg port-reg)

Store TCP source port (expects network byte order).

tcp-hdr-reg: Register pointing to TCP header port-reg: Register containing port (network order)

Store TCP source port (expects network byte order).

tcp-hdr-reg: Register pointing to TCP header
port-reg: Register containing port (network order)
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close