Expand description
Opcode and bytecode wire-format contract (version 1).
§File layout (RUSO + version byte)
- Metadata (name, description, impact, severity, author, report title)
- Probe table (HTTP / DNS / TCP specs)
- String pool
- Matcher pool (
QualifiedMatch) - Extract pool (
ExtractSource) - Evidence pool (
EvidenceKind) - Payload pool (raw bytes for
Sendoverrides) - Instruction stream (
Opcodediscriminants)
§Instruction opcodes (wire u8)
| Byte | Variant | Payload |
|---|---|---|
| 1 | Set | name_id: u32, value_id: u32 |
| 2 | Send | probe_id: u32, optional payload index |
| 3 | Match | matcher_id: u32 |
| 4 | MatchAll | start: u32, len: u16 |
| 5 | MatchAny | start: u32, len: u16 |
| 6 | Assert | matcher_id: u32 |
| 7 | Extract | name_id: u32, source_id: u32 |
| 8 | IfMatch | matcher_id: u32, else_pc: u32 |
| 9 | Save | from_id: u32, to_id: u32 |
| 10 | Evidence | kind_id: u32 |
| 11 | Retry | probe_id: u32, count: u32 |
| 12 | RetryDelay | duration_id: u32 |
| 13 | Sleep | duration_id: u32 |
| 14 | Stop | — |
| 15 | Fail | — |
| 16 | Continue | — |
| 17 | Exit | — |
| 18 | (reserved) | was Repeat, removed |
| 19 | LoopBack | — |
| 20 | Break | — |
| 21 | SetList | name_id: u32, start: u32, len: u16 |
| 22 | ForList | item_id: u32, start: u32, len: u16, end_pc: u32 |
| 23 | ForVar | item_id: u32, list_id: u32, end_pc: u32 |
Compilers must emit crate::BytecodeProgram compatible with crate::VERSION.
Structs§
- Bytecode
Program - Compiled script ready for the executor (probes, metadata, and instruction stream).
Enums§
- Opcode
- A single VM instruction. Operands are
u32/u16indices into the program’s pools (strings,matchers,extracts,evidence) or program counters (Pc) intocode— never inline data.
Constants§
- MAGIC
- The four magic bytes every
.rbcfile starts with. - OP_
ASSERT - Evaluate a matcher and abort the script when it fails:
matcher_id: u32. - OP_
BREAK - Leave the enclosing loop.
- OP_
CONTINUE - Skip the rest of the current loop iteration and start the next one.
- OP_
EVIDENCE - Attach proof to the finding this script emits:
kind_id: u32, an evidence-pool index naming the source (body, whole response, or a header). - OP_EXIT
- Halt the script immediately without emitting a finding.
- OP_
EXTRACT - Pull a value out of the last response into a variable:
name_id: u32,source_id: u32(an extract-pool index). - OP_FAIL
- Halt the script and mark the run as failed.
- OP_
FOR_ LIST - Loop over a literal list:
item_id: u32(the loop variable),start: u32,len: u16(the elements),end_pc: u32(where to resume). - OP_
FOR_ VAR - Loop over a list held in a variable:
item_id: u32(the loop variable),list_id: u32(the list variable),end_pc: u32(where to resume). - OP_
IF_ MATCH - Branch on a matcher: run the following block when it holds, otherwise jump
to
else_pc. Payload ismatcher_id: u32,else_pc: u32. - OP_
LOOP_ BACK - Jump back to the top of the enclosing loop.
- OP_
MATCH - Evaluate one matcher and record the outcome:
matcher_id: u32. - OP_
MATCH_ ALL - Evaluate a contiguous run of matchers; holds only if all of them do.
Payload is
start: u32,len: u16. - OP_
MATCH_ ANY - Evaluate a contiguous run of matchers; holds if any of them does.
Payload is
start: u32,len: u16. - OP_
RETRY - Re-send a probe up to
counttimes while it keeps failing:probe_id: u32,count: u32. - OP_
RETRY_ DELAY - Set the delay inserted between
OP_RETRYattempts:duration_id: u32(a string-pool duration literal). - OP_SAVE
- Copy one variable into another:
from_id: u32,to_id: u32. - OP_SEND
- Fire a probe:
probe_id: u32, plus an optional payload-pool index that overrides the probe’s own body. - OP_SET
- Bind a variable:
name_id: u32,value_id: u32(both string-pool indices). - OP_
SET_ LIST - Bind a list variable from a contiguous run of string-pool entries:
name_id: u32,start: u32,len: u16. - OP_
SLEEP - Pause execution:
duration_id: u32. - OP_STOP
- Halt the script and report whatever has matched so far.
- VERSION
- The wire-format version this build reads and writes. The decoder accepts this value only; see the module docs before changing it.
Type Aliases§
- Pc
- Instruction pointer index into
BytecodeProgram::code.