Interactive Tutorial · Local Browser WebAssembly · 5 min

Chapter 5: Multi-Subnet Policy Checks with Reusable flow(c, s)

Write a multi-packet firewall check once using placeholder names, then replay it across Floor 1, Floor 2, Guest Wi-Fi, or IPv4 + IPv6.

Labs completed0/7
The Situation · 5 min

Three campus user VLANs (floor1_pc, floor2_pc, wifi_user) all need to pass the same 4-packet TCP + TLS handshake to sso_gw without copy-pasting 12 lines.

What You'll Pull Off Here

  • Define flow name(c, s) { ... } between host and compile.
  • Reference only the placeholder parameter names (c, s) inside the flow body.
  • Call tls_check(...) inside compile across multiple subnet pairs (including IPv4 and IPv6 pairs).
Interactive Lab Check

Lab 5: Run tls_check for wifi_user

Add tls_check(wifi_user, sso_gw) inside compile { ... } so all 3 campus subnets execute the 4-packet handshake (12 frames total).

  1. 1.Locate compile { ... } at the bottom of the editor.
  2. 2.Add tls_check(wifi_user, sso_gw) right below tls_check(floor2_pc, sso_gw).
  3. 3.Click Check Exercise to confirm all 12 frames compile cleanly.

1. flow(c, s) — Reusable Packet Stencils Without Loops

Copy-pasting the same 4-packet TCP + TLS handshake across five campus subnets makes captures tedious to read and easy to mistype.

A flow block sits between host and compile. Give it placeholder names in parentheses (flow tls_check(c, s) { ... }), then call tls_check(floor1_pc, sso_gw) inside compile for each subnet pair you want to test.

  • Parentheses with >= 1 parameter are required: flow tls_check(c, s) { ... }.
  • Inside the flow braces, only use the parameter names (c, s), never global host names.
  • There is no loop keyword: each flow call inside compile expands predictably in order.
Word-by-Word Syntax Breakdown
Define the exchange once, then stamp it out for any host pair:
flow tls_check(c, s) { ... }   ->   compile { tls_check(floor1_pc, sso_gw) }
flow tls_check(c, s)Stencil HeaderReusable template taking two placeholder endpoints c and s
c -> s tcp syn ...Stencil BodyUses c and s so any IPv4 pair or IPv6 pair can plug right in
tls_check(floor1_pc, sso_gw)Flow CallExpands all 4 frames inside compile for floor1_pc <-> sso_gw
Quick Formatting Reference (2 rules)
ItemValid .frasmAvoid
Flow parametersflow tls_check(c, s) { c -> s tcp syn dstport 443 }flow tls_check { floor1_pc -> sso_gw tcp syn }
Repeating sequencescompile { tls_check(a, s) tls_check(b, s) }loop 2 { ... } // no loop keyword in FrameAssembly
campus_sso_matrix.frasmLoading WASM…
Wireshark filter: tls.handshake.type == 1
Open in Playground
0 B · 0.000 ms
Compiling capture in WebAssembly…
Learn FrameAssembly: Docs, Protocols & Labs — FrameAssembly