Lines Matching defs:bev
287 struct bufferevent_private bev;
336 evutil_offsetof(struct bufferevent_openssl, bev.bev),
348 upcast(struct bufferevent *bev)
351 if (bev->be_ops != &bufferevent_ops_openssl)
353 bev_o = (void*)( ((char*)bev) -
354 evutil_offsetof(struct bufferevent_openssl, bev.bev));
355 EVUTIL_ASSERT(bev_o->bev.bev.be_ops == &bufferevent_ops_openssl);
383 struct bufferevent *bev = &bev_ssl->bev.bev;
385 r = _bufferevent_add_event(&bev->ev_read, &bev->timeout_read);
387 r = _bufferevent_add_event(&bev->ev_write,
388 &bev->timeout_write);
403 struct bufferevent *bev = &bev_ssl->bev.bev;
404 r = _bufferevent_add_event(&bev->ev_write, &bev->timeout_write);
406 r = _bufferevent_add_event(&bev->ev_read,
407 &bev->timeout_read);
421 struct bufferevent *bev = &bev_ssl->bev.bev;
422 event_del(&bev->ev_read);
434 struct bufferevent *bev = &bev_ssl->bev.bev;
435 event_del(&bev->ev_write);
460 struct bufferevent *bev = &bev_ssl->bev.bev;
463 if (!(bev->enabled & EV_WRITE))
465 if (bev->enabled & EV_READ)
474 struct bufferevent *bev = &bev_ssl->bev.bev;
477 if (!(bev->enabled & EV_READ))
479 if (bev->enabled & EV_WRITE)
531 _bufferevent_run_eventcb(&bev_ssl->bev.bev, event);
552 _bufferevent_decrement_write_buckets(&bev_ssl->bev, w);
554 _bufferevent_decrement_read_buckets(&bev_ssl->bev, r);
568 struct bufferevent *bev = &bev_ssl->bev.bev;
569 struct evbuffer *input = bev->input;
574 if (bev_ssl->bev.read_suspended)
577 atmost = _bufferevent_get_read_max(&bev_ssl->bev);
586 if (bev_ssl->bev.read_suspended)
626 BEV_RESET_GENERIC_READ_TIMEOUT(bev);
638 struct bufferevent *bev = &bev_ssl->bev.bev;
639 struct evbuffer *output = bev->output;
646 atmost = _bufferevent_get_write_max(&bev_ssl->bev);
655 if (bev_ssl->bev.write_suspended)
705 BEV_RESET_GENERIC_WRITE_TIMEOUT(bev);
707 if (evbuffer_get_length(output) <= bev->wm_write.low)
708 _bufferevent_run_writecb(bev);
720 bytes_to_read(struct bufferevent_openssl *bev)
722 struct evbuffer *input = bev->bev.bev.input;
723 struct event_watermark *wm = &bev->bev.bev.wm_read;
729 if (bev->write_blocked_on_read) {
733 if (! (bev->bev.bev.enabled & EV_READ)) {
737 if (bev->bev.read_suspended) {
752 limit = _bufferevent_get_read_max(&bev->bev);
789 if (bev_ssl->bev.read_suspended)
821 struct bufferevent *bev = &bev_ssl->bev.bev;
822 struct evbuffer *input = bev->input;
824 if (evbuffer_get_length(input) >= bev->wm_read.low) {
825 _bufferevent_run_readcb(bev);
831 if (bev_ssl->bev.read_suspended ||
832 !(bev_ssl->bev.bev.enabled & EV_READ)) {
833 event_del(&bev_ssl->bev.bev.ev_read);
842 struct evbuffer *output = bev_ssl->bev.bev.output;
849 struct bufferevent *bev = &bev_ssl->bev.bev;
850 struct evbuffer *input = bev->input;
852 if (evbuffer_get_length(input) >= bev->wm_read.low) {
853 _bufferevent_run_readcb(bev);
865 while ((bev_ssl->bev.bev.enabled & EV_WRITE) &&
866 (! bev_ssl->bev.write_suspended) &&
881 event_del(&bev_ssl->bev.bev.ev_write);
882 } else if (bev_ssl->bev.write_suspended ||
883 !(bev_ssl->bev.bev.enabled & EV_WRITE)) {
885 event_del(&bev_ssl->bev.bev.ev_write);
926 _bufferevent_run_eventcb(&bev_ssl->bev.bev, event);
933 _bufferevent_incref_and_lock(&bev_ssl->bev.bev);
935 _bufferevent_run_eventcb(&bev_ssl->bev.bev,
940 _bufferevent_decref_and_unlock(&bev_ssl->bev.bev);
947 _bufferevent_incref_and_lock(&bev_ssl->bev.bev);
949 _bufferevent_run_eventcb(&bev_ssl->bev.bev,
954 _bufferevent_decref_and_unlock(&bev_ssl->bev.bev);
966 struct bufferevent *bev = &bev_ssl->bev.bev;
969 fd = event_get_fd(&bev->ev_read);
971 rpending = event_pending(&bev->ev_read, EV_READ, NULL);
972 wpending = event_pending(&bev->ev_write, EV_WRITE, NULL);
973 event_del(&bev->ev_read);
974 event_del(&bev->ev_write);
976 event_assign(&bev->ev_read, bev->ev_base, fd,
978 event_assign(&bev->ev_write, bev->ev_base, fd,
981 r1 = _bufferevent_add_event(&bev->ev_read, &bev->timeout_read);
983 r2 = _bufferevent_add_event(&bev->ev_write, &bev->timeout_write);
1013 bufferevent_enable(&bev_ssl->bev.bev, bev_ssl->bev.bev.enabled);
1014 _bufferevent_run_eventcb(&bev_ssl->bev.bev,
1052 _bufferevent_incref_and_lock(&bev_ssl->bev.bev);
1054 _bufferevent_run_eventcb(&bev_ssl->bev.bev, BEV_EVENT_TIMEOUT);
1057 _bufferevent_decref_and_unlock(&bev_ssl->bev.bev);
1070 struct bufferevent *bev = &bev_ssl->bev.bev;
1073 fd = event_get_fd(&bev->ev_read);
1075 event_del(&bev->ev_read);
1076 event_del(&bev->ev_write);
1078 event_assign(&bev->ev_read, bev->ev_base, fd,
1080 event_assign(&bev->ev_write, bev->ev_base, fd,
1083 r1 = _bufferevent_add_event(&bev->ev_read, &bev->timeout_read);
1084 r2 = _bufferevent_add_event(&bev->ev_write, &bev->timeout_write);
1092 bufferevent_ssl_renegotiate(struct bufferevent *bev)
1094 struct bufferevent_openssl *bev_ssl = upcast(bev);
1117 r = _bufferevent_add_event(&bev_ssl->bev.bev.ev_write,
1118 &bev_ssl->bev.bev.timeout_write);
1127 be_openssl_enable(struct bufferevent *bev, short events)
1129 struct bufferevent_openssl *bev_ssl = upcast(bev);
1142 BEV_RESET_GENERIC_READ_TIMEOUT(bev);
1144 BEV_RESET_GENERIC_WRITE_TIMEOUT(bev);
1155 be_openssl_disable(struct bufferevent *bev, short events)
1157 struct bufferevent_openssl *bev_ssl = upcast(bev);
1168 BEV_DEL_GENERIC_READ_TIMEOUT(bev);
1170 BEV_DEL_GENERIC_WRITE_TIMEOUT(bev);
1176 be_openssl_destruct(struct bufferevent *bev)
1178 struct bufferevent_openssl *bev_ssl = upcast(bev);
1181 _bufferevent_del_generic_timeout_cbs(bev);
1183 event_del(&bev->ev_read);
1184 event_del(&bev->ev_write);
1187 if (bev_ssl->bev.options & BEV_OPT_CLOSE_ON_FREE) {
1217 be_openssl_adj_timeouts(struct bufferevent *bev)
1219 struct bufferevent_openssl *bev_ssl = upcast(bev);
1222 return _bufferevent_generic_adj_timeouts(bev);
1225 if (event_pending(&bev->ev_read, EV_READ, NULL))
1226 r1 = _bufferevent_add_event(&bev->ev_read, &bev->timeout_read);
1227 if (event_pending(&bev->ev_write, EV_WRITE, NULL))
1228 r2 = _bufferevent_add_event(&bev->ev_write, &bev->timeout_write);
1242 be_openssl_ctrl(struct bufferevent *bev,
1245 struct bufferevent_openssl *bev_ssl = upcast(bev);
1266 data->fd = event_get_fd(&bev->ev_read);
1306 bev_p = &bev_ssl->bev;
1319 bev_ssl->outbuf_cb = evbuffer_add_cb(bev_p->bev.output,
1323 bufferevent_enable_locking(&bev_ssl->bev.bev, NULL);
1326 _bufferevent_init_generic_timeout_cbs(&bev_ssl->bev.bev);
1361 bev_ssl->bev.bev.enabled = EV_READ|EV_WRITE;
1364 if (event_add(&bev_ssl->bev.bev.ev_read, NULL) < 0)
1366 if (event_add(&bev_ssl->bev.bev.ev_write, NULL) < 0)
1371 return &bev_ssl->bev.bev;
1374 bufferevent_free(&bev_ssl->bev.bev);
1443 bufferevent_get_openssl_error(struct bufferevent *bev)
1447 BEV_LOCK(bev);
1448 bev_ssl = upcast(bev);
1452 BEV_UNLOCK(bev);