Skip to content

javascript verison of luismartingarcia's Protcol - An ASCII Header Generator for Network Protocols with convenient GUI page

License

Notifications You must be signed in to change notification settings

leommxj/protocoljs

Repository files navigation

ProtocolJS

A JavaScript implementation of luismartingarcia's Protocol - an ASCII header generator for network protocols with a convenient GUI.

Live Demo

Features

  • 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.)

Usage

As a Library

<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>

From C Struct

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

GUI Tool

Online version

Protocol Specification Format

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

Development

npm run dev      # Start dev server
npm run build    # Build for production
npm run deploy   # Deploy to GitHub Pages

License

See LICENSE file.

About

javascript verison of luismartingarcia's Protcol - An ASCII Header Generator for Network Protocols with convenient GUI page

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published