io.h 683 B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include <library/cpp/openssl/holders/bio.h>
  3. namespace NOpenSSL {
  4. class TAbstractIO {
  5. public:
  6. TAbstractIO();
  7. virtual ~TAbstractIO();
  8. virtual int Write(const char* data, size_t dlen, size_t* written) = 0;
  9. virtual int Read(char* data, size_t dlen, size_t* readbytes) = 0;
  10. virtual int Puts(const char* buf) = 0;
  11. virtual int Gets(char* buf, int size) = 0;
  12. virtual long Ctrl(int cmd, long larg, void* parg);
  13. virtual void Flush() = 0;
  14. int WriteOld(const char* data, int dlen);
  15. int ReadOld(char* data, int dlen);
  16. inline operator BIO* () noexcept {
  17. return Bio;
  18. }
  19. private:
  20. BIO* Bio;
  21. };
  22. } // namespace NOpenSSL