/*
 *------------------------------------------------------------------
 * Copyright (c) 2017 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *------------------------------------------------------------------
 */

#ifndef vpp_api_h_included
#define vpp_api_h_included

#include <string.h>
#include <stdbool.h>
#include <vppinfra/types.h>
#include <vlibapi/api_types.h>
#include <vapi/vapi_common.h>
#include <svm/queue.h>

#ifdef __cplusplus
extern "C"
{
#endif

/**
 * @file vapi.h
 *
 * common vpp api C declarations
 *
 * This file declares the common C API functions. These include connect,
 * disconnect and utility functions as well as the low-level vapi_send and
 * vapi_recv API. This is only the transport layer.
 *
 * Message formats and higher-level APIs are generated by running the
 * vapi_c_gen.py script (which is run for in-tree APIs as part of the build
 * process). It's not recommended to mix the higher and lower level APIs. Due
 * to version issues, the higher-level APIs are not part of the shared library.
 */
typedef struct vapi_ctx_s *vapi_ctx_t;

/**
 * @brief allocate vapi message of given size
 *
 * @note message must be freed by vapi_msg_free if not consumed by vapi_send
 * call
 *
 * @param ctx opaque vapi context
 *
 * @return pointer to message or NULL if out of memory
 */
void *vapi_msg_alloc (vapi_ctx_t ctx, size_t size);

/**
 * @brief free a vapi message
 *
 * @note messages received by vapi_recv must be freed when no longer needed
 *
 * @param ctx opaque vapi context
 * @param msg message to be freed
 */
void vapi_msg_free (vapi_ctx_t ctx, void *msg);

/**
 * @brief allocate vapi context
 *
 * @param[out] pointer to result variable
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_ctx_alloc (vapi_ctx_t *result);

/**
 * @brief free vapi context
 */
void vapi_ctx_free (vapi_ctx_t ctx);

/**
 * @brief check if message identified by it's message id is known by the vpp to
 * which the connection is open
 */
bool vapi_is_msg_available (vapi_ctx_t ctx, vapi_msg_id_t type);

/**
 * @brief connect to vpp
 *
 * @param ctx opaque vapi context, must be allocated using vapi_ctx_alloc first
 * @param name application name
 * @param chroot_prefix shared memory prefix
 * @param max_outstanding_requests max number of outstanding requests queued
 * @param response_queue_size size of the response queue
 * @param mode mode of operation - blocking or nonblocking
 * @param handle_keepalives - if true, automatically handle memclnt_keepalive
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_connect (vapi_ctx_t ctx, const char *name,
			   const char *chroot_prefix,
			   int max_outstanding_requests,
			   int response_queue_size, vapi_mode_e mode,
			   bool handle_keepalives);

/**
 * @brief connect to vpp
 *
 * @param ctx opaque vapi context, must be allocated using vapi_ctx_alloc first
 * @param name application name
 * @param path shared memory prefix or path to unix socket
 * @param max_outstanding_requests max number of outstanding requests queued
 * @param response_queue_size size of the response queue
 * @param mode mode of operation - blocking or nonblocking
 * @param handle_keepalives - if true, automatically handle memclnt_keepalive
 * @param use_uds - if true, use unix domain socket transport
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_connect_ex (vapi_ctx_t ctx, const char *name,
			      const char *path, int max_outstanding_requests,
			      int response_queue_size, vapi_mode_e mode,
			      bool handle_keepalives, bool use_uds);

/**
 * @brief connect to vpp from a client in same process
 * @remark This MUST be called from a separate thread. If called
 *         from the main thread, it will deadlock.
 *
 * @param ctx opaque vapi context, must be allocated using vapi_ctx_alloc first
 * @param name application name
 * @param max_outstanding_requests max number of outstanding requests queued
 * @param response_queue_size size of the response queue
 * @param mode mode of operation - blocking or nonblocking
 * @param handle_keepalives - if true, automatically handle memclnt_keepalive
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_connect_from_vpp (vapi_ctx_t ctx, const char *name,
				    int max_outstanding_requests,
				    int response_queue_size, vapi_mode_e mode,
				    bool handle_keepalives);

/**
 * @brief disconnect from vpp
 *
 * @param ctx opaque vapi context
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_disconnect (vapi_ctx_t ctx);
vapi_error_e vapi_disconnect_from_vpp (vapi_ctx_t ctx);

/**
 * @brief get event file descriptor
 *
 * @note this file descriptor becomes readable when messages (from vpp)
 * are waiting in queue
 *
 * @param ctx opaque vapi context
 * @param[out] fd pointer to result variable
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_get_fd (vapi_ctx_t ctx, int *fd);

/**
 * @brief low-level api for sending messages to vpp
 *
 * @note it is not recommended to use this api directly, use generated api
 * instead
 *
 * @param ctx opaque vapi context
 * @param msg message to send
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_send (vapi_ctx_t ctx, void *msg);

/**
 * @brief low-level api for atomically sending two messages to vpp - either
 * both messages are sent or neither one is
 *
 * @note it is not recommended to use this api directly, use generated api
 * instead
 *
 * @param ctx opaque vapi context
 * @param msg1 first message to send
 * @param msg2 second message to send
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_send2 (vapi_ctx_t ctx, void *msg1, void *msg2);

/**
 * @brief low-level api for reading messages from vpp
 *
 * @note it is not recommended to use this api directly, use generated api
 * instead
 *
 * @param ctx opaque vapi context
 * @param[out] msg pointer to result variable containing message
 * @param[out] msg_size pointer to result variable containing message size
 * @param cond enum type for blocking, non-blocking or timed wait call
 * @param time in sec for timed wait
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_recv (vapi_ctx_t ctx, void **msg, size_t *msg_size,
			svm_q_conditional_wait_t cond, u32 time);

/**
 * @brief wait for connection to become readable
 *
 * @param ctx opaque vapi context
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_wait (vapi_ctx_t ctx);

/**
 * @brief pick next message sent by vpp and call the appropriate callback
 *
 * @note if using block mode, it will be blocked indefinitely until the next
 * msg available. If using non-blocking mode, it will block for time_wait
 * seconds until the next msg available if time_wait > 0, or does not block if
 * time_wait == 0.
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_dispatch_one_timedwait (vapi_ctx_t ctx, u32 wait_time);

/**
 * @brief pick next message sent by vpp and call the appropriate callback
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_dispatch_one (vapi_ctx_t ctx);

/**
 * @brief loop vapi_dispatch_one until responses to all currently outstanding
 * requests have been received and their callbacks called
 *
 * @note the dispatch loop is interrupted if any error is encountered or
 * returned from the callback, in which case this error is returned as the
 * result of vapi_dispatch. In this case it might be necessary to call
 * dispatch again to process the remaining messages. Returning VAPI_EUSER
 * from a callback allows the user to break the dispatch loop (and
 * distinguish this case in the calling code from other failures). VAPI never
 * returns VAPI_EUSER on its own.
 *
 * @return VAPI_OK on success, other error code on error
 */
vapi_error_e vapi_dispatch (vapi_ctx_t ctx);

/** generic vapi event callback */
typedef vapi_error_e (*vapi_event_cb) (vapi_ctx_t ctx, void *callback_ctx,
				       void *payload);

/**
 * @brief set event callback to call when message with given id is dispatched
 *
 * @param ctx opaque vapi context
 * @param id message id
 * @param callback callback
 * @param callback_ctx context pointer stored and passed to callback
 */
void vapi_set_event_cb (vapi_ctx_t ctx, vapi_msg_id_t id,
			vapi_event_cb callback, void *callback_ctx);

/**
 * @brief clear event callback for given message id
 *
 * @param ctx opaque vapi context
 * @param id message id
 */
void vapi_clear_event_cb (vapi_ctx_t ctx, vapi_msg_id_t id);

/** generic vapi event callback */
typedef vapi_error_e (*vapi_generic_event_cb) (vapi_ctx_t ctx,
					       void *callback_ctx,
					       vapi_msg_id_t id, void *msg);
/**
 * @brief set generic event callback
 *
 * @note this callback is called by dispatch if no message-type specific
 * callback is set (so it's a fallback callback)
 *
 * @param ctx opaque vapi context
 * @param callback callback
 * @param callback_ctx context pointer stored and passed to callback
 */
void vapi_set_generic_event_cb (vapi_ctx_t ctx, vapi_generic_event_cb callback,
				void *callback_ctx);

/**
 * @brief clear generic event callback
 *
 * @param ctx opaque vapi context
 */
void vapi_clear_generic_event_cb (vapi_ctx_t ctx);

/**
 * @brief signal RX thread to exit
 *
 * @note This adds a message to the client input queue that indicates that
 * an RX thread should stop processing incoming messages and exit. If an
 * application has an RX thread which sleeps while waiting for incoming
 * messages using vapi_wait(), this call will allow the application to
 * wake up from the vapi_wait() call and figure out that it should stop
 * running.
 *
 * @param ctx opaque vapi context
 */
void vapi_stop_rx_thread (vapi_ctx_t ctx);

#ifdef __cplusplus
}
#endif

#endif

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
