Lines Matching defs:bio
27 #include <openssl/bio.h>
36 BIOPointer bio(BIO_new(GetMethod()));
37 if (bio && env != nullptr)
38 NodeBIO::FromBIO(bio.get())->env_ = env;
39 return bio;
44 BIOPointer bio = New(env);
46 if (!bio ||
48 BIO_write(bio.get(), data, len) != static_cast<int>(len) ||
49 BIO_set_mem_eof_return(bio.get(), 0) != 1) {
53 return bio;
57 int NodeBIO::New(BIO* bio) {
58 BIO_set_data(bio, new NodeBIO());
59 BIO_set_init(bio, 1);
65 int NodeBIO::Free(BIO* bio) {
66 if (bio == nullptr)
69 if (BIO_get_shutdown(bio)) {
70 if (BIO_get_init(bio) && BIO_get_data(bio) != nullptr) {
71 delete FromBIO(bio);
72 BIO_set_data(bio, nullptr);
80 int NodeBIO::Read(BIO* bio, char* out, int len) {
81 BIO_clear_retry_flags(bio);
83 NodeBIO* nbio = FromBIO(bio);
89 BIO_set_retry_read(bio);
130 int NodeBIO::Write(BIO* bio, const char* data, int len) {
131 BIO_clear_retry_flags(bio);
133 FromBIO(bio)->Write(data, len);
139 int NodeBIO::Puts(BIO* bio, const char* str) {
140 return Write(bio, str, strlen(str));
144 int NodeBIO::Gets(BIO* bio, char* out, int size) {
145 NodeBIO* nbio = FromBIO(bio);
169 long NodeBIO::Ctrl(BIO* bio, int cmd, long num, // NOLINT(runtime/int)
174 nbio = FromBIO(bio);
197 ret = BIO_get_shutdown(bio);
200 BIO_set_shutdown(bio, num);
493 NodeBIO* NodeBIO::FromBIO(BIO* bio) {
494 CHECK_NOT_NULL(BIO_get_data(bio));
495 return static_cast<NodeBIO*>(BIO_get_data(bio));