Florin Coras | 7baeb71 | 2019-01-04 17:05:43 -0800 | [diff] [blame] | 1 | /* |
| 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) |
wanghanlin | dcacdc4 | 2020-12-28 16:19:05 +0800 | [diff] [blame] | 24 | #define VLS_WORKER_RPC_TIMEOUT 3 /* timeout to wait rpc response. */ |
Florin Coras | 7baeb71 | 2019-01-04 17:05:43 -0800 | [diff] [blame] | 25 | |
| 26 | typedef int vls_handle_t; |
| 27 | |
| 28 | vls_handle_t vls_create (uint8_t proto, uint8_t is_nonblocking); |
liuyacan | 534468e | 2021-05-09 03:50:40 +0000 | [diff] [blame] | 29 | int vls_shutdown (vls_handle_t vlsh); |
Florin Coras | 7baeb71 | 2019-01-04 17:05:43 -0800 | [diff] [blame] | 30 | int vls_close (vls_handle_t vlsh); |
| 31 | int vls_bind (vls_handle_t vlsh, vppcom_endpt_t * ep); |
| 32 | int vls_listen (vls_handle_t vlsh, int q_len); |
| 33 | int vls_connect (vls_handle_t vlsh, vppcom_endpt_t * server_ep); |
| 34 | vls_handle_t vls_accept (vls_handle_t vlsh, vppcom_endpt_t * ep, int flags); |
| 35 | ssize_t vls_read (vls_handle_t vlsh, void *buf, size_t nbytes); |
| 36 | ssize_t vls_recvfrom (vls_handle_t vlsh, void *buffer, uint32_t buflen, |
| 37 | int flags, vppcom_endpt_t * ep); |
| 38 | int vls_write (vls_handle_t vlsh, void *buf, size_t nbytes); |
| 39 | int vls_write_msg (vls_handle_t vlsh, void *buf, size_t nbytes); |
| 40 | int vls_sendto (vls_handle_t vlsh, void *buf, int buflen, int flags, |
| 41 | vppcom_endpt_t * ep); |
| 42 | int vls_attr (vls_handle_t vlsh, uint32_t op, void *buffer, |
| 43 | uint32_t * buflen); |
| 44 | vls_handle_t vls_epoll_create (void); |
| 45 | int vls_epoll_ctl (vls_handle_t ep_vlsh, int op, vls_handle_t vlsh, |
| 46 | struct epoll_event *event); |
| 47 | int vls_epoll_wait (vls_handle_t ep_vlsh, struct epoll_event *events, |
| 48 | int maxevents, double wait_for_time); |
Florin Coras | 0ef8ef2 | 2019-01-18 08:37:13 -0800 | [diff] [blame] | 49 | int vls_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map, |
| 50 | vcl_si_set * except_map, double wait_for_time); |
Florin Coras | 7baeb71 | 2019-01-04 17:05:43 -0800 | [diff] [blame] | 51 | vcl_session_handle_t vlsh_to_sh (vls_handle_t vlsh); |
| 52 | vcl_session_handle_t vlsh_to_session_index (vls_handle_t vlsh); |
| 53 | vls_handle_t vls_session_index_to_vlsh (uint32_t session_index); |
| 54 | int vls_app_create (char *app_name); |
hanlin | 4266d4d | 2020-05-19 17:34:17 +0800 | [diff] [blame] | 55 | unsigned char vls_use_eventfd (void); |
hanlin | a3a4896 | 2020-07-13 11:09:15 +0800 | [diff] [blame] | 56 | unsigned char vls_mt_wrk_supported (void); |
| 57 | int vls_use_real_epoll (void); |
| 58 | void vls_register_vcl_worker (void); |
Florin Coras | 7baeb71 | 2019-01-04 17:05:43 -0800 | [diff] [blame] | 59 | |
| 60 | #endif /* SRC_VCL_VCL_LOCKED_H_ */ |
| 61 | |
| 62 | /* |
| 63 | * fd.io coding-style-patch-verification: ON |
| 64 | * |
| 65 | * Local Variables: |
| 66 | * eval: (c-set-style "gnu") |
| 67 | * End: |
| 68 | */ |