我正在尝试p4中的嵌套结构实现,但是却遇到了编译器错误。这里有任何解决方法吗?
header ethernet_t
{
bit<48> dstAddr;
bit<48> srcAddr;
bit<16> etherType;
}
/* Assemble headers in a single struct */
struct my_headers_t
{
ethernet_t ethernet;
}
struct s1
{
my_headers_t hdr;
}
parser MyParser(packet_in packet,out s1 s,inout my_metadata_t meta,inout standard_metadata_t standard_metadata)
{
state start{
packet.extract(s.hdr.ethernet);
transition select(s.hdr.ethernet.etherType)
{
default: accept;
}
}
}