blob: 163c2ab6f5c8de940423344c43d66e05fef9c769 [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
39const bit<4> IP_VERSION_4 = 4;
40const bit<4> IP_VERSION_6 = 6;
41
42const bit<8> PROTO_ICMP = 1;
43const bit<8> PROTO_TCP = 6;
44const bit<8> PROTO_UDP = 17;
45const bit<8> PROTO_ICMPV6 = 58;
46
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080047const bit<4> IPV4_MIN_IHL = 5;
48
Carmelo Casconeb531b682018-01-30 17:55:56 -080049#ifndef _PKT_OUT_HDR_ANNOT_
50#define _PKT_OUT_HDR_ANNOT_
Yi Tseng1d842672017-11-28 16:06:52 -080051#endif
Yi Tsengbe342052017-11-03 10:21:23 -070052
53const fwd_type_t FWD_BRIDGING = 0;
54const fwd_type_t FWD_MPLS = 1;
55const fwd_type_t FWD_IPV4_UNICAST = 2;
56const fwd_type_t FWD_IPV4_MULTICAST = 3;
57const fwd_type_t FWD_IPV6_UNICAST = 4;
58const fwd_type_t FWD_IPV6_MULTICAST = 5;
59
Yi Tseng1b154bd2017-11-20 17:48:19 -080060const bit<8> DEFAULT_MPLS_TTL = 64;
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080061const bit<8> DEFAULT_IPV4_TTL = 64;
62
63#define ETH_HDR_SIZE 14
64#define IPV4_HDR_SIZE 20
65#define UDP_HDR_SIZE 8
Carmelo Cascone14cde402018-01-25 01:57:18 -080066#define GTP_HDR_SIZE 8
Carmelo Casconeb81f4be2018-01-16 23:24:01 -080067
68#define UDP_PORT_GTPU 2152
69#define GTP_GPDU 0xff
70#define GTPU_VERSION 0x01
71#define GTP_PROTOCOL_TYPE_GTP 0x01
72
73typedef bit direction_t;
74typedef bit pcc_gate_status_t;
75typedef bit<32> sdf_rule_id_t;
76typedef bit<32> pcc_rule_id_t;
77
78const sdf_rule_id_t DEFAULT_SDF_RULE_ID = 0;
79const pcc_rule_id_t DEFAULT_PCC_RULE_ID = 0;
80
81const direction_t DIR_UPLINK = 1w0;
82const direction_t DIR_DOWNLINK = 1w1;
83
84const pcc_gate_status_t PCC_GATE_OPEN = 1w0;
85const pcc_gate_status_t PCC_GATE_CLOSED = 1w1;
Yi Tseng1b154bd2017-11-20 17:48:19 -080086
Yi Tsengbe342052017-11-03 10:21:23 -070087#endif