merge: iobackend on dev
This commit is contained in:
commit
9923ebc677
3 changed files with 218 additions and 17 deletions
|
|
@ -3,6 +3,13 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
// Error codes
|
||||
#define IOB_ERROR_GENERIC -1
|
||||
#define IOB_ERROR_BAD_ARG -2
|
||||
#define IOB_ERROR_MODULE_NOT_INITIALIZED -3
|
||||
#define IOB_ERROR_MODULE_ALREADY_INITIALIZED -4
|
||||
#define IOB_ERROR_CANNOT_OPEN_FILE -5
|
||||
|
||||
enum iob_mode
|
||||
{
|
||||
IOB_MODE_NULL = 0,
|
||||
|
|
@ -11,11 +18,19 @@ enum iob_mode
|
|||
IOB_MODE_CMD
|
||||
};
|
||||
|
||||
enum iob_state
|
||||
{
|
||||
IOB_STATE_NOT_INITIALIZED,
|
||||
IOB_STATE_READY,
|
||||
IOB_STATE_FINISHED,
|
||||
IOB_STATE_ERROR
|
||||
};
|
||||
|
||||
/* @struct iob_context
|
||||
* @var mode
|
||||
* @var args contains
|
||||
* the script name when mode is set to IOB_SCRIPT,
|
||||
* the command to execute when mode is set to IOB_CMD,
|
||||
* the script name when mode is set to IOB_MODE_SCRIPT,
|
||||
* the command to execute when mode is set to IOB_MODE_CMD
|
||||
*/
|
||||
struct iob_context
|
||||
{
|
||||
|
|
@ -31,17 +46,16 @@ struct iob_context
|
|||
*/
|
||||
int iob_init(struct iob_context *context);
|
||||
|
||||
/* TODO
|
||||
*
|
||||
*
|
||||
*
|
||||
/* @brief Closes the opened buffers and the module gracefully
|
||||
*/
|
||||
void iob_close();
|
||||
void iob_close(void);
|
||||
|
||||
/*i TODO
|
||||
*
|
||||
*
|
||||
/* @brief reads at most one line of the input and stores it into *stream
|
||||
*
|
||||
* @param stream is a pointer that will be set to a string to parse
|
||||
* @return the number of read characters if positive,
|
||||
* zero if finished (reached EOF),
|
||||
* the error code otherwise
|
||||
*/
|
||||
ssize_t stream_read(char **stream);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue