poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
PSC_TcpServerOpts Class Reference

Options for creating a TCP server. More...

#include <poser/core/server.h>

Public Member Functions

PSC_TcpServerOptsPSC_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.
 

Detailed Description

Options for creating a TCP server.

Member Function Documentation

◆ PSC_TcpServerOpts_bind()

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.

Parameters
selfthe PSC_TcpServerOpts
bindhosthostname or address to bind to

◆ PSC_TcpServerOpts_create()

PSC_TcpServerOpts * PSC_TcpServerOpts_create ( int  port)

PSC_TcpServerOpts constructor.

Creates an options object initialized to default values.

Parameters
portthe port to listen on
Returns
a newly created options object

◆ PSC_TcpServerOpts_destroy()

void PSC_TcpServerOpts_destroy ( PSC_TcpServerOpts self)

PSC_TcpServerOpts destructor.

Parameters
selfthe PSC_TcpServerOpts

◆ PSC_TcpServerOpts_enableTls()

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.

Parameters
selfthe PSC_TcpServerOpts
certfilecertificate file for the server certificate
keyfileprivate key file for the server certificate

◆ PSC_TcpServerOpts_numericHosts()

void PSC_TcpServerOpts_numericHosts ( PSC_TcpServerOpts self)

Only use numeric hosts, don't attempt to resolve addresses.

Parameters
selfthe PSC_TcpServerOpts

◆ PSC_TcpServerOpts_readBufSize()

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.

Parameters
selfthe PSC_TcpServerOpts
szthe size of the read buffer, must be > 0

◆ PSC_TcpServerOpts_setProto()

void PSC_TcpServerOpts_setProto ( PSC_TcpServerOpts self,
PSC_Proto  proto 
)

Set a specific protocol (IPv4 or IPv6).

Parameters
selfthe PSC_TcpServerOpts
protoprotocol the server should use

The documentation for this class was generated from the following file: