blob: 1db958f0d56e5714407825a079ffba38f227c7ea [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<3> next_type_t;
25typedef bit<20> mpls_label_t;
26typedef bit<9> port_num_t;
27typedef bit<48> mac_addr_t;
28typedef bit<16> group_id_t;
29typedef bit<12> vlan_id_t;
30
31const bit<16> ETHERTYPE_QINQ = 0x88A8;
32const bit<16> ETHERTYPE_QINQ_NON_STD = 0x9100;
33const bit<16> ETHERTYPE_VLAN = 0x8100;
34const bit<16> ETHERTYPE_MPLS = 0x8847;
35const bit<16> ETHERTYPE_MPLS_MULTICAST =0x8848;
36const bit<16> ETHERTYPE_IPV4 = 0x0800;
37const bit<16> ETHERTYPE_IPV6 = 0x86dd;
38const bit<16> ETHERTYPE_ARP = 0x0806;
39
40const bit<4> IP_VERSION_4 = 4;
41const bit<4> IP_VERSION_6 = 6;
42
43const bit<8> PROTO_ICMP = 1;
44const bit<8> PROTO_TCP = 6;
45const bit<8> PROTO_UDP = 17;
46const bit<8> PROTO_ICMPV6 = 58;
47
48const port_num_t CPU_PORT = 255;
49const port_num_t DROP_PORT = 511;
50
51const fwd_type_t FWD_BRIDGING = 0;
52const fwd_type_t FWD_MPLS = 1;
53const fwd_type_t FWD_IPV4_UNICAST = 2;
54const fwd_type_t FWD_IPV4_MULTICAST = 3;
55const fwd_type_t FWD_IPV6_UNICAST = 4;
56const fwd_type_t FWD_IPV6_MULTICAST = 5;
57
58const next_type_t NEXT_TYPE_SIMPLE = 0;
59const next_type_t NEXT_TYPE_HASHED = 1;
60const next_type_t NEXT_TYPE_BROADCAST = 2;
61const next_type_t NEXT_TYPE_PUNT = 3;
62
Yi Tseng1b154bd2017-11-20 17:48:19 -080063const bit<8> DEFAULT_MPLS_TTL = 64;
64
Yi Tsengbe342052017-11-03 10:21:23 -070065#endif