gwenhywfar  5.14.1
request.h
Go to the documentation of this file.
1 /****************************************************************************
2  * This file is part of the project Gwenhywfar.
3  * Gwenhywfar (c) by 2024 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_REQUEST_H
10 #define GWEN_MSG_REQUEST_H
11 
12 
13 #include <gwenhywfar/gwenhywfar.h>
14 #include <gwenhywfar/msg.h>
15 #include <gwenhywfar/endpoint.h>
16 #include <gwenhywfar/inherit.h>
17 #include <gwenhywfar/tree2.h>
18 #include <gwenhywfar/timestamp.h>
19 
20 
21 #define GWEN_MSG_REQUEST_RESULT_NOT_HANDLED 0
22 #define GWEN_MSG_REQUEST_RESULT_HANDLED 1
23 
24 #define GWEN_MSG_REQUEST_REASON_DONE 0
25 #define GWEN_MSG_REQUEST_REASON_ABORTED 1
26 #define GWEN_MSG_REQUEST_REASON_TIMEOUT 2
27 #define GWEN_MSG_REQUEST_REASON_DISCONNECT 3
28 
29 #define GWEN_MSG_REQUEST_STATE_OPEN 0
30 #define GWEN_MSG_REQUEST_STATE_DONE 1
31 
32 
33 
35 
38 
41 typedef void (*GWEN_MSG_REQUEST_ABORT_FN)(GWEN_MSG_REQUEST *rq, int reason);
42 
43 
46 
49 
52 
55 
58 
62 
65 
68 
70 
73 
76 
77 
80  uint32_t refMsgId);
81 
82 
86 
87 
88 
91 
94 
98 
99 
100 
101 #endif
102 
103 
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestMsgId(GWEN_MSG_REQUEST *rq, uint32_t id)
Definition: request.c:119
GWENHYWFAR_API GWEN_MSG * GWEN_MsgRequest_GetRequestMsg(const GWEN_MSG_REQUEST *rq)
Definition: request.c:75
GWENHYWFAR_API GWEN_MSG_REQUEST * GWEN_MsgRequest_new()
Definition: request.c:29
int(* GWEN_MSG_REQUEST_HANDLERESPONSE_FN)(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
Definition: request.h:39
struct GWEN_MSG_ENDPOINT GWEN_MSG_ENDPOINT
Object which can send and receive messages (base class).
Definition: endpoint.h:37
GWENHYWFAR_API void GWEN_MsgRequest_SetPrivateData(GWEN_MSG_REQUEST *rq, void *p)
Definition: request.c:292
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestType(GWEN_MSG_REQUEST *rq, int t)
Definition: request.c:67
GWENHYWFAR_API void GWEN_MsgRequest_Abort(GWEN_MSG_REQUEST *rq, int reason)
Definition: request.c:219
GWENHYWFAR_API int GWEN_MsgRequest_HandleResponse(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
Definition: request.c:202
GWENHYWFAR_API void GWEN_MsgRequest_SubRequestFinished(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST *subRq, int reason)
Definition: request.c:211
GWENHYWFAR_API GWEN_MSG_ENDPOINT * GWEN_MsgRequest_GetEndpoint(const GWEN_MSG_REQUEST *rq)
Definition: request.c:92
GWENHYWFAR_API void GWEN_MsgRequest_AddMsgToList(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
Definition: request.c:141
struct GWEN_MSG_REQUEST GWEN_MSG_REQUEST
Definition: request.h:34
GWENHYWFAR_API GWEN_MSG * GWEN_MsgRequest_GetFirstMsgFromList(const GWEN_MSG_REQUEST *rq)
Definition: request.c:134
GWENHYWFAR_API void GWEN_MsgRequest_SetExpiresAt(GWEN_MSG_REQUEST *rq, GWEN_TIMESTAMP *ts)
Definition: request.c:176
#define GWEN_INHERIT_FUNCTION_LIB_DEFS(t, decl)
Definition: inherit.h:125
GWENHYWFAR_API const GWEN_TIMESTAMP * GWEN_MsgRequest_GetCreatedAt(const GWEN_MSG_REQUEST *rq)
Definition: request.c:152
GWENHYWFAR_API int GWEN_MsgRequest_GetResult(const GWEN_MSG_REQUEST *rq)
Definition: request.c:300
GWENHYWFAR_API void GWEN_MsgRequest_SetTimestamps(GWEN_MSG_REQUEST *rq, int expiresInSecs)
Definition: request.c:186
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestMsg(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
Definition: request.c:82
GWENHYWFAR_API GWEN_MSG_LIST * GWEN_MsgRequest_GetMsgList(const GWEN_MSG_REQUEST *rq)
Definition: request.c:127
GWENHYWFAR_API void GWEN_MsgRequest_free(GWEN_MSG_REQUEST *rq)
Definition: request.c:42
GWENHYWFAR_API void GWEN_MsgRequest_SetState(GWEN_MSG_REQUEST *rq, int i)
Definition: request.c:322
GWENHYWFAR_API void GWEN_MsgRequest_SetEndpoint(GWEN_MSG_REQUEST *rq, GWEN_MSG_ENDPOINT *ep)
Definition: request.c:99
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:67
struct GWEN_MSG GWEN_MSG
Definition: msg.h:24
GWENHYWFAR_API GWEN_MSG_REQUEST_HANDLERESPONSE_FN GWEN_MsgRequest_SetHandleResponseFn(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST_HANDLERESPONSE_FN fn)
Definition: request.c:237
void(* GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN)(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST *subRq, int reason)
Definition: request.h:40
GWENHYWFAR_API void GWEN_MsgRequest_SetCreatedAt(GWEN_MSG_REQUEST *rq, GWEN_TIMESTAMP *ts)
Definition: request.c:159
GWENHYWFAR_API GWEN_MSG_REQUEST_ABORT_FN GWEN_MsgRequest_SetAbortFn(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST_ABORT_FN f)
Definition: request.c:268
GWENHYWFAR_API int GWEN_MsgRequest_GetRequestType(const GWEN_MSG_REQUEST *rq)
Definition: request.c:60
GWEN_TREE2_FUNCTION_LIB_DEFS(GWEN_JSON_ELEM, GWEN_JsonElement, GWENHYWFAR_API)
GWENHYWFAR_API int GWEN_MsgRequest_GetState(const GWEN_MSG_REQUEST *rq)
Definition: request.c:315
GWENHYWFAR_API uint32_t GWEN_MsgRequest_GetRequestMsgId(const GWEN_MSG_REQUEST *rq)
Definition: request.c:112
GWENHYWFAR_API GWEN_MSG_REQUEST * GWEN_MsgRequest_Tree2_FindByEndpointAndMsgId(GWEN_MSG_REQUEST *rootRq, GWEN_MSG_ENDPOINT *ep, uint32_t refMsgId)
Definition: request.c:335
GWENHYWFAR_API const GWEN_TIMESTAMP * GWEN_MsgRequest_GetExpiresAt(const GWEN_MSG_REQUEST *rq)
Definition: request.c:169
GWENHYWFAR_API void * GWEN_MsgRequest_GetPrivateData(const GWEN_MSG_REQUEST *rq)
Definition: request.c:285
void(* GWEN_MSG_REQUEST_ABORT_FN)(GWEN_MSG_REQUEST *rq, int reason)
Definition: request.h:41
GWENHYWFAR_API GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN GWEN_MsgRequest_SetSubRequestFinishedFn(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN f)
Definition: request.c:252
struct GWEN_TIMESTAMP GWEN_TIMESTAMP
Definition: timestamp.h:36
GWENHYWFAR_API void GWEN_MsgRequest_SetResult(GWEN_MSG_REQUEST *rq, int result)
Definition: request.c:307