blob: 167664698ed5f9bc2a78a55bb14b31790dddbff3 [file] [log] [blame]
Carmelo Casconec8d34862017-07-30 00:48:23 -04001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Carmelo Casconec8d34862017-07-30 00:48:23 -04003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070017#ifndef __HEADERS__
18#define __HEADERS__
19
20#include "defines.p4"
Carmelo Cascone837e6452017-07-19 20:35:22 -040021
22@controller_header("packet_in")
23header packet_in_header_t {
24 bit<9> ingress_port;
Keesjan Karsten23368892018-05-22 10:46:01 +000025 bit<7> _padding;
Carmelo Cascone837e6452017-07-19 20:35:22 -040026}
27
28@controller_header("packet_out")
29header packet_out_header_t {
30 bit<9> egress_port;
Keesjan Karsten23368892018-05-22 10:46:01 +000031 bit<7> _padding;
Carmelo Cascone837e6452017-07-19 20:35:22 -040032}
33
Yi Tseng21629932017-06-06 11:17:43 -070034header ethernet_t {
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070035 bit<48> dst_addr;
36 bit<48> src_addr;
37 bit<16> ether_type;
Yi Tseng21629932017-06-06 11:17:43 -070038}
39
40header ipv4_t {
41 bit<4> version;
42 bit<4> ihl;
Jonghwan Hyun8be03392017-12-04 15:48:44 -080043 bit<6> dscp;
44 bit<2> ecn;
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070045 bit<16> len;
Yi Tseng21629932017-06-06 11:17:43 -070046 bit<16> identification;
47 bit<3> flags;
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070048 bit<13> frag_offset;
Yi Tseng21629932017-06-06 11:17:43 -070049 bit<8> ttl;
50 bit<8> protocol;
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070051 bit<16> hdr_checksum;
52 bit<32> src_addr;
53 bit<32> dst_addr;
Yi Tseng21629932017-06-06 11:17:43 -070054}
55
56header tcp_t {
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070057 bit<16> src_port;
58 bit<16> dst_port;
59 bit<32> seq_no;
60 bit<32> ack_no;
61 bit<4> data_offset;
Yi Tseng21629932017-06-06 11:17:43 -070062 bit<3> res;
63 bit<3> ecn;
64 bit<6> ctrl;
65 bit<16> window;
66 bit<16> checksum;
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070067 bit<16> urgent_ptr;
Yi Tseng21629932017-06-06 11:17:43 -070068}
69
70header udp_t {
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070071 bit<16> src_port;
72 bit<16> dst_port;
Yi Tseng21629932017-06-06 11:17:43 -070073 bit<16> length_;
74 bit<16> checksum;
75}
76
Yi Tseng21629932017-06-06 11:17:43 -070077#endif