request.h
Go to the documentation of this file.
/****************************************************************************
* This file is part of the project Gwenhywfar.
* Gwenhywfar (c) by 2024 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifndef GWEN_MSG_REQUEST_H
#define GWEN_MSG_REQUEST_H
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/msg.h>
#include <gwenhywfar/endpoint.h>
#include <gwenhywfar/inherit.h>
#include <gwenhywfar/tree2.h>
#include <gwenhywfar/timestamp.h>
#define GWEN_MSG_REQUEST_RESULT_NOT_HANDLED 0
#define GWEN_MSG_REQUEST_RESULT_HANDLED 1
#define GWEN_MSG_REQUEST_REASON_DONE 0
#define GWEN_MSG_REQUEST_REASON_ABORTED 1
#define GWEN_MSG_REQUEST_REASON_TIMEOUT 2
#define GWEN_MSG_REQUEST_REASON_DISCONNECT 3
#define GWEN_MSG_REQUEST_STATE_OPEN 0
#define GWEN_MSG_REQUEST_STATE_DONE 1
typedef struct GWEN_MSG_REQUEST GWEN_MSG_REQUEST;
GWEN_INHERIT_FUNCTION_LIB_DEFS(GWEN_MSG_REQUEST, GWENHYWFAR_API)
GWEN_TREE2_FUNCTION_LIB_DEFS(GWEN_MSG_REQUEST, GWEN_MsgRequest, GWENHYWFAR_API)
typedef int (*GWEN_MSG_REQUEST_HANDLERESPONSE_FN)(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg);
typedef void (*GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN)(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST *subRq, int reason);
typedef void (*GWEN_MSG_REQUEST_ABORT_FN)(GWEN_MSG_REQUEST *rq, int reason);
GWENHYWFAR_API GWEN_MSG_REQUEST *GWEN_MsgRequest_new();
GWENHYWFAR_API void GWEN_MsgRequest_free(GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API int GWEN_MsgRequest_GetRequestType(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestType(GWEN_MSG_REQUEST *rq, int t);
GWENHYWFAR_API GWEN_MSG *GWEN_MsgRequest_GetRequestMsg(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestMsg(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg);
GWENHYWFAR_API GWEN_MSG_ENDPOINT *GWEN_MsgRequest_GetEndpoint(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetEndpoint(GWEN_MSG_REQUEST *rq, GWEN_MSG_ENDPOINT *ep);
GWENHYWFAR_API uint32_t GWEN_MsgRequest_GetRequestMsgId(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestMsgId(GWEN_MSG_REQUEST *rq, uint32_t id);
GWENHYWFAR_API GWEN_MSG_LIST *GWEN_MsgRequest_GetMsgList(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API GWEN_MSG *GWEN_MsgRequest_GetFirstMsgFromList(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_AddMsgToList(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg);
GWENHYWFAR_API const GWEN_TIMESTAMP *GWEN_MsgRequest_GetCreatedAt(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetCreatedAt(GWEN_MSG_REQUEST *rq, GWEN_TIMESTAMP *ts);
GWENHYWFAR_API const GWEN_TIMESTAMP *GWEN_MsgRequest_GetExpiresAt(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetExpiresAt(GWEN_MSG_REQUEST *rq, GWEN_TIMESTAMP *ts);
GWENHYWFAR_API void GWEN_MsgRequest_SetTimestamps(GWEN_MSG_REQUEST *rq, int expiresInSecs);
GWENHYWFAR_API int GWEN_MsgRequest_GetResult(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetResult(GWEN_MSG_REQUEST *rq, int result);
GWENHYWFAR_API int GWEN_MsgRequest_GetState(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetState(GWEN_MSG_REQUEST *rq, int i);
GWENHYWFAR_API GWEN_MSG_REQUEST *GWEN_MsgRequest_Tree2_FindByEndpointAndMsgId(GWEN_MSG_REQUEST *rootRq,
GWEN_MSG_ENDPOINT *ep,
uint32_t refMsgId);
GWENHYWFAR_API int GWEN_MsgRequest_HandleResponse(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg);
GWENHYWFAR_API void GWEN_MsgRequest_SubRequestFinished(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST *subRq, int reason);
GWENHYWFAR_API void GWEN_MsgRequest_Abort(GWEN_MSG_REQUEST *rq, int reason);
GWENHYWFAR_API void *GWEN_MsgRequest_GetPrivateData(const GWEN_MSG_REQUEST *rq);
GWENHYWFAR_API void GWEN_MsgRequest_SetPrivateData(GWEN_MSG_REQUEST *rq, void *p);
GWENHYWFAR_API GWEN_MSG_REQUEST_HANDLERESPONSE_FN GWEN_MsgRequest_SetHandleResponseFn(GWEN_MSG_REQUEST *rq,
GWEN_MSG_REQUEST_HANDLERESPONSE_FN fn);
GWENHYWFAR_API GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN GWEN_MsgRequest_SetSubRequestFinishedFn(GWEN_MSG_REQUEST *rq,
GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN f);
GWENHYWFAR_API GWEN_MSG_REQUEST_ABORT_FN GWEN_MsgRequest_SetAbortFn(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST_ABORT_FN f);
#endif
endpoint.h
GWEN_MSG_ENDPOINT
struct GWEN_MSG_ENDPOINT GWEN_MSG_ENDPOINT
Object which can send and receive messages (base class).
Definition endpoint.h:37
gwenhywfar.h
GWENHYWFAR_API
#define GWENHYWFAR_API
Definition gwenhywfarapi.h:67
inherit.h
GWEN_INHERIT_FUNCTION_LIB_DEFS
#define GWEN_INHERIT_FUNCTION_LIB_DEFS(t, decl)
Definition inherit.h:125
msg.h
GWEN_MSG
struct GWEN_MSG GWEN_MSG
Definition msg.h:24
GWEN_MsgRequest_SetAbortFn
GWENHYWFAR_API GWEN_MSG_REQUEST_ABORT_FN GWEN_MsgRequest_SetAbortFn(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST_ABORT_FN f)
GWEN_MsgRequest_GetRequestType
GWENHYWFAR_API int GWEN_MsgRequest_GetRequestType(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_SetState
GWENHYWFAR_API void GWEN_MsgRequest_SetState(GWEN_MSG_REQUEST *rq, int i)
GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN
void(* GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN)(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST *subRq, int reason)
Definition request.h:40
GWEN_MsgRequest_GetPrivateData
GWENHYWFAR_API void * GWEN_MsgRequest_GetPrivateData(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_GetEndpoint
GWENHYWFAR_API GWEN_MSG_ENDPOINT * GWEN_MsgRequest_GetEndpoint(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_SetTimestamps
GWENHYWFAR_API void GWEN_MsgRequest_SetTimestamps(GWEN_MSG_REQUEST *rq, int expiresInSecs)
GWEN_MsgRequest_SetHandleResponseFn
GWENHYWFAR_API GWEN_MSG_REQUEST_HANDLERESPONSE_FN GWEN_MsgRequest_SetHandleResponseFn(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST_HANDLERESPONSE_FN fn)
GWEN_MsgRequest_SetPrivateData
GWENHYWFAR_API void GWEN_MsgRequest_SetPrivateData(GWEN_MSG_REQUEST *rq, void *p)
GWEN_MsgRequest_SetRequestMsgId
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestMsgId(GWEN_MSG_REQUEST *rq, uint32_t id)
GWEN_MsgRequest_SetRequestMsg
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestMsg(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
GWEN_MsgRequest_GetFirstMsgFromList
GWENHYWFAR_API GWEN_MSG * GWEN_MsgRequest_GetFirstMsgFromList(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_GetCreatedAt
GWENHYWFAR_API const GWEN_TIMESTAMP * GWEN_MsgRequest_GetCreatedAt(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_GetMsgList
GWENHYWFAR_API GWEN_MSG_LIST * GWEN_MsgRequest_GetMsgList(const GWEN_MSG_REQUEST *rq)
GWEN_MSG_REQUEST_HANDLERESPONSE_FN
int(* GWEN_MSG_REQUEST_HANDLERESPONSE_FN)(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
Definition request.h:39
GWEN_MsgRequest_SetEndpoint
GWENHYWFAR_API void GWEN_MsgRequest_SetEndpoint(GWEN_MSG_REQUEST *rq, GWEN_MSG_ENDPOINT *ep)
GWEN_MsgRequest_SetCreatedAt
GWENHYWFAR_API void GWEN_MsgRequest_SetCreatedAt(GWEN_MSG_REQUEST *rq, GWEN_TIMESTAMP *ts)
GWEN_MsgRequest_new
GWENHYWFAR_API GWEN_MSG_REQUEST * GWEN_MsgRequest_new()
GWEN_MsgRequest_GetResult
GWENHYWFAR_API int GWEN_MsgRequest_GetResult(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_SubRequestFinished
GWENHYWFAR_API void GWEN_MsgRequest_SubRequestFinished(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST *subRq, int reason)
GWEN_MsgRequest_GetRequestMsg
GWENHYWFAR_API GWEN_MSG * GWEN_MsgRequest_GetRequestMsg(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_SetRequestType
GWENHYWFAR_API void GWEN_MsgRequest_SetRequestType(GWEN_MSG_REQUEST *rq, int t)
GWEN_MsgRequest_Abort
GWENHYWFAR_API void GWEN_MsgRequest_Abort(GWEN_MSG_REQUEST *rq, int reason)
GWEN_MsgRequest_free
GWENHYWFAR_API void GWEN_MsgRequest_free(GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_Tree2_FindByEndpointAndMsgId
GWENHYWFAR_API GWEN_MSG_REQUEST * GWEN_MsgRequest_Tree2_FindByEndpointAndMsgId(GWEN_MSG_REQUEST *rootRq, GWEN_MSG_ENDPOINT *ep, uint32_t refMsgId)
GWEN_MsgRequest_AddMsgToList
GWENHYWFAR_API void GWEN_MsgRequest_AddMsgToList(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
GWEN_MsgRequest_GetState
GWENHYWFAR_API int GWEN_MsgRequest_GetState(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_GetRequestMsgId
GWENHYWFAR_API uint32_t GWEN_MsgRequest_GetRequestMsgId(const GWEN_MSG_REQUEST *rq)
GWEN_MsgRequest_SetSubRequestFinishedFn
GWENHYWFAR_API GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN GWEN_MsgRequest_SetSubRequestFinishedFn(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST_SUBREQUESTFINISHED_FN f)
GWEN_MsgRequest_SetResult
GWENHYWFAR_API void GWEN_MsgRequest_SetResult(GWEN_MSG_REQUEST *rq, int result)
GWEN_MsgRequest_HandleResponse
GWENHYWFAR_API int GWEN_MsgRequest_HandleResponse(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
GWEN_MsgRequest_SetExpiresAt
GWENHYWFAR_API void GWEN_MsgRequest_SetExpiresAt(GWEN_MSG_REQUEST *rq, GWEN_TIMESTAMP *ts)
GWEN_MsgRequest_GetExpiresAt
GWENHYWFAR_API const GWEN_TIMESTAMP * GWEN_MsgRequest_GetExpiresAt(const GWEN_MSG_REQUEST *rq)
GWEN_MSG_REQUEST
struct GWEN_MSG_REQUEST GWEN_MSG_REQUEST
Definition request.h:34
GWEN_MSG_REQUEST_ABORT_FN
void(* GWEN_MSG_REQUEST_ABORT_FN)(GWEN_MSG_REQUEST *rq, int reason)
Definition request.h:41
GWEN_MSG_LIST
Definition listdoc.h:5766
timestamp.h
GWEN_TIMESTAMP
struct GWEN_TIMESTAMP GWEN_TIMESTAMP
Definition timestamp.h:36
tree2.h
GWEN_TREE2_FUNCTION_LIB_DEFS
#define GWEN_TREE2_FUNCTION_LIB_DEFS(t, pr, decl)
Definition tree2.h:336