Lines Matching defs:bio

57 #include <openssl/bio.h>
97 static int mem_new(BIO *bio) {
107 bio->shutdown = 1;
108 bio->init = 1;
109 bio->num = -1;
110 bio->ptr = (char *)b;
115 static int mem_free(BIO *bio) {
118 if (bio == NULL) {
122 if (!bio->shutdown || !bio->init || bio->ptr == NULL) {
126 b = (BUF_MEM *)bio->ptr;
127 if (bio->flags & BIO_FLAGS_MEM_RDONLY) {
131 bio->ptr = NULL;
135 static int mem_read(BIO *bio, char *out, int outl) {
137 BUF_MEM *b = (BUF_MEM*) bio->ptr;
139 BIO_clear_retry_flags(bio);
148 if (bio->flags & BIO_FLAGS_MEM_RDONLY) {
154 ret = bio->num;
156 BIO_set_retry_read(bio);
162 static int mem_write(BIO *bio, const char *in, int inl) {
167 b = (BUF_MEM *)bio->ptr;
169 if (bio->flags & BIO_FLAGS_MEM_RDONLY) {
174 BIO_clear_retry_flags(bio);
193 static int mem_gets(BIO *bio, char *buf, int size) {
196 BUF_MEM *b = (BUF_MEM *)bio->ptr;
198 BIO_clear_retry_flags(bio);
221 i = mem_read(bio, buf, i);
228 static long mem_ctrl(BIO *bio, int cmd, long num, void *ptr) {
232 BUF_MEM *b = (BUF_MEM *)bio->ptr;
238 if (bio->flags & BIO_FLAGS_MEM_RDONLY) {
251 bio->num = (int)num;
261 mem_free(bio);
262 bio->shutdown = (int)num;
263 bio->ptr = ptr;
272 ret = (long)bio->shutdown;
275 bio->shutdown = (int)num;
300 int BIO_mem_contents(const BIO *bio, const uint8_t **out_contents,
303 if (bio->method != &mem_method) {
307 b = (BUF_MEM *)bio->ptr;
313 long BIO_get_mem_data(BIO *bio, char **contents) {
314 return BIO_ctrl(bio, BIO_CTRL_INFO, 0, (char *) contents);
317 int BIO_get_mem_ptr(BIO *bio, BUF_MEM **out) {
318 return BIO_ctrl(bio, BIO_C_GET_BUF_MEM_PTR, 0, (char *) out);
321 int BIO_set_mem_buf(BIO *bio, BUF_MEM *b, int take_ownership) {
322 return BIO_ctrl(bio, BIO_C_SET_BUF_MEM, take_ownership, (char *) b);
325 int BIO_set_mem_eof_return(BIO *bio, int eof_value) {
326 return BIO_ctrl(bio, BIO_C_SET_BUF_MEM_EOF_RETURN, eof_value, NULL);