Lines Matching refs:conn

63     APP_CONN *conn;  local
69 conn = calloc(1, sizeof(APP_CONN));
70 if (conn == NULL)
73 ssl = conn->ssl = SSL_new(ctx);
75 free(conn);
87 free(conn);
95 free(conn);
101 free(conn);
108 free(conn);
128 conn->ssl_bio = ssl_bio;
129 conn->net_bio = net_bio;
130 return conn;
139 int tx(APP_CONN *conn, const void *buf, int buf_len) argument
143 l = BIO_write(conn->ssl_bio, buf, buf_len);
145 rc = SSL_get_error(conn->ssl, l);
148 conn->tx_need_rx = 1;
156 conn->tx_need_rx = 0;
168 int rx(APP_CONN *conn, void *buf, int buf_len) argument
172 l = BIO_read(conn->ssl_bio, buf, buf_len);
174 rc = SSL_get_error(conn->ssl, l);
177 conn->rx_need_tx = 1;
184 conn->rx_need_tx = 0;
198 int read_net_tx(APP_CONN *conn, void *buf, int buf_len) argument
200 return BIO_read(conn->net_bio, buf, buf_len);
209 int write_net_rx(APP_CONN *conn, const void *buf, int buf_len) argument
211 return BIO_write(conn->net_bio, buf, buf_len);
217 size_t net_rx_space(APP_CONN *conn) argument
219 return BIO_ctrl_get_write_guarantee(conn->net_bio);
226 size_t net_tx_avail(APP_CONN *conn) argument
228 return BIO_ctrl_pending(conn->net_bio);
244 int get_conn_pending_tx(APP_CONN *conn) argument
247 return (SSL_net_read_desired(conn->ssl) ? POLLIN : 0)
248 | (SSL_net_write_desired(conn->ssl) ? POLLOUT : 0)
251 return (conn->tx_need_rx ? POLLIN : 0) | POLLOUT | POLLERR;
255 int get_conn_pending_rx(APP_CONN *conn) argument
258 return get_conn_pending_tx(conn);
260 return (conn->rx_need_tx ? POLLOUT : 0) | POLLIN | POLLERR;
268 void teardown(APP_CONN *conn) argument
270 BIO_free_all(conn->ssl_bio);
271 BIO_free_all(conn->net_bio);
272 free(conn);
297 static int pump(APP_CONN *conn, int fd, int events, int timeout) argument
306 if (net_rx_space(conn) == 0)
308 if (net_tx_avail(conn) > 0)
318 while ((wspace = net_rx_space(conn)) > 0) {
333 l2 = write_net_rx(conn, buf, l);
341 l = read_net_tx(conn, buf, sizeof(buf));
361 APP_CONN *conn = NULL; local
413 conn = new_conn(ctx, argv[1]);
414 if (conn == NULL) {
421 l = tx(conn, tx_p, tx_len);
428 if (pump(conn, fd, get_conn_pending_tx(conn), timeout) != 1) {
437 l = rx(conn, rx_buf, sizeof(rx_buf));
443 if (pump(conn, fd, get_conn_pending_rx(conn), timeout) != 1) {
452 if (conn != NULL)
453 teardown(conn);