GNU libmicrohttpd  0.9.69
mhd_sockets.h File Reference
#include "mhd_options.h"
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#include "mhd_limits.h"
#include "sysfdsetsize.h"
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for mhd_sockets.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MHD_POSIX_SOCKETS   1
 
#define _MHD_SYS_DEFAULT_FD_SETSIZE   get_system_fdsetsize_value ()
 
#define MHD_PANIC(msg)
 
#define MHD_INVALID_SOCKET   (-1)
 
#define MHD_SOCKET_DEFINED   1
 
#define MAYBE_SOCK_CLOEXEC   0
 
#define MAYBE_SOCK_NONBLOCK   0
 
#define MAYBE_SOCK_NOSIGPIPE   0
 
#define MAYBE_MSG_NOSIGNAL   0
 
#define MHD_SCKT_SEND_MAX_SIZE_   SSIZE_MAX
 
#define MHD_socket_close_(fd)   ((0 == close ((fd))) || (EBADF != errno))
 
#define MHD_socket_close_chk_(fd)
 
#define MHD_send_(s, b, l)
 
#define MHD_recv_(s, b, l)   ((ssize_t) recv ((s),(void*) (b),(MHD_SCKT_SEND_SIZE_) (l), 0))
 
#define MHD_SCKT_FD_FITS_FDSET_SETSIZE_(fd, pset, setsize)
 
#define MHD_SCKT_FD_FITS_FDSET_(fd, pset)
 
#define MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_(fd, pset, setsize)
 
#define MHD_SYS_select_(n, r, w, e, t)   select ((n),(r),(w),(e),(t))
 
#define MHD_SCKT_MISSING_ERR_CODE_   31450
 
#define MHD_SCKT_EAGAIN_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_EWOULDBLOCK_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_EINTR_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ECONNRESET_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ECONNABORTED_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ENOTCONN_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_EMFILE_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ENFILE_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ENOMEM_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ENOBUFS_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_EBADF_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ENOTSOCK_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_EINVAL_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_EFAUL_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ENOSYS_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ENOTSUP_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_EOPNOTSUPP_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_EACCESS_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_SCKT_ENETDOWN_   MHD_SCKT_MISSING_ERR_CODE_
 
#define MHD_socket_get_error_()   (errno)
 
#define MHD_socket_strerr_(err)   strerror ((err))
 
#define MHD_socket_last_strerr_()   MHD_socket_strerr_ (MHD_socket_get_error_ ())
 
#define MHD_socket_fset_error_(err)   (errno = (err))
 
#define MHD_socket_try_set_error_(err)
 
#define MHD_socket_set_error_(err)   (errno = (err))
 
#define MHD_SCKT_ERR_IS_(err, code)
 
#define MHD_SCKT_LAST_ERR_IS_(code)
 
#define MHD_SCKT_ERR_IS_EINTR_(err)   MHD_SCKT_ERR_IS_ ((err),MHD_SCKT_EINTR_)
 
#define MHD_SCKT_ERR_IS_EAGAIN_(err)   MHD_SCKT_ERR_IS_ ((err),MHD_SCKT_EAGAIN_)
 
#define MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)
 
#define MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_(err)
 
#define MHD_SCKT_ERR_IS_REMOTE_DISCNN_(err)
 
#define MHD_socket_set_error_to_ENOMEM()
 

Typedefs

typedef int MHD_socket
 
typedef int MHD_SCKT_OPT_BOOL_
 
typedef size_t MHD_SCKT_SEND_SIZE_
 

Functions

int MHD_add_to_fd_set_ (MHD_socket fd, fd_set *set, MHD_socket *max_fd, unsigned int fd_setsize)
 
int MHD_socket_nonblocking_ (MHD_socket sock)
 
int MHD_socket_set_nodelay_ (MHD_socket sock, bool on)
 
int MHD_socket_noninheritable_ (MHD_socket sock)
 
int MHD_socket_cork_ (MHD_socket sock, bool on)
 
int MHD_socket_buffering_reset_ (MHD_socket sock)
 
MHD_socket MHD_socket_create_listen_ (int pf)
 

Macro Definition Documentation

◆ _MHD_SYS_DEFAULT_FD_SETSIZE

#define _MHD_SYS_DEFAULT_FD_SETSIZE   get_system_fdsetsize_value ()

Definition at line 127 of file mhd_sockets.h.

◆ MAYBE_MSG_NOSIGNAL

#define MAYBE_MSG_NOSIGNAL   0

Definition at line 176 of file mhd_sockets.h.

◆ MAYBE_SOCK_CLOEXEC

#define MAYBE_SOCK_CLOEXEC   0

Definition at line 158 of file mhd_sockets.h.

◆ MAYBE_SOCK_NONBLOCK

#define MAYBE_SOCK_NONBLOCK   0

Definition at line 164 of file mhd_sockets.h.

◆ MAYBE_SOCK_NOSIGPIPE

#define MAYBE_SOCK_NOSIGPIPE   0

Definition at line 170 of file mhd_sockets.h.

◆ MHD_INVALID_SOCKET

#define MHD_INVALID_SOCKET   (-1)

Definition at line 146 of file mhd_sockets.h.

◆ MHD_PANIC

#define MHD_PANIC (   msg)
Value:
do { fprintf (stderr, \
"Abnormal termination at %d line in file %s: %s\n", \
(int) __LINE__, __FILE__, msg); abort (); \
} while (0)

Definition at line 134 of file mhd_sockets.h.

◆ MHD_POSIX_SOCKETS

#define MHD_POSIX_SOCKETS   1

Definition at line 42 of file mhd_sockets.h.

◆ MHD_recv_

#define MHD_recv_ (   s,
  b,
 
)    ((ssize_t) recv ((s),(void*) (b),(MHD_SCKT_SEND_SIZE_) (l), 0))

MHD_recv_ is wrapper for system's recv()

Parameters
sthe socket to use
bthe buffer for data to receive
lthe length of b
Returns
ssize_t type value

Definition at line 293 of file mhd_sockets.h.

◆ MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_

#define MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_ (   fd,
  pset,
  setsize 
)
Value:
FD_SET ((fd), \
(pset))

Add FD to fd_set with specified FD_SETSIZE.

Parameters
fdthe fd to add
psetthe valid pointer to fd_set.
setsizethe value of FD_SETSIZE.
Note
To work on W32 with value of FD_SETSIZE different from currently defined value, system definition of FD_SET() is not used.

Definition at line 342 of file mhd_sockets.h.

◆ MHD_SCKT_EACCESS_

#define MHD_SCKT_EACCESS_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 509 of file mhd_sockets.h.

◆ MHD_SCKT_EAGAIN_

#define MHD_SCKT_EAGAIN_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 422 of file mhd_sockets.h.

◆ MHD_SCKT_EBADF_

#define MHD_SCKT_EBADF_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 474 of file mhd_sockets.h.

◆ MHD_SCKT_ECONNABORTED_

#define MHD_SCKT_ECONNABORTED_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 444 of file mhd_sockets.h.

◆ MHD_SCKT_ECONNRESET_

#define MHD_SCKT_ECONNRESET_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 439 of file mhd_sockets.h.

◆ MHD_SCKT_EFAUL_

#define MHD_SCKT_EFAUL_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 489 of file mhd_sockets.h.

◆ MHD_SCKT_EINTR_

#define MHD_SCKT_EINTR_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 434 of file mhd_sockets.h.

◆ MHD_SCKT_EINVAL_

#define MHD_SCKT_EINVAL_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 484 of file mhd_sockets.h.

◆ MHD_SCKT_EMFILE_

#define MHD_SCKT_EMFILE_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 454 of file mhd_sockets.h.

◆ MHD_SCKT_ENETDOWN_

#define MHD_SCKT_ENETDOWN_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 514 of file mhd_sockets.h.

◆ MHD_SCKT_ENFILE_

#define MHD_SCKT_ENFILE_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 459 of file mhd_sockets.h.

◆ MHD_SCKT_ENOBUFS_

#define MHD_SCKT_ENOBUFS_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 469 of file mhd_sockets.h.

◆ MHD_SCKT_ENOMEM_

#define MHD_SCKT_ENOMEM_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 464 of file mhd_sockets.h.

◆ MHD_SCKT_ENOSYS_

#define MHD_SCKT_ENOSYS_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 494 of file mhd_sockets.h.

◆ MHD_SCKT_ENOTCONN_

#define MHD_SCKT_ENOTCONN_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 449 of file mhd_sockets.h.

◆ MHD_SCKT_ENOTSOCK_

#define MHD_SCKT_ENOTSOCK_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 479 of file mhd_sockets.h.

◆ MHD_SCKT_ENOTSUP_

#define MHD_SCKT_ENOTSUP_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 499 of file mhd_sockets.h.

◆ MHD_SCKT_EOPNOTSUPP_

#define MHD_SCKT_EOPNOTSUPP_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 504 of file mhd_sockets.h.

◆ MHD_SCKT_ERR_IS_

#define MHD_SCKT_ERR_IS_ (   err,
  code 
)
Value:
( (MHD_SCKT_MISSING_ERR_CODE_ != (code)) && \
((code) == (err)) )

Check whether given socket error is equal to specified system native MHD_SCKT_E*_ code. If platform don't have specific error code, result is always boolean false.

Returns
boolean true if code is real error code and err equals to MHD_SCKT_E*_ code; boolean false otherwise

Definition at line 631 of file mhd_sockets.h.

◆ MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_

#define MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_ (   err)
Value:

Check whether is given socket error is type of "incoming connection was disconnected before 'accept()' is called".

Returns
boolean true is err match described socket error code, boolean false otherwise.

Definition at line 695 of file mhd_sockets.h.

◆ MHD_SCKT_ERR_IS_EAGAIN_

#define MHD_SCKT_ERR_IS_EAGAIN_ (   err)    MHD_SCKT_ERR_IS_ ((err),MHD_SCKT_EAGAIN_)

Check whether given socket error is equal to system's socket error codes for EAGAIN or EWOULDBLOCK.

Returns
boolean true if err is equal to sockets' EAGAIN or EWOULDBLOCK codes; boolean false otherwise.

Definition at line 663 of file mhd_sockets.h.

◆ MHD_SCKT_ERR_IS_EINTR_

#define MHD_SCKT_ERR_IS_EINTR_ (   err)    MHD_SCKT_ERR_IS_ ((err),MHD_SCKT_EINTR_)

Check whether given socket error is equal to system's socket error codes for EINTR.

Returns
boolean true if err is equal to sockets' EINTR code; boolean false otherwise.

Definition at line 654 of file mhd_sockets.h.

◆ MHD_SCKT_ERR_IS_LOW_RESOURCES_

#define MHD_SCKT_ERR_IS_LOW_RESOURCES_ (   err)
Value:
(MHD_SCKT_ERR_IS_ ((err), \
|| \
MHD_SCKT_ERR_IS_ ((err), \
|| \
MHD_SCKT_ERR_IS_ ((err), \
|| \
MHD_SCKT_ERR_IS_ ((err), \

Check whether given socket error is any kind of "low resource" error.

Returns
boolean true if err is any kind of "low resource" error, boolean false otherwise.

Definition at line 676 of file mhd_sockets.h.

◆ MHD_SCKT_ERR_IS_REMOTE_DISCNN_

#define MHD_SCKT_ERR_IS_REMOTE_DISCNN_ (   err)
Value:
(MHD_SCKT_ERR_IS_ ((err), \
|| \
MHD_SCKT_ERR_IS_ ((err), \

Check whether is given socket error is type of "connection was terminated by remote side".

Returns
boolean true is err match described socket error code, boolean false otherwise.

Definition at line 708 of file mhd_sockets.h.

◆ MHD_SCKT_EWOULDBLOCK_

#define MHD_SCKT_EWOULDBLOCK_   MHD_SCKT_MISSING_ERR_CODE_

Definition at line 429 of file mhd_sockets.h.

◆ MHD_SCKT_FD_FITS_FDSET_

#define MHD_SCKT_FD_FITS_FDSET_ (   fd,
  pset 
)
Value:
(pset), \
FD_SETSIZE)

Check whether FD can be added to fd_set with current FD_SETSIZE.

Parameters
fdthe fd to check
psetthe pointer to fd_set to check or NULL to check whether FD can be used with fd_sets.
Returns
boolean true if FD can be added to fd_set, boolean false otherwise.

Definition at line 329 of file mhd_sockets.h.

◆ MHD_SCKT_FD_FITS_FDSET_SETSIZE_

#define MHD_SCKT_FD_FITS_FDSET_SETSIZE_ (   fd,
  pset,
  setsize 
)
Value:
((fd) < \
setsize))

Check whether FD can be added to fd_set with specified FD_SETSIZE.

Parameters
fdthe fd to check
psetthe pointer to fd_set to check or NULL to check whether FD can be used with fd_sets.
setsizethe value of FD_SETSIZE.
Returns
boolean true if FD can be added to fd_set, boolean false otherwise.

Definition at line 307 of file mhd_sockets.h.

◆ MHD_SCKT_LAST_ERR_IS_

#define MHD_SCKT_LAST_ERR_IS_ (   code)
Value:

Check whether last socket error is equal to specified system native MHD_SCKT_E*_ code. If platform don't have specific error code, result is always boolean false.

Returns
boolean true if code is real error code and last socket error equals to MHD_SCKT_E*_ code; boolean false otherwise

Definition at line 643 of file mhd_sockets.h.

◆ MHD_SCKT_MISSING_ERR_CODE_

#define MHD_SCKT_MISSING_ERR_CODE_   31450

Definition at line 414 of file mhd_sockets.h.

◆ MHD_SCKT_SEND_MAX_SIZE_

#define MHD_SCKT_SEND_MAX_SIZE_   SSIZE_MAX

MHD_SCKT_SEND_MAX_SIZE_ is maximum send()/recv() size value.

Definition at line 242 of file mhd_sockets.h.

◆ MHD_send_

#define MHD_send_ (   s,
  b,
 
)
Value:
((ssize_t) send ((s),(const void*) (b),(MHD_SCKT_SEND_SIZE_) (l), \
MAYBE_MSG_NOSIGNAL))

MHD_send_ is wrapper for system's send()

Parameters
sthe socket to use
bthe buffer with data to send
lthe length of data in b
Returns
ssize_t type value

Definition at line 281 of file mhd_sockets.h.

◆ MHD_socket_close_

#define MHD_socket_close_ (   fd)    ((0 == close ((fd))) || (EBADF != errno))

MHD_socket_close_(fd) close any FDs (non-W32) / close only socket FDs (W32). Note that on HP-UNIX, this function may leak the FD if errno is set to EINTR. Do not use HP-UNIX.

Parameters
fddescriptor to close
Returns
boolean true on success (error codes like EINTR and EIO are counted as success, only EBADF counts as an error!), boolean false otherwise.

Definition at line 258 of file mhd_sockets.h.

◆ MHD_socket_close_chk_

#define MHD_socket_close_chk_ (   fd)
Value:
do { \
if (! MHD_socket_close_ (fd)) \
MHD_PANIC (_ ("Close socket failed.\n")); \
} while (0)

MHD_socket_close_chk_(fd) close socket and abort execution if error is detected.

Parameters
fdsocket to close

Definition at line 268 of file mhd_sockets.h.

◆ MHD_SOCKET_DEFINED

#define MHD_SOCKET_DEFINED   1

Definition at line 152 of file mhd_sockets.h.

◆ MHD_socket_fset_error_

#define MHD_socket_fset_error_ (   err)    (errno = (err))

MHD_socket_fset_error_() set socket system native error code.

Definition at line 575 of file mhd_sockets.h.

◆ MHD_socket_get_error_

#define MHD_socket_get_error_ ( )    (errno)

MHD_socket_error_ return system native error code for last socket error.

Returns
system error code for last socket error.

Definition at line 543 of file mhd_sockets.h.

◆ MHD_socket_last_strerr_

#define MHD_socket_last_strerr_ ( )    MHD_socket_strerr_ (MHD_socket_get_error_ ())

Definition at line 569 of file mhd_sockets.h.

◆ MHD_socket_set_error_

#define MHD_socket_set_error_ (   err)    (errno = (err))

MHD_socket_set_error_() set socket system native error code to specified code or replacement code if specified code is not defined on system.

Definition at line 614 of file mhd_sockets.h.

◆ MHD_socket_set_error_to_ENOMEM

#define MHD_socket_set_error_to_ENOMEM ( )
Value:

Set socket's error code to ENOMEM or equivalent if ENOMEM is not available on platform.

Definition at line 729 of file mhd_sockets.h.

◆ MHD_socket_strerr_

#define MHD_socket_strerr_ (   err)    strerror ((err))

Definition at line 562 of file mhd_sockets.h.

◆ MHD_socket_try_set_error_

#define MHD_socket_try_set_error_ (   err)
Value:
(MHD_socket_fset_error_ ((err)), ! 0) : \
0)

MHD_socket_try_set_error_() set socket system native error code if specified code is defined on system.

Returns
non-zero if specified err code is defined on system and error was set; zero if specified err code is not defined on system and error was not set.

Definition at line 588 of file mhd_sockets.h.

◆ MHD_SYS_select_

#define MHD_SYS_select_ (   n,
  r,
  w,
  e,
 
)    select ((n),(r),(w),(e),(t))

Definition at line 356 of file mhd_sockets.h.

Typedef Documentation

◆ MHD_SCKT_OPT_BOOL_

typedef int MHD_SCKT_OPT_BOOL_

MHD_SCKT_OPT_BOOL_ is type for bool parameters for setsockopt()/getsockopt()

Definition at line 223 of file mhd_sockets.h.

◆ MHD_SCKT_SEND_SIZE_

typedef size_t MHD_SCKT_SEND_SIZE_

MHD_SCKT_SEND_SIZE_ is type used to specify size for send and recv functions

Definition at line 233 of file mhd_sockets.h.

◆ MHD_socket

typedef int MHD_socket

MHD_socket is type for socket FDs

Definition at line 145 of file mhd_sockets.h.

Function Documentation

◆ MHD_add_to_fd_set_()

int MHD_add_to_fd_set_ ( MHD_socket  fd,
fd_set *  set,
MHD_socket max_fd,
unsigned int  fd_setsize 
)

Add fd to the set. If fd is greater than max_fd, set max_fd to fd.

Parameters
fdfile descriptor to add to the set
setset to modify
max_fdmaximum value to potentially update
fd_setsizevalue of FD_SETSIZE
Returns
non-zero if succeeded, zero otherwise

Definition at line 377 of file mhd_sockets.c.

References fd, MHD_INVALID_SOCKET, MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_, MHD_SCKT_FD_FITS_FDSET_SETSIZE_, and NULL.

Referenced by internal_get_fdset2(), MHD_daemon_get_fdset2(), MHD_daemon_select_(), MHD_get_fdset2(), MHD_select(), and thread_main_handle_connection().

Here is the caller graph for this function:

◆ MHD_socket_buffering_reset_()

int MHD_socket_buffering_reset_ ( MHD_socket  sock)

Change socket buffering mode to default.

Parameters
socksocket to manipulate
Returns
non-zero if succeeded, zero otherwise

Definition at line 553 of file mhd_sockets.c.

References MHD_socket_cork_(), and MHD_socket_set_nodelay_().

Referenced by MHD_add_connection().

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

◆ MHD_socket_cork_()

int MHD_socket_cork_ ( MHD_socket  sock,
bool  on 
)

Enable/disable the cork option.

TCP_NOPUSH has the same logic as MSG_MSG_MORE. The two are more or less equivalent by a source transformation (ie send(MSG_MORE) => "set TCP_NOPUSH + send() + clear TCP_NOPUSH". Both of them are really fairly "local", but TCP_NOPUSH has a notion of persistency that is entirely lacking in MSG_MORE. ... with TCP_NOPUSH you basically have to know what your last write is, and clear the bit before that write if you want to avoid bad latencies.

See also: https://yarchive.net/comp/linux/sendfile.html

Parameters
socksocket to manipulate
onset to true to enable CORK, false to disable
Returns
non-zero if succeeded, zero otherwise

Enable/disable the cork option.

Parameters
socksocket to manipulate
onset to true to enable CORK, false to disable
Returns
non-zero if succeeded, zero otherwise

Definition at line 506 of file mhd_sockets.c.

Referenced by MHD_socket_buffering_reset_(), post_cork_setsockopt(), and pre_cork_setsockopt().

Here is the caller graph for this function:

◆ MHD_socket_create_listen_()

MHD_socket MHD_socket_create_listen_ ( int  pf)

Create a listen socket, with noninheritable flag if possible.

Parameters
pfprotocol family to use
Returns
created socket or MHD_INVALID_SOCKET in case of errors

Definition at line 474 of file mhd_sockets.c.

References fd, MAYBE_MSG_NOSIGNAL, MAYBE_SOCK_CLOEXEC, MAYBE_SOCK_NOSIGPIPE, MHD_INVALID_SOCKET, MHD_socket_close_, MHD_socket_fset_error_, MHD_socket_get_error_, MHD_socket_noninheritable_(), and NULL.

Referenced by MHD_start_daemon_va(), and open_listen_socket().

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

◆ MHD_socket_nonblocking_()

int MHD_socket_nonblocking_ ( MHD_socket  sock)

Change socket options to be non-blocking.

Parameters
socksocket to manipulate
Returns
non-zero if succeeded, zero otherwise

Definition at line 407 of file mhd_sockets.c.

Referenced by MHD_accept_connection(), MHD_accept_connection_(), MHD_add_connection(), MHD_daemon_add_connection(), MHD_daemon_start(), and MHD_start_daemon_va().

Here is the caller graph for this function:

◆ MHD_socket_noninheritable_()

int MHD_socket_noninheritable_ ( MHD_socket  sock)

Change socket options to be non-inheritable.

Parameters
socksocket to manipulate
Returns
non-zero if succeeded, zero otherwise
Warning
Does not set socket error on W32.

Definition at line 442 of file mhd_sockets.c.

Referenced by MHD_accept_connection(), MHD_accept_connection_(), MHD_add_connection(), MHD_daemon_add_connection(), and MHD_socket_create_listen_().

Here is the caller graph for this function:

◆ MHD_socket_set_nodelay_()

int MHD_socket_set_nodelay_ ( MHD_socket  sock,
bool  on 
)

Disable Nagle's algorithm on sock. This is what we do by default for all TCP sockets in MHD, unless the platform does not support the MSG_MORE or MSG_CORK or MSG_NOPUSH options.

Parameters
socksocket to manipulate
onvalue to use
Returns
0 on success

Definition at line 477 of file mhd_sockets.c.

Referenced by MHD_accept_connection(), MHD_socket_buffering_reset_(), post_cork_setsockopt(), and pre_cork_setsockopt().

Here is the caller graph for this function:
MHD_socket
int MHD_socket
Definition: microhttpd.h:187
_
#define _(String)
Definition: mhd_options.h:42
MHD_SCKT_ENOBUFS_
#define MHD_SCKT_ENOBUFS_
Definition: mhd_sockets.h:469
MHD_socket_get_error_
#define MHD_socket_get_error_()
Definition: mhd_sockets.h:543
MHD_TLS_Plugin::send
ssize_t(* send)(void *cls, struct MHD_TLS_ConnectionState *cs, const void *buf, size_t buf_size)
Definition: microhttpd_tls.h:137
MHD_SCKT_ENFILE_
#define MHD_SCKT_ENFILE_
Definition: mhd_sockets.h:459
MHD_SCKT_ECONNABORTED_
#define MHD_SCKT_ECONNABORTED_
Definition: mhd_sockets.h:444
MHD_SCKT_ERR_IS_
#define MHD_SCKT_ERR_IS_(err, code)
Definition: mhd_sockets.h:631
MHD_SCKT_ENOMEM_
#define MHD_SCKT_ENOMEM_
Definition: mhd_sockets.h:464
fd
int fd
Definition: microhttpd.h:3157
MHD_socket_fset_error_
#define MHD_socket_fset_error_(err)
Definition: mhd_sockets.h:575
MHD_socket_set_error_
#define MHD_socket_set_error_(err)
Definition: mhd_sockets.h:614
MHD_SCKT_EMFILE_
#define MHD_SCKT_EMFILE_
Definition: mhd_sockets.h:454
MHD_SCKT_SEND_SIZE_
size_t MHD_SCKT_SEND_SIZE_
Definition: mhd_sockets.h:213
MHD_SCKT_ECONNRESET_
#define MHD_SCKT_ECONNRESET_
Definition: mhd_sockets.h:439
MHD_SCKT_FD_FITS_FDSET_SETSIZE_
#define MHD_SCKT_FD_FITS_FDSET_SETSIZE_(fd, pset, setsize)
Definition: mhd_sockets.h:307
MHD_socket_close_
#define MHD_socket_close_(fd)
Definition: mhd_sockets.h:258
MHD_SCKT_MISSING_ERR_CODE_
#define MHD_SCKT_MISSING_ERR_CODE_
Definition: mhd_sockets.h:414