Queued Input


Classes

union  ix_qio_ctrl_t

Typedefs

typedef ix_qio_s ix_qio_t
typedef ix_qio_hook_e(*) IX_QIO_SAVE_FCT (unsigned char *input, int len, void *userarg)

Enumerations

enum  ix_qio_ctrl_e { IX_QIO_MAXLEN = 0x01, IX_QIO_DELIM = 0x02 }
enum  ix_qio_hook_e { IX_QIO_HOOK_BUFFER_REUSE = 0x01, IX_QIO_HOOK_BUFFER_LOCKED = 0x02, IX_QIO_HOOK_ERROR = 0xF0000 }

Functions

ix_qio_tix_qio_new (int fd, int ctrl_tag, ix_qio_ctrl_t ctrl_info, size_t maxlen)
int ix_qio_reopen (ix_qio_t *pqio, int fd)
int ix_qio_receive (ix_qio_t *pqio, IX_QIO_SAVE_FCT save_fct, void *userarg)
int ix_qio_msg (ix_qio_t *pqio, ix_msg_queue_t *pmq)
ix_msg_queue_tix_qio_getmsg (ix_qio_t *pqio)
int ix_qio_issetup (ix_qio_t *pqio)
int ix_qio_isvalid (ix_qio_t *pqio)
int ix_qio_getfd (ix_qio_t *pqio)
void ix_qio_free (ix_qio_t *pqio)

Detailed Description

Input is buffered and is processed either in user supplied call back or pushed to message queue when completeness condition (e.g. length or CR in input stream) is true (ix_qio_receive(), ix_qio_msg()). Queued Input is referred to as QIO.

Typedef Documentation

typedef ix_qio_hook_e( *) IX_QIO_SAVE_FCT(unsigned char *input, int len, void *userarg)

Hook function to receive QIO buffered data, see ix_qio_receive If the hook function returns IX_QIO_BUFFER_REUSE , the input buffer is again used internally. If return value is IX_QIO_BUFFER_LOCKED, the caller has to deal with the memory pointer !!! If input is NULL, error occured and file will be closed. You can signal your thread to reopen QIO but !!not!! in this callback

Parameters:
userarg User argument for hook function

typedef struct ix_qio_s ix_qio_t

handler for queued IO


Enumeration Type Documentation

enum ix_qio_ctrl_e

tag for QIO control structure

enum ix_qio_hook_e

return codes for QIO hook


Function Documentation

void ix_qio_free ( ix_qio_t pqio  ) 

free QIO object

Parameters:
pqio handle of QIO object

int ix_qio_getfd ( ix_qio_t pqio  ) 

Get the file descriptor of the qio object

Parameters:
pqio Handle of QIO object
Returns:
  • file descriptor
  • <0: error

ix_msg_queue_t* ix_qio_getmsg ( ix_qio_t pqio  ) 

Get the message queue of the qio object

Parameters:
pqio Handle of QIO object
Returns:
  • Message Queue
  • NULL: error

int ix_qio_issetup ( ix_qio_t pqio  ) 

Returns true if the qio object is setup via qio_msg or qio_receive

Parameters:
pqio Handle of QIO object
Returns:
  • !0: is setup
  • 0: is not setup

int ix_qio_isvalid ( ix_qio_t pqio  ) 

Returns true if the qio object's file descriptor is valid

Parameters:
pqio Handle of QIO object
Returns:
  • !0: is valid
  • 0: is not valid

int ix_qio_msg ( ix_qio_t pqio,
ix_msg_queue_t pmq 
)

Set up and kick receiving on QIO. Store to message queue when input is complete, The entries in the message queue are of type ix_buffer_t and have to be freed using ix_buffer_free(). An empty buffer signals error on file input.

Parameters:
pqio Handle of QIO object
pmq Handle of message queue to feed when input complete
Returns:
  • 0: OK
  • !0: error

ix_qio_t* ix_qio_new ( int  fd,
int  ctrl_tag,
ix_qio_ctrl_t  ctrl_info,
size_t  maxlen 
)

Creates new queued IO object

Parameters:
fd File descriptor to buffer input from
ctrl_tag Type of control structure see ix_qio_ctrl_e, ix_qio_ctrl_t
pctrl_info Address of control info structure
maxlen maximal size of data queued
Returns:
  • QIO handle
  • NULL: Error

int ix_qio_receive ( ix_qio_t pqio,
IX_QIO_SAVE_FCT  save_fct,
void *  userarg 
)

Set up and kick receiving on QIO handle. Call hook when input is complete. Note: Don't mix calls to ix_qio_receive() and ix_qio_msg().

Parameters:
pqio Handle of QIO object
save_fct This hook function is called internally when input is complete. Note: This function should only be used to save the input buffer and e.g. trigger some event, processing of input should then take elsewhere. e.g. in event receive loop.
Returns:
  • 0: OK
  • !0: error

int ix_qio_reopen ( ix_qio_t pqio,
int  fd 
)

Reopens QIO object after file error

Parameters:
pqio Handle of QIO object
fd File descriptor to buffer input from
Returns:
  • 0: OK
  • !0: Error


Generated on 4 Mar 2014 for ixtools by  doxygen 1.4.7