Lines Matching defs:connection

30 #include "connection.h"
40 * @param connection connection to handshake on
46 run_tls_handshake (struct MHD_Connection *connection)
49 connection->last_activity = MHD_monotonic_time();
50 if (connection->state == MHD_TLS_CONNECTION_INIT)
52 ret = SSL_accept (connection->tls_session);
55 /* set connection state to enable HTTP processing */
56 connection->state = MHD_CONNECTION_INIT;
59 int error = SSL_get_error (connection->tls_session, ret);
68 MHD_DLOG (connection->daemon,
71 MHD_connection_close (connection,
80 * This function handles a particular SSL/TLS connection when
87 * connection to be terminated.
92 * @param connection the source connection
93 * @return always #MHD_YES (we should continue to process the connection)
96 MHD_tls_connection_handle_read (struct MHD_Connection *connection)
98 if (MHD_YES == run_tls_handshake (connection))
100 return MHD_connection_handle_read (connection);
108 * the connection has been marked for closing.
110 * @return always #MHD_YES (we should continue to process the connection)
113 MHD_tls_connection_handle_write (struct MHD_Connection *connection)
115 if (MHD_YES == run_tls_handshake (connection))
117 return MHD_connection_handle_write (connection);
122 * This function was created to handle per-connection processing that
127 * @param connection being handled
129 * connection (not dead yet), #MHD_NO if it died
132 MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
137 MHD_DLOG (connection->daemon,
140 MHD_state_to_string (connection->state));
142 timeout = connection->connection_timeout;
143 if ( (timeout != 0) && (timeout <= (MHD_monotonic_time() - connection->last_activity)))
144 MHD_connection_close (connection,
146 switch (connection->state)
151 /* close connection if necessary */
153 SSL_shutdown (connection->tls_session);
154 return MHD_connection_handle_idle (connection);
156 if ( (0 != SSL_pending (connection->tls_session)) &&
157 (MHD_YES != MHD_tls_connection_handle_read (connection)) )
159 return MHD_connection_handle_idle (connection);
162 return MHD_connection_epoll_update_ (connection);
170 * Set connection callback function to be used through out
171 * the processing of this secure connection.
173 * @param connection which callbacks should be modified
176 MHD_set_https_callbacks (struct MHD_Connection *connection)
178 connection->read_handler = &MHD_tls_connection_handle_read;
179 connection->write_handler = &MHD_tls_connection_handle_write;
180 connection->idle_handler = &MHD_tls_connection_handle_idle;