poll.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef ECL_IO_POLL_HPP_
00013 #define ECL_IO_POLL_HPP_
00014 
00015 /*****************************************************************************
00016 ** Includes
00017 *****************************************************************************/
00018 
00019 #include "sockets.hpp"
00020 
00021 #ifdef ECL_IS_WIN32
00022   // nothing special here.
00023 #else
00024   #include <poll.h>
00025 #endif
00026 
00027 /*****************************************************************************
00028 ** Macros
00029 *****************************************************************************/
00030 
00031 #ifdef ECL_IS_WIN32
00032   #ifndef POLLRDNORM
00033     #define POLLRDNORM  0x0100 /* mapped to read fds_set */
00034   #endif
00035   #ifndef POLLRDBAND
00036     #define POLLRDBAND  0x0200 /* mapped to exception fds_set */
00037   #endif
00038   #ifndef POLLIN
00039     #define POLLIN      (POLLRDNORM | POLLRDBAND) /* There is data to read.  */
00040   #endif
00041   #ifndef POLLPRI
00042     #define POLLPRI     0x0400 /* There is urgent data to read.  */
00043   #endif
00044 
00045   #ifndef POLLWRNORM
00046     #define POLLWRNORM  0x0010 /* mapped to write fds_set */
00047   #endif
00048   #ifndef POLLOUT
00049     #define POLLOUT     (POLLWRNORM) /* Writing now will not block.  */
00050   #endif
00051   #ifndef POLLWRBAND
00052     #define POLLWRBAND  0x0020 /* mapped to write fds_set */
00053   #endif
00054   #ifndef POLLERR
00055     #define POLLERR     0x0001 /* Error condition.  */
00056   #endif
00057   #ifndef POLLHUP
00058     #define POLLHUP     0x0002 /* Hung up.  */
00059   #endif
00060   #ifndef POLLNVAL
00061     #define POLLNVAL    0x0004 /* Invalid polling request.  */
00062   #endif
00063 #else
00064     // Nothing to see here!
00065 #endif
00066 
00067 /*****************************************************************************
00068 ** Namespaces
00069 *****************************************************************************/
00070 
00071 namespace ecl {
00072 
00073 /*****************************************************************************
00074 ** Types
00075 *****************************************************************************/
00076 
00077 #ifdef ECL_IS_WIN32
00078   /* poll emulation support */
00079   typedef struct socket_pollfd {
00080     socket_descriptor fd;      /* file descriptor */
00081     short events;     /* requested events */
00082     short revents;    /* returned events */
00083   } socket_pollfd;
00084 
00085   typedef unsigned long int nfds_t;
00086 #else
00087   typedef struct pollfd socket_pollfd;
00088   typedef ::nfds_t ndfs_t;
00089 #endif
00090 
00091 
00092   ecl_io_PUBLIC int poll_sockets(socket_pollfd *fds, nfds_t nfds, int timeout);
00093 
00094 } // namespace ecl
00095 
00096 #endif /* ECL_IO_POLL_HPP_ */


ecl_io
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 18:53:24