aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vapi/vapi.c
AgeCommit message (Collapse)AuthorFilesLines
2023-09-06vapi: fix verification for reply messageSylvain Cadilhac1-1/+1
Type: fix Byte swapping should be done before verifying message otherwise the message length will be wrongly computed. Change-Id: I90b2f60bd33e5362e0edd5ee425f6a6f07886f1e Signed-off-by: Sylvain Cadilhac <sylvain.cadilhac@freepro.com>
2023-08-18vapi: support servicesStanislav Zaikin1-5/+37
Add missing support for service { rpc X_get returns X_get_reply stream X_details; } Type: improvement Change-Id: I27555f61a2974e414cb6554f32c550b8ee5eb037 Signed-off-by: Stanislav Zaikin <stanislav.zaikin@46labs.com> Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
2023-01-04vapi: add vapi_stop_rx_thread()Matthew Smith1-0/+10
Type: improvement Allow vapi to signal to an application's RX thread that it should wake up and exit. Before disconnecting from VPP's API, libvlibmemoryclient inserts an rx_thread_exit message into the client's own input queue to cause its RX thread to wake up from its blocking dequeue and exit cleanly. Add a function to vapi's API which will allow libvapi client applications which have an RX thread waiting for incoming messages using vapi_wait() to do the same thing. The existing libvlibmemoryclient code which does this was moved to a separate function and made available for vapi_stop_rx_thread() to call. Also fixed some inconsistencies in indentation of function prototypes in vapi.h to make checkstyle.sh happy. Signed-off-by: Matthew Smith <mgsmith@netgate.com> Change-Id: I7bbb73470807123cc63ef313cfb91d1fd31b34e5
2022-12-20vapi: use the correct my_context_id when disconnecting API clientsMauro Sardara1-5/+75
While before the my_client_index variable was stored as global variable in api_main_t, after commit 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f the my_client_index becomes part of vapi_ctx_t. Each API client (internal/external) connected to VPP stores its client index in vapi_ctx_t. The issue is in the client disconnection. The vapi_disconnect is untouched in patch 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f, so it keeps the behavior of using the my_client_index stored in api_main_t. Ticket: VPP-2069 Type: fix Fixes: 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: Idf8c1d1056cbd631cc3057cf7acc486216fa8303
2022-12-14vapi: implement vapi_wait() for readsMatthew Smith1-2/+6
Type: improvement The function vapi_wait() is intended to allow a caller to block while waiting until the API queue can be read/written. It was a stub that returned VAPI_ENOTSUP. Add code which implements the wait on being able to read an incoming message. Had to touch a few other things in vapi.h to make checkstyle.sh happy after changing the prototype of vapi_wait(). Signed-off-by: Matthew Smith <mgsmith@netgate.com> Change-Id: Ida80c1a1d34fe297ab23268087be65ea53ad7040
2022-05-02vapi: support api clients within vpp processOle Troan1-29/+394
Add vapi_connect_from_vpp() and vapi_disconnect_from_vpp() calls to allow API clients from within VPP process. Add a new memclnt_create version that gives the user a knob to enable or disable dead client scans (keepalive). Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Id0b7bb89308db3a3aed2d3fcbedf4e1282dcd03f Signed-off-by: Ole Troan <ot@cisco.com>
2022-01-25api: vapi: honor non-blocking settingKlement Sekera1-1/+3
Pass correct conditional based on how vapi is configured wrt blocking. Type: fix Fixes: 3fca567ff438145e28dd1318ad5b1734c1091257 Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I47adca19f104d7a758cb2940e93c9fd8c7cc9bfa
2021-11-16vapi: verify message size when receivedKlement Sekera1-13/+9
Verifying message size including VLA size allows to dismiss some coverity warnings in generated code. Type: improvement Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I824658881254b3e7a9bfca228a266cfee448cc2e
2021-10-18interface: add api test fileFilip Tehlar1-1/+1
Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Ib07029204ecf12bf2adb5a39afa54bc98fb81f34
2021-09-27misc: api move continuedFlorin Coras1-1/+2
Move control ping and change dependencies from vpe.api_types to memclnt.api_types Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I9f8bc442e28738c48d64d1f6794082c8c4f5725b
2020-06-10vapi: memset allocated messages to zeroKlement Sekera1-0/+4
This avoids using dirty data from shared memory by client. Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I96eecf655bf344ec29609cedbd8dc891b572e207
2019-12-10api: multiple connections per processDave Barach1-4/+4
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I2272521d6e69edcd385ef684af6dd4eea5eaa953
2019-11-27misc: add address sanitizer heap instrumentationBenoît Ganne1-0/+5
Introduce AddressSanitizer support: https://github.com/google/sanitizers/ This starts with heap instrumentation. vlib_buffer, bihash and stack instrumentation should follow. Type: feature Change-Id: I7f20e235b2f79db72efd0e756f22c75f717a9884 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2018-11-07Unresolved symbols in libvapiclientNeale Ranns1-0/+1
Change-Id: I6d6a73ac62f24928fb51e89948b92a1cb9134c40 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-10-23c11 safe string handling supportDave Barach1-7/+8
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2018-09-03vapi: init clib mem heap on connect if neededKlement Sekera1-0/+4
Change-Id: Id45a3a37dd77771289622314406dccf50b64f04d Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-07-05VPP-1335 vapi crash when memclnt_keepalive receivedKlement Sekera1-6/+46
Change-Id: If33a7cc6c76147fd3ea9d8118370e7a508819b81 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-01-22svm: queue sub: Add conditional timed waitMohsin Kazmi1-3/+6
On reviece side svm queue only permits blocking and non-blocking calls. This patch adds timed wait blocking functionality which returns either on signal/event or on given time out. It also preserves the original behavior, so it will not hurt client applications which are using svm queue. Change-Id: Ic10632170330a80afb8bc781d4ccddfe4da2c69a Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-01-09api: refactor vlibmemoryFlorin Coras1-12/+10
- separate client/server code for both memory and socket apis - separate memory api code from generic vlib api code - move unix_shared_memory_fifo to svm and rename to svm_fifo_t - overall declutter Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2 Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-11-05Fix coverity warnings in VOM and VAPINeale Ranns1-3/+3
Change-Id: I0db55e079f9b1835668c8efe69e6e6f7f8437b00 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-10-03Repair vlib API socket serverDave Barach1-0/+2
- Teach vpp_api_test to send/receive API messages over sockets - Add memfd-based shared memory - Add api messages to create memfd-based shared memory segments - vpp_api_test supports both socket and shared memory segment connections - vpp_api_test pivot from socket to shared memory API messaging - add socket client support to libvlibclient.so - dead client reaper sends ping messages, container-friendly - dead client reaper falls back to kill (<pid>, 0) live checking if e.g. a python app goes silent for tens of seconds - handle ping messages in python client support code - teach show api ring about pairwise shared-memory segments - fix ip probing of already resolved destinations (VPP-998) We'll need this work to implement proper host-stack client isolation Change-Id: Ic23b65f75c854d0393d9a2e9d6b122a9551be769 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-09-27Various fixes for issues found by Coverity (VPP-972)Chris Luke1-0/+1
174267: Revisit this string termination issue 174816: Add check for NULL when trace is enabled 177211: Add notation that mutex is not required here 177117: Added check for log2_page_size == 0 and returns an error if so 163697,163698: Added missing sw_if_index validation Change-Id: I5a76fcf6505c785bfb3269e353360031c6a0fd0f Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-09-19Add C++ APIKlement Sekera1-11/+48
Change-Id: Iff634f22d43470e2dc028387b3816257fd7b4156 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-09-19Add new C APIKlement Sekera1-0/+895
Change-Id: I717ce3cd7c867c155de149ec56623269d26d0ff7 Signed-off-by: Klement Sekera <ksekera@cisco.com>