X-Git-Url: https://code.wpia.club/?p=cassiopeia.git;a=blobdiff_plain;f=src%2Fio%2Fbios.h;fp=src%2Fio%2Fbios.h;h=b866264a3e802b0c64cdf6e05f1da369e311b00a;hp=3bbb66b02b660f245bf959a6bbd3f946c2c9b3f9;hb=da9f337a893bd317460118f89efa83a3427f797f;hpb=23987db96db7962a6ee58d1aeda2bd87780ca579 diff --git a/src/io/bios.h b/src/io/bios.h index 3bbb66b..b866264 100644 --- a/src/io/bios.h +++ b/src/io/bios.h @@ -3,23 +3,23 @@ #include struct bio_st { - const BIO_METHOD *method; - /* bio, mode, argp, argi, argl, ret */ - long (*callback) (struct bio_st *, int, const char *, int, long, long); - char *cb_arg; /* first argument for the callback */ - int init; - int shutdown; - int flags; /* extra storage */ - int retry_reason; - int num; - void *ptr; - struct bio_st *next_bio; /* used by filter BIOs */ - struct bio_st *prev_bio; /* used by filter BIOs */ - int references; - uint64_t num_read; - uint64_t num_write; - CRYPTO_EX_DATA ex_data; - CRYPTO_RWLOCK *lock; + const BIO_METHOD *method; + /* bio, mode, argp, argi, argl, ret */ + long ( *callback )( struct bio_st *, int, const char *, int, long, long ); + char *cb_arg; /* first argument for the callback */ + int init; + int shutdown; + int flags; /* extra storage */ + int retry_reason; + int num; + void *ptr; + struct bio_st *next_bio; /* used by filter BIOs */ + struct bio_st *prev_bio; /* used by filter BIOs */ + int references; + uint64_t num_read; + uint64_t num_write; + CRYPTO_EX_DATA ex_data; + CRYPTO_RWLOCK *lock; }; @@ -30,44 +30,44 @@ public: static const int typeID = BIO_TYPE_CUSTOM; virtual ~OpensslBIO(); - virtual int write( const char* buf, int num ) = 0; - virtual int read( char* buf, int size ) = 0; - virtual int puts( const char* str ); - virtual int gets( char* str, int size ); - virtual long ctrl( int cmod, long arg1, void* arg2 ) = 0; + virtual int write( const char *buf, int num ) = 0; + virtual int read( char *buf, int size ) = 0; + virtual int puts( const char *str ); + virtual int gets( char *str, int size ); + virtual long ctrl( int cmod, long arg1, void *arg2 ) = 0; }; namespace BIOWrapper { - int write( BIO* b, const char* buf, int num ); + int write( BIO *b, const char *buf, int num ); - int read( BIO* b, char* buf, int size ); + int read( BIO *b, char *buf, int size ); - int puts( BIO* b, const char* str ); + int puts( BIO *b, const char *str ); - int gets( BIO* b, char* str, int size ); + int gets( BIO *b, char *str, int size ); - long ctrl( BIO* b, int cmod, long arg1, void* arg2 ); + long ctrl( BIO *b, int cmod, long arg1, void *arg2 ); template - int bio_new( BIO* b ) { + int bio_new( BIO *b ) { b->init = 1; b->num = 0; b->ptr = new T(); return 1; } - int free( BIO* b ); + int free( BIO *b ); } template -BIO_METHOD* toBio() { +BIO_METHOD *toBio() { return toBio( BIOWrapper::bio_new ); } template -BIO_METHOD* toBio( int ( *newfunc )( BIO* ) ) { +BIO_METHOD *toBio( int ( *newfunc )( BIO * ) ) { BIO_METHOD *meth = BIO_meth_new( T::typeID, T::getName() ); BIO_meth_set_write( meth, BIOWrapper::write ); BIO_meth_set_read( meth, BIOWrapper::read );