gwenhywfar  5.14.1
msg_ipc.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 
10 #ifndef GWEN_MSG_MSG_IPC_H
11 #define GWEN_MSG_MSG_IPC_H
12 
13 
14 #include <gwenhywfar/msg.h>
15 
16 
17 #define GWEN_MSGIPC_OFFS_SIZE 0 /* 4 bytes: number of all bytes including size, protoid, protover and code */
18 #define GWEN_MSGIPC_OFFS_PROTOID 4 /* 1 byte: protocol id (free to use) */
19 #define GWEN_MSGIPC_OFFS_PROTOVER 5 /* 1 byte: protocol version (free to use) */
20 #define GWEN_MSGIPC_OFFS_CODE 6 /* 2 bytes msg code (meaning depends on protocol) */
21 #define GWEN_MSGIPC_OFFS_ID 8 /* 4 bytes msg id */
22 #define GWEN_MSGIPC_OFFS_REFID 12 /* 4 bytes reference msg id */
23 #define GWEN_MSGIPC_OFFS_PAYLOAD 16 /* begin of payload for a given message */
24 
25 
26 
27 GWENHYWFAR_API GWEN_MSG *GWEN_IpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code,
28  uint32_t msgId, uint32_t refMsgId,
29  uint32_t payloadLen, const uint8_t *payload);
35 GWENHYWFAR_API uint16_t GWEN_IpcMsg_GetCode(const GWEN_MSG *msg);
36 
37 GWENHYWFAR_API uint32_t GWEN_IpcMsg_GetMsgId(const GWEN_MSG *msg);
39 
40 
41 #endif
42 
43 
GWENHYWFAR_API uint8_t GWEN_IpcMsg_GetProtoId(const GWEN_MSG *msg)
Definition: msg_ipc.c:81
GWENHYWFAR_API void GWEN_IpcMsg_AdjustMsgSize(GWEN_MSG *msg)
Definition: msg_ipc.c:50
GWENHYWFAR_API uint32_t GWEN_IpcMsg_GetMsgId(const GWEN_MSG *msg)
Definition: msg_ipc.c:102
GWENHYWFAR_API uint8_t GWEN_IpcMsg_GetProtoVersion(const GWEN_MSG *msg)
Definition: msg_ipc.c:88
GWENHYWFAR_API uint32_t GWEN_IpcMsg_GetMsgSize(const GWEN_MSG *msg)
Definition: msg_ipc.c:74
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:67
struct GWEN_MSG GWEN_MSG
Definition: msg.h:24
GWENHYWFAR_API uint32_t GWEN_IpcMsg_GetRefMsgId(const GWEN_MSG *msg)
Definition: msg_ipc.c:109
GWENHYWFAR_API uint16_t GWEN_IpcMsg_GetCode(const GWEN_MSG *msg)
Definition: msg_ipc.c:95
GWENHYWFAR_API GWEN_MSG * GWEN_IpcMsg_new(uint8_t protoId, uint8_t protoVer, uint16_t code, uint32_t msgId, uint32_t refMsgId, uint32_t payloadLen, const uint8_t *payload)
Definition: msg_ipc.c:22
GWENHYWFAR_API int GWEN_IpcMsg_IsMsgComplete(const GWEN_MSG *msg)
Definition: msg_ipc.c:58