1header_type ethernet_t { 2 fields { 3 dstAddr : 48; 4 } 5} 6 7header_type ipv4_t { 8 fields { 9 srcAddr : 32; 10 } 11} 12 13parser start { 14 return parse_ethernet; 15} 16 17header ethernet_t ethernet; 18 19parser parse_ethernet { 20 extract(ethernet); 21 return parse_ipv4; 22} 23 24action nop() 25{} 26 27header ipv4_t ipv4; 28 29parser parse_ipv4 { 30 extract(ipv4); 31 return ingress; 32} 33 34table routing { 35 reads { 36 ethernet.dstAddr: exact; 37 ipv4.srcAddr: exact; 38 } 39 actions { nop; } 40 size : 512; 41} 42 43control ingress 44{ 45 apply(routing); 46}