Client Library - Pollfd API


Detailed Description

detailed description

Example:
typical usage of pollfd api;
 int pollfd_in_cb (s_window_t *window, s_pollfd_t *pfd)
 {
        // do what ever you want with your fd
        // return -1 on error, 0 on success
        return 0;
 }

 int pollfd_in_err (s_window_t *window, s_pollfd_t *pfd)
 {
        // will be called if something bad happens on poll call
        // return -1 to stop client, otherwise return 0
        return 0;
 }

 int pollfd_in_close (s_window_t *window, s_pollfd_t *pfd)
 {
        // will be called while uniting the window
        return 0;
 }

 s_pollfd_t *pfd;

 // initialize pfd struct
 s_pollfd_init(&pfd);

 // set fd to poll, and callback functions
 pfd->fd = fd;
 pfd->pf_in = pollfd_in_cb;
 pfd->pf_err = pollfd_err_cb;
 pfd->pf_close = pollfd_close_cb;

 // add pfd to the window
 s_pollfd_add(window, pfd);

 // del pfd from window
 s_pollfd_del(window, pfd);

 // uninitialize pfd struct
 s_pollfd_uninit(pfd);


Data Structures

struct  s_pollfd_s
 polfd struct More...
struct  s_pollfds_s
 polfds struct More...

Functions

int s_pollfd_init (s_pollfd_t **pfd)
 initialize the pollfd struct.
int s_pollfd_uninit (s_pollfd_t *pfd)
 uninitialize the pollfd struct
s_pollfd_ts_pollfd_find (s_window_t *window, int fd)
 finds the pollfd struct that is associated with fd
int s_pollfd_add (s_window_t *window, s_pollfd_t *pfd)
 adds a pollfd to windows` pollfds list
int s_pollfd_del (s_window_t *window, s_pollfd_t *pfd)
 deletes a pollfd from windows` pollfds list
int s_pollfds_init (s_window_t *window)
 initialize the pollfds struct for given window
int s_pollfds_uninit (s_window_t *window)
 uninitialize the pollfds struct for given window


Function Documentation

int s_pollfd_add ( s_window_t window,
s_pollfd_t pfd 
)

adds a pollfd to windows` pollfds list

Parameters:
*window - window to attach the pollfd
*pfd - the pollfd
Returns:
0 on success, 1 on error.

int s_pollfd_del ( s_window_t window,
s_pollfd_t pfd 
)

deletes a pollfd from windows` pollfds list

Parameters:
*window - window that holds the pollfd
*pfd - the pollfd
Returns:
0 on success, 1 on error.

s_pollfd_t* s_pollfd_find ( s_window_t window,
int  fd 
)

finds the pollfd struct that is associated with fd

Parameters:
window - the window that holds pollfd
fd - file descriptor to find
Returns:
pointer to pollfd on success, NULL on error.

int s_pollfd_init ( s_pollfd_t **  pfd  ) 

initialize the pollfd struct.

Parameters:
**pfd - address of the pollfd pointer.
Returns:
0 on success, 1 on error.

int s_pollfd_uninit ( s_pollfd_t pfd  ) 

uninitialize the pollfd struct

Parameters:
*pfd - the pollfd
Returns:
0 on success, 1 on error.

int s_pollfds_init ( s_window_t window  ) 

initialize the pollfds struct for given window

Parameters:
*window - window
Returns:
0 on success, 1 on error.

int s_pollfds_uninit ( s_window_t window  ) 

uninitialize the pollfds struct for given window

Parameters:
*window - window
Returns:
0 on success, 1 on error.


Generated on Wed Dec 27 17:53:06 2006 for xynth-0.8.40 by  doxygen 1.4.7