3 #include <openssl/bio.h>
5 #define BIO_TYPE_CUSTOM 0xff
9 static const int typeID = BIO_TYPE_CUSTOM;
10 virtual ~OpensslBIO();
12 virtual int write( const char* buf, int num ) = 0;
13 virtual int read( char* buf, int size ) = 0;
14 virtual int puts( const char* str );
15 virtual int gets( char* str, int size );
16 virtual long ctrl( int cmod, long arg1, void* arg2 ) = 0;
19 namespace BIOWrapper {
21 int write( BIO* b, const char* buf, int num );
23 int read( BIO* b, char* buf, int size );
25 int puts( BIO* b, const char* str );
27 int gets( BIO* b, char* str, int size );
29 long ctrl( BIO* b, int cmod, long arg1, void* arg2 );
32 int bio_new( BIO* b ) {
45 return toBio<T>( BIOWrapper::bio_new<T> );
49 BIO_METHOD* toBio( int ( *newfunc )( BIO* ) ) {
50 static BIO_METHOD new_method = {