Lines Matching refs:conn

58     APP_CONN *conn;  in new_conn()  local
64 conn = calloc(1, sizeof(APP_CONN)); in new_conn()
65 if (conn == NULL) in new_conn()
68 ssl = conn->ssl = SSL_new(ctx); in new_conn()
70 free(conn); in new_conn()
78 free(conn); in new_conn()
84 free(conn); in new_conn()
90 free(conn); in new_conn()
99 free(conn); in new_conn()
104 conn->fd = fd; in new_conn()
105 return conn; in new_conn()
114 int tx(APP_CONN *conn, const void *buf, int buf_len) in tx() argument
118 conn->tx_need_rx = 0; in tx()
120 l = SSL_write(conn->ssl, buf, buf_len); in tx()
122 rc = SSL_get_error(conn->ssl, l); in tx()
125 conn->tx_need_rx = 1; in tx()
143 int rx(APP_CONN *conn, void *buf, int buf_len) in rx() argument
147 conn->rx_need_tx = 0; in rx()
149 l = SSL_read(conn->ssl, buf, buf_len); in rx()
151 rc = SSL_get_error(conn->ssl, l); in rx()
154 conn->rx_need_tx = 1; in rx()
180 int get_conn_fd(APP_CONN *conn) in get_conn_fd() argument
182 return conn->fd; in get_conn_fd()
198 int get_conn_pending_tx(APP_CONN *conn) in get_conn_pending_tx() argument
201 return (SSL_net_read_desired(conn->ssl) ? POLLIN : 0) in get_conn_pending_tx()
202 | (SSL_net_write_desired(conn->ssl) ? POLLOUT : 0) in get_conn_pending_tx()
205 return (conn->tx_need_rx ? POLLIN : 0) | POLLOUT | POLLERR; in get_conn_pending_tx()
209 int get_conn_pending_rx(APP_CONN *conn) in get_conn_pending_rx() argument
211 return get_conn_pending_tx(conn); in get_conn_pending_rx()
223 int get_conn_pump_timeout(APP_CONN *conn) in get_conn_pump_timeout() argument
228 if (!SSL_get_event_timeout(conn->ssl, &tv, &is_infinite)) in get_conn_pump_timeout()
238 void pump(APP_CONN *conn) in pump() argument
240 SSL_handle_events(conn->ssl); in pump()
248 void teardown(APP_CONN *conn) in teardown() argument
250 SSL_shutdown(conn->ssl); in teardown()
251 SSL_free(conn->ssl); in teardown()
252 free(conn); in teardown()
306 APP_CONN *conn = NULL; in main() local
361 conn = new_conn(ctx, fd, argv[1]); in main()
362 if (conn == NULL) { in main()
369 l = tx(conn, tx_p, tx_len); in main()
383 ms_to_timeval(&t, get_conn_pump_timeout(conn)); in main()
391 pfd.fd = get_conn_fd(conn); in main()
392 pfd.events = get_conn_pending_tx(conn); in main()
400 pump(conn); in main()
415 l = rx(conn, rx_buf, sizeof(rx_buf)); in main()
427 ms_to_timeval(&t, get_conn_pump_timeout(conn)); in main()
435 pfd.fd = get_conn_fd(conn); in main()
436 pfd.events = get_conn_pending_rx(conn); in main()
444 pump(conn); in main()
458 if (conn != NULL) in main()
459 teardown(conn); in main()