Blame src/buffer_ssl.h

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