]> WPIA git - cassiopeia.git/blob - src/io/opensslBIO.h
1cf96f89a82c6cefe96223552d004778a9970059
[cassiopeia.git] / src / io / opensslBIO.h
1 #pragma once
2
3 #include <memory>
4 #include "bios.h"
5 #include <vector>
6 #include <exception>
7
8 class OpensslBIOWrapper : public OpensslBIO {
9 private:
10     std::shared_ptr<BIO> b;
11     std::vector<char> buffer;
12     int pos = 0;
13 public:
14     OpensslBIOWrapper( std::shared_ptr<BIO> b );
15     virtual ~OpensslBIOWrapper();
16
17     int write( const char* buf, int num );
18     int read( char* buf, int size );
19     long ctrl( int cmod, long arg1, void* arg2 );
20
21     int puts( const char* str );
22     int gets( char* str, int size );
23
24     static const char* getName();
25
26     std::string readLine();
27 };
28
29 class eof_exception : public std::exception {
30 };