poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
server.h
Go to the documentation of this file.
1#ifndef POSER_CORE_SERVER_H
2#define POSER_CORE_SERVER_H
3
7#include <poser/decl.h>
8
10#include <poser/core/proto.h>
11#include <stddef.h>
12
18C_CLASS_DECL(PSC_Server);
19
23C_CLASS_DECL(PSC_TcpServerOpts);
24
28C_CLASS_DECL(PSC_UnixServerOpts);
29
30C_CLASS_DECL(PSC_Event);
31
38DECLEXPORT PSC_TcpServerOpts *
40 ATTR_RETNONNULL;
41
49DECLEXPORT void
50PSC_TcpServerOpts_bind(PSC_TcpServerOpts *self, const char *bindhost)
51 CMETHOD ATTR_NONNULL((2));
52
60DECLEXPORT void
62 CMETHOD;
63
72DECLEXPORT void
74 const char *certfile, const char *keyfile)
75 CMETHOD ATTR_NONNULL((2)) ATTR_NONNULL((3));
76
93DECLEXPORT void
94PSC_TcpServerOpts_enableClientCert(PSC_TcpServerOpts *self,
95 const char *cafile)
96 CMETHOD;
97
113DECLEXPORT void
114PSC_TcpServerOpts_requireClientCert(PSC_TcpServerOpts *self,
115 const char *cafile)
116 CMETHOD;
117
132DECLEXPORT void
133PSC_TcpServerOpts_validateClientCert(PSC_TcpServerOpts *self, void *receiver,
134 PSC_CertValidator validator)
135 CMETHOD ATTR_NONNULL((3));
136
142DECLEXPORT void
143PSC_TcpServerOpts_setProto(PSC_TcpServerOpts *self, PSC_Proto proto)
144 CMETHOD;
145
150DECLEXPORT void
151PSC_TcpServerOpts_numericHosts(PSC_TcpServerOpts *self)
152 CMETHOD;
153
158DECLEXPORT void
159PSC_TcpServerOpts_destroy(PSC_TcpServerOpts *self);
160
167DECLEXPORT PSC_UnixServerOpts *
168PSC_UnixServerOpts_create(const char *name)
169 ATTR_RETNONNULL ATTR_NONNULL((1));
170
178DECLEXPORT void
179PSC_UnixSeverOpts_readBufSize(PSC_UnixServerOpts *self, size_t sz)
180 CMETHOD;
181
189DECLEXPORT void
190PSC_UnixServerOpts_owner(PSC_UnixServerOpts *self, int uid, int gid)
191 CMETHOD;
192
200DECLEXPORT void
201PSC_UnixServerOpts_mode(PSC_UnixServerOpts *self, int mode)
202 CMETHOD;
203
208DECLEXPORT void
209PSC_UnixServerOpts_destroy(PSC_UnixServerOpts *self);
210
216DECLEXPORT PSC_Server *
217PSC_Server_createTcp(const PSC_TcpServerOpts *opts)
218 ATTR_NONNULL((1));
219
225DECLEXPORT PSC_Server *
226PSC_Server_createUnix(const PSC_UnixServerOpts *opts)
227 ATTR_NONNULL((1));
228
237DECLEXPORT PSC_Event *
238PSC_Server_clientConnected(PSC_Server *self)
239 CMETHOD ATTR_RETNONNULL ATTR_PURE;
240
252DECLEXPORT PSC_Event *
253PSC_Server_clientDisconnected(PSC_Server *self)
254 CMETHOD ATTR_RETNONNULL ATTR_PURE;
255
266DECLEXPORT void
267PSC_Server_disable(PSC_Server *self)
268 CMETHOD;
269
276DECLEXPORT void
277PSC_Server_enable(PSC_Server *self)
278 CMETHOD;
279
285DECLEXPORT void
286PSC_Server_destroy(PSC_Server *self);
287
288#endif
declarations for the PSC_CertInfo class
int(* PSC_CertValidator)(void *receiver, const PSC_CertInfo *info)
Custom certificate validator.
Definition: certinfo.h:24
A simple event class.
A server listening on a socket and accepting connections.
Options for creating a TCP server.
void PSC_TcpServerOpts_bind(PSC_TcpServerOpts *self, const char *bindhost)
Bind to a specific hostname or address.
PSC_TcpServerOpts * PSC_TcpServerOpts_create(int port)
PSC_TcpServerOpts constructor.
void PSC_TcpServerOpts_enableTls(PSC_TcpServerOpts *self, const char *certfile, const char *keyfile)
Enable TLS for the server.
void PSC_TcpServerOpts_readBufSize(PSC_TcpServerOpts *self, size_t sz)
Set read buffer size.
Options for creating a local UNIX server.
declaration of the PSC_Proto enum
PSC_Proto
Protocol to use for TCP connections.
Definition: proto.h:10