gwenhywfar  5.11.2beta
msg.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_H
11 #define GWEN_MSG_MSG_H
12 
13 
14 #include <gwenhywfar/list.h>
15 #include <gwenhywfar/inherit.h>
16 #include <gwenhywfar/buffer.h>
17 #include <gwenhywfar/db.h>
18 
19 
20 
21 #define GWEN_MSG_FLAGS_PAYLOADINFO_SET 0x80000000u
22 
23 
24 
25 typedef struct GWEN_MSG GWEN_MSG;
28 
29 
30 
31 GWENHYWFAR_API GWEN_MSG *GWEN_Msg_new(uint32_t bufferSize);
32 GWENHYWFAR_API GWEN_MSG *GWEN_Msg_fromBytes(const uint8_t *ptr, uint32_t len);
33 
37 
39 GWENHYWFAR_API void GWEN_Msg_SetGroupId(GWEN_MSG *msg, int groupId);
40 
41 GWENHYWFAR_API uint32_t GWEN_Msg_GetMaxSize(const GWEN_MSG *msg);
43 GWENHYWFAR_API const uint8_t *GWEN_Msg_GetConstBuffer(const GWEN_MSG *msg);
47 GWENHYWFAR_API int GWEN_Msg_AddByte(GWEN_MSG *msg, uint8_t b);
48 GWENHYWFAR_API int GWEN_Msg_AddBytes(GWEN_MSG *msg, const uint8_t *bufferPtr, uint32_t bufferLen);
50 GWENHYWFAR_API int GWEN_Msg_IncCurrentPos(GWEN_MSG *msg, uint32_t i);
53 
54 
62 
65 
68 
72 GWENHYWFAR_API uint32_t GWEN_Msg_GetFlags(const GWEN_MSG *msg);
73 GWENHYWFAR_API void GWEN_Msg_SetFlags(GWEN_MSG *msg, uint32_t f);
74 GWENHYWFAR_API void GWEN_Msg_AddFlags(GWEN_MSG *msg, uint32_t f);
75 GWENHYWFAR_API void GWEN_Msg_DelFlags(GWEN_MSG *msg, uint32_t f);
76 
77 
78 GWENHYWFAR_API uint64_t GWEN_Msg_GetUint64At(const GWEN_MSG *msg, int offs, uint64_t defaultValue);
79 GWENHYWFAR_API uint32_t GWEN_Msg_GetUint32At(const GWEN_MSG *msg, int offs, uint32_t defaultValue);
80 GWENHYWFAR_API uint16_t GWEN_Msg_GetUint16At(const GWEN_MSG *msg, int offs, uint16_t defaultValue);
81 GWENHYWFAR_API uint8_t GWEN_Msg_GetUint8At(const GWEN_MSG *msg, int offs, uint8_t defaultValue);
82 
83 
84 GWENHYWFAR_API void GWEN_Msg_Dump(const GWEN_MSG *msg, GWEN_BUFFER *buf);
85 
86 
87 #endif
88 
89 
GWENHYWFAR_API void GWEN_Msg_free(GWEN_MSG *msg)
Definition: msg.c:74
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:228
GWENHYWFAR_API uint32_t GWEN_Msg_GetFlags(const GWEN_MSG *msg)
Definition: msg.c:301
GWENHYWFAR_API int GWEN_Msg_ReadNextByte(GWEN_MSG *msg)
Definition: msg.c:220
GWENHYWFAR_API void GWEN_Msg_Dump(const GWEN_MSG *msg, GWEN_BUFFER *buf)
Definition: msg.c:423
GWENHYWFAR_API int GWEN_Msg_RewindCurrentPos(GWEN_MSG *msg)
Definition: msg.c:247
GWENHYWFAR_API uint32_t GWEN_Msg_GetParsedPayloadSize(const GWEN_MSG *msg)
Definition: msg.c:267
GWENHYWFAR_API void GWEN_Msg_Attach(GWEN_MSG *msg)
Definition: msg.c:66
GWENHYWFAR_API GWEN_MSG * GWEN_Msg_dup(const GWEN_MSG *srcMsg)
Definition: msg.c:91
GWENHYWFAR_API uint32_t GWEN_Msg_GetBytesInBuffer(const GWEN_MSG *msg)
Definition: msg.c:147
GWENHYWFAR_API void GWEN_Msg_AddFlags(GWEN_MSG *msg, uint32_t f)
Definition: msg.c:318
GWENHYWFAR_API void GWEN_Msg_SetParsedPayloadOffset(GWEN_MSG *msg, uint32_t v)
Definition: msg.c:293
GWENHYWFAR_API void GWEN_Msg_SetFlags(GWEN_MSG *msg, uint32_t f)
Definition: msg.c:310
#define GWEN_INHERIT_FUNCTION_LIB_DEFS(t, decl)
Definition: inherit.h:125
GWENHYWFAR_API void GWEN_Msg_DelFlags(GWEN_MSG *msg, uint32_t f)
Definition: msg.c:326
GWENHYWFAR_API void GWEN_Msg_SetDbParsedInfo(GWEN_MSG *msg, GWEN_DB_NODE *db)
Definition: msg.c:343
GWENHYWFAR_API int GWEN_Msg_GetRemainingBytes(const GWEN_MSG *msg)
Definition: msg.c:258
GWENHYWFAR_API int GWEN_Msg_AddBytes(GWEN_MSG *msg, const uint8_t *bufferPtr, uint32_t bufferLen)
Definition: msg.c:189
GWENHYWFAR_API void GWEN_Msg_SetGroupId(GWEN_MSG *msg, int groupId)
Definition: msg.c:122
GWENHYWFAR_API const uint8_t * GWEN_Msg_GetConstBuffer(const GWEN_MSG *msg)
Definition: msg.c:138
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:38
GWENHYWFAR_API void GWEN_Msg_SetParsedPayloadSize(GWEN_MSG *msg, uint32_t v)
Definition: msg.c:276
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:67
#define GWEN_LIST_FUNCTION_LIB_DEFS(t, pr, decl)
Definition: list1.h:349
GWENHYWFAR_API uint8_t GWEN_Msg_GetUint8At(const GWEN_MSG *msg, int offs, uint8_t defaultValue)
Definition: msg.c:408
GWENHYWFAR_API int GWEN_Msg_IncCurrentPos(GWEN_MSG *msg, uint32_t i)
Definition: msg.c:233
GWENHYWFAR_API GWEN_DB_NODE * GWEN_Msg_GetDbParsedInfo(const GWEN_MSG *msg)
Definition: msg.c:334
struct GWEN_MSG GWEN_MSG
Definition: msg.h:25
GWENHYWFAR_API uint16_t GWEN_Msg_GetUint16At(const GWEN_MSG *msg, int offs, uint16_t defaultValue)
Definition: msg.c:393
GWENHYWFAR_API void GWEN_Msg_SetBytesInBuffer(GWEN_MSG *msg, uint32_t i)
Definition: msg.c:157
GWENHYWFAR_API GWEN_MSG * GWEN_Msg_new(uint32_t bufferSize)
Definition: msg.c:33
GWENHYWFAR_API uint32_t GWEN_Msg_GetMaxSize(const GWEN_MSG *msg)
Definition: msg.c:165
GWENHYWFAR_API GWEN_MSG * GWEN_Msg_fromBytes(const uint8_t *ptr, uint32_t len)
Definition: msg.c:50
GWENHYWFAR_API int GWEN_Msg_AddByte(GWEN_MSG *msg, uint8_t b)
Definition: msg.c:182
GWENHYWFAR_API int GWEN_Msg_GetGroupId(const GWEN_MSG *msg)
Definition: msg.c:115
GWENHYWFAR_API uint32_t GWEN_Msg_GetParsedPayloadOffset(const GWEN_MSG *msg)
Definition: msg.c:284
GWENHYWFAR_API uint32_t GWEN_Msg_GetUint32At(const GWEN_MSG *msg, int offs, uint32_t defaultValue)
Definition: msg.c:378
GWENHYWFAR_API uint64_t GWEN_Msg_GetUint64At(const GWEN_MSG *msg, int offs, uint64_t defaultValue)
Definition: msg.c:354
GWENHYWFAR_API uint8_t * GWEN_Msg_GetBuffer(GWEN_MSG *msg)
Definition: msg.c:129
GWENHYWFAR_API uint32_t GWEN_Msg_GetCurrentPos(const GWEN_MSG *msg)
Definition: msg.c:172