ruedigergad/clj-net-pcap

Improve DSL syntax

ruedigergad opened this issue · 1 comments

The current DSL syntax is quite verbose.
A potential improvement could be to use Clojure-like expressions in the DSL, e.g.:
{:type :json-str
:rules [{"name" (int16 0)}
{"ts" (timestamp 0)}
{"ip-src" (ipv4-address :ipv4-src)}]}
This could also be used for including the scaling and centering, e.g.:
{:type :json-str
:rules [{"ts" (timestamp 0)}
{"src-port" (/ (int16 :udp-src) 65535)}]}
These are just some first examples but the potential could also be extended further such that the scaling factors could be, e.g., automatically calculated based on the extraction function, e.g.:
{:type :json-str
:rules [{"ts" (timestamp 0)}
{"src-port" (normalize (int16 :udp-src))}]}

Added an improved DSL approach.