/** * @file ipc.h * @brief IPC implementation for API * Copyright (c) 2017 Samsung Electronics Co., Ltd. * This software is the confidential and proprietary information * of Samsung Electronics, Inc. ("Confidential Information"). You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with Samsung. */ #ifndef __IPC_H__ #define __IPC_H__ /** * @struct _IPC_SOCKET_HANDLE_s * @brief This struct contains IPC Socket handle * * The _IPC_SOCKET_HANDLE_s struct encapsulate server_h and client_h in the one data * */ struct _IPC_SOCKET_HANDLE_s { int server_h; int client_h; }; typedef struct _IPC_SOCKET_HANDLE_s SOCKET_HANDLE; /** * @fn int IPC_OpenServerConnection(char *server, SOCKET_HANDLE *phandle) * @brief This function to open server connection for IPC * @param *server [in] server information * @param *phandle [out] handle * @return int result of function */ int IPC_OpenServerConnection(char *server, SOCKET_HANDLE * phandle); /** * @fn int IPC_OpenServerClose(SOCKET_HANDLE *phandle) * @brief This function to close server connection for IPC in server * @param *phandle [in] handle * @return int result of function */ int IPC_OpenServerClose(SOCKET_HANDLE * phandle); /** * @fn int IPC_RecvMessage(SOCKET_HANDLE *phandle, char *buf, int size) * @brief This function to receive message through IPC in server * @param *phandle [in] handle * @param buf [out] buffer string * @param size [out] size * @return int result of function */ int IPC_RecvMessage(SOCKET_HANDLE * phandle, char *buf, int size); /** * @fn int IPC_SendMessage(SOCKET_HANDLE *phandle, char *buf, int size) * @brief This function to send message through IPC in server * @param *phandle [in] handle * @param *buf [in] buffer string * @param size [in] size * @return int result of function */ int IPC_SendMessage(SOCKET_HANDLE * phandle, char *buf, int size); /** * @fn int IPC_ClientAccept(SOCKET_HANDLE *phandle) * @brief This function to accept when it connects through IPC in server * @param *phandle [in] handle * @return int result of function */ int IPC_ClientAccept(SOCKET_HANDLE * phandle); /** * @fn int IPC_GetMessage(SOCKET_HANDLE *phandle, int *msgSize) * @brief This function to get message size in server * @param *phandle [in] handle * @param *msgSize [out] message size * @return int result of function */ int IPC_GetMessage(SOCKET_HANDLE * phandle, int *msgSize); /** * @fn int IPC_OpenClientConnection(char *server, SOCKET_HANDLE *phandle) * @brief This function to open client connection * @param *server [in] server information * @param *phandle [in] handle * @return int result of function */ int IPC_OpenClientConnection(char *server, SOCKET_HANDLE * phandle); /** * @fn int IPC_OpenClientClose(SOCKET_HANDLE *phandle) * @brief This function to open client connection * @param *phandle [in] handle * @return int result of function */ int IPC_OpenClientClose(SOCKET_HANDLE * phandle); /** * @fn void ltoa(int val, char *string, int base) * @brief This function to convert long to string * @param val [in] val * @param *string [out] converted string * @param base [in] base * @param str_size [in] string buffer size * @return int result of function */ void ltoa(int val, char *string, int base, int str_size); /** * @fn int IPC_SocketOpenServerConnection(char *server, SOCKET_HANDLE *phandle) * @brief This function to open socket server connection * @param *server [in] server information * @param *phandle [in] handle * @return int result of function */ int IPC_SocketOpenServerConnection(char *server, SOCKET_HANDLE * phandle); /** * @fn int IPC_SocketOpenServerClose(SOCKET_HANDLE *phandle) * @brief This function to close socket connection in server * @param *phandle [in] handle * @return int result of function */ int IPC_SocketOpenServerClose(SOCKET_HANDLE * phandle); /** * @fn int IPC_SocketRecvMessage(SOCKET_HANDLE *phandle, char * buf, int size) * @brief This function to receive message from socket connection in server * @param *phandle [in] handle * @param *buf [out] buffer string * @param *size [out] buffer size * @return int result of function */ int IPC_SocketRecvMessage(SOCKET_HANDLE * phandle, char *buf, int size); /** * @fn int IPC_SocketSendMessage(SOCKET_HANDLE *phandle, char *buf, int size) * @brief This function to send message from socket in client * @param *phandle [in] handle * @param *buf [in] buffer string * @param *size [in] buffer size * @return int result of function */ int IPC_SocketSendMessage(SOCKET_HANDLE * phandle, char *buf, int size); /** * @fn int IPC_SocketServerSendMessage(SOCKET_HANDLE *phandle, char *buf, int size) * @brief This function to send message from socket in client * @param *phandle [in] handle * @param *buf [in] buffer string * @param *size [in] buffer size * @return int result of function */ int IPC_SocketServerSendMessage(SOCKET_HANDLE * phandle, char *buf, int size); /** * @fn int IPC_SocketGetMessage(SOCKET_HANDLE *phandle, int *msgSize) * @brief This function to send message size from socket in server * @param *phandle [in] handle * @param *msgSize [in] get message size * @return int result of function */ int IPC_SocketGetMessage(SOCKET_HANDLE * phandle, int *msgSize); /** * @fn int IPC_SocketClientAccept(SOCKET_HANDLE *phandle) * @brief This function to accept socket in client * @param *phandle [in] handle * @return int result of function */ int IPC_SocketClientAccept(SOCKET_HANDLE * phandle); /** * @fn int IPC_SocketOpenClientConnection(char *server, SOCKET_HANDLE *phandle) * @brief This function to open socket connection in client * @param *server [in] server information * @param *phandle [in] handle * @return int result of function */ int IPC_SocketOpenClientConnection(char *server, SOCKET_HANDLE * phandle); /** * @fn int IPC_SocketOpenClientClose(SOCKET_HANDLE *phandle); * @brief This function to close socket in client * @param *phandle [in] handle * @return int result of function */ int IPC_SocketOpenClientClose(SOCKET_HANDLE * phandle); #endif /* __IPC_H__ */