Blame src/buffer_ssl.h

Packit 8f70b4
/*
Packit 8f70b4
 * lftp - file transfer program
Packit 8f70b4
 *
Packit 8f70b4
 * Copyright (c) 1996-2016 by Alexander V. Lukyanov (lav@yars.free.net)
Packit 8f70b4
 *
Packit 8f70b4
 * This program is free software; you can redistribute it and/or modify
Packit 8f70b4
 * it under the terms of the GNU General Public License as published by
Packit 8f70b4
 * the Free Software Foundation; either version 3 of the License, or
Packit 8f70b4
 * (at your option) any later version.
Packit 8f70b4
 *
Packit 8f70b4
 * This program is distributed in the hope that it will be useful,
Packit 8f70b4
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8f70b4
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 8f70b4
 * GNU General Public License for more details.
Packit 8f70b4
 *
Packit 8f70b4
 * You should have received a copy of the GNU General Public License
Packit 8f70b4
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 8f70b4
 */
Packit 8f70b4
Packit 8f70b4
#ifndef BUFFER_SSL_H
Packit 8f70b4
#define BUFFER_SSL_H
Packit 8f70b4
Packit 8f70b4
#include "buffer.h"
Packit 8f70b4
Packit 8f70b4
#if USE_SSL
Packit 8f70b4
#include "lftp_ssl.h"
Packit 8f70b4
class IOBufferSSL : public IOBuffer
Packit 8f70b4
{
Packit 8f70b4
   Ref<lftp_ssl> my_ssl;
Packit 8f70b4
   const Ref<lftp_ssl>& ssl;
Packit 8f70b4
Packit 8f70b4
   int Get_LL(int size);
Packit 8f70b4
   int Put_LL(const char *buf,int size);
Packit 8f70b4
   int PutEOF_LL();
Packit 8f70b4
Packit 8f70b4
   int want_mask() const { return (ssl->want_in()?POLLIN:0)|(ssl->want_out()?POLLOUT:0); }
Packit 8f70b4
   int block_mask() const { int wm=want_mask(); return wm?wm:POLLIN; }
Packit 8f70b4
   int dir_mask() const { return (mode==GET?POLLIN:POLLOUT); }
Packit 8f70b4
Packit 8f70b4
public:
Packit 8f70b4
   IOBufferSSL(lftp_ssl *s,dir_t m) : IOBuffer(m), my_ssl(s), ssl(my_ssl) {}
Packit 8f70b4
   IOBufferSSL(const Ref<lftp_ssl>& s,dir_t m) : IOBuffer(m), ssl(s) {}
Packit 8f70b4
   ~IOBufferSSL();
Packit 8f70b4
   int Do();
Packit 8f70b4
   bool Done() { return IOBuffer::Done() && ssl->handshake_done; }
Packit 8f70b4
};
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#endif//BUFFER_SSL_H