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