Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# wait.h

    00001 #ifndef CRYPTOPP_WAIT_H
    00002 #define CRYPTOPP_WAIT_H
    00003
    00004 #include "config.h"
    00005
    00006 #ifdef SOCKETS_AVAILABLE
    00007
    00008 #include "cryptlib.h"
    00009 #include <vector>
    00010
    00011 #ifdef USE_WINDOWS_STYLE_SOCKETS
    00012 #include <windows.h>
    00013 #else
    00014 #include <sys/types.h>
    00015 #endif
    00016
    00017 NAMESPACE_BEGIN(CryptoPP)
    00018
    00019 //! container of wait objects
    00020 class WaitObjectContainer
    00021 {
    00022 public:
    00023         //! exception thrown by WaitObjectContainer
    00024         class Err : public Exception
    00025         {
    00026         public:
    00027                 Err(const std::string& s) : Exception(IO_ERROR, s) {}
    00028         };
    00029
    00030         WaitObjectContainer();
    00031
    00032         void Clear();
    00033         void SetNoWait() {m_noWait = true;}
    00034         bool Wait(unsigned long milliseconds);
    00035
    00036 #ifdef USE_WINDOWS_STYLE_SOCKETS
    00037         void AddHandle(HANDLE handle);
    00038 #else
    00039         void AddReadFd(int fd);
    00040         void AddWriteFd(int fd);
    00041 #endif
    00042
    00043 private:
    00044 #ifdef USE_WINDOWS_STYLE_SOCKETS
    00045         std::vector<HANDLE> m_handles;
    00046 #else
    00047         fd_set m_readfds, m_writefds;
    00048         int m_maxFd;
    00049 #endif
    00050         bool m_noWait;
    00051 };
    00052
    00053 NAMESPACE_END
    00054
    00055 #endif
    00056
    00057 #endif