blob: 901b1384f091c3919410840e7dac107486ccc838 [file] [log] [blame]
Carmelo Casconec8d34862017-07-30 00:48:23 -04001/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
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
Yi Tseng21629932017-06-06 11:17:43 -070017#ifndef HEADERS
18#define HEADERS
Carmelo Cascone837e6452017-07-19 20:35:22 -040019
20@controller_header("packet_in")
21header packet_in_header_t {
22 bit<9> ingress_port;
23}
24
25@controller_header("packet_out")
26header packet_out_header_t {
27 bit<9> egress_port;
28}
29
Yi Tseng21629932017-06-06 11:17:43 -070030struct intrinsic_metadata_t {
31 bit<32> ingress_global_timestamp;
32 bit<32> lf_field_list;
33 bit<16> mcast_grp;
34 bit<16> egress_rid;
35}
36
37header ethernet_t {
38 bit<48> dstAddr;
39 bit<48> srcAddr;
40 bit<16> etherType;
41}
42
43header ipv4_t {
44 bit<4> version;
45 bit<4> ihl;
46 bit<8> diffserv;
47 bit<16> totalLen;
48 bit<16> identification;
49 bit<3> flags;
50 bit<13> fragOffset;
51 bit<8> ttl;
52 bit<8> protocol;
53 bit<16> hdrChecksum;
54 bit<32> srcAddr;
55 bit<32> dstAddr;
56}
57
58header tcp_t {
59 bit<16> srcPort;
60 bit<16> dstPort;
61 bit<32> seqNo;
62 bit<32> ackNo;
63 bit<4> dataOffset;
64 bit<3> res;
65 bit<3> ecn;
66 bit<6> ctrl;
67 bit<16> window;
68 bit<16> checksum;
69 bit<16> urgentPtr;
70}
71
72header udp_t {
73 bit<16> srcPort;
74 bit<16> dstPort;
75 bit<16> length_;
76 bit<16> checksum;
77}
78
Carmelo Cascone837e6452017-07-19 20:35:22 -040079struct headers_t {
Yi Tseng21629932017-06-06 11:17:43 -070080 ethernet_t ethernet;
81 ipv4_t ipv4;
82 tcp_t tcp;
83 udp_t udp;
Carmelo Cascone837e6452017-07-19 20:35:22 -040084 packet_out_header_t packet_out;
85 packet_in_header_t packet_in;
Yi Tseng21629932017-06-06 11:17:43 -070086}
87#endif