poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
connection.h
Go to the documentation of this file.
1#ifndef POSER_CORE_CONNECTION_H
2#define POSER_CORE_CONNECTION_H
3
8#include <poser/decl.h>
9
10#include <stddef.h>
11#include <stdint.h>
12
26C_CLASS_DECL(PSC_Connection);
27
31C_CLASS_DECL(PSC_EADataReceived);
32
33C_CLASS_DECL(PSC_Event);
34
44typedef const char *(*PSC_MessageEndLocator)(const char *str);
45
54DECLEXPORT PSC_Event *
56 CMETHOD ATTR_RETNONNULL ATTR_PURE;
57
70DECLEXPORT PSC_Event *
72 CMETHOD ATTR_RETNONNULL ATTR_PURE;
73
86DECLEXPORT PSC_Event *
88 CMETHOD ATTR_RETNONNULL ATTR_PURE;
89
98DECLEXPORT PSC_Event *
100 CMETHOD ATTR_RETNONNULL ATTR_PURE;
101
108DECLEXPORT PSC_Event *
110 CMETHOD ATTR_RETNONNULL ATTR_PURE;
111
119DECLEXPORT const char *
121 CMETHOD ATTR_RETNONNULL ATTR_PURE;
122
130DECLEXPORT const char *
132 CMETHOD ATTR_PURE;
133
140DECLEXPORT int
142 CMETHOD ATTR_PURE;
143
160DECLEXPORT int
162 CMETHOD;
163
175DECLEXPORT void
177 CMETHOD ATTR_NONNULL((2));
178
190DECLEXPORT void
192 CMETHOD;
193
218DECLEXPORT int
220 const uint8_t *buf, size_t sz, void *id)
221 CMETHOD ATTR_NONNULL((2));
222
235DECLEXPORT int
236PSC_Connection_sendTextAsync(PSC_Connection *self, const char *text, void *id)
237 CMETHOD ATTR_NONNULL((2));
238
246DECLEXPORT void
248 CMETHOD;
249
258DECLEXPORT int
260 CMETHOD;
261
276DECLEXPORT int
278 CMETHOD;
279
293DECLEXPORT void
295 CMETHOD;
296
305DECLEXPORT void
307 void *data, void (*deleter)(void *))
308 CMETHOD;
309
316DECLEXPORT void *
318 CMETHOD ATTR_PURE;
319
327DECLEXPORT const uint8_t *
329 CMETHOD;
330
338DECLEXPORT size_t
340 CMETHOD;
341
349DECLEXPORT const char *
351 CMETHOD;
352
361DECLEXPORT void
363 CMETHOD;
364
365#endif
A socket connection.
void * PSC_Connection_data(const PSC_Connection *self)
Retreive attached data object.
void PSC_Connection_pause(PSC_Connection *self)
Pause receiving data.
void PSC_Connection_receiveLine(PSC_Connection *self)
Configure for receiving lines.
void PSC_Connection_close(PSC_Connection *self, int blacklist)
Close connection.
const char * PSC_Connection_remoteAddr(const PSC_Connection *self)
The remote address.
void PSC_Connection_receiveText(PSC_Connection *self, PSC_MessageEndLocator locator)
Configure for receiving text.
PSC_Event * PSC_Connection_closed(PSC_Connection *self)
Connection closed.
int PSC_Connection_remotePort(const PSC_Connection *self)
The remote port.
PSC_Event * PSC_Connection_dataReceived(PSC_Connection *self)
Data received.
void PSC_Connection_setData(PSC_Connection *self, void *data, void(*deleter)(void *))
Attach a data object.
int PSC_Connection_resume(PSC_Connection *self)
Resume receiving data.
int PSC_Connection_confirmDataReceived(PSC_Connection *self)
Confirm receiving data is completed.
PSC_Event * PSC_Connection_connected(PSC_Connection *self)
Connection successfully connected.
PSC_Event * PSC_Connection_nameResolved(PSC_Connection *self)
Remote name resolved.
int PSC_Connection_receiveBinary(PSC_Connection *self, size_t expected)
Configure for receiving binary data.
int PSC_Connection_sendAsync(PSC_Connection *self, const uint8_t *buf, size_t sz, void *id)
Send data to the peer.
int PSC_Connection_sendTextAsync(PSC_Connection *self, const char *text, void *id)
Send text to the peer.
const char * PSC_Connection_remoteHost(const PSC_Connection *self)
The remote hostname.
PSC_Event * PSC_Connection_dataSent(PSC_Connection *self)
Data sent.
Event arguments for data received on a connection.
size_t PSC_EADataReceived_size(const PSC_EADataReceived *self)
The size of the data received.
const uint8_t * PSC_EADataReceived_buf(const PSC_EADataReceived *self)
The data received.
const char * PSC_EADataReceived_text(const PSC_EADataReceived *self)
The text received.
void PSC_EADataReceived_markHandling(PSC_EADataReceived *self)
Mark received data as being handled.
A simple event class.
const char *(* PSC_MessageEndLocator)(const char *str)
Callback to find the end of a text message.
Definition: connection.h:44