aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/openssl/method/io.h
blob: f1d3df978d73cce334f0ff4de2e967b3ee0a73f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include <library/cpp/openssl/holders/bio.h>

namespace NOpenSSL {

class TAbstractIO {
public:
    TAbstractIO();
    virtual ~TAbstractIO();

    virtual int Write(const char* data, size_t dlen, size_t* written) = 0;
    virtual int Read(char* data, size_t dlen, size_t* readbytes) = 0;
    virtual int Puts(const char* buf) = 0;
    virtual int Gets(char* buf, int size) = 0;

    virtual long Ctrl(int cmd, long larg, void* parg);
    virtual void Flush() = 0;

    int WriteOld(const char* data, int dlen);
    int ReadOld(char* data, int dlen);

    inline operator BIO* () noexcept {
        return Bio;
    }

private:
    BIO* Bio;
};

} // namespace NOpenSSL