poser
A C framework for POsix SERvices
|
Options for creating a TCP client. More...
#include <poser/core/client.h>
Public Member Functions | |
PSC_TcpClientOpts * | PSC_TcpClientOpts_create (const char *remotehost, int port) |
PSC_TcpClientOpts constructor. | |
void | PSC_TcpClientOpts_readBufSize (PSC_TcpClientOpts *self, size_t sz) |
Set read buffer size. | |
void | PSC_TcpClientOpts_enableTls (PSC_TcpClientOpts *self, const char *certfile, const char *keyfile) |
Enable TLS for the connection. | |
void | PSC_TcpClientOpts_disableCertVerify (PSC_TcpClientOpts *self) |
Disable server certificate verification. | |
void | PSC_TcpClientOpts_setProto (PSC_TcpClientOpts *self, PSC_Proto proto) |
Set a specific protocol (IPv4 or IPv6). | |
void | PSC_TcpClientOpts_numericHosts (PSC_TcpClientOpts *self) |
Only use numeric hosts, don't attempt to resolve addresses. | |
void | PSC_TcpClientOpts_setBlacklistHits (PSC_TcpClientOpts *self, int blacklistHits) |
Enable blacklisting of failed remote addresses. | |
void | PSC_TcpClientOpts_destroy (PSC_TcpClientOpts *self) |
PSC_TcpClientOpts destructor. | |
Options for creating a TCP client.
PSC_TcpClientOpts * PSC_TcpClientOpts_create | ( | const char * | remotehost, |
int | port | ||
) |
PSC_TcpClientOpts constructor.
Creates an options object initialized to default values.
remotehost | host to connect to (name or address) |
port | port to connect to |
void PSC_TcpClientOpts_destroy | ( | PSC_TcpClientOpts * | self | ) |
PSC_TcpClientOpts destructor.
self | the PSC_TcpClientOpts |
void PSC_TcpClientOpts_disableCertVerify | ( | PSC_TcpClientOpts * | self | ) |
Disable server certificate verification.
self | the PSC_TcpClientOpts |
void PSC_TcpClientOpts_enableTls | ( | PSC_TcpClientOpts * | self, |
const char * | certfile, | ||
const char * | keyfile | ||
) |
Enable TLS for the connection.
Enables TLS for the connection to be created, optionally using a client certificate.
self | the PSC_TcpClientOpts |
certfile | certificate file for client certificate |
keyfile | private key file for client certificate |
void PSC_TcpClientOpts_numericHosts | ( | PSC_TcpClientOpts * | self | ) |
Only use numeric hosts, don't attempt to resolve addresses.
self | the PSC_TcpClientOpts |
void PSC_TcpClientOpts_readBufSize | ( | PSC_TcpClientOpts * | self, |
size_t | sz | ||
) |
Set read buffer size.
Sets the size of the buffer used for reading from the connection, in bytes. The default value is 16 kiB.
self | the PSC_TcpClientOpts |
sz | the size of the read buffer, must be > 0 |
void PSC_TcpClientOpts_setBlacklistHits | ( | PSC_TcpClientOpts * | self, |
int | blacklistHits | ||
) |
Enable blacklisting of failed remote addresses.
When this is set to a non-zero value, a remote address is put on a blacklist after errors or timeouts during connect or TLS hanshake, or when closed with the blacklist parameter of PSC_Connection_close() set to 1.
This can be useful for remote services using some load-balancing or round-robin DNS. In this case, it can be avoided to try the same host over and over again.
self | the PSC_TcpClientOpts |
blacklistHits | number of hits needed to remove the entry from the blacklist again |
void PSC_TcpClientOpts_setProto | ( | PSC_TcpClientOpts * | self, |
PSC_Proto | proto | ||
) |
Set a specific protocol (IPv4 or IPv6).
self | the PSC_TcpClientOpts |
proto | protocol the client should use |