io-ssl.h (1924B)
1 /* -*- Mode: c++; -*- */ 2 /* -------------------------------------------------------------------- 3 * Filename: 4 * src/io/io.h 5 * 6 * Description: 7 * Declaration of the IO class. 8 * 9 * Authors: 10 * Andreas Aardal Hanssen <andreas-binc curly bincimap spot org> 11 * 12 * Bugs: 13 * 14 * ChangeLog: 15 * 16 * -------------------------------------------------------------------- 17 * Copyright 2002-2005 Andreas Aardal Hanssen 18 * 19 * This program is free software; you can redistribute it and/or modify 20 * it under the terms of the GNU General Public License as published by 21 * the Free Software Foundation; either version 2 of the License, or 22 * (at your option) any later version. 23 * 24 * This program is distributed in the hope that it will be useful, 25 * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 * GNU General Public License for more details. 28 * 29 * You should have received a copy of the GNU General Public License 30 * along with this program; if not, write to the Free Software 31 * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. 32 * -------------------------------------------------------------------- 33 */ 34 #ifndef io_ssl_h_included 35 #define io_ssl_h_included 36 #ifdef HAVE_CONFIG_H 37 #include <config.h> 38 #endif 39 40 #ifdef WITH_SSL 41 42 #include <string> 43 44 #include <stdio.h> 45 #include <openssl/ssl.h> 46 #include <openssl/err.h> 47 48 #include "io.h" 49 50 namespace Binc { 51 52 class SSLEnabledIO : public IO { 53 public: 54 enum { 55 MODE_PLAIN = 0x01, 56 MODE_SSL = 0x04, 57 MODE_SYSLOG = 0x02 58 }; 59 60 bool isModeSSL(void); 61 bool setModeSSL(void); 62 63 void writeStr(const std::string s); 64 int fillBuffer(int timeout, bool retry); 65 66 int pending(void) const; 67 68 //-- 69 SSLEnabledIO(void); 70 SSLEnabledIO(FILE *); 71 ~SSLEnabledIO(void); 72 73 private: 74 SSL *ssl; 75 SSL_CTX *ctx; 76 77 }; 78 } 79 80 #endif 81 #endif