blob: 7ec72538bc94948c127f3d7ea07436d92ce4a3f2 [file] [log] [blame]
Florin Corase86a8ed2018-01-05 03:20:25 -08001/*
2 *------------------------------------------------------------------
3 * Copyright (c) 2018 Cisco and/or its affiliates.
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
18#ifndef SRC_VLIBMEMORY_MEMORY_CLIENT_H_
19#define SRC_VLIBMEMORY_MEMORY_CLIENT_H_
20
21#include <vlibmemory/memory_shared.h>
Dave Barach920180e2019-11-14 08:03:48 -050022#include <setjmp.h>
23
24/*
25 * Exported so folks can code a working custom rx_pthread function
26 */
27typedef struct
28{
29 u8 rx_thread_jmpbuf_valid;
30 u8 connected_to_vlib;
31 jmp_buf rx_thread_jmpbuf;
32 pthread_t rx_thread_handle;
33 /* Plugin message base lookup scheme */
34 volatile u8 first_msg_id_reply_ready;
35 u16 first_msg_id_reply;
36} memory_client_main_t;
37
38extern memory_client_main_t memory_client_main;
Florin Corase86a8ed2018-01-05 03:20:25 -080039
40int vl_client_connect (const char *name, int ctx_quota, int input_queue_size);
Florin Coraseaec2a62018-12-04 16:34:05 -080041void vl_client_send_disconnect (u8 do_cleanup);
Florin Corasd6c30d92018-01-29 05:11:24 -080042int vl_client_disconnect (void);
Florin Corase86a8ed2018-01-05 03:20:25 -080043int vl_client_api_map (const char *region_name);
44void vl_client_api_unmap (void);
45void vl_client_disconnect_from_vlib (void);
Florin Corasb384b542018-01-15 01:08:33 -080046void vl_client_disconnect_from_vlib_no_unmap (void);
Florin Corase86a8ed2018-01-05 03:20:25 -080047int vl_client_connect_to_vlib (const char *svm_name, const char *client_name,
48 int rx_queue_size);
Dave Barach920180e2019-11-14 08:03:48 -050049int vl_client_connect_to_vlib_thread_fn (const char *svm_name,
50 const char *client_name,
51 int rx_queue_size,
52 void *(*)(void *));
Florin Corase86a8ed2018-01-05 03:20:25 -080053int vl_client_connect_to_vlib_no_rx_pthread (const char *svm_name,
54 const char *client_name,
55 int rx_queue_size);
56int vl_client_connect_to_vlib_no_map (const char *svm_name,
57 const char *client_name,
58 int rx_queue_size);
Tomasz Kulasek97dcf5b2019-01-31 18:26:32 +010059int vl_client_connect_to_vlib_no_rx_pthread_no_map (const char *svm_name,
60 const char *client_name,
61 int rx_queue_size);
Florin Corase86a8ed2018-01-05 03:20:25 -080062void vl_client_install_client_message_handlers (void);
Florin Corasb384b542018-01-15 01:08:33 -080063u8 vl_mem_client_is_connected (void);
Florin Corase86a8ed2018-01-05 03:20:25 -080064
65#endif /* SRC_VLIBMEMORY_MEMORY_CLIENT_H_ */
66
67/*
68 * fd.io coding-style-patch-verification: ON
69 *
70 * Local Variables:
71 * eval: (c-set-style "gnu")
72 * End:
73 */