blob: 176911ef81cd6e7d56f6ba0e33b96c9d0f41c3da [file] [log] [blame]
Yi Tsengbe342052017-11-03 10:21:23 -07001/*
2 * Copyright 2017-present Open Networking Foundation
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
17#ifndef __DEFINE__
18#define __DEFINE__
19
20#define MAX_PORTS 511
21
Carmelo Cascone35d9b332018-06-15 16:27:22 +020022#ifndef _BOOL
23#define _BOOL bool
24#endif
25#ifndef _TRUE
26#define _TRUE true
27#endif
28#ifndef _FALSE
Yi Tseng34af3162018-06-17 18:02:21 +080029#define _FALSE false
Carmelo Cascone35d9b332018-06-15 16:27:22 +020030#endif
31
32#ifndef _PKT_OUT_HDR_ANNOT
33#define _PKT_OUT_HDR_ANNOT
34#endif
35
36#ifndef IP_VER_LENGTH
37#define IP_VER_LENGTH 4
38#endif
39#ifndef IP_VERSION_4
40#define IP_VERSION_4 4
41#endif
42#ifndef IP_VERSION_6
43#define IP_VERSION_6 6
44#endif
45
46#define ETH_HDR_SIZE 14
47#define IPV4_HDR_SIZE 20
48#define UDP_HDR_SIZE 8
49#define GTP_HDR_SIZE 8
50
51#define UDP_PORT_GTPU 2152
52#define GTP_GPDU 0xff
53#define GTPU_VERSION 0x01
54#define GTP_PROTOCOL_TYPE_GTP 0x01
55
Yi Tsengbe342052017-11-03 10:21:23 -070056typedef bit<3> fwd_type_t;
Yi Tseng1b154bd2017-11-20 17:48:19 -080057typedef bit<32> next_id_t;
Yi Tsengbe342052017-11-03 10:21:23 -070058typedef bit<20> mpls_label_t;
59typedef bit<9> port_num_t;
60typedef bit<48> mac_addr_t;
61typedef bit<16> group_id_t;
62typedef bit<12> vlan_id_t;
63
64const bit<16> ETHERTYPE_QINQ = 0x88A8;
65const bit<16> ETHERTYPE_QINQ_NON_STD = 0x9100;
66const bit<16> ETHERTYPE_VLAN = 0x8100;
67const bit<16> ETHERTYPE_MPLS = 0x8847;
68const bit<16> ETHERTYPE_MPLS_MULTICAST =0x8848;
69const bit<16> ETHERTYPE_IPV4 = 0x0800;
70const bit<16> ETHERTYPE_IPV6 = 0x86dd;
71const bit<16> ETHERTYPE_ARP = 0x0806;
72
Yi Tsengbe342052017-11-03 10:21:23 -070073const bit<8> PROTO_ICMP = 1;
74const bit<8> PROTO_TCP = 6;
75const bit<8> PROTO_UDP = 17;
76const bit<8> PROTO_ICMPV6 = 58;
77
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080078const bit<4> IPV4_MIN_IHL = 5;
79
Yi Tsengbe342052017-11-03 10:21:23 -070080const fwd_type_t FWD_BRIDGING = 0;
81const fwd_type_t FWD_MPLS = 1;
82const fwd_type_t FWD_IPV4_UNICAST = 2;
83const fwd_type_t FWD_IPV4_MULTICAST = 3;
84const fwd_type_t FWD_IPV6_UNICAST = 4;
85const fwd_type_t FWD_IPV6_MULTICAST = 5;
86
Yi Tseng1b154bd2017-11-20 17:48:19 -080087const bit<8> DEFAULT_MPLS_TTL = 64;
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080088const bit<8> DEFAULT_IPV4_TTL = 64;
89
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080090typedef bit direction_t;
91typedef bit pcc_gate_status_t;
92typedef bit<32> sdf_rule_id_t;
93typedef bit<32> pcc_rule_id_t;
94
95const sdf_rule_id_t DEFAULT_SDF_RULE_ID = 0;
96const pcc_rule_id_t DEFAULT_PCC_RULE_ID = 0;
97
98const direction_t DIR_UPLINK = 1w0;
99const direction_t DIR_DOWNLINK = 1w1;
100
101const pcc_gate_status_t PCC_GATE_OPEN = 1w0;
102const pcc_gate_status_t PCC_GATE_CLOSED = 1w1;
Yi Tseng1b154bd2017-11-20 17:48:19 -0800103
Yi Tsengbe342052017-11-03 10:21:23 -0700104#endif