poser
A C framework for POsix SERvices
|
Options for creating a TCP server. More...
#include <poser/core/server.h>
Public Member Functions | |
PSC_TcpServerOpts * | PSC_TcpServerOpts_create (int port) |
PSC_TcpServerOpts constructor. | |
void | PSC_TcpServerOpts_bind (PSC_TcpServerOpts *self, const char *bindhost) |
Bind to a specific hostname or address. | |
void | PSC_TcpServerOpts_readBufSize (PSC_TcpServerOpts *self, size_t sz) |
Set read buffer size. | |
void | PSC_TcpServerOpts_enableTls (PSC_TcpServerOpts *self, const char *certfile, const char *keyfile) |
Enable TLS for the server. | |
void | PSC_TcpServerOpts_setProto (PSC_TcpServerOpts *self, PSC_Proto proto) |
Set a specific protocol (IPv4 or IPv6). | |
void | PSC_TcpServerOpts_numericHosts (PSC_TcpServerOpts *self) |
Only use numeric hosts, don't attempt to resolve addresses. | |
void | PSC_TcpServerOpts_destroy (PSC_TcpServerOpts *self) |
PSC_TcpServerOpts destructor. | |
Options for creating a TCP server.
void PSC_TcpServerOpts_bind | ( | PSC_TcpServerOpts * | self, |
const char * | bindhost | ||
) |
Bind to a specific hostname or address.
This can be called multiple times to bind to multiple names or addresses. If it isn't called at all, the server will listen on any interface/address.
self | the PSC_TcpServerOpts |
bindhost | hostname or address to bind to |
PSC_TcpServerOpts * PSC_TcpServerOpts_create | ( | int | port | ) |
PSC_TcpServerOpts constructor.
Creates an options object initialized to default values.
port | the port to listen on |
void PSC_TcpServerOpts_destroy | ( | PSC_TcpServerOpts * | self | ) |
PSC_TcpServerOpts destructor.
self | the PSC_TcpServerOpts |
void PSC_TcpServerOpts_enableTls | ( | PSC_TcpServerOpts * | self, |
const char * | certfile, | ||
const char * | keyfile | ||
) |
Enable TLS for the server.
Causes TLS to be enabled for any incoming connection, using a server certificate. Note the certificate is required.
self | the PSC_TcpServerOpts |
certfile | certificate file for the server certificate |
keyfile | private key file for the server certificate |
void PSC_TcpServerOpts_numericHosts | ( | PSC_TcpServerOpts * | self | ) |
Only use numeric hosts, don't attempt to resolve addresses.
self | the PSC_TcpServerOpts |
void PSC_TcpServerOpts_readBufSize | ( | PSC_TcpServerOpts * | self, |
size_t | sz | ||
) |
Set read buffer size.
Sets the size of the buffer used for connections accepted from this server, in bytes. The default value is 16 kiB.
self | the PSC_TcpServerOpts |
sz | the size of the read buffer, must be > 0 |
void PSC_TcpServerOpts_setProto | ( | PSC_TcpServerOpts * | self, |
PSC_Proto | proto | ||
) |
Set a specific protocol (IPv4 or IPv6).
self | the PSC_TcpServerOpts |
proto | protocol the server should use |