A JavaScript implementation of luismartingarcia's Protocol - an ASCII header generator for network protocols with a convenient GUI.
- Parse protocol descriptions and generate ASCII art diagrams
- Convert C struct definitions to protocol descriptions
- Field inspector with bit/byte offset calculations
- Range expression generation (Python & C)
- Support for big-endian and little-endian
- 40+ built-in protocol templates (TCP, UDP, IP, ICMP, Ethernet, etc.)
<script src="./parser.js"></script>
<script src="./protocol.js"></script>
<script>
protocoljs.parser("Type:8,Code:8,Checksum:16,Identifier:16,Sequence Number:16,Data:64");
console.log(protocoljs.toString());
</script>var struct_str = "struct SIMPLE { int a; char b; char c[20]; };";
protocoljs.fromCStruct(struct_str, "ILP32");
// Returns: "a:32,b:8,c:160"Supported data models: ILP32, LP64, LLP64
FieldName:bits,FieldName:bits,...?option=value
Options:
bits- Bits per line (default: 32)numbers- Show top rulers (y/n)labelmin- Minimum bits to show label
npm run dev # Start dev server
npm run build # Build for production
npm run deploy # Deploy to GitHub PagesSee LICENSE file.