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