connection.h File Reference

Methods for managing connections. More...

#include "internal.h"

Include dependency graph for connection.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int MHD_connection_get_fdset (struct MHD_Connection *connection, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, int *max_fd)
int MHD_connection_get_pollfd (struct MHD_Connection *connection, struct MHD_Pollfd *p)
void MHD_set_http_callbacks_ (struct MHD_Connection *connection)
int MHD_connection_handle_read (struct MHD_Connection *connection)
int MHD_connection_handle_write (struct MHD_Connection *connection)
int MHD_connection_handle_idle (struct MHD_Connection *connection)
void MHD_connection_close (struct MHD_Connection *connection, enum MHD_RequestTerminationCode termination_code)


Detailed Description

Methods for managing connections.

Author:
Daniel Pittman

Christian Grothoff

Definition in file connection.h.


Function Documentation

void MHD_connection_close ( struct MHD_Connection connection,
enum MHD_RequestTerminationCode  termination_code 
)

Close the given connection and give the specified termination code to the user.

Parameters:
connection connection to close
termination_code termination reason to give

Definition at line 305 of file connection.c.

References MHD_Connection::client_aware, MHD_Connection::client_context, MHD_Connection::daemon, MHD_CONNECTION_CLOSED, MHD_NO, MHD_YES, MHD_Daemon::notify_completed, MHD_Daemon::notify_completed_cls, NULL, MHD_Connection::read_closed, SHUTDOWN, MHD_Connection::socket_fd, and MHD_Connection::state.

Referenced by close_all_connections(), connection_close_error(), MHD_connection_handle_idle(), MHD_connection_handle_read(), MHD_handle_connection(), MHD_tls_connection_handle_idle(), and run_tls_handshake().

Here is the caller graph for this function:

int MHD_connection_get_fdset ( struct MHD_Connection connection,
fd_set *  read_fd_set,
fd_set *  write_fd_set,
fd_set *  except_fd_set,
int *  max_fd 
)

Obtain the select sets for this connection. The given sets (and the maximum) are updated and must have already been initialized.

Parameters:
connection connetion to get select sets for
read_fd_set read set to initialize
write_fd_set write set to initialize
except_fd_set except set to initialize (never changed)
max_fd where to store largest FD put into any set
Returns:
MHD_YES on success

Definition at line 831 of file connection.c.

References add_to_fd_set(), MHD_Pollfd::events, MHD_Pollfd::fd, MHD_connection_get_pollfd(), MHD_POLL_ACTION_IN, MHD_POLL_ACTION_OUT, and MHD_YES.

Referenced by MHD_get_fdset(), and MHD_handle_connection().

Here is the call graph for this function:

Here is the caller graph for this function:

int MHD_connection_get_pollfd ( struct MHD_Connection connection,
struct MHD_Pollfd p 
)

Obtain the pollfd for this connection

Parameters:
connection connetion to get poll set for
p where to store the polling information
Returns:
MHD_YES on success. If return MHD_YES and p->fd < 0, this connection is not waiting for any read or write events

Definition at line 863 of file connection.c.

References CONNECTION_CLOSE_ERROR, MHD_Connection::daemon, MHD_Pollfd::events, EXTRA_CHECK, MHD_Pollfd::fd, INTERNAL_ERROR, MHD_CONNECTION_BODY_RECEIVED, MHD_CONNECTION_BODY_SENT, MHD_CONNECTION_CHUNKED_BODY_READY, MHD_CONNECTION_CHUNKED_BODY_UNREADY, MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_FOOTERS_RECEIVED, MHD_CONNECTION_FOOTERS_SENDING, MHD_CONNECTION_FOOTERS_SENT, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_HEADERS_SENDING, MHD_CONNECTION_HEADERS_SENT, MHD_CONNECTION_INIT, MHD_CONNECTION_NORMAL_BODY_READY, MHD_CONNECTION_NORMAL_BODY_UNREADY, MHD_CONNECTION_URL_RECEIVED, MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_REQUEST_ENTITY_TOO_LARGE, MHD_HTTP_REQUEST_URI_TOO_LONG, MHD_NO, MHD_POLL_ACTION_IN, MHD_POLL_ACTION_OUT, MHD_pool_create(), MHD_TLS_CONNECTION_INIT, MHD_USE_SELECT_INTERNALLY, MHD_USE_THREAD_PER_CONNECTION, MHD_YES, NULL, MHD_Connection::pool, MHD_Daemon::pool_size, MHD_Connection::read_buffer_offset, MHD_Connection::read_buffer_size, MHD_Connection::read_closed, REQUEST_TOO_BIG, MHD_Connection::socket_fd, MHD_Connection::state, transmit_error_response(), and try_grow_read_buffer().

Referenced by MHD_connection_get_fdset(), and MHD_handle_connection().

Here is the call graph for this function:

Here is the caller graph for this function:

int MHD_connection_handle_idle ( struct MHD_Connection connection  ) 

This function was created to handle per-connection processing that has to happen even if the socket cannot be read or written to. All implementations (multithreaded, external select, internal select) call this function.

Parameters:
connection connection to handle
Returns:
MHD_YES if we should continue to process the connection (not dead yet), MHD_NO if it died

Definition at line 2075 of file connection.c.

References build_header_response(), call_connection_handler(), MHD_Daemon::cleanup_connection_mutex, MHD_Daemon::cleanup_head, MHD_Daemon::cleanup_tail, CONNECTION_CLOSE_ERROR, MHD_Connection::connection_timeout, MHD_Daemon::connections_head, MHD_Daemon::connections_tail, MHD_Connection::daemon, DLL_insert, DLL_remove, EXTRA_CHECK, get_next_header_line(), HTTP_100_CONTINUE, MHD_Connection::last_activity, MHD_CONNECTION_BODY_RECEIVED, MHD_CONNECTION_BODY_SENT, MHD_CONNECTION_CHUNKED_BODY_READY, MHD_CONNECTION_CHUNKED_BODY_UNREADY, MHD_connection_close(), MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_FOOTERS_RECEIVED, MHD_CONNECTION_FOOTERS_SENDING, MHD_CONNECTION_FOOTERS_SENT, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_HEADERS_SENDING, MHD_CONNECTION_HEADERS_SENT, MHD_CONNECTION_INIT, MHD_CONNECTION_NORMAL_BODY_READY, MHD_CONNECTION_NORMAL_BODY_UNREADY, MHD_CONNECTION_URL_RECEIVED, MHD_destroy_response(), MHD_FOOTER_KIND, MHD_get_response_header(), MHD_HEADER_KIND, MHD_HTTP_BAD_REQUEST, MHD_HTTP_HEADER_CONNECTION, MHD_HTTP_VERSION_1_1, MHD_lookup_connection_value(), MHD_monotonic_time(), MHD_NO, MHD_PANIC, MHD_pool_destroy(), MHD_pool_reset(), MHD_REQUEST_TERMINATED_COMPLETED_OK, MHD_REQUEST_TERMINATED_TIMEOUT_REACHED, MHD_SIZE_UNKNOWN, MHD_YES, need_100_continue(), MHD_Daemon::notify_completed_cls, NULL, parse_connection_headers(), parse_initial_message_line(), process_broken_line(), process_header_line(), process_request_body(), MHD_Connection::read_closed, REQUEST_MALFORMED, MHD_Connection::state, transmit_error_response(), try_ready_chunked_body(), and try_ready_normal_body().

Referenced by MHD_set_http_callbacks_(), and MHD_tls_connection_handle_idle().

Here is the call graph for this function:

Here is the caller graph for this function:

int MHD_connection_handle_read ( struct MHD_Connection connection  ) 

This function handles a particular connection when it has been determined that there is data to be read off a socket. All implementations (multithreaded, external select, internal select) call this function to handle reads.

Parameters:
connection connection to handle
Returns:
always MHD_YES (we should continue to process the connection)

Definition at line 1853 of file connection.c.

References do_read(), MHD_Connection::last_activity, MHD_BUF_INC_SIZE, MHD_CONNECTION_BODY_RECEIVED, MHD_connection_close(), MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_INIT, MHD_CONNECTION_URL_RECEIVED, MHD_monotonic_time(), MHD_NO, MHD_pool_reallocate(), MHD_REQUEST_TERMINATED_READ_ERROR, MHD_YES, MHD_Connection::read_buffer_offset, MHD_Connection::read_buffer_size, MHD_Connection::state, and try_grow_read_buffer().

Referenced by MHD_set_http_callbacks_(), and MHD_tls_connection_handle_read().

Here is the call graph for this function:

Here is the caller graph for this function:

int MHD_connection_handle_write ( struct MHD_Connection connection  ) 

This function was created to handle writes to sockets when it has been determined that the socket can be written to. All implementations (multithreaded, external select, internal select) call this function

Parameters:
connection connection to handle
Returns:
always MHD_YES (we should continue to process the connection)

Definition at line 1917 of file connection.c.

References check_write_done(), CONNECTION_CLOSE_ERROR, MHD_Connection::continue_message_write_offset, MHD_Response::crc, MHD_Connection::daemon, MHD_Response::data, MHD_Response::data_size, MHD_Response::data_start, do_write(), EXTRA_CHECK, FPRINTF, HTTP_100_CONTINUE, MHD_Connection::last_activity, MHD_CONNECTION_BODY_RECEIVED, MHD_CONNECTION_BODY_SENT, MHD_CONNECTION_CHUNKED_BODY_READY, MHD_CONNECTION_CHUNKED_BODY_UNREADY, MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_FOOTERS_RECEIVED, MHD_CONNECTION_FOOTERS_SENDING, MHD_CONNECTION_FOOTERS_SENT, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_HEADERS_SENDING, MHD_CONNECTION_HEADERS_SENT, MHD_CONNECTION_INIT, MHD_CONNECTION_NORMAL_BODY_READY, MHD_CONNECTION_NORMAL_BODY_UNREADY, MHD_CONNECTION_URL_RECEIVED, MHD_monotonic_time(), MHD_TLS_CONNECTION_INIT, MHD_YES, MHD_Response::mutex, NULL, MHD_Connection::response, MHD_Connection::send_cls, MHD_Connection::state, STRERROR, and try_ready_normal_body().

Referenced by MHD_set_http_callbacks_(), and MHD_tls_connection_handle_write().

Here is the call graph for this function:

Here is the caller graph for this function:

void MHD_set_http_callbacks_ ( struct MHD_Connection connection  ) 

Set callbacks for this connection to those for HTTP.

Parameters:
connection connection to initialize

Definition at line 2453 of file connection.c.

References MHD_Connection::idle_handler, MHD_connection_handle_idle(), MHD_connection_handle_read(), MHD_connection_handle_write(), MHD_Connection::read_handler, and MHD_Connection::write_handler.

Referenced by MHD_add_connection().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Thu Sep 27 17:56:16 2012 for GNU libmicrohttpd by  doxygen 1.4.7