Mon Nov 6 06:42:47 2006

Asterisk developer's documentation


io.h File Reference

I/O Management (derived from Cheops-NG). More...

#include <sys/poll.h>

Include dependency graph for io.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define AST_IO_CB(a)   ((ast_io_cb)(a))
#define AST_IO_ERR   POLLERR
#define AST_IO_HUP   POLLHUP
#define AST_IO_IN   POLLIN
#define AST_IO_NVAL   POLLNVAL
#define AST_IO_OUT   POLLOUT
#define AST_IO_PRI   POLLPRI

Typedefs

typedef int(*) ast_io_cb (int *id, int fd, short events, void *cbdata)

Functions

int ast_get_termcols (int fd)
int ast_hide_password (int fd)
int * ast_io_add (struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data)
int * ast_io_change (struct io_context *ioc, int *id, int fd, ast_io_cb callback, short events, void *data)
void ast_io_dump (struct io_context *ioc)
int ast_io_remove (struct io_context *ioc, int *id)
int ast_io_wait (struct io_context *ioc, int howlong)
int ast_restore_tty (int fd, int oldstatus)
io_context * io_context_create (void)
void io_context_destroy (struct io_context *ioc)


Detailed Description

I/O Management (derived from Cheops-NG).

Definition in file io.h.


Define Documentation

#define AST_IO_ERR   POLLERR

Error condition (errno or getsockopt)

Definition at line 45 of file io.h.

#define AST_IO_HUP   POLLHUP

Hangup

Definition at line 47 of file io.h.

#define AST_IO_IN   POLLIN

Input ready

Definition at line 37 of file io.h.

#define AST_IO_NVAL   POLLNVAL

Invalid fd

Definition at line 49 of file io.h.

#define AST_IO_OUT   POLLOUT

Output ready

Definition at line 39 of file io.h.

#define AST_IO_PRI   POLLPRI

Priority input ready

Definition at line 41 of file io.h.


Function Documentation

int ast_hide_password ( int  fd  ) 

Set fd into non-echoing mode (if fd is a tty)

int* ast_io_add ( struct io_context *  ioc,
int  fd,
ast_io_cb  callback,
short  events,
void *  data 
)

Parameters:
ioc which context to use
fd which fd to monitor
callback callback function to run
events event mask of events to wait for
data data to pass to the callback Watch for any of revents activites on fd, calling callback with data as callback data. Returns a pointer to ID of the IO event, or NULL on failure.

int* ast_io_change ( struct io_context *  ioc,
int *  id,
int  fd,
ast_io_cb  callback,
short  events,
void *  data 
)

Parameters:
ioc which context to use
id 
fd the fd you wish it to contain now
callback new callback function
events event mask to wait for
data data to pass to the callback function Change an i/o handler, updating fd if > -1, callback if non-null, and revents if >-1, and data if non-null. Returns a pointero to the ID of the IO event, or NULL on failure.

void ast_io_dump ( struct io_context *  ioc  ) 

Dumps the IO array

int ast_io_remove ( struct io_context *  ioc,
int *  id 
)

Parameters:
ioc which io_context to remove it from
id which ID to remove Remove an I/O id from consideration Returns 0 on success or -1 on failure.

int ast_io_wait ( struct io_context *  ioc,
int  howlong 
)

Parameters:
ioc which context to act upon
howlong how many milliseconds to wait Wait for I/O to happen, returning after howlong milliseconds, and after processing any necessary I/O. Returns the number of I/O events which took place.

int ast_restore_tty ( int  fd,
int  oldstatus 
)

Restores TTY mode

struct io_context* io_context_create ( void   ) 

Create a context for I/O operations Basically mallocs an IO structure and sets up some default values. Returns an allocated io_context structure

void io_context_destroy ( struct io_context *  ioc  ) 

Destroys a context


Generated on Mon Nov 6 06:42:47 2006 for Asterisk - the Open Source PBX by  doxygen 1.5.1