Wick.Protocol.InHeader (wick v0.1.0)

Copy Markdown View Source

fuse_in_header — the 40-byte prefix on every request the kernel sends to userspace.

Layout (little-endian):

+-------+--------+----------------------------------+
| off   | size   | field                            |
+-------+--------+----------------------------------+
|  0    | u32    | len (total frame length)         |
|  4    | u32    | opcode                           |
|  8    | u64    | unique (matches in reply)        |
| 16    | u64    | nodeid (target inode)            |
| 24    | u32    | uid                              |
| 28    | u32    | gid                              |
| 32    | u32    | pid                              |
| 36    | u32    | padding (zero)                   |
+-------+--------+----------------------------------+

Summary

Types

t()

Decoded request header.

Functions

Encode a header struct back to bytes. padding is always written as zero. Primarily a test helper — production code never emits a request header (the kernel does that).

Size of the on-wire header in bytes (always 40).

Split a complete request frame into its header and body. Validates that header.len matches the frame size.

Types

t()

@type t() :: %Wick.Protocol.InHeader{
  gid: non_neg_integer(),
  len: non_neg_integer(),
  nodeid: non_neg_integer(),
  opcode: non_neg_integer(),
  pid: non_neg_integer(),
  uid: non_neg_integer(),
  unique: non_neg_integer()
}

Decoded request header.

Functions

encode(h)

@spec encode(t()) :: binary()

Encode a header struct back to bytes. padding is always written as zero. Primarily a test helper — production code never emits a request header (the kernel does that).

size()

@spec size() :: 40

Size of the on-wire header in bytes (always 40).

split(arg1)

@spec split(binary()) :: {:ok, t(), binary()} | {:error, term()}

Split a complete request frame into its header and body. Validates that header.len matches the frame size.