summaryrefslogtreecommitdiff
path: root/trafgen_lexer.l
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-01-29 00:06:27 +0200
committerTobias Klauser <tklauser@distanz.ch>2016-01-29 09:01:14 +0100
commit4f51efe253208cb906a31e75da21a1f718132486 (patch)
tree1a69e5623b175f16bf13969759edf9a9d9836d0e /trafgen_lexer.l
parentd275f16591ca44d91ee4e56d65553529a429a62d (diff)
trafgen: parser: Add syntax to build UDP header
Add function 'udp()' to generate UDP header. Fields supported: sp|sport UDP source port (default 0) dp|dport UDP destination port (default 0) len|length Length of UDP header + payload (calculated automatically) csum Checksum field (calculated automatically) Example (Echo request): { udp(dport=7) } Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_lexer.l')
-rw-r--r--trafgen_lexer.l4
1 files changed, 4 insertions, 0 deletions
diff --git a/trafgen_lexer.l b/trafgen_lexer.l
index eeb252f..56011a3 100644
--- a/trafgen_lexer.l
+++ b/trafgen_lexer.l
@@ -133,9 +133,13 @@ ip_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)
"df" { return K_DF; }
"mf" { return K_MF; }
+"sp"|"sport" { return K_SPORT; }
+"dp"|"dport" { return K_DPORT; }
+
"eth" { return K_ETH; }
"arp" { return K_ARP; }
"ip4"|"ipv4" { return K_IP4; }
+"udp" { return K_UDP; }
[ ]*"-"[ ]* { return '-'; }
[ ]*"+"[ ]* { return '+'; }