/**
 * @file       hidl_proca.h
 * @brief      Wrapper API over the HIDL implementation of PROCA provisioning
 *
 * @author     Ivan Vorobiov (i.vorobiov@samsung.com)
 * @date       Created Jun 26, 2018
 * @copyright  In Samsung Ukraine R&D Center (SURC) under a contract between
 * @copyright  LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine) and
 * @copyright  "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
 * @copyright   Copyright: (c) Samsung Electronics Co, Ltd 2018. All rights reserved.
**/

#ifndef HIDL_HIDL_PROCA_H_
#define HIDL_HIDL_PROCA_H_

/**
 * @brief Run HIDL-based PROCA service to handler provisioning API.
 * There is daemon side API.
 * @param handler Pointer to function that will be called when NewCertificate
 * request is arrived
 * @param arg Pointer to data that will be passed to each handler call. Can be
 * used to pass some context information to handler
 * @return fd of hidl server for polling
 */
int HidlServerRun(void *handler, void *arg);

/**
 * @brief Notify HIDL about incoming event in hidl fd
 * @param hidl_fd fd of hidl server for polling
 * @return 0 in case of success
 */
int HidlServerProcessRequest(int hidl_fd);

/**
 * @brief Terminate PROCA service
 * @param hidl_fd fd of hidl server for polling
 */
void HidlServerStop(int hidl_fd);

/**
 * @brief Run HIDL-based request to PROCA service. There is library side API.
 * @param [in,out] buffer,buffer_size Serialized data that will be send
 * to Trustlet and return back
 * @return 0 in case of success
 */
int HidlNewCertificate(uint8_t *buffer, size_t *buffer_size);

#endif /* HIDL_HIDL_PROCA_H_ */
