lcrzo_wait(3)

NAME
lcrzo_wait - lcrzo library : waiting

CONTENTS
/*    Laurent Constantin's network library (lcrzo)
                 lcrzo_wait module
  Functions waiting for data to be read.
*/
/*-------------------------------------------------------------*/
/* definition of a lcrzo_wait. You should not use its
   fields directly. */
typedef struct
{ int source;
  void *psource;
  int action;
  lcrzo_int32 wantedfixedsize;
} lcrzo_wait;
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_init_process_end
   Description :
     Initialize a lcrzo_wait : wait for the end of a process.
   Input parameter(s) :
     *pprocess : process to wait for
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pprocess
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_process_end(lcrzo_process *pprocess,
				lcrzo_wait *pwait);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_init_file_read
   Description :
     Initialize a lcrzo_wait : wait for data from the file.
   Input parameter(s) :
     *pfile : lcrzo_file where to wait for data
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pfile
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_file_read(lcrzo_file *pfile,
			      lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_file_read_fixed
   Description :
     Initialize a lcrzo_wait : wait for fixed data from the file.
   Input parameter(s) :
     *pfile : lcrzo_file where to wait for data
     wantedfixedsize : wanted size
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pfile
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_file_read_fixed(lcrzo_file *pfile,
				    lcrzo_int32 wantedfixedsize,
				    lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_file_read_line
   Description :
     Initialize a lcrzo_wait : wait for a line from the file.
   Input parameter(s) :
     *pfile : lcrzo_file where to wait for data
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pfile
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_file_read_line(lcrzo_file *pfile,
				   lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_file_end
   Description :
     Initialize a lcrzo_wait : wait for end of file.
   Input parameter(s) :
     *pfile : lcrzo_file where to wait for end
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pfile
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_file_end(lcrzo_file *pfile,
			     lcrzo_wait *pwait);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_init_ipc_read
   Description :
     Initialize a lcrzo_wait : wait for data from the ipc.
   Input parameter(s) :
     *pipc : lcrzo_ipc where to wait for data
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pipc
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_ipc_read(lcrzo_ipc *pipc,
			     lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_ipc_read_fixed
   Description :
     Initialize a lcrzo_wait : wait for fixed data from the ipc.
   Input parameter(s) :
     *pipc : lcrzo_ipc where to wait for data
     wantedfixedsize : wanted size
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pipc
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_ipc_read_fixed(lcrzo_ipc *pipc,
				   lcrzo_int32 wantedfixedsize,
				   lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_ipc_read_line
   Description :
     Initialize a lcrzo_wait : wait for a line from the ipc.
   Input parameter(s) :
     *pipc : lcrzo_ipc where to wait for data
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pipc
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_ipc_read_line(lcrzo_ipc *pipc,
				  lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_ipc_end
   Description :
     Initialize a lcrzo_wait : wait for end of ipc.
   Input parameter(s) :
     *pipc : lcrzo_ipc where to wait for end
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *pipc
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_ipc_end(lcrzo_ipc *pipc,
			    lcrzo_wait *pwait);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_init_sniff_read
   Description :
     Initialize a lcrzo_wait : wait for data from the sniff.
   Input parameter(s) :
     *psniff : lcrzo_sniff where to wait for data
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *psniff
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_sniff_read(lcrzo_sniff *psniff,
                               lcrzo_wait *pwait);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_init_sock_read
   Description :
     Initialize a lcrzo_wait : wait for data from the sock.
   Input parameter(s) :
     *psock : lcrzo_sock where to wait for data
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *psock
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_sock_read(lcrzo_sock *psock,
			      lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_sock_read_fixed
   Description :
     Initialize a lcrzo_wait : wait for fixed data from the sock.
   Input parameter(s) :
     *psock : lcrzo_sock where to wait for data
     wantedfixedsize : wanted size
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *psock
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_sock_read_fixed(lcrzo_sock *psock,
				    lcrzo_int32 wantedfixedsize,
				    lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_sock_read_line
   Description :
     Initialize a lcrzo_wait : wait for a line from the sock.
   Input parameter(s) :
     *psock : lcrzo_sock where to wait for data
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *psock
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_sock_read_line(lcrzo_sock *psock,
				   lcrzo_wait *pwait);
/* Name : lcrzo_wait_init_sock_end
   Description :
     Initialize a lcrzo_wait : wait for end of sock.
   Input parameter(s) :
     *psock : lcrzo_sock where to wait for end
   Input/output parameter(s) :
   Output parameter(s) :
     *pwait : lcrzo_wait associated to *psock
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_init_sock_end(lcrzo_sock *psock,
			     lcrzo_wait *pwait);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_close
   Description :
     Close a lcrzo_wait.
   Input parameter(s) :
     *pwait : lcrzo_wait to close
   Input/output parameter(s) :
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_close(lcrzo_wait *pwait);
/*-------------------------------------------------------------*/
/* Use LCRZO_WAIT_NODELAY to wait 0 seconds */
#define LCRZO_WAIT_NODELAY   lcrzo__time_init_wait_nodelay()
/* Use LCRZO_WAIT_INFINITE to wait indefinitively */
#define LCRZO_WAIT_INFINITE  lcrzo__time_init_wait_infinite()
/* Do not use the 2 following functions, but the defines above */
lcrzo_time * lcrzo__time_init_wait_nodelay(void);
lcrzo_time * lcrzo__time_init_wait_infinite(void);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_wait1
   Description :
     Wait for 1 event.
   Input parameter(s) :
     *pwait1 : lcrzo_wait to wait for
     *pmaxwaitingtime : maximum waiting time (can be a lcrzo_time,
                        LCRZO_WAIT_NODELAY or LCRZO_WAIT_INFINITE)
   Input/output parameter(s) :
   Output parameter(s) :
     *pevent1 : an event occured on *pwait1
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_wait1(lcrzo_wait *pwait1,
                     lcrzo_time *pmaxwaitingtime,
                     lcrzo_bool *pevent1);
/* Name : lcrzo_wait_wait2
   Description :
     Wait for 1 event amongst 2 lcrzo_wait.
   Input parameter(s) :
     *pwait1 : lcrzo_wait to wait for
     *pwait2 : lcrzo_wait to wait for
     *pmaxwaitingtime : maximum waiting time (can be a lcrzo_time,
                        LCRZO_WAIT_NODELAY or LCRZO_WAIT_INFINITE)
   Input/output parameter(s) :
   Output parameter(s) :
     *pevent1 : an event occured on *pwait1
     *pevent2 : an event occured on *pwait2
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_wait2(lcrzo_wait *pwait1,
                     lcrzo_wait *pwait2,
                     lcrzo_time *pmaxwaitingtime,
                     lcrzo_bool *pevent1,
                     lcrzo_bool *pevent2);
/* Name : lcrzo_wait_wait2_all
   Description :
     Wait for 2 events.
   Input parameter(s) :
     *pwait1 : lcrzo_wait to wait for
     *pwait2 : lcrzo_wait to wait for
     *pmaxwaitingtime : maximum waiting time (can be a lcrzo_time,
                        LCRZO_WAIT_NODELAY or LCRZO_WAIT_INFINITE)
   Input/output parameter(s) :
   Output parameter(s) :
     *pevent : an event occured on *pwait1 and on *pwait2
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_wait2_all(lcrzo_wait *pwait1,
                         lcrzo_wait *pwait2,
                         lcrzo_time *pmaxwaitingtime,
                         lcrzo_bool *pevent);
/* Idem with 3, 4 or 5 events */
int lcrzo_wait_wait3(lcrzo_wait *pwait1,
                     lcrzo_wait *pwait2,
                     lcrzo_wait *pwait3,
                     lcrzo_time *pmaxwaitingtime,
                     lcrzo_bool *pevent1,
                     lcrzo_bool *pevent2,
                     lcrzo_bool *pevent3);
int lcrzo_wait_wait3_all(lcrzo_wait *pwait1,
                         lcrzo_wait *pwait2,
                         lcrzo_wait *pwait3,
                         lcrzo_time *pmaxwaitingtime,
                         lcrzo_bool *pevent);
int lcrzo_wait_wait4(lcrzo_wait *pwait1,
                     lcrzo_wait *pwait2,
                     lcrzo_wait *pwait3,
                     lcrzo_wait *pwait4,
                     lcrzo_time *pmaxwaitingtime,
                     lcrzo_bool *pevent1,
                     lcrzo_bool *pevent2,
                     lcrzo_bool *pevent3,
                     lcrzo_bool *pevent4);
int lcrzo_wait_wait4_all(lcrzo_wait *pwait1,
                         lcrzo_wait *pwait2,
                         lcrzo_wait *pwait3,
                         lcrzo_wait *pwait4,
                         lcrzo_time *pmaxwaitingtime,
                         lcrzo_bool *pevent);
int lcrzo_wait_wait5(lcrzo_wait *pwait1,
                     lcrzo_wait *pwait2,
                     lcrzo_wait *pwait3,
                     lcrzo_wait *pwait4,
                     lcrzo_wait *pwait5,
                     lcrzo_time *pmaxwaitingtime,
                     lcrzo_bool *pevent1,
                     lcrzo_bool *pevent2,
                     lcrzo_bool *pevent3,
                     lcrzo_bool *pevent4,
                     lcrzo_bool *pevent5);
int lcrzo_wait_wait5_all(lcrzo_wait *pwait1,
                         lcrzo_wait *pwait2,
                         lcrzo_wait *pwait3,
                         lcrzo_wait *pwait4,
                         lcrzo_wait *pwait5,
                         lcrzo_time *pmaxwaitingtime,
                         lcrzo_bool *pevent);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_list_init
   Description :
     Initialize a list a events. It can be use to wait for more
     than 5 event.
   Input parameter(s) :
   Input/output parameter(s) :
     *pwaitlist : list initialized
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_list_init(lcrzo_list *pwaitlist);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_list_add
   Description :
     Add an event to the waiting list.
   Input parameter(s) :
     itemindex : index of the item to add
     *pwait : lcrzo_wait to add
   Input/output parameter(s) :
     *pwaitlist : list where to add items
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_list_add(lcrzo_list *pwaitlist,
                        lcrzo_int32 itemindex,
                        lcrzo_wait *pwait);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_list_del
   Description :
     Remove an event to the waiting list.
   Input parameter(s) :
     itemindex : index of the item to remove
   Input/output parameter(s) :
     *pwaitlist : list where to remove items
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_list_del(lcrzo_list *pwaitlist,
                        lcrzo_int32 itemindex);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_list_wait
   Description :
     Wait for an event in the waiting list.
   Input parameter(s) :
     *pmaxwaitingtime : maximum waiting time (can be a lcrzo_time,
                        LCRZO_WAIT_NODELAY or LCRZO_WAIT_INFINITE)
   Input/output parameter(s) :
     *pwaitlist : list where to wait for
   Output parameter(s) :
     *pevent : true if an event occured
     *pfirsteventindex : index of the first event
     *plistofalleventindexes : list of all events indexes
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_list_wait(lcrzo_list *pwaitlist,
                         lcrzo_time *pmaxwaitingtime,
                         lcrzo_bool *pevent,
                         lcrzo_int32 *pfirsteventindex,
                         lcrzo_list *plistofalleventindexes);
/*-------------------------------------------------------------*/
/* Name : lcrzo_wait_list_wait_all
   Description :
     Wait for all events in the waiting list.
   Input parameter(s) :
     *pmaxwaitingtime : maximum waiting time (can be a lcrzo_time,
                        LCRZO_WAIT_NODELAY or LCRZO_WAIT_INFINITE)
   Input/output parameter(s) :
     *pwaitlist : list where to wait for
   Output parameter(s) :
     *pevent : true if all events occured
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_wait_list_wait_all(lcrzo_list *pwaitlist,
                             lcrzo_time *pmaxwaitingtime,
                             lcrzo_bool *pevent);

SEE ALSO
lcrzo(3), lcrzo_types(3), lcrzo_data(3), lcrzo_string(3), lcrzo_time(3), lcrzo_file(3), lcrzo_address(3), lcrzo_device(3), lcrzo_list(3), lcrzo_process(3), lcrzo_ipc(3), lcrzo_header(3), lcrzo_ipopt(3), lcrzo_tcpopt(3), lcrzo_packet(3), lcrzo_icmp(3), lcrzo_print(3), lcrzo_record(3), lcrzo_conf(3), lcrzo_spoof(3), lcrzo_sniff(3), lcrzo_sock(3), lcrzo_wait(3), lcrzo_global(3), lcrzo_error(3) lcrzo_misc(3), lcrzo_obso(3),