| /* |
| * Copyright 2017-present Open Networking Foundation |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #ifndef __HEADERS__ |
| #define __HEADERS__ |
| |
| #include "defines.p4" |
| |
| @controller_header("packet_in") |
| header packet_in_header_t { |
| bit<9> ingress_port; |
| } |
| |
| @controller_header("packet_out") |
| header packet_out_header_t { |
| bit<9> egress_port; |
| } |
| |
| header ethernet_t { |
| bit<48> dst_addr; |
| bit<48> src_addr; |
| bit<16> ether_type; |
| } |
| |
| header ipv4_t { |
| bit<4> version; |
| bit<4> ihl; |
| bit<8> diffserv; |
| bit<16> len; |
| bit<16> identification; |
| bit<3> flags; |
| bit<13> frag_offset; |
| bit<8> ttl; |
| bit<8> protocol; |
| bit<16> hdr_checksum; |
| bit<32> src_addr; |
| bit<32> dst_addr; |
| } |
| |
| header tcp_t { |
| bit<16> src_port; |
| bit<16> dst_port; |
| bit<32> seq_no; |
| bit<32> ack_no; |
| bit<4> data_offset; |
| bit<3> res; |
| bit<3> ecn; |
| bit<6> ctrl; |
| bit<16> window; |
| bit<16> checksum; |
| bit<16> urgent_ptr; |
| } |
| |
| header udp_t { |
| bit<16> src_port; |
| bit<16> dst_port; |
| bit<16> length_; |
| bit<16> checksum; |
| } |
| |
| struct headers_t { |
| ethernet_t ethernet; |
| ipv4_t ipv4; |
| tcp_t tcp; |
| udp_t udp; |
| packet_out_header_t packet_out; |
| packet_in_header_t packet_in; |
| } |
| |
| struct local_metadata_t { |
| bit<16> l4_src_port; |
| bit<16> l4_dst_port; |
| next_hop_id_t next_hop_id; |
| bit<16> selector; |
| } |
| |
| #endif |