blob: 5c32f5308de1b60a578b5d7c84cd05d881a37ba0 [file] [log] [blame]
Damjan Marion7cd468a2016-12-19 23:05:39 +01001/*
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
Damjan Marion7cd468a2016-12-19 23:05:39 +010023#include <svm/svm.h>
24#include <vlib/vlib.h>
25#include <vlibmemory/unix_shared_memory_queue.h>
26#include <vlib/unix/unix.h>
27#include <vlibapi/api.h>
Klement Sekera58eb8662017-06-09 06:06:49 +020028#include <vlibmemory/api_common.h>
Damjan Marion7cd468a2016-12-19 23:05:39 +010029
30static inline u32
31vl_msg_api_handle_get_epoch (u32 index)
32{
33 return (index & VL_API_EPOCH_MASK);
34}
35
36static inline u32
37vl_msg_api_handle_get_index (u32 index)
38{
39 return (index >> VL_API_EPOCH_SHIFT);
40}
41
42static inline u32
43vl_msg_api_handle_from_index_and_epoch (u32 index, u32 epoch)
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
Damjan Marion7cd468a2016-12-19 23:05:39 +010052void vl_enable_disable_memory_api (vlib_main_t * vm, int yesno);
Dave Barach59b25652017-09-10 15:04:27 -040053
Damjan Marion7cd468a2016-12-19 23:05:39 +010054#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 */