| /* |
| * Copyright 2017-present Open Networking Foundation |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #ifndef __DEFINE__ |
| #define __DEFINE__ |
| |
| #define MAX_PORTS 511 |
| |
| typedef bit<3> fwd_type_t; |
| typedef bit<32> next_id_t; |
| typedef bit<3> next_type_t; |
| typedef bit<20> mpls_label_t; |
| typedef bit<9> port_num_t; |
| typedef bit<48> mac_addr_t; |
| typedef bit<16> group_id_t; |
| typedef bit<12> vlan_id_t; |
| |
| const bit<16> ETHERTYPE_QINQ = 0x88A8; |
| const bit<16> ETHERTYPE_QINQ_NON_STD = 0x9100; |
| const bit<16> ETHERTYPE_VLAN = 0x8100; |
| const bit<16> ETHERTYPE_MPLS = 0x8847; |
| const bit<16> ETHERTYPE_MPLS_MULTICAST =0x8848; |
| const bit<16> ETHERTYPE_IPV4 = 0x0800; |
| const bit<16> ETHERTYPE_IPV6 = 0x86dd; |
| const bit<16> ETHERTYPE_ARP = 0x0806; |
| |
| const bit<4> IP_VERSION_4 = 4; |
| const bit<4> IP_VERSION_6 = 6; |
| |
| const bit<8> PROTO_ICMP = 1; |
| const bit<8> PROTO_TCP = 6; |
| const bit<8> PROTO_UDP = 17; |
| const bit<8> PROTO_ICMPV6 = 58; |
| |
| const port_num_t CPU_PORT = 255; |
| const port_num_t DROP_PORT = 511; |
| |
| const fwd_type_t FWD_BRIDGING = 0; |
| const fwd_type_t FWD_MPLS = 1; |
| const fwd_type_t FWD_IPV4_UNICAST = 2; |
| const fwd_type_t FWD_IPV4_MULTICAST = 3; |
| const fwd_type_t FWD_IPV6_UNICAST = 4; |
| const fwd_type_t FWD_IPV6_MULTICAST = 5; |
| |
| const next_type_t NEXT_TYPE_SIMPLE = 0; |
| const next_type_t NEXT_TYPE_HASHED = 1; |
| const next_type_t NEXT_TYPE_BROADCAST = 2; |
| const next_type_t NEXT_TYPE_PUNT = 3; |
| |
| #endif |