GNU libmicrohttpd 0.9.77
Loading...
Searching...
No Matches
mhd_send.h File Reference

Declarations of send() wrappers. More...

#include "platform.h"
#include "internal.h"
#include <errno.h>
#include "mhd_sockets.h"
#include "connection.h"
Include dependency graph for mhd_send.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void MHD_send_init_static_vars_ (void)
 
ssize_t MHD_send_data_ (struct MHD_Connection *connection, const char *buffer, size_t buffer_size, bool push_data)
 
ssize_t MHD_send_hdr_and_body_ (struct MHD_Connection *connection, const char *header, size_t header_size, bool never_push_hdr, const char *body, size_t body_size, bool complete_response)
 
bool MHD_connection_set_nodelay_state_ (struct MHD_Connection *connection, bool nodelay_state)
 
bool MHD_connection_set_cork_state_ (struct MHD_Connection *connection, bool cork_state)
 
ssize_t MHD_send_iovec_ (struct MHD_Connection *connection, struct MHD_iovec_track_ *const r_iov, bool push_data)
 

Detailed Description

Declarations of send() wrappers.

Author
ng0
Karlson2k (Evgeny Grin)

Definition in file mhd_send.h.

Function Documentation

◆ MHD_connection_set_cork_state_()

bool MHD_connection_set_cork_state_ ( struct MHD_Connection connection,
bool  cork_state 
)

Set required cork state for connection socket

The function automatically updates sk_corked state.

Parameters
connectionthe connection to manipulate
cork_statethe requested new state of socket
Returns
true if succeed, false if failed or not supported by the current platform / kernel.

Definition at line 240 of file mhd_send.c.

References _, _MHD_UNKNOWN, _MHD_YES, MHD_Connection::daemon, MHD_Connection::is_nonip, MHD_SCKT_EINVAL_, MHD_SCKT_ENOPROTOOPT_, MHD_SCKT_ENOTSOCK_, MHD_SCKT_ERR_IS_, MHD_socket_get_error_, MHD_socket_strerr_, MHD_Connection::sk_corked, and MHD_Connection::socket_fd.

Referenced by post_send_setopt(), and pre_send_setopt().

Here is the caller graph for this function:

◆ MHD_connection_set_nodelay_state_()

bool MHD_connection_set_nodelay_state_ ( struct MHD_Connection connection,
bool  nodelay_state 
)

Set required TCP_NODELAY state for connection socket

The function automatically updates sk_nodelay state.

Parameters
connectionthe connection to manipulate
nodelay_statethe requested new state of socket
Returns
true if succeed, false if failed or not supported by the current platform / kernel.

Definition at line 170 of file mhd_send.c.

References _, _MHD_UNKNOWN, _MHD_YES, MHD_Connection::daemon, MHD_Connection::is_nonip, MHD_SCKT_EINVAL_, MHD_SCKT_ENOPROTOOPT_, MHD_SCKT_ENOTSOCK_, MHD_SCKT_ERR_IS_, MHD_socket_get_error_, MHD_socket_strerr_, MHD_Connection::sk_nodelay, and MHD_Connection::socket_fd.

Referenced by MHD_run_tls_handshake_(), post_send_setopt(), and pre_send_setopt().

Here is the caller graph for this function:

◆ MHD_send_data_()

ssize_t MHD_send_data_ ( struct MHD_Connection connection,
const char *  buffer,
size_t  buffer_size,
bool  push_data 
)

Send buffer to the client, push data from network buffer if requested and full buffer is sent.

Parameters
connectionthe MHD_Connection structure
buffercontent of the buffer to send
buffer_sizethe size of the buffer (in bytes)
push_dataset to true to force push the data to the network from system buffers (usually set for the last piece of data), set to false to prefer holding incomplete network packets (more data will be send for the same reply).
Returns
sum of the number of bytes sent from both buffers or error code (negative)

Definition at line 749 of file mhd_send.c.

References MHD_Connection::daemon, MHD_CONNECTION_CLOSED, MHD_EPOLL_STATE_WRITE_READY, MHD_ERR_AGAIN_, MHD_ERR_BADF_, MHD_ERR_CONNRESET_, MHD_ERR_INVAL_, MHD_ERR_NOMEM_, MHD_ERR_NOTCONN_, MHD_ERR_OPNOTSUPP_, MHD_ERR_PIPE_, MHD_ERR_TLS_, MHD_INVALID_SOCKET, MHD_SCKT_EBADF_, MHD_SCKT_EINVAL_, MHD_SCKT_ENOTCONN_, MHD_SCKT_EOPNOTSUPP_, MHD_SCKT_EPIPE_, MHD_SCKT_ERR_IS_, MHD_SCKT_ERR_IS_EAGAIN_, MHD_SCKT_ERR_IS_EINTR_, MHD_SCKT_ERR_IS_LOW_RESOURCES_, MHD_SCKT_ERR_IS_REMOTE_DISCNN_, MHD_SCKT_SEND_MAX_SIZE_, MHD_send4_, MHD_socket_get_error_, MHD_USE_TLS, MHD_Daemon::options, post_send_setopt(), pre_send_setopt(), MHD_Connection::socket_fd, SSIZE_MAX, and MHD_Connection::state.

Referenced by MHD_connection_handle_write(), MHD_send_hdr_and_body_(), and send_iov_emu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_send_hdr_and_body_()

ssize_t MHD_send_hdr_and_body_ ( struct MHD_Connection connection,
const char *  header,
size_t  header_size,
bool  never_push_hdr,
const char *  body,
size_t  body_size,
bool  complete_response 
)

Send reply header with optional reply body.

Parameters
connectionthe MHD_Connection structure
headercontent of header to send
header_sizethe size of the header (in bytes)
never_push_hdrset to true to disable internal algorithm that can push automatically header data alone to the network
bodycontent of the body to send (optional, may be NULL)
body_sizethe size of the body (in bytes)
complete_responseset to true if complete response is provided by header and body, set to false if additional body data will be sent later
Returns
sum of the number of bytes sent from both buffers or error code (negative)

Definition at line 901 of file mhd_send.c.

References _MHD_SEND_VEC_MAX, MHD_Connection::daemon, mhd_assert, MHD_CONNECTION_CLOSED, MHD_EPOLL_STATE_WRITE_READY, MHD_ERR_AGAIN_, MHD_ERR_BADF_, MHD_ERR_CONNRESET_, MHD_ERR_INVAL_, MHD_ERR_NOMEM_, MHD_ERR_NOTCONN_, MHD_ERR_OPNOTSUPP_, MHD_ERR_PIPE_, MHD_INVALID_SOCKET, MHD_SCKT_EBADF_, MHD_SCKT_EINVAL_, MHD_SCKT_ENOTCONN_, MHD_SCKT_EOPNOTSUPP_, MHD_SCKT_EPIPE_, MHD_SCKT_ERR_IS_, MHD_SCKT_ERR_IS_EAGAIN_, MHD_SCKT_ERR_IS_EINTR_, MHD_SCKT_ERR_IS_LOW_RESOURCES_, MHD_SCKT_ERR_IS_REMOTE_DISCNN_, MHD_send_data_(), MHD_socket_get_error_, MHD_USE_TLS, MSG_NOSIGNAL_OR_ZERO, NULL, MHD_Daemon::options, post_send_setopt(), pre_send_setopt(), MHD_Daemon::sigpipe_blocked, MHD_Connection::sk_nonblck, MHD_Connection::sk_spipe_suppress, MHD_Connection::socket_fd, SSIZE_MAX, MHD_Connection::state, and UINT_MAX.

Referenced by MHD_connection_handle_write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_send_init_static_vars_()

void MHD_send_init_static_vars_ ( void  )

Initialises static variables

Definition at line 153 of file mhd_send.c.

Referenced by MHD_init().

Here is the caller graph for this function:

◆ MHD_send_iovec_()

ssize_t MHD_send_iovec_ ( struct MHD_Connection connection,
struct MHD_iovec_track_ *const  r_iov,
bool  push_data 
)

Function for sending responses backed by a an array of memory buffers.

Parameters
connectionthe MHD connection structure
r_iovthe pointer to iov response structure with tracking
push_dataset to true to force push the data to the network from system buffers (usually set for the last piece of data), set to false to prefer holding incomplete network packets (more data will be send for the same reply).
Returns
actual number of bytes sent

Definition at line 1614 of file mhd_send.c.

References MHD_iovec_track_::cnt, MHD_Connection::daemon, MHD_Response::data_iov, MHD_iovec_track_::iov, mhd_assert, MHD_USE_TLS, NULL, MHD_Daemon::options, MHD_Connection::resp_iov, MHD_Connection::response, send_iov_emu(), MHD_iovec_track_::sent, MHD_Daemon::sigpipe_blocked, and MHD_Connection::sk_spipe_suppress.

Referenced by MHD_connection_handle_write().

Here is the call graph for this function:
Here is the caller graph for this function: