Created function to set received some data in user buffer (used in simulated UserProcess mode).

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4808 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
winckel
2013-12-22 11:36:48 +00:00
parent 4ea3d1cb14
commit b3fda596b1
2 changed files with 217 additions and 186 deletions
@@ -304,6 +304,36 @@ int user_api_read_data(int fd)
LOG_FUNC_RETURN (rbytes); LOG_FUNC_RETURN (rbytes);
} }
/****************************************************************************
** **
** Name: user_api_set_data() **
** **
** Description: Set content of data received buffer to allow loop back **
** **
** Inputs: message: Message to set into the received buffer **
** **
** Outputs: Return: The number of bytes write when success; **
** RETURNerror Otherwise **
** Others: _user_api_recv_buffer **
** **
***************************************************************************/
int user_api_set_data(char *message)
{
LOG_FUNC_IN;
int rbytes;
memset(_user_api_recv_buffer, 0, USER_API_RECV_BUFFER_SIZE);
strncpy(_user_api_recv_buffer, message, USER_API_RECV_BUFFER_SIZE);
rbytes = strlen(_user_api_recv_buffer);
LOG_TRACE(INFO, "USR-API - %d bytes write", rbytes);
LOG_DUMP(_user_api_recv_buffer, rbytes);
LOG_FUNC_RETURN (rbytes);
}
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: user_api_send_data() ** ** Name: user_api_send_data() **
@@ -49,6 +49,7 @@ int user_api_get_fd(void);
const void* user_api_get_data(int index); const void* user_api_get_data(int index);
int user_api_read_data(int fd); int user_api_read_data(int fd);
int user_api_set_data(char *message);
int user_api_send_data(int fd, int length); int user_api_send_data(int fd, int length);
void user_api_close(int fd); void user_api_close(int fd);