gwenhywfar  5.11.1beta
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>
15 #include <gwenhywfar/inetsocket.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
29 extern "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
52 extern "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 
195 GWENHYWFAR_API GWEN_MSG_ENDPOINT *GWEN_MsgEndpoint_new(const char *name, int groupId);
196 
198 
199 
202 
205 
209 
214 
217 
218 
222 
227 
228 
230 
233 
234 
235 
237  GWEN_SOCKETSET *readSet,
238  GWEN_SOCKETSET *writeSet,
239  GWEN_SOCKETSET *xSet);
240 
242  GWEN_SOCKETSET *readSet,
243  GWEN_SOCKETSET *writeSet,
244  GWEN_SOCKETSET *xSet);
245 
256 
257 
258 
259 
260 
262  GWEN_SOCKETSET *readSet,
263  GWEN_SOCKETSET *writeSet,
264  GWEN_SOCKETSET *xSet);
265 
267  GWEN_SOCKETSET *readSet,
268  GWEN_SOCKETSET *writeSet,
269  GWEN_SOCKETSET *xSet);
270 
279 
280 
282 
283 
284 
285 
286 GWENHYWFAR_API int GWEN_MsgEndpoint_ReadFromSocket(GWEN_MSG_ENDPOINT *ep, uint8_t *bufferPtr, uint32_t bufferLen);
287 GWENHYWFAR_API int GWEN_MsgEndpoint_WriteToSocket(GWEN_MSG_ENDPOINT *ep, const uint8_t *bufferPtr, uint32_t bufferLen);
289 
290 
291 
299 
300 
301 
302 
307 
308 
311 #ifdef __cplusplus
312 }
313 #endif
314 
315 
316 #endif
317 
318 
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 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 const char * GWEN_MsgEndpoint_GetName(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_LIST * GWEN_MsgEndpoint_GetReceivedMessageList(const GWEN_MSG_ENDPOINT *ep)
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 GWEN_MSG_LIST * GWEN_MsgEndpoint_GetSendMessageList(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_SetState(GWEN_MSG_ENDPOINT *ep, int m)
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 GWEN_MSG * GWEN_MsgEndpoint_TakeFirstReceivedMessage(GWEN_MSG_ENDPOINT *ep)
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)
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 void GWEN_MsgEndpoint_SetSocket(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKET *sk)
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 GWEN_MSG * GWEN_MsgEndpoint_GetCurrentlyReceivedMsg(const GWEN_MSG_ENDPOINT *ep)
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_ENDPOINT * GWEN_MsgEndpoint_new(const char *name, int groupId)
GWENHYWFAR_API GWEN_MSG * GWEN_MsgEndpoint_GetFirstSendMessage(const GWEN_MSG_ENDPOINT *ep)
GWENHYWFAR_API void GWEN_MsgEndpoint_AddSendMessage(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *m)
GWENHYWFAR_API GWEN_SOCKET * GWEN_MsgEndpoint_GetSocket(const GWEN_MSG_ENDPOINT *ep)
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)
#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:25