-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow lookahead of structs with size of 0 (#4149)
Signed-off-by: Mihai Budiu <[email protected]>
- Loading branch information
1 parent
c9319af
commit c2460b2
Showing
7 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <core.p4> | ||
|
||
parser Parser(packet_in pkt); | ||
package SimpleArch(Parser p); | ||
|
||
struct Foo { | ||
bit<0> f0; | ||
} | ||
|
||
parser MyParser(packet_in packet) { | ||
state start { | ||
transition select(packet.lookahead<Foo>().f0) { | ||
0: accept; | ||
default: reject; | ||
} | ||
} | ||
} | ||
|
||
SimpleArch(MyParser()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <core.p4> | ||
|
||
parser Parser(packet_in pkt); | ||
package SimpleArch(Parser p); | ||
struct Foo { | ||
bit<0> f0; | ||
} | ||
|
||
parser MyParser(packet_in packet) { | ||
state start { | ||
transition select((packet.lookahead<Foo>()).f0) { | ||
0: accept; | ||
default: reject; | ||
} | ||
} | ||
} | ||
|
||
SimpleArch(MyParser()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <core.p4> | ||
|
||
parser Parser(packet_in pkt); | ||
package SimpleArch(Parser p); | ||
struct Foo { | ||
bit<0> f0; | ||
} | ||
|
||
parser MyParser(packet_in packet) { | ||
@name("MyParser.tmp") bit<0> tmp; | ||
@name("MyParser.tmp_0") Foo tmp_0; | ||
state start { | ||
tmp_0 = packet.lookahead<Foo>(); | ||
tmp = tmp_0.f0; | ||
transition select(tmp) { | ||
0: accept; | ||
default: reject; | ||
} | ||
} | ||
} | ||
|
||
SimpleArch(MyParser()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <core.p4> | ||
|
||
parser Parser(packet_in pkt); | ||
package SimpleArch(Parser p); | ||
struct Foo { | ||
bit<0> f0; | ||
} | ||
|
||
parser MyParser(packet_in packet) { | ||
@name("MyParser.tmp_0") Foo tmp_0; | ||
state start { | ||
packet.lookahead<bit<0>>(); | ||
transition select(tmp_0.f0) { | ||
0: accept; | ||
default: reject; | ||
} | ||
} | ||
} | ||
|
||
SimpleArch(MyParser()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <core.p4> | ||
|
||
parser Parser(packet_in pkt); | ||
package SimpleArch(Parser p); | ||
struct Foo { | ||
bit<0> f0; | ||
} | ||
|
||
parser MyParser(packet_in packet) { | ||
state start { | ||
transition select((packet.lookahead<Foo>()).f0) { | ||
0: accept; | ||
default: reject; | ||
} | ||
} | ||
} | ||
|
||
SimpleArch(MyParser()) main; |
Empty file.