1 // 2 // VMime library (http://www.vmime.org) 3 // Copyright (C) 2002-2013 Vincent Richard <vincent@vmime.org> 4 // 5 // This program is free software; you can redistribute it and/or 6 // modify it under the terms of the GNU General Public License as 7 // published by the Free Software Foundation; either version 3 of 8 // the License, or (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License along 16 // with this program; if not, write to the Free Software Foundation, Inc., 17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 // 19 // Linking this library statically or dynamically with other modules is making 20 // a combined work based on this library. Thus, the terms and conditions of 21 // the GNU General Public License cover the whole combination. 22 // 23 24 #ifndef VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED 25 #define VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED 26 27 28 #include "vmime/config.hpp" 29 30 31 #if VMIME_PLATFORM_IS_POSIX 32 33 34 #include "vmime/platform.hpp" 35 36 #if VMIME_HAVE_MESSAGING_FEATURES 37 #include "vmime/platforms/posix/posixSocket.hpp" 38 #endif 39 40 #if VMIME_HAVE_FILESYSTEM_FEATURES 41 #include "vmime/platforms/posix/posixFile.hpp" 42 #include "vmime/platforms/posix/posixChildProcess.hpp" 43 #endif 44 45 46 namespace vmime { 47 namespace platforms { 48 namespace posix { 49 50 51 class VMIME_EXPORT posixHandler : public vmime::platform::handler 52 { 53 public: 54 55 posixHandler(); 56 ~posixHandler(); 57 58 unsigned long getUnixTime() const; 59 60 const vmime::datetime getCurrentLocalTime() const; 61 62 const vmime::charset getLocalCharset() const; 63 64 const vmime::string getHostName() const; 65 66 unsigned int getProcessId() const; 67 unsigned int getThreadId() const; 68 69 #if VMIME_HAVE_MESSAGING_FEATURES 70 shared_ptr <vmime::net::socketFactory> getSocketFactory(); 71 #endif 72 73 #if VMIME_HAVE_FILESYSTEM_FEATURES 74 shared_ptr <vmime::utility::fileSystemFactory> getFileSystemFactory(); 75 76 shared_ptr <vmime::utility::childProcessFactory> getChildProcessFactory(); 77 #endif 78 79 void generateRandomBytes(unsigned char* buffer, const unsigned int count); 80 81 shared_ptr <utility::sync::criticalSection> createCriticalSection(); 82 83 private: 84 85 #if VMIME_HAVE_MESSAGING_FEATURES 86 shared_ptr <posixSocketFactory> m_socketFactory; 87 #endif 88 89 #if VMIME_HAVE_FILESYSTEM_FEATURES 90 shared_ptr <posixFileSystemFactory> m_fileSysFactory; 91 shared_ptr <posixChildProcessFactory> m_childProcFactory; 92 #endif 93 }; 94 95 96 } // posix 97 } // platforms 98 } // vmime 99 100 101 #endif // VMIME_PLATFORM_IS_POSIX 102 103 #endif // VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED 104