/**
 * @file teecs_shared_memory.h
 * @brief GP-like client interface for world shared memory management
 * @author Iaroslav Makarchuk (i.makarchuk@samsung.com)
 * @date Created Oct 3, 2016
 * @par In Samsung Ukraine R&D Center (SURC) under a contract between
 * @par LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine) and
 * @par "Samsung Elecrtronics Co", Ltd (Seoul, Republic of Korea)
 * @par Copyright: (c) Samsung Electronics Co, Ltd 2015. All rights reserved.
 *
 * This software is proprietary of Samsung Electronics.
 * No part of this software, either material or conceptual may be copied
 * or distributed, transmitted, transcribed, stored in a retrieval system
 * or translated into any human or computer language in any form by any means,
 * electronic, mechanical, manual or otherwise, or disclosed to third parties
 * without the express written permission of Samsung Electronics.
 */

#ifndef TEECS_SHARED_MEMORY_H_
#define TEECS_SHARED_MEMORY_H_

#include <tee_client_api.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Allocates session-related shared memory region
 *
 * @note The function behaves like TEEC_AllocateSharedMemory but the scope of
 * the allocated buffer is limited with the specified session instead of context
 *
 * @param[in]      context   Client context
 * @param[in]      session   Session the shared buffer will be related to
 * @param[in,out]  sharedMem Shared memory object that will be allocated
 *
 * @retval TEEC_SUCCESS              Allocation successful
 * @retval TEEC_ERROR_BAD_PARAMETERS Bad parameters passed
 * @retval TEEC_ERROR_OUT_OF_MEMORY  Memory cannot be allocated
 * @retval TEEC_ERROR_GENERIC        Any other error
 */
TEEC_Result TEECS_AllocateSessionSharedMemory(TEEC_Context *context,
                                              TEEC_Session *session,
                                              TEEC_SharedMemory *sharedMem);

#ifdef __cplusplus
}
#endif

#endif /* TEECS_SHARED_MEMORY_H_ */
