FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
api.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * api.h
4  *
5  * Copyright (c) 2009 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #ifndef included_vlibmemory_api_h
21 #define included_vlibmemory_api_h
22 
23 #include <svm/svm.h>
24 #include <vlib/vlib.h>
26 #include <vlib/unix/unix.h>
27 #include <vlibapi/api.h>
28 #include <vlibmemory/api_common.h>
29 
30 static inline u32
32 {
33  return (index & VL_API_EPOCH_MASK);
34 }
35 
36 static inline u32
38 {
39  return (index >> VL_API_EPOCH_SHIFT);
40 }
41 
42 static inline u32
44 {
45  u32 handle;
46  ASSERT (index < 0x00FFFFFF);
47 
48  handle = (index << VL_API_EPOCH_SHIFT) | (epoch & VL_API_EPOCH_MASK);
49  return handle;
50 }
51 
52 void vl_enable_disable_memory_api (vlib_main_t * vm, int yesno);
53 
54 #endif /* included_vlibmemory_api_h */
55 
56 /*
57  * fd.io coding-style-patch-verification: ON
58  *
59  * Local Variables:
60  * eval: (c-set-style "gnu")
61  * End:
62  */
void vl_enable_disable_memory_api(vlib_main_t *vm, int yesno)
Definition: memory_vlib.c:1231
#define VL_API_EPOCH_MASK
Definition: api_common.h:90
static u32 vl_msg_api_handle_get_index(u32 index)
Definition: api.h:37
#define VL_API_EPOCH_SHIFT
Definition: api_common.h:91
#define ASSERT(truth)
unsigned int u32
Definition: types.h:88
static u32 vl_msg_api_handle_get_epoch(u32 index)
Definition: api.h:31
static u32 vl_msg_api_handle_from_index_and_epoch(u32 index, u32 epoch)
Definition: api.h:43