2 #ifndef LIBNAGIOS_iobroker_h__ 3 #define LIBNAGIOS_iobroker_h__ 18 #define IOBROKER_USES_EPOLL 1 22 #if (_POSIX_C_SOURCE - 0) >= 200112L 24 # define IOBROKER_POLLIN POLLIN 25 # define IOBROKER_POLLPRI POLLPRI 26 # define IOBROKER_POLLOUT POLLOUT 28 # define IOBROKER_POLLERR POLLERR 29 # define IOBROKER_POLLHUP POLLHUP 30 # define IOBROKER_POLLNVAL POLLNVAL 32 # define IOBROKER_POLLIN 0x001 33 # define IOBROKER_POLLPRI 0x002 34 # define IOBROKER_POLLOUT 0x004 36 # define IOBROKER_POLLERR 0x008 37 # define IOBROKER_POLLHUP 0x010 38 # define IOBROKER_POLLNVAL 0x020 42 #define IOBROKER_SUCCESS 0 43 #define IOBROKER_ENOSET (-1) 44 #define IOBROKER_ENOINIT (-2) 45 #define IOBROKER_ELIB (-3) 46 #define IOBROKER_EALREADY (-EALREADY) 47 #define IOBROKER_EINVAL (-EINVAL) 51 #define IOBROKER_CLOSE_SOCKETS 1 55 typedef struct iobroker_set iobroker_set;
88 extern int iobroker_register(iobroker_set *iobs,
int sd,
void *arg,
int (*handler)(
int,
int,
void *));
103 extern int iobroker_register_out(iobroker_set *iobs,
int sd,
void *arg,
int (*handler)(
int,
int,
void *));
int iobroker_get_num_fds(iobroker_set *iobs)
Getter function for number of file descriptors registered in the set specified.
const char * iobroker_strerror(int error)
Get a string describing the error in the last iobroker call.
int iobroker_poll(iobroker_set *iobs, int timeout)
Wait for input on any of the registered sockets.
int iobroker_get_max_fds(iobroker_set *iobs)
Getter function for the maximum amount of file descriptors this set can handle.
iobroker_set * iobroker_create(void)
Create a new socket set.
int iobroker_register(iobroker_set *iobs, int sd, void *arg, int(*handler)(int, int, void *))
Register a socket for input polling with the broker.
int iobroker_close(iobroker_set *iobs, int sd)
Unregister and close(2) a socket registered for input with the broker.
void iobroker_destroy(iobroker_set *iobs, int flags)
Destroy a socket set as created by iobroker_create.
int iobroker_register_out(iobroker_set *iobs, int sd, void *arg, int(*handler)(int, int, void *))
Register a socket for output polling with the broker.
int iobroker_unregister(iobroker_set *iobs, int sd)
Unregister a socket for input polling with the broker.
int iobroker_max_usable_fds(void)
Published utility function used to determine the max number of file descriptors this process can keep...
int iobroker_is_registered(iobroker_set *iobs, int fd)
Check if a particular filedescriptor is registered with the iobroker set.
int iobroker_deregister(iobroker_set *iobs, int sd)
Deregister a socket for input polling with the broker (this is identical to iobroker_unregister()) ...