Carmelo Cascone | 16de6db | 2017-08-22 00:27:57 +0200 | [diff] [blame] | 1 | #ifndef __HEADERS_P4__ |
| 2 | #define __HEADERS_P4__ |
| 3 | |
| 4 | #ifdef __TOFINO_BUILD__ |
| 5 | #include <tofino/intrinsic_metadata.p4> |
| 6 | #endif |
| 7 | |
| 8 | header_type packet_in_t { |
Carmelo Cascone | 4f01102 | 2017-06-05 01:41:02 -0400 | [diff] [blame] | 9 | fields { |
Carmelo Cascone | 16de6db | 2017-08-22 00:27:57 +0200 | [diff] [blame] | 10 | ingress_port: 9; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | header_type packet_out_t { |
| 15 | fields { |
| 16 | egress_port: 9; |
Carmelo Cascone | 4f01102 | 2017-06-05 01:41:02 -0400 | [diff] [blame] | 17 | } |
| 18 | } |
| 19 | |
| 20 | header_type ethernet_t { |
| 21 | fields { |
| 22 | dstAddr : 48; |
| 23 | srcAddr : 48; |
| 24 | etherType : 16; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | header_type ipv4_t { |
| 29 | fields { |
| 30 | version : 4; |
| 31 | ihl : 4; |
| 32 | diffserv : 8; |
| 33 | totalLen : 16; |
| 34 | identification : 16; |
| 35 | flags : 3; |
| 36 | fragOffset : 13; |
| 37 | ttl : 8; |
| 38 | protocol : 8; |
| 39 | hdrChecksum : 16; |
| 40 | srcAddr : 32; |
| 41 | dstAddr: 32; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | header_type tcp_t { |
| 46 | fields { |
| 47 | srcPort : 16; |
| 48 | dstPort : 16; |
| 49 | seqNo : 32; |
| 50 | ackNo : 32; |
| 51 | dataOffset : 4; |
| 52 | res : 3; |
| 53 | ecn : 3; |
| 54 | ctrl : 6; |
| 55 | window : 16; |
| 56 | checksum : 16; |
| 57 | urgentPtr : 16; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | header_type udp_t { |
| 62 | fields { |
| 63 | srcPort : 16; |
| 64 | dstPort : 16; |
| 65 | length_ : 16; |
| 66 | checksum : 16; |
| 67 | } |
Carmelo Cascone | 16de6db | 2017-08-22 00:27:57 +0200 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | #endif |