summaryrefslogtreecommitdiff
path: root/trafgen_lexer.l
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-02-01 19:01:40 +0200
committerTobias Klauser <tklauser@distanz.ch>2016-02-02 16:54:48 +0100
commit4d0b09dd07543fbceba9921f1219e310fd53d8ef (patch)
treeeb89915df9ad619cf29c9c27619dacd22260c890 /trafgen_lexer.l
parenta4e17af38e2e2545c32292b7b46102d49e738e1e (diff)
trafgen: parser: Add syntax for VLAN header creating
Add 'vlan()' function to generate VLAN header. Fields supported: tpid|proto Set TPID (Tag Protocol Identifier) (default 0x8100) 1ad Set TPID field as 0x88a8 1q Set TPID field as 0x8100 tci Set TCI (Tag Control Information) (default 0) pcp Set PCP (Priority Code Point) (PCP) (default 0) dei|cfi Set DEI (Drop Eligible Indicator) (default 0) id Set VID (VLAN Identifier) (default 0) Examples: { eth(), vlan(id=1), ipv4() } { vlan(id=1, 1ad), vlan(id=100, pcp=3), ipv4() } 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.l9
1 files changed, 9 insertions, 0 deletions
diff --git a/trafgen_lexer.l b/trafgen_lexer.l
index ef7ec2a..e1d1a3f 100644
--- a/trafgen_lexer.l
+++ b/trafgen_lexer.l
@@ -112,6 +112,14 @@ ip4_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)
"saddr"|"sa" { return K_SADDR; }
[e]?"type" { return K_ETYPE; }
+ /* VLAN (802.1Q & 802.1ad) */
+"tpid" { return K_TPID; }
+"tci" { return K_TCI; }
+"pcp" { return K_PCP; }
+"dei"|"cfi" { return K_DEI; }
+"1ad" { return K_1AD; }
+"1q" { return K_1Q; }
+
/* ARP */
"sha"|"smac" { return K_SHA; }
"spa"|"sip" { return K_SPA; }
@@ -158,6 +166,7 @@ ip4_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)
"urgptr" { return K_URG_PTR; }
"eth" { return K_ETH; }
+"vlan" { return K_VLAN; }
"arp" { return K_ARP; }
"ip4"|"ipv4" { return K_IP4; }
"udp" { return K_UDP; }