blob: 11b71eee4afb2d0df48507368bb584d1681fadf6 [file] [log] [blame]
Florin Coras7baeb712019-01-04 17:05:43 -08001/*
2 * Copyright (c) 2019 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this
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 * VCL Locked Sessions
16 */
17
18#ifndef SRC_VCL_VCL_LOCKED_H_
19#define SRC_VCL_VCL_LOCKED_H_
20
21#include <vcl/vppcom.h>
22
23#define VLS_INVALID_HANDLE ((int)-1)
wanghanlindcacdc42020-12-28 16:19:05 +080024#define VLS_WORKER_RPC_TIMEOUT 3 /* timeout to wait rpc response. */
Florin Coras7baeb712019-01-04 17:05:43 -080025
26typedef int vls_handle_t;
27
28vls_handle_t vls_create (uint8_t proto, uint8_t is_nonblocking);
29int vls_close (vls_handle_t vlsh);
30int vls_bind (vls_handle_t vlsh, vppcom_endpt_t * ep);
31int vls_listen (vls_handle_t vlsh, int q_len);
32int vls_connect (vls_handle_t vlsh, vppcom_endpt_t * server_ep);
33vls_handle_t vls_accept (vls_handle_t vlsh, vppcom_endpt_t * ep, int flags);
34ssize_t vls_read (vls_handle_t vlsh, void *buf, size_t nbytes);
35ssize_t vls_recvfrom (vls_handle_t vlsh, void *buffer, uint32_t buflen,
36 int flags, vppcom_endpt_t * ep);
37int vls_write (vls_handle_t vlsh, void *buf, size_t nbytes);
38int vls_write_msg (vls_handle_t vlsh, void *buf, size_t nbytes);
39int vls_sendto (vls_handle_t vlsh, void *buf, int buflen, int flags,
40 vppcom_endpt_t * ep);
41int vls_attr (vls_handle_t vlsh, uint32_t op, void *buffer,
42 uint32_t * buflen);
43vls_handle_t vls_epoll_create (void);
44int vls_epoll_ctl (vls_handle_t ep_vlsh, int op, vls_handle_t vlsh,
45 struct epoll_event *event);
46int vls_epoll_wait (vls_handle_t ep_vlsh, struct epoll_event *events,
47 int maxevents, double wait_for_time);
Florin Coras0ef8ef22019-01-18 08:37:13 -080048int vls_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
49 vcl_si_set * except_map, double wait_for_time);
Florin Coras7baeb712019-01-04 17:05:43 -080050vcl_session_handle_t vlsh_to_sh (vls_handle_t vlsh);
51vcl_session_handle_t vlsh_to_session_index (vls_handle_t vlsh);
52vls_handle_t vls_session_index_to_vlsh (uint32_t session_index);
53int vls_app_create (char *app_name);
hanlin4266d4d2020-05-19 17:34:17 +080054unsigned char vls_use_eventfd (void);
hanlina3a48962020-07-13 11:09:15 +080055unsigned char vls_mt_wrk_supported (void);
56int vls_use_real_epoll (void);
57void vls_register_vcl_worker (void);
Florin Coras7baeb712019-01-04 17:05:43 -080058
59#endif /* SRC_VCL_VCL_LOCKED_H_ */
60
61/*
62 * fd.io coding-style-patch-verification: ON
63 *
64 * Local Variables:
65 * eval: (c-set-style "gnu")
66 * End:
67 */