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
9#include <poser/core/proto.h>
10#include <stddef.h>
11
17C_CLASS_DECL(PSC_Server);
18
22C_CLASS_DECL(PSC_TcpServerOpts);
23
27C_CLASS_DECL(PSC_UnixServerOpts);
28
29C_CLASS_DECL(PSC_Event);
30
37DECLEXPORT PSC_TcpServerOpts *
39 ATTR_RETNONNULL;
40
48DECLEXPORT void
49PSC_TcpServerOpts_bind(PSC_TcpServerOpts *self, const char *bindhost)
50 CMETHOD ATTR_NONNULL((2));
51
59DECLEXPORT void
61 CMETHOD;
62
71DECLEXPORT void
73 const char *certfile, const char *keyfile)
74 CMETHOD ATTR_NONNULL((2)) ATTR_NONNULL((3));
75
81DECLEXPORT void
82PSC_TcpServerOpts_setProto(PSC_TcpServerOpts *self, PSC_Proto proto)
83 CMETHOD;
84
89DECLEXPORT void
90PSC_TcpServerOpts_numericHosts(PSC_TcpServerOpts *self)
91 CMETHOD;
92
97DECLEXPORT void
98PSC_TcpServerOpts_destroy(PSC_TcpServerOpts *self);
99
106DECLEXPORT PSC_UnixServerOpts *
107PSC_UnixServerOpts_create(const char *name)
108 ATTR_RETNONNULL ATTR_NONNULL((1));
109
117DECLEXPORT void
118PSC_UnixSeverOpts_readBufSize(PSC_UnixServerOpts *self, size_t sz)
119 CMETHOD;
120
128DECLEXPORT void
129PSC_UnixServerOpts_owner(PSC_UnixServerOpts *self, int uid, int gid)
130 CMETHOD;
131
139DECLEXPORT void
140PSC_UnixServerOpts_mode(PSC_UnixServerOpts *self, int mode)
141 CMETHOD;
142
147DECLEXPORT void
148PSC_UnixServerOpts_destroy(PSC_UnixServerOpts *self);
149
155DECLEXPORT PSC_Server *
156PSC_Server_createTcp(const PSC_TcpServerOpts *opts)
157 ATTR_NONNULL((1));
158
164DECLEXPORT PSC_Server *
165PSC_Server_createUnix(const PSC_UnixServerOpts *opts)
166 ATTR_NONNULL((1));
167
176DECLEXPORT PSC_Event *
177PSC_Server_clientConnected(PSC_Server *self)
178 CMETHOD ATTR_RETNONNULL ATTR_PURE;
179
191DECLEXPORT PSC_Event *
192PSC_Server_clientDisconnected(PSC_Server *self)
193 CMETHOD ATTR_RETNONNULL ATTR_PURE;
194
205DECLEXPORT void
206PSC_Server_disable(PSC_Server *self)
207 CMETHOD;
208
215DECLEXPORT void
216PSC_Server_enable(PSC_Server *self)
217 CMETHOD;
218
224DECLEXPORT void
225PSC_Server_destroy(PSC_Server *self);
226
227#endif
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