gwenhywfar 5.12.0
endpoint.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the project Gwenhywfar.
3 * Gwenhywfar (c) by 2023 Martin Preuss, all rights reserved.
4 *
5 * The license for this file can be found in the file COPYING which you
6 * should have received along with this file.
7 ****************************************************************************/
8
9#ifndef GWEN_MSG_ENDPOINT_H
10#define GWEN_MSG_ENDPOINT_H
11
12
13#include <gwenhywfar/inherit.h>
14#include <gwenhywfar/tree2.h>
16
17
18
19#define GWEN_MSG_ENDPOINT_FLAGS_DELETE 0x80000000u
20#define GWEN_MSG_ENDPOINT_FLAGS_NOIO 0x40000000u
21
22
23#define GWEN_MSG_ENDPOINT_STATE_UNCONNECTED 0
24#define GWEN_MSG_ENDPOINT_STATE_CONNECTING 1
25#define GWEN_MSG_ENDPOINT_STATE_CONNECTED 2
26
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32
40
41#ifdef __cplusplus
42}
43#endif
44
45
46#include <gwenhywfar/msg.h>
47
48#include <time.h>
49
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
181
182
184 GWEN_SOCKETSET *readSet,
185 GWEN_SOCKETSET *writeSet,
186 GWEN_SOCKETSET *xSet);
187
189 GWEN_SOCKETSET *readSet,
190 GWEN_SOCKETSET *writeSet,
191 GWEN_SOCKETSET *xSet);
192
193
194
197
199
200
203
206
210
215
218
220
221
225
230
231
233
236
237
238
240 GWEN_SOCKETSET *readSet,
241 GWEN_SOCKETSET *writeSet,
242 GWEN_SOCKETSET *xSet);
243
245 GWEN_SOCKETSET *readSet,
246 GWEN_SOCKETSET *writeSet,
247 GWEN_SOCKETSET *xSet);
248
259
260
261
262
263
265 GWEN_SOCKETSET *readSet,
266 GWEN_SOCKETSET *writeSet,
267 GWEN_SOCKETSET *xSet);
268
270 GWEN_SOCKETSET *readSet,
271 GWEN_SOCKETSET *writeSet,
272 GWEN_SOCKETSET *xSet);
273
282
283
285
286
287
288
289GWENHYWFAR_API int GWEN_MsgEndpoint_ReadFromSocket(GWEN_MSG_ENDPOINT *ep, uint8_t *bufferPtr, uint32_t bufferLen);
290GWENHYWFAR_API int GWEN_MsgEndpoint_WriteToSocket(GWEN_MSG_ENDPOINT *ep, const uint8_t *bufferPtr, uint32_t bufferLen);
292
293
294
302
303
304
305
310
311
314#ifdef __cplusplus
315}
316#endif
317
318
319#endif
320
321
GWENHYWFAR_API int GWEN_MsgEndpoint_DiscardInput(GWEN_MSG_ENDPOINT *ep)
struct GWEN_MSG_ENDPOINT GWEN_MSG_ENDPOINT
Object which can send and receive messages (base class).
Definition: endpoint.h:37
GWENHYWFAR_API GWEN_SOCKET * GWEN_MsgEndpoint_GetSocket(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_CheckSockets(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKETSET *readSet, GWEN_SOCKETSET *writeSet, GWEN_SOCKETSET *xSet)
GWENHYWFAR_API void GWEN_MsgEndpoint_AddSockets(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKETSET *readSet, GWEN_SOCKETSET *writeSet, GWEN_SOCKETSET *xSet)
GWENHYWFAR_API int GWEN_MsgEndpoint_GetDefaultMessageSize(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_SetFlags(GWEN_MSG_ENDPOINT *ep, uint32_t f)
GWENHYWFAR_API void GWEN_MsgEndpoint_RemoveUnconnectedAndEmptyChildren(GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API time_t GWEN_MsgEndpoint_GetTimeOfLastStateChange(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API GWEN_MSG_ENDPOINT * GWEN_MsgEndpoint_new(const char *name, int groupId)
void(* GWEN_MSG_ENDPOINT_ADDSOCKETS_FN)(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKETSET *readSet, GWEN_SOCKETSET *writeSet, GWEN_SOCKETSET *xSet)
Definition: endpoint.h:183
GWENHYWFAR_API int GWEN_MsgEndpoint_HaveMessageToSend(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_free(GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_Attach(GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_SetState(GWEN_MSG_ENDPOINT *ep, int m)
GWENHYWFAR_API const char * GWEN_MsgEndpoint_GetName(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API int GWEN_MsgEndpoint_ReadFromSocket(GWEN_MSG_ENDPOINT *ep, uint8_t *bufferPtr, uint32_t bufferLen)
GWENHYWFAR_API void GWEN_MsgEndpoint_IoLoop(GWEN_MSG_ENDPOINT *ep, int timeout)
GWENHYWFAR_API GWEN_MSG_ENDPOINT_CHECKSOCKETS_FN GWEN_MsgEndpoint_SetCheckSocketsFn(GWEN_MSG_ENDPOINT *ep, GWEN_MSG_ENDPOINT_CHECKSOCKETS_FN fn)
GWENHYWFAR_API void GWEN_MsgEndpoint_ChildrenCheckSockets(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKETSET *readSet, GWEN_SOCKETSET *writeSet, GWEN_SOCKETSET *xSet)
GWENHYWFAR_API int GWEN_MsgEndpoint_WriteToSocket(GWEN_MSG_ENDPOINT *ep, const uint8_t *bufferPtr, uint32_t bufferLen)
GWENHYWFAR_API void GWEN_MsgEndpoint_SetCurrentlyReceivedMsg(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *m)
GWENHYWFAR_API int GWEN_MsgEndpoint_GetGroupId(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API GWEN_MSG_ENDPOINT_ADDSOCKETS_FN GWEN_MsgEndpoint_SetAddSocketsFn(GWEN_MSG_ENDPOINT *ep, GWEN_MSG_ENDPOINT_ADDSOCKETS_FN fn)
GWENHYWFAR_API void GWEN_MsgEndpoint_ChildrenIoLoop(GWEN_MSG_ENDPOINT *ep, int timeout)
GWENHYWFAR_API GWEN_MSG_LIST * GWEN_MsgEndpoint_GetReceivedMessageList(const GWEN_MSG_ENDPOINT *ep)
void(* GWEN_MSG_ENDPOINT_CHECKSOCKETS_FN)(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKETSET *readSet, GWEN_SOCKETSET *writeSet, GWEN_SOCKETSET *xSet)
Definition: endpoint.h:188
GWENHYWFAR_API void GWEN_MsgEndpoint_SetDefaultMessageSize(GWEN_MSG_ENDPOINT *ep, int i)
GWENHYWFAR_API GWEN_MSG * GWEN_MsgEndpoint_GetFirstSendMessage(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API GWEN_MSG_LIST * GWEN_MsgEndpoint_GetSendMessageList(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_SetSocket(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKET *sk)
GWENHYWFAR_API uint32_t GWEN_MsgEndpoint_GetNextMessageId(GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_AddFlags(GWEN_MSG_ENDPOINT *ep, uint32_t f)
GWENHYWFAR_API void GWEN_MsgEndpoint_AddReceivedMessage(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *m)
GWENHYWFAR_API int GWEN_MsgEndpoint_GetState(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API GWEN_MSG * GWEN_MsgEndpoint_GetFirstReceivedMessage(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_DelFlags(GWEN_MSG_ENDPOINT *ep, uint32_t f)
GWENHYWFAR_API GWEN_MSG * GWEN_MsgEndpoint_GetCurrentlyReceivedMsg(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_AddSendMessage(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *m)
GWENHYWFAR_API void GWEN_MsgEndpoint_ChildrenAddSockets(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKETSET *readSet, GWEN_SOCKETSET *writeSet, GWEN_SOCKETSET *xSet)
GWENHYWFAR_API uint32_t GWEN_MsgEndpoint_GetFlags(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_Disconnect(GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API GWEN_MSG * GWEN_MsgEndpoint_TakeFirstReceivedMessage(GWEN_MSG_ENDPOINT *ep)
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:67
This file contains sockets and socket sets.
struct GWEN_SOCKETSETSTRUCT GWEN_SOCKETSET
Definition: inetsocket.h:41
struct GWEN_SOCKET GWEN_SOCKET
Definition: inetsocket.h:40
#define GWEN_INHERIT_FUNCTION_LIB_DEFS(t, decl)
Definition: inherit.h:125
GWEN_TREE2_FUNCTION_LIB_DEFS(GWEN_JSON_ELEM, GWEN_JsonElement, GWENHYWFAR_API)
struct GWEN_MSG GWEN_MSG
Definition: msg.h:24