dpdk: Add support for Mellanox ConnectX-4 devices
[vpp.git] / src / vnet / adj / adj_types.h
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef __ADJ_TYPES_H__
17 #define __ADJ_TYPES_H__
18
19 #include <vnet/vnet.h>
20
21 /**
22  * @brief An index for adjacencies.
23  * Alas 'C' is not typesafe enough to b0rk when a u32 is used instead of
24  * an adi_index_t. However, for us humans, we can glean much more intent
25  * from the declaration
26  *  foo bar(adj_index_t t);
27  * than we can from
28  *  foo bar(u32 t);
29  */
30 typedef u32 adj_index_t; 
31
32 /**
33  * @brief Invalid ADJ index - used when no adj is known
34  * likewise blazoned capitals INVALID speak volumes where ~0 does not.
35  */
36 #define ADJ_INDEX_INVALID ((u32)~0)
37
38 /**
39  * @brief return codes from a adjacency walker callback function
40  */
41 typedef enum adj_walk_rc_t_
42 {
43     ADJ_WALK_RC_STOP,
44     ADJ_WALK_RC_CONTINUE,
45 } adj_walk_rc_t;
46
47 /**
48  * @brief Call back function when walking adjacencies
49  */
50 typedef adj_walk_rc_t (*adj_walk_cb_t)(adj_index_t ai,
51                                        void *ctx);
52
53 #endif