2 * Copyright (c) 2019 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef SRC_VCL_VCL_LOCKED_H_
19 #define SRC_VCL_VCL_LOCKED_H_
21 #include <vcl/vppcom.h>
23 #define VLS_INVALID_HANDLE ((int)-1)
25 typedef int vls_handle_t;
27 vls_handle_t vls_create (uint8_t proto, uint8_t is_nonblocking);
28 int vls_close (vls_handle_t vlsh);
29 int vls_bind (vls_handle_t vlsh, vppcom_endpt_t * ep);
30 int vls_listen (vls_handle_t vlsh, int q_len);
31 int vls_connect (vls_handle_t vlsh, vppcom_endpt_t * server_ep);
32 vls_handle_t vls_accept (vls_handle_t vlsh, vppcom_endpt_t * ep, int flags);
33 ssize_t vls_read (vls_handle_t vlsh, void *buf, size_t nbytes);
34 ssize_t vls_recvfrom (vls_handle_t vlsh, void *buffer, uint32_t buflen,
35 int flags, vppcom_endpt_t * ep);
36 int vls_write (vls_handle_t vlsh, void *buf, size_t nbytes);
37 int vls_write_msg (vls_handle_t vlsh, void *buf, size_t nbytes);
38 int vls_sendto (vls_handle_t vlsh, void *buf, int buflen, int flags,
40 int vls_attr (vls_handle_t vlsh, uint32_t op, void *buffer,
42 vls_handle_t vls_epoll_create (void);
43 int vls_epoll_ctl (vls_handle_t ep_vlsh, int op, vls_handle_t vlsh,
44 struct epoll_event *event);
45 int vls_epoll_wait (vls_handle_t ep_vlsh, struct epoll_event *events,
46 int maxevents, double wait_for_time);
47 int vls_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
48 vcl_si_set * except_map, double wait_for_time);
49 vcl_session_handle_t vlsh_to_sh (vls_handle_t vlsh);
50 vcl_session_handle_t vlsh_to_session_index (vls_handle_t vlsh);
51 vls_handle_t vls_session_index_to_vlsh (uint32_t session_index);
52 int vls_app_create (char *app_name);
53 unsigned char vls_use_eventfd (void);
54 unsigned char vls_mt_wrk_supported (void);
55 int vls_use_real_epoll (void);
56 void vls_register_vcl_worker (void);
58 #endif /* SRC_VCL_VCL_LOCKED_H_ */
61 * fd.io coding-style-patch-verification: ON
64 * eval: (c-set-style "gnu")