frameassembly-wasm 3.2.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -37
- package/frameassembly_wasm.d.ts +47 -9
- package/frameassembly_wasm.js +47 -9
- package/frameassembly_wasm_bg.wasm +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# FrameAssembly WebAssembly Compiler (`frameassembly-wasm` v3.
|
|
1
|
+
# FrameAssembly WebAssembly Compiler (`frameassembly-wasm` v3.3.0)
|
|
2
2
|
|
|
3
3
|
[](https://frameassembly-lang.dev/)
|
|
4
4
|
[](https://github.com/SteveWinschel/FrameAssembly/blob/main/LICENSE)
|
|
5
5
|
|
|
6
6
|
[**Try in Browser (`frameassembly-lang.dev`)**](https://frameassembly-lang.dev/) • [**Building Locally**](#building-locally) • [**Vite, React & Next.js**](#initialization-vite-react-nextjs--browser-apps) • [**API Reference**](#api-reference)
|
|
7
7
|
|
|
8
|
-
`frameassembly-wasm` (`v3.
|
|
8
|
+
`frameassembly-wasm` (`v3.3.0`) is the **internal WebAssembly compiler, `.pcap`/`.pcapng`-to-`.frasm` decompiler, packet ladder inspector, and UTF-16 diagnostic engine** powering [**`frameassembly-lang.dev`**](https://frameassembly-lang.dev/) and the official VS Code extension (`SteveWinschel.frameassembly-vscode`). It compiles `.frasm` code into classic `.pcap` and `.pcapng` packet captures and decompiles existing captures back into `.frasm` code across 146 L2–L7 protocols (`18` L2, `31` L3, `3` L4, and `94` L7) inside browser applications and VS Code Desktop/Web Extension Hosts. *(CLI users should install the native binary via `cargo install frameassembly` and update with `frameassembly update`. FrameAssembly is a network packet specification compiler, not x86 Flat Assembler.)*
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
## Client-Side `.frasm` to `.pcapng` Compilation & PCAP Decompilation in the Browser & Node.js
|
|
13
13
|
|
|
14
|
-
`frameassembly-wasm` compiles the FrameAssembly Rust engine to WebAssembly, turning `.frasm` code into classic `.pcap` (`compileFrasmToPcap` / `compile_frasm_to_pcap`) or `.pcapng` (`
|
|
14
|
+
`frameassembly-wasm` compiles the FrameAssembly Rust engine to WebAssembly, turning `.frasm` code into classic `.pcap` (`compileFrasmToPcap` / `compile_frasm_to_pcap`) or `.pcapng` (`compileFrasm` / `compile_frasm_to_pcapng`) byte streams, decompiling binary `.pcap` and `.pcapng` captures into strict-lowercase `.frasm` code via `reverse_pcap(pcapBytes)` / `reversePcap(pcapBytes)`, and emitting real-time Monaco, CodeMirror, and VS Code diagnostics in the browser or Node.js without a backend server:
|
|
15
15
|
|
|
16
16
|
```frameassembly
|
|
17
17
|
host client { ip 192.168.1.10 mac 00:11:22:33:44:55 }
|
|
@@ -29,9 +29,9 @@ compile {
|
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
31
|
import init, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
compile_frasm_to_pcapng,
|
|
33
|
+
validate_frasm,
|
|
34
|
+
inspect_frasm,
|
|
35
35
|
reversePcap,
|
|
36
36
|
} from "./pkg/frameassembly_wasm.js";
|
|
37
37
|
|
|
@@ -50,15 +50,15 @@ compile {
|
|
|
50
50
|
dns_query(client, server)
|
|
51
51
|
}`;
|
|
52
52
|
|
|
53
|
-
// 1. Validate syntax
|
|
54
|
-
const diagnostics =
|
|
53
|
+
// 1. Validate syntax and semantics for Monaco / CodeMirror / VS Code editor markers
|
|
54
|
+
const diagnostics = validate_frasm(source);
|
|
55
55
|
if (diagnostics.length === 0) {
|
|
56
56
|
// 2. Inspect individual packet ladder rows, protocol labels, summaries, and hex payloads
|
|
57
|
-
const previews =
|
|
57
|
+
const previews = inspect_frasm(source);
|
|
58
58
|
console.log(`Synthesized ${previews.length} frames (${previews[0].protocol}: ${previews[0].summary}).`);
|
|
59
59
|
|
|
60
60
|
// 3. Compile to binary PCAPNG Uint8Array
|
|
61
|
-
const pcapngBytes =
|
|
61
|
+
const pcapngBytes = compile_frasm_to_pcapng(source);
|
|
62
62
|
const blob = new Blob([pcapngBytes], { type: "application/vnd.tcpdump.pcap" });
|
|
63
63
|
console.log(`Generated PCAPNG: ${blob.size} bytes`);
|
|
64
64
|
|
|
@@ -72,7 +72,7 @@ if (diagnostics.length === 0) {
|
|
|
72
72
|
|
|
73
73
|
## Building Locally
|
|
74
74
|
|
|
75
|
-
`frameassembly-wasm` is an internal workspace crate powering [`frameassembly-lang.dev`](https://frameassembly-lang.dev/) and `frameassembly-vscode` rather than a standalone user CLI package. Build the WebAssembly bundle
|
|
75
|
+
`frameassembly-wasm` is an internal workspace crate powering [`frameassembly-lang.dev`](https://frameassembly-lang.dev/) and `frameassembly-vscode` rather than a standalone user CLI package. Build the WebAssembly bundle from the repository root using `wasm-pack`:
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
78
|
wasm-pack build frameassembly-wasm --release --target web
|
|
@@ -84,13 +84,13 @@ This generates `frameassembly-wasm/pkg/{frameassembly_wasm.js,frameassembly_wasm
|
|
|
84
84
|
|
|
85
85
|
## Initialization (Vite, React, Next.js & Browser Apps)
|
|
86
86
|
|
|
87
|
-
Import the generated WebAssembly binary URL explicitly with `?url` so Vite, Webpack 5, and Next.js serve the `.wasm` asset
|
|
87
|
+
Import the generated WebAssembly binary URL explicitly with `?url` so Vite, Webpack 5, and Next.js serve the `.wasm` asset in both development and production builds, and pass the options object to `init` (`wasm-bindgen 0.2.130`):
|
|
88
88
|
|
|
89
89
|
```ts
|
|
90
90
|
import init, {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
validate_frasm,
|
|
92
|
+
inspect_frasm,
|
|
93
|
+
compile_frasm_to_pcapng,
|
|
94
94
|
reversePcap,
|
|
95
95
|
type IdeDiagnostic,
|
|
96
96
|
type PacketPreview,
|
|
@@ -106,10 +106,10 @@ await init({ module_or_path: wasmUrl });
|
|
|
106
106
|
|
|
107
107
|
## API Reference
|
|
108
108
|
|
|
109
|
-
> **
|
|
109
|
+
> **Compatibility aliases:** FrameAssembly 3.x renamed its source files from `.fasm` to `.frasm`. Every export uses a `*_frasm` / `*Frasm` name (`validate_frasm`, `inspect_frasm`, `compile_frasm_to_pcapng`, `validateFrasm`, `inspectFrasm`, `compileFrasm`). Legacy 2.x names (`validate_fasm`, `validateFasm`, `inspect_fasm`, `compile_fasm_to_pcapng`, `compileFasm`) remain exported as identical aliases for existing integrations, and `ReversePcapResult.fasm` aliases `frasm`. All structured JS returns serialize as plain JavaScript objects via `serialize_maps_as_objects(true)`.
|
|
110
110
|
|
|
111
|
-
### `
|
|
112
|
-
Parses, validates, and test-compiles `.frasm` source code, returning zero-based UTF-16 line and column spans ready for Monaco Editor, CodeMirror 6, or VS Code diagnostic markers (including
|
|
111
|
+
### `validate_frasm(source: string): IdeDiagnostic[]` / `validateFrasm(source: string): IdeDiagnostic[]` (aliases: `validate_fasm`, `validateFasm`)
|
|
112
|
+
Parses, validates, and test-compiles `.frasm` source code, returning zero-based UTF-16 line and column spans (handling `\n`, `\r\n`, and bare `\r` line breaks) ready for Monaco Editor, CodeMirror 6, or VS Code diagnostic markers (including strict-lowercase quick-fix remediation hints in `help`). Returns an empty array `[]` when compilation succeeds, or a single diagnostic when `source` exceeds the `4 MiB` WebAssembly input limit (`MAX_WASM_SOURCE_BYTES`).
|
|
113
113
|
|
|
114
114
|
```ts
|
|
115
115
|
interface IdeDiagnostic {
|
|
@@ -117,13 +117,13 @@ interface IdeDiagnostic {
|
|
|
117
117
|
start_col: number; // 0-based UTF-16 character column
|
|
118
118
|
end_line: number; // 0-based UTF-16 line index
|
|
119
119
|
end_col: number; // 0-based UTF-16 character column
|
|
120
|
-
message: string; //
|
|
120
|
+
message: string; // Diagnostic error message
|
|
121
121
|
help?: string; // Actionable remediation or 1-click quick-fix hint
|
|
122
122
|
}
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
### `
|
|
126
|
-
Compiles `.frasm` source code into an array of packet ladder inspection entries
|
|
125
|
+
### `inspect_frasm(source: string): PacketPreview[]` / `inspectFrasm(source: string): PacketPreview[]` (alias: `inspect_fasm`)
|
|
126
|
+
Compiles `.frasm` source code into an array of packet ladder inspection entries using `frameassembly::inspect::summarize_frame`, including relative millisecond timestamps, endpoint pairs (`source_dest`), protocol labels (`protocol`), decoded Ethernet/VLAN/QinQ/MPLS/LLC/L3/L4/L7 summaries (`summary`), frame lengths, and lowercase space-delimited hex byte dumps. Throws a JavaScript `Error` if `source` exceeds `MAX_WASM_SOURCE_BYTES` or compilation fails.
|
|
127
127
|
|
|
128
128
|
```ts
|
|
129
129
|
interface PacketPreview {
|
|
@@ -132,19 +132,19 @@ interface PacketPreview {
|
|
|
132
132
|
length: number; // Total packet length in bytes
|
|
133
133
|
hex: string; // Space-separated lowercase hex byte dump
|
|
134
134
|
source_dest: string; // Formatted "src -> dst" IPv4, IPv6, or MAC pair
|
|
135
|
-
protocol: string; // Highest-layer protocol label (e.g. "DNS", "SNMP", "MODBUS")
|
|
135
|
+
protocol: string; // Highest-layer protocol label (e.g. "DNS", "SNMP", "MODBUS", "NGAP")
|
|
136
136
|
summary: string; // Decoded L2/L3/L4/L7 frame summary string
|
|
137
137
|
}
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
### `compileFrasmToPcap(source: string): Uint8Array` / `compile_frasm_to_pcap(source: string): Uint8Array`
|
|
141
|
-
Compiles `.frasm` source code into a binary `Uint8Array` containing a valid classic libpcap (`.pcap`) byte stream (`LINKTYPE_ETHERNET`, `snaplen =
|
|
141
|
+
Compiles `.frasm` source code into a binary `Uint8Array` containing a valid classic libpcap (`.pcap`) byte stream (`LINKTYPE_ETHERNET`, `snaplen = 262144`, microsecond or nanosecond timestamp header selection). Throws a JavaScript `Error` with diagnostic context if `source` exceeds `MAX_WASM_SOURCE_BYTES` or compilation fails.
|
|
142
142
|
|
|
143
|
-
### `
|
|
144
|
-
Compiles `.frasm` source code into a binary `Uint8Array` containing a valid, standards-compliant PCAPNG byte stream with nanosecond timestamp precision (`IfTsResol = 9`). Throws a JavaScript `Error` with diagnostic context if compilation fails.
|
|
143
|
+
### `compile_frasm_to_pcapng(source: string): Uint8Array` / `compileFrasm(source: string): Uint8Array` (aliases: `compile_fasm_to_pcapng`, `compileFasm`)
|
|
144
|
+
Compiles `.frasm` source code into a binary `Uint8Array` containing a valid, standards-compliant PCAPNG byte stream with nanosecond timestamp precision (`IfTsResol = 9`), host `NameResolutionBlock` records, and per-frame `comment` options. Throws a JavaScript `Error` with diagnostic context if `source` exceeds `MAX_WASM_SOURCE_BYTES` or compilation fails.
|
|
145
145
|
|
|
146
146
|
### `reverse_pcap(pcap_bytes: Uint8Array): ReverseJsResult` / `reversePcap(pcap_bytes: Uint8Array): ReverseJsResult`
|
|
147
|
-
Decompiles an in-memory `.pcap` or `.pcapng` byte array (`Uint8Array`) across all
|
|
147
|
+
Decompiles an in-memory `.pcap` or `.pcapng` byte array (`Uint8Array`) across all 146 native Layer 2 through Layer 7 protocols into strict-lowercase `.frasm` code (`host1`, `host2`, ... declarations and an inline `compile` block), returning summary statistics (`packetCount`, `hostCount`). Throws a structured plain JS error object (`{ success: false, error, message }`) if `pcap_bytes` exceeds the `64 MiB` WebAssembly capture limit (`MAX_WASM_PCAP_BYTES`) or is not a valid packet capture.
|
|
148
148
|
|
|
149
149
|
```ts
|
|
150
150
|
interface ReversePcapResult {
|
|
@@ -163,17 +163,18 @@ type ReverseJsResult = ReversePcapResult;
|
|
|
163
163
|
## Complete Browser Playground & Download Example
|
|
164
164
|
|
|
165
165
|
```ts
|
|
166
|
-
import init, {
|
|
166
|
+
import init, { compile_frasm_to_pcapng, reversePcap, validate_frasm } from "./pkg/frameassembly_wasm.js";
|
|
167
|
+
import wasmUrl from "./pkg/frameassembly_wasm_bg.wasm?url";
|
|
167
168
|
|
|
168
169
|
export async function downloadCapture(frasmCode: string, filename = "capture.pcapng") {
|
|
169
|
-
await init();
|
|
170
|
+
await init({ module_or_path: wasmUrl });
|
|
170
171
|
|
|
171
|
-
const errors =
|
|
172
|
+
const errors = validate_frasm(frasmCode);
|
|
172
173
|
if (errors.length > 0) {
|
|
173
174
|
throw new Error(`Compilation error: ${errors[0].message}`);
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
const pcapng =
|
|
177
|
+
const pcapng = compile_frasm_to_pcapng(frasmCode);
|
|
177
178
|
const blob = new Blob([pcapng], { type: "application/vnd.tcpdump.pcap" });
|
|
178
179
|
const url = URL.createObjectURL(blob);
|
|
179
180
|
|
|
@@ -187,7 +188,7 @@ export async function downloadCapture(frasmCode: string, filename = "capture.pca
|
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
export async function importCaptureFile(file: File): Promise<string> {
|
|
190
|
-
await init();
|
|
191
|
+
await init({ module_or_path: wasmUrl });
|
|
191
192
|
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
192
193
|
const result = reversePcap(bytes);
|
|
193
194
|
return result.frasm;
|
|
@@ -198,15 +199,15 @@ export async function importCaptureFile(file: File): Promise<string> {
|
|
|
198
199
|
|
|
199
200
|
## Features & Engine Capabilities
|
|
200
201
|
|
|
201
|
-
- **
|
|
202
|
-
- **
|
|
203
|
-
- **Nanosecond Fidelity**: Compiles and reverses
|
|
204
|
-
- **
|
|
202
|
+
- **Browser & IDE Execution**: Runs locally in WebAssembly inside Chrome, Firefox, Safari, Edge, Web Workers, VS Code Desktop/Web, and Node.js without a backend server.
|
|
203
|
+
- **146 Native Protocols (`18` L2, `31` L3, `3` L4, `94` L7)**: Forward compilation and `.pcap`/`.pcapng` decompilation across Ethernet, 802.1Q VLAN, QinQ, MPLS, CDP, IS-IS, MACsec, PPPoE, PROFINET, EtherCAT, ARP, IPv4/IPv6, ICMP, SRv6, IP-in-IP, TCP, UDP, SCTP (NGAP/S1AP/Diameter), SNMPv1/v2c/v3 USM, DNS, DHCP, HTTP/2, TLS, QUIC, Modbus, DNP3, and MAC-only switch topologies.
|
|
204
|
+
- **Nanosecond Fidelity**: Compiles and reverses PCAP and PCAPNG captures with nanosecond-resolution Section and Interface Description Blocks (`IfTsResol(9)`), host name resolution records, and packet comments.
|
|
205
|
+
- **Bounded In-Memory Processing**: Executes live syntax validation with CRLF-accurate UTF-16 spans, packet ladder inspection, compilation, and drag-and-drop capture reversal in browser memory with bounded input caps (`4 MiB` source, `64 MiB` capture).
|
|
205
206
|
|
|
206
207
|
---
|
|
207
208
|
|
|
208
209
|
## Disambiguation: FrameAssembly vs. Flat Assembler
|
|
209
210
|
|
|
210
|
-
**FrameAssembly** (`.frasm`, media type `text/vnd.frameassembly`) is a network packet specification compiler for generating and decompiling `.pcap` and `.pcapng` packet captures. It is
|
|
211
|
+
**FrameAssembly** (`.frasm`, media type `text/vnd.frameassembly`) is a network packet specification compiler for generating and decompiling `.pcap` and `.pcapng` packet captures. It is unrelated to x86 Flat Assembler (`fasm.net`, which uses `.asm`/`.fasm` files) and SymbiFlow / F4PGA FPGA bitstream FASM tools.
|
|
211
212
|
|
|
212
|
-
Interactive browser playground: [https://frameassembly-lang.dev/](https://frameassembly-lang.dev/) • Documentation: [https://frameassembly-lang.dev/docs](https://frameassembly-lang.dev/docs) • Use cases and examples: [https://frameassembly-lang.dev/use-cases](https://frameassembly-lang.dev/use-cases) • Source code and formal grammars: https://github.com/SteveWinschel/FrameAssembly
|
|
213
|
+
Interactive browser playground: [https://frameassembly-lang.dev/](https://frameassembly-lang.dev/) • Documentation: [https://frameassembly-lang.dev/docs](https://frameassembly-lang.dev/docs) • Use cases and examples: [https://frameassembly-lang.dev/use-cases](https://frameassembly-lang.dev/use-cases) • Source code and formal grammars: [GitHub (`SteveWinschel/FrameAssembly`)](https://github.com/SteveWinschel/FrameAssembly)
|
package/frameassembly_wasm.d.ts
CHANGED
|
@@ -40,11 +40,17 @@ export interface ReversePcapError {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (`compileFasm` 2.x alias).
|
|
43
|
+
*
|
|
44
|
+
* # Errors
|
|
45
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or compilation fails.
|
|
43
46
|
*/
|
|
44
47
|
export function compileFasm(source: string): Uint8Array;
|
|
45
48
|
|
|
46
49
|
/**
|
|
47
50
|
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (`compileFrasm` alias).
|
|
51
|
+
*
|
|
52
|
+
* # Errors
|
|
53
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or compilation fails.
|
|
48
54
|
*/
|
|
49
55
|
export function compileFrasm(source: string): Uint8Array;
|
|
50
56
|
|
|
@@ -52,12 +58,16 @@ export function compileFrasm(source: string): Uint8Array;
|
|
|
52
58
|
* Compiles `.frasm` source into a classic libpcap (`.pcap`) byte array (`compileFrasmToPcap` JS `Uint8Array`).
|
|
53
59
|
*
|
|
54
60
|
* # Errors
|
|
55
|
-
* Returns a JavaScript `JsValue` error if
|
|
61
|
+
* Returns a JavaScript `JsValue` error if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or if
|
|
62
|
+
* parsing, validation, or serialization fails.
|
|
56
63
|
*/
|
|
57
64
|
export function compileFrasmToPcap(source: string): Uint8Array;
|
|
58
65
|
|
|
59
66
|
/**
|
|
60
|
-
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (
|
|
67
|
+
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (`compile_fasm_to_pcapng` 2.x alias).
|
|
68
|
+
*
|
|
69
|
+
* # Errors
|
|
70
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or compilation fails.
|
|
61
71
|
*/
|
|
62
72
|
export function compile_fasm_to_pcapng(source: string): Uint8Array;
|
|
63
73
|
|
|
@@ -65,27 +75,43 @@ export function compile_fasm_to_pcapng(source: string): Uint8Array;
|
|
|
65
75
|
* Compiles `.frasm` source into a classic libpcap (`.pcap`) byte array (`compile_frasm_to_pcap` JS alias).
|
|
66
76
|
*
|
|
67
77
|
* # Errors
|
|
68
|
-
* Returns a JavaScript `JsValue` error if
|
|
78
|
+
* Returns a JavaScript `JsValue` error if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or if
|
|
79
|
+
* parsing, validation, or serialization fails.
|
|
69
80
|
*/
|
|
70
81
|
export function compile_frasm_to_pcap(source: string): Uint8Array;
|
|
71
82
|
|
|
72
83
|
/**
|
|
73
84
|
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (JS `Uint8Array`).
|
|
85
|
+
*
|
|
86
|
+
* # Errors
|
|
87
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or compilation fails.
|
|
74
88
|
*/
|
|
75
89
|
export function compile_frasm_to_pcapng(source: string): Uint8Array;
|
|
76
90
|
|
|
77
91
|
/**
|
|
78
92
|
* Returns decoded frame metadata for `.frasm` source (`inspectFrasm` camelCase alias).
|
|
93
|
+
*
|
|
94
|
+
* # Errors
|
|
95
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`], compilation fails,
|
|
96
|
+
* or JS serialization fails.
|
|
79
97
|
*/
|
|
80
98
|
export function inspectFrasm(source: string): PacketPreview[];
|
|
81
99
|
|
|
82
100
|
/**
|
|
83
|
-
* Returns decoded frame metadata, endpoint/protocol summaries, and hex strings
|
|
101
|
+
* Returns decoded frame metadata, endpoint/protocol summaries, and hex strings (`inspect_fasm` 2.x alias).
|
|
102
|
+
*
|
|
103
|
+
* # Errors
|
|
104
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`], compilation fails,
|
|
105
|
+
* or JS serialization fails.
|
|
84
106
|
*/
|
|
85
107
|
export function inspect_fasm(source: string): PacketPreview[];
|
|
86
108
|
|
|
87
109
|
/**
|
|
88
110
|
* Returns decoded frame metadata, endpoint/protocol summaries, and hex strings for `.frasm` source.
|
|
111
|
+
*
|
|
112
|
+
* # Errors
|
|
113
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`], compilation fails,
|
|
114
|
+
* or JS serialization fails.
|
|
89
115
|
*/
|
|
90
116
|
export function inspect_frasm(source: string): PacketPreview[];
|
|
91
117
|
|
|
@@ -93,8 +119,8 @@ export function inspect_frasm(source: string): PacketPreview[];
|
|
|
93
119
|
* Decompiles an in-memory `.pcap` or `.pcapng` capture (`reversePcap` camelCase alias).
|
|
94
120
|
*
|
|
95
121
|
* # Errors
|
|
96
|
-
* Returns a structured `JsValue` error object (`{ success: false, error, message }`) if
|
|
97
|
-
* `pcap_bytes` is not a valid `.pcap` or `.pcapng` capture.
|
|
122
|
+
* Returns a structured plain `JsValue` error object (`{ success: false, error, message }`) if
|
|
123
|
+
* `pcap_bytes` exceeds [`MAX_WASM_PCAP_BYTES`] or is not a valid `.pcap` or `.pcapng` capture.
|
|
98
124
|
*/
|
|
99
125
|
export function reversePcap(pcap_bytes: Uint8Array | number[]): ReversePcapResult;
|
|
100
126
|
|
|
@@ -103,28 +129,40 @@ export function reversePcap(pcap_bytes: Uint8Array | number[]): ReversePcapResul
|
|
|
103
129
|
* source code and summary counts (`{ success: true, frasm, fasm, packetCount, hostCount }`).
|
|
104
130
|
*
|
|
105
131
|
* # Errors
|
|
106
|
-
* Returns a structured `JsValue` error object (`{ success: false, error, message }`) if
|
|
107
|
-
* `pcap_bytes` is not a valid `.pcap` or `.pcapng` capture.
|
|
132
|
+
* Returns a structured plain `JsValue` error object (`{ success: false, error, message }`) if
|
|
133
|
+
* `pcap_bytes` exceeds [`MAX_WASM_PCAP_BYTES`] or is not a valid `.pcap` or `.pcapng` capture.
|
|
108
134
|
*/
|
|
109
135
|
export function reverse_pcap(pcap_bytes: Uint8Array | number[]): ReversePcapResult;
|
|
110
136
|
|
|
111
137
|
/**
|
|
112
138
|
* Validates `.frasm` source and returns UTF-16 line/column diagnostics (`validateFasm` 2.x alias).
|
|
139
|
+
*
|
|
140
|
+
* # Errors
|
|
141
|
+
* Returns a JavaScript `Error` if diagnostic serialization fails.
|
|
113
142
|
*/
|
|
114
143
|
export function validateFasm(source: string): IdeDiagnostic[];
|
|
115
144
|
|
|
116
145
|
/**
|
|
117
146
|
* Validates `.frasm` source and returns UTF-16 line/column diagnostics (`validateFrasm` camelCase alias).
|
|
147
|
+
*
|
|
148
|
+
* # Errors
|
|
149
|
+
* Returns a JavaScript `Error` if diagnostic serialization fails.
|
|
118
150
|
*/
|
|
119
151
|
export function validateFrasm(source: string): IdeDiagnostic[];
|
|
120
152
|
|
|
121
153
|
/**
|
|
122
|
-
* Validates `.frasm` source and returns UTF-16 line/column diagnostics
|
|
154
|
+
* Validates `.frasm` source and returns UTF-16 line/column diagnostics (`validate_fasm` 2.x alias).
|
|
155
|
+
*
|
|
156
|
+
* # Errors
|
|
157
|
+
* Returns a JavaScript `Error` if diagnostic serialization fails.
|
|
123
158
|
*/
|
|
124
159
|
export function validate_fasm(source: string): IdeDiagnostic[];
|
|
125
160
|
|
|
126
161
|
/**
|
|
127
162
|
* Validates `.frasm` source and returns UTF-16 line/column diagnostics for Monaco, CodeMirror, and VS Code.
|
|
163
|
+
*
|
|
164
|
+
* # Errors
|
|
165
|
+
* Returns a JavaScript `Error` if diagnostic serialization fails.
|
|
128
166
|
*/
|
|
129
167
|
export function validate_frasm(source: string): IdeDiagnostic[];
|
|
130
168
|
|
package/frameassembly_wasm.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (`compileFasm` 2.x alias).
|
|
5
|
+
*
|
|
6
|
+
* # Errors
|
|
7
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or compilation fails.
|
|
5
8
|
* @param {string} source
|
|
6
9
|
* @returns {Uint8Array}
|
|
7
10
|
*/
|
|
@@ -19,6 +22,9 @@ export function compileFasm(source) {
|
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (`compileFrasm` alias).
|
|
25
|
+
*
|
|
26
|
+
* # Errors
|
|
27
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or compilation fails.
|
|
22
28
|
* @param {string} source
|
|
23
29
|
* @returns {Uint8Array}
|
|
24
30
|
*/
|
|
@@ -38,7 +44,8 @@ export function compileFrasm(source) {
|
|
|
38
44
|
* Compiles `.frasm` source into a classic libpcap (`.pcap`) byte array (`compileFrasmToPcap` JS `Uint8Array`).
|
|
39
45
|
*
|
|
40
46
|
* # Errors
|
|
41
|
-
* Returns a JavaScript `JsValue` error if
|
|
47
|
+
* Returns a JavaScript `JsValue` error if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or if
|
|
48
|
+
* parsing, validation, or serialization fails.
|
|
42
49
|
* @param {string} source
|
|
43
50
|
* @returns {Uint8Array}
|
|
44
51
|
*/
|
|
@@ -55,7 +62,10 @@ export function compileFrasmToPcap(source) {
|
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
/**
|
|
58
|
-
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (
|
|
65
|
+
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (`compile_fasm_to_pcapng` 2.x alias).
|
|
66
|
+
*
|
|
67
|
+
* # Errors
|
|
68
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or compilation fails.
|
|
59
69
|
* @param {string} source
|
|
60
70
|
* @returns {Uint8Array}
|
|
61
71
|
*/
|
|
@@ -75,7 +85,8 @@ export function compile_fasm_to_pcapng(source) {
|
|
|
75
85
|
* Compiles `.frasm` source into a classic libpcap (`.pcap`) byte array (`compile_frasm_to_pcap` JS alias).
|
|
76
86
|
*
|
|
77
87
|
* # Errors
|
|
78
|
-
* Returns a JavaScript `JsValue` error if
|
|
88
|
+
* Returns a JavaScript `JsValue` error if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or if
|
|
89
|
+
* parsing, validation, or serialization fails.
|
|
79
90
|
* @param {string} source
|
|
80
91
|
* @returns {Uint8Array}
|
|
81
92
|
*/
|
|
@@ -93,6 +104,9 @@ export function compile_frasm_to_pcap(source) {
|
|
|
93
104
|
|
|
94
105
|
/**
|
|
95
106
|
* Compiles `.frasm` source into a standards-compliant PCAPNG byte array (JS `Uint8Array`).
|
|
107
|
+
*
|
|
108
|
+
* # Errors
|
|
109
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`] or compilation fails.
|
|
96
110
|
* @param {string} source
|
|
97
111
|
* @returns {Uint8Array}
|
|
98
112
|
*/
|
|
@@ -110,6 +124,10 @@ export function compile_frasm_to_pcapng(source) {
|
|
|
110
124
|
|
|
111
125
|
/**
|
|
112
126
|
* Returns decoded frame metadata for `.frasm` source (`inspectFrasm` camelCase alias).
|
|
127
|
+
*
|
|
128
|
+
* # Errors
|
|
129
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`], compilation fails,
|
|
130
|
+
* or JS serialization fails.
|
|
113
131
|
* @param {string} source
|
|
114
132
|
* @returns {PacketPreview[]}
|
|
115
133
|
*/
|
|
@@ -124,7 +142,11 @@ export function inspectFrasm(source) {
|
|
|
124
142
|
}
|
|
125
143
|
|
|
126
144
|
/**
|
|
127
|
-
* Returns decoded frame metadata, endpoint/protocol summaries, and hex strings
|
|
145
|
+
* Returns decoded frame metadata, endpoint/protocol summaries, and hex strings (`inspect_fasm` 2.x alias).
|
|
146
|
+
*
|
|
147
|
+
* # Errors
|
|
148
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`], compilation fails,
|
|
149
|
+
* or JS serialization fails.
|
|
128
150
|
* @param {string} source
|
|
129
151
|
* @returns {PacketPreview[]}
|
|
130
152
|
*/
|
|
@@ -140,6 +162,10 @@ export function inspect_fasm(source) {
|
|
|
140
162
|
|
|
141
163
|
/**
|
|
142
164
|
* Returns decoded frame metadata, endpoint/protocol summaries, and hex strings for `.frasm` source.
|
|
165
|
+
*
|
|
166
|
+
* # Errors
|
|
167
|
+
* Returns a JavaScript `Error` if `source` exceeds [`MAX_WASM_SOURCE_BYTES`], compilation fails,
|
|
168
|
+
* or JS serialization fails.
|
|
143
169
|
* @param {string} source
|
|
144
170
|
* @returns {PacketPreview[]}
|
|
145
171
|
*/
|
|
@@ -157,8 +183,8 @@ export function inspect_frasm(source) {
|
|
|
157
183
|
* Decompiles an in-memory `.pcap` or `.pcapng` capture (`reversePcap` camelCase alias).
|
|
158
184
|
*
|
|
159
185
|
* # Errors
|
|
160
|
-
* Returns a structured `JsValue` error object (`{ success: false, error, message }`) if
|
|
161
|
-
* `pcap_bytes` is not a valid `.pcap` or `.pcapng` capture.
|
|
186
|
+
* Returns a structured plain `JsValue` error object (`{ success: false, error, message }`) if
|
|
187
|
+
* `pcap_bytes` exceeds [`MAX_WASM_PCAP_BYTES`] or is not a valid `.pcap` or `.pcapng` capture.
|
|
162
188
|
* @param {Uint8Array | number[]} pcap_bytes
|
|
163
189
|
* @returns {ReversePcapResult}
|
|
164
190
|
*/
|
|
@@ -177,8 +203,8 @@ export function reversePcap(pcap_bytes) {
|
|
|
177
203
|
* source code and summary counts (`{ success: true, frasm, fasm, packetCount, hostCount }`).
|
|
178
204
|
*
|
|
179
205
|
* # Errors
|
|
180
|
-
* Returns a structured `JsValue` error object (`{ success: false, error, message }`) if
|
|
181
|
-
* `pcap_bytes` is not a valid `.pcap` or `.pcapng` capture.
|
|
206
|
+
* Returns a structured plain `JsValue` error object (`{ success: false, error, message }`) if
|
|
207
|
+
* `pcap_bytes` exceeds [`MAX_WASM_PCAP_BYTES`] or is not a valid `.pcap` or `.pcapng` capture.
|
|
182
208
|
* @param {Uint8Array | number[]} pcap_bytes
|
|
183
209
|
* @returns {ReversePcapResult}
|
|
184
210
|
*/
|
|
@@ -194,6 +220,9 @@ export function reverse_pcap(pcap_bytes) {
|
|
|
194
220
|
|
|
195
221
|
/**
|
|
196
222
|
* Validates `.frasm` source and returns UTF-16 line/column diagnostics (`validateFasm` 2.x alias).
|
|
223
|
+
*
|
|
224
|
+
* # Errors
|
|
225
|
+
* Returns a JavaScript `Error` if diagnostic serialization fails.
|
|
197
226
|
* @param {string} source
|
|
198
227
|
* @returns {IdeDiagnostic[]}
|
|
199
228
|
*/
|
|
@@ -209,6 +238,9 @@ export function validateFasm(source) {
|
|
|
209
238
|
|
|
210
239
|
/**
|
|
211
240
|
* Validates `.frasm` source and returns UTF-16 line/column diagnostics (`validateFrasm` camelCase alias).
|
|
241
|
+
*
|
|
242
|
+
* # Errors
|
|
243
|
+
* Returns a JavaScript `Error` if diagnostic serialization fails.
|
|
212
244
|
* @param {string} source
|
|
213
245
|
* @returns {IdeDiagnostic[]}
|
|
214
246
|
*/
|
|
@@ -223,7 +255,10 @@ export function validateFrasm(source) {
|
|
|
223
255
|
}
|
|
224
256
|
|
|
225
257
|
/**
|
|
226
|
-
* Validates `.frasm` source and returns UTF-16 line/column diagnostics
|
|
258
|
+
* Validates `.frasm` source and returns UTF-16 line/column diagnostics (`validate_fasm` 2.x alias).
|
|
259
|
+
*
|
|
260
|
+
* # Errors
|
|
261
|
+
* Returns a JavaScript `Error` if diagnostic serialization fails.
|
|
227
262
|
* @param {string} source
|
|
228
263
|
* @returns {IdeDiagnostic[]}
|
|
229
264
|
*/
|
|
@@ -239,6 +274,9 @@ export function validate_fasm(source) {
|
|
|
239
274
|
|
|
240
275
|
/**
|
|
241
276
|
* Validates `.frasm` source and returns UTF-16 line/column diagnostics for Monaco, CodeMirror, and VS Code.
|
|
277
|
+
*
|
|
278
|
+
* # Errors
|
|
279
|
+
* Returns a JavaScript `Error` if diagnostic serialization fails.
|
|
242
280
|
* @param {string} source
|
|
243
281
|
* @returns {IdeDiagnostic[]}
|
|
244
282
|
*/
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"collaborators": [
|
|
5
5
|
"Steve Winschel"
|
|
6
6
|
],
|
|
7
|
-
"description": "Compile .frasm network traffic code to .pcapng and decompile .pcap/.pcapng packet captures in WebAssembly across
|
|
8
|
-
"version": "3.
|
|
7
|
+
"description": "Compile FrameAssembly .frasm network traffic code to .pcapng and decompile .pcap/.pcapng packet captures in WebAssembly across 146 L2-L7 protocols with live IDE diagnostics and frame inspection.",
|
|
8
|
+
"version": "3.3.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|