GNU libmicrohttpd
0.9.72
|
functions to add connection to our active set More...
#include "internal.h"
#include "connection_add.h"
#include "connection_call_handlers.h"
#include "connection_close.h"
#include "connection_finish_forward.h"
#include "connection_update_last_activity.h"
#include "daemon_ip_limit.h"
#include "daemon_select.h"
#include "daemon_poll.h"
#include "mhd_sockets.h"
Go to the source code of this file.
Macros | |
#define | EXTRA_SLOTS 0 |
Functions | |
static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ | thread_main_handle_connection (void *data) |
static ssize_t | recv_param_adapter (struct MHD_Connection *connection, void *other, size_t i) |
static ssize_t | send_param_adapter (struct MHD_Connection *connection, const void *other, size_t i) |
static enum MHD_StatusCode | internal_add_connection (struct MHD_Daemon *daemon, MHD_socket client_socket, const struct sockaddr *addr, socklen_t addrlen, bool external_add, bool non_blck) |
enum MHD_StatusCode | MHD_daemon_add_connection (struct MHD_Daemon *daemon, MHD_socket client_socket, const struct sockaddr *addr, socklen_t addrlen) |
enum MHD_StatusCode | MHD_accept_connection_ (struct MHD_Daemon *daemon) |
functions to add connection to our active set
Definition in file connection_add.c.
#define EXTRA_SLOTS 0 |
|
static |
Add another client connection to the set of connections managed by MHD. This API is usually not needed (since MHD will accept inbound connections on the server socket). Use this API in special cases, for example if your HTTP server is behind NAT and needs to connect out to the HTTP client.
The given client socket will be managed (and closed!) by MHD after this call and must no longer be used directly by the application afterwards.
daemon | daemon that manages the connection |
client_socket | socket to manage (MHD will expect to receive an HTTP request from this socket next). |
addr | IP address of the client |
addrlen | number of bytes in addr |
external_add | perform additional operations needed due to the application calling us directly |
non_blck | indicate that socket in non-blocking mode |
Definition at line 521 of file connection_add.c.
References MHD_EPOLL_STATE_WRITE_READY, MHD_ERR_AGAIN_, MHD_ERR_CONNRESET_, MHD_ERR_NOTCONN_, MHD_INVALID_SOCKET, MHD_REQUEST_CLOSED, MHD_SCKT_ECONNRESET_, MHD_SCKT_ERR_IS_, MHD_SCKT_ERR_IS_EAGAIN_, MHD_SCKT_ERR_IS_EINTR_, MHD_SCKT_SEND_MAX_SIZE_, MHD_send_, MHD_socket_get_error_, MHD_Connection::request, MHD_Connection::socket_fd, and MHD_Request::state.
enum MHD_StatusCode MHD_accept_connection_ | ( | struct MHD_Daemon * | daemon | ) |
Accept an incoming connection and create the MHD_Connection object for it. This function also enforces policy by way of checking with the accept policy callback.
daemon | handle with the listen socket |
Definition at line 521 of file connection_add.c.
|
static |
Callback for receiving data from the socket.
connection | the MHD connection structure |
other | where to write received data to |
i | maximum size of other (in bytes) |
Definition at line 468 of file connection_add.c.
References MHD_EPOLL_STATE_READ_READY, MHD_ERR_AGAIN_, MHD_ERR_CONNRESET_, MHD_ERR_NOTCONN_, MHD_INVALID_SOCKET, MHD_recv_, MHD_REQUEST_CLOSED, MHD_SCKT_ECONNRESET_, MHD_SCKT_ERR_IS_, MHD_SCKT_ERR_IS_EAGAIN_, MHD_SCKT_ERR_IS_EINTR_, MHD_SCKT_SEND_MAX_SIZE_, MHD_socket_get_error_, MHD_Connection::request, MHD_Connection::socket_fd, and MHD_Request::state.
|
static |
Callback for writing data to the socket.
connection | the MHD connection structure |
other | data to write |
i | number of bytes to write |
Definition at line 521 of file connection_add.c.
|
static |
Main function of the thread that handles an individual connection when MHD_USE_THREAD_PER_CONNECTION is set.
data | the struct MHD_Connection this thread will handle |
Definition at line 85 of file connection_add.c.
References _, MHD_Request::client_context, MHD_Daemon::connection_default_timeout, MHD_Connection::daemon, data, MHD_Request::event_loop_info, MHD_Daemon::event_loop_syscall, EXTRA_SLOTS, MHD_Daemon::itc, MHD_Connection::last_activity, MHD_add_to_fd_set_(), MHD_connection_call_handlers_(), MHD_connection_close_(), MHD_connection_update_last_activity_(), MHD_EVENT_LOOP_INFO_BLOCK, MHD_EVENT_LOOP_INFO_CLEANUP, MHD_EVENT_LOOP_INFO_READ, MHD_EVENT_LOOP_INFO_WRITE, MHD_INVALID_SOCKET, MHD_monotonic_sec_counter(), MHD_NO, MHD_REQUEST_CLOSED, MHD_request_handle_idle_(), MHD_request_resume(), MHD_REQUEST_TERMINATED_COMPLETED_OK, MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN, MHD_REQUEST_TERMINATED_WITH_ERROR, MHD_response_queue_for_destroy(), MHD_SCKT_EINTR_, MHD_SCKT_ERR_IS_EINTR_, MHD_SCKT_LAST_ERR_IS_, MHD_socket_get_error_, MHD_socket_last_strerr_, MHD_socket_strerr_, MHD_SYS_select_, NULL, MHD_Connection::pid, MHD_Connection::request, MHD_Request::response, MHD_Daemon::shutdown, MHD_Connection::socket_fd, MHD_Request::state, MHD_Connection::suspended, MHD_Response::termination_cb, MHD_Response::termination_cb_cls, TIMEVAL_TV_SEC_MAX, and MHD_Connection::tls_read_ready.