blob: a74f9ab26be7fe3c18497d2318f05571939c3de2 [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
22typedef bit<3> fwd_type_t;
Yi Tseng1b154bd2017-11-20 17:48:19 -080023typedef bit<32> next_id_t;
Yi Tsengbe342052017-11-03 10:21:23 -070024typedef bit<20> mpls_label_t;
25typedef bit<9> port_num_t;
26typedef bit<48> mac_addr_t;
27typedef bit<16> group_id_t;
28typedef bit<12> vlan_id_t;
29
30const bit<16> ETHERTYPE_QINQ = 0x88A8;
31const bit<16> ETHERTYPE_QINQ_NON_STD = 0x9100;
32const bit<16> ETHERTYPE_VLAN = 0x8100;
33const bit<16> ETHERTYPE_MPLS = 0x8847;
34const bit<16> ETHERTYPE_MPLS_MULTICAST =0x8848;
35const bit<16> ETHERTYPE_IPV4 = 0x0800;
36const bit<16> ETHERTYPE_IPV6 = 0x86dd;
37const bit<16> ETHERTYPE_ARP = 0x0806;
38
Yi Tseng3d3956d2018-01-31 17:28:05 -080039#ifndef IP_VER_LENGTH
40#define IP_VER_LENGTH 4
41#endif
42#ifndef IP_VERSION_4
43#define IP_VERSION_4 4
44#endif
45#ifndef IP_VERSION_6
46#define IP_VERSION_6 6
47#endif
Yi Tsengbe342052017-11-03 10:21:23 -070048
49const bit<8> PROTO_ICMP = 1;
50const bit<8> PROTO_TCP = 6;
51const bit<8> PROTO_UDP = 17;
52const bit<8> PROTO_ICMPV6 = 58;
53
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080054const bit<4> IPV4_MIN_IHL = 5;
55
Carmelo Casconeb531b682018-01-30 17:55:56 -080056#ifndef _PKT_OUT_HDR_ANNOT_
57#define _PKT_OUT_HDR_ANNOT_
Yi Tseng1d842672017-11-28 16:06:52 -080058#endif
Yi Tsengbe342052017-11-03 10:21:23 -070059
60const fwd_type_t FWD_BRIDGING = 0;
61const fwd_type_t FWD_MPLS = 1;
62const fwd_type_t FWD_IPV4_UNICAST = 2;
63const fwd_type_t FWD_IPV4_MULTICAST = 3;
64const fwd_type_t FWD_IPV6_UNICAST = 4;
65const fwd_type_t FWD_IPV6_MULTICAST = 5;
66
Yi Tseng1b154bd2017-11-20 17:48:19 -080067const bit<8> DEFAULT_MPLS_TTL = 64;
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080068const bit<8> DEFAULT_IPV4_TTL = 64;
69
70#define ETH_HDR_SIZE 14
71#define IPV4_HDR_SIZE 20
72#define UDP_HDR_SIZE 8
Carmelo Cascone14cde402018-01-25 01:57:18 -080073#define GTP_HDR_SIZE 8
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080074
75#define UDP_PORT_GTPU 2152
76#define GTP_GPDU 0xff
77#define GTPU_VERSION 0x01
78#define GTP_PROTOCOL_TYPE_GTP 0x01
79
80typedef bit direction_t;
81typedef bit pcc_gate_status_t;
82typedef bit<32> sdf_rule_id_t;
83typedef bit<32> pcc_rule_id_t;
84
85const sdf_rule_id_t DEFAULT_SDF_RULE_ID = 0;
86const pcc_rule_id_t DEFAULT_PCC_RULE_ID = 0;
87
88const direction_t DIR_UPLINK = 1w0;
89const direction_t DIR_DOWNLINK = 1w1;
90
91const pcc_gate_status_t PCC_GATE_OPEN = 1w0;
92const pcc_gate_status_t PCC_GATE_CLOSED = 1w1;
Yi Tseng1b154bd2017-11-20 17:48:19 -080093
Carmelo Cascone04888222018-03-19 22:18:12 -070094const bit<6> DSCP_INT = 0x1;
95
Yi Tsengbe342052017-11-03 10:21:23 -070096#endif