gwenhywfar 5.12.0
msg.c
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#ifdef HAVE_CONFIG_H
10# include <config.h>
11#endif
12
13/*#define DISABLE_DEBUGLOG*/
14
15
16#include "msgio/msg_p.h"
17
18#include <gwenhywfar/error.h>
19#include <gwenhywfar/misc.h>
20#include <gwenhywfar/debug.h>
21#include <gwenhywfar/text.h>
22#include <gwenhywfar/endianfns.h>
23
24
25#define GWEN_MSG_SIZE_STEP 4096
26#define GWEN_MSG_SIZE_MASK (~4095)
27
28
31
32
33static int _ensureWritePos(GWEN_MSG *msg, uint32_t newPos);
34
35
36
37GWEN_MSG *GWEN_Msg_new(uint32_t bufferSize)
38{
39 GWEN_MSG *msg;
40
42 msg->refCount=1;
45 if (bufferSize) {
46 msg->buffer=(uint8_t*) malloc(bufferSize);
47 msg->maxSize=bufferSize;
48 }
49 return msg;
50}
51
52
53
54GWEN_MSG *GWEN_Msg_fromBytes(const uint8_t *ptr, uint32_t len)
55{
56 if (ptr && len) {
57 GWEN_MSG *msg;
58
59 msg=GWEN_Msg_new(len);
60 memmove(msg->buffer, ptr, len);
61 msg->bytesInBuffer=len;
62 return msg;
63 }
64
65 return NULL;
66}
67
68
69
71{
72 if (msg && msg->refCount>0)
73 msg->refCount++;
74}
75
76
77
79{
80 if (msg && msg->refCount>0) {
81 if (msg->refCount==1) {
84 free(msg->buffer);
85 GWEN_DB_Group_free(msg->dbParsedInfo);
87 }
88 else
89 msg->refCount--;
90 }
91}
92
93
94
96{
97 if (srcMsg && srcMsg->refCount>0) {
98 GWEN_MSG *msg;
99
100 msg=GWEN_Msg_new(srcMsg->maxSize);
101 if (srcMsg->maxSize)
102 memmove(msg->buffer, srcMsg->buffer, msg->maxSize);
103 msg->bytesInBuffer=srcMsg->bytesInBuffer;
104 msg->currentPos=srcMsg->currentPos;
105 msg->groupId=srcMsg->groupId;
106 msg->parsedPayloadSize=srcMsg->parsedPayloadSize;
107 msg->parsedPayloadOffset=srcMsg->parsedPayloadOffset;
108 msg->flags=srcMsg->flags;
109 if (srcMsg->dbParsedInfo)
110 msg->dbParsedInfo=GWEN_DB_Group_dup(srcMsg->dbParsedInfo);
111
112 return msg;
113 }
114 return NULL;
115}
116
117
118
120{
121 return msg->groupId;
122}
123
124
125
126void GWEN_Msg_SetGroupId(GWEN_MSG *msg, int groupId)
127{
128 msg->groupId=groupId;
129}
130
131
132
134{
135 if (msg)
136 return msg->buffer;
137 return NULL;
138}
139
140
141
142const uint8_t *GWEN_Msg_GetConstBuffer(const GWEN_MSG *msg)
143{
144 if (msg)
145 return msg->buffer;
146 return NULL;
147}
148
149
150
152{
153 if (msg)
154 return msg->bytesInBuffer;
155 else
156 return 0;
157}
158
159
160
162{
163 if (msg && i<=msg->maxSize)
164 msg->bytesInBuffer=i;
165}
166
167
168
169uint32_t GWEN_Msg_GetMaxSize(const GWEN_MSG *msg)
170{
171 return msg?(msg->maxSize):0;
172}
173
174
175
177{
178 if (msg)
179 return msg->currentPos;
180 else
181 return 0;
182}
183
184
185
186int GWEN_Msg_AddByte(GWEN_MSG *msg, uint8_t b)
187{
188 return GWEN_Msg_AddBytes(msg, &b, 1);
189}
190
191
192
193int GWEN_Msg_AddBytes(GWEN_MSG *msg, const uint8_t *bufferPtr, uint32_t bufferLen)
194{
195 if (msg) {
196 uint32_t newPos;
197 int rv;
198
199 newPos=msg->currentPos+bufferLen;
200 rv=_ensureWritePos(msg, newPos);
201 if (rv<0) {
202 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
203 return rv;
204 }
205 memmove(msg->buffer+msg->currentPos, bufferPtr, bufferLen);
206 msg->currentPos+=bufferLen;
207 msg->bytesInBuffer+=bufferLen;
208 return 0;
209 }
210 return GWEN_ERROR_GENERIC;
211}
212
213
214
215int GWEN_Msg_WriteUint64At(GWEN_MSG *msg, uint32_t pos, uint64_t v)
216{
217 if (msg) {
218 int rv;
219
220 rv=_ensureWritePos(msg, pos+8);
221 if (rv<0) {
222 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
223 return rv;
224 }
225 else {
226 uint64_t *ptr=(uint64_t*)(msg->buffer+pos);
227 *ptr=GWEN_ENDIAN_HTOLE64(v);
228 return 0;
229 }
230 }
231 return GWEN_ERROR_GENERIC;
232}
233
234
235
236int GWEN_Msg_WriteUint32At(GWEN_MSG *msg, uint32_t pos, uint32_t v)
237{
238 if (msg) {
239 int rv;
240
241 rv=_ensureWritePos(msg, pos+4);
242 if (rv<0) {
243 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
244 return rv;
245 }
246 else {
247 uint32_t *ptr=(uint32_t*)(msg->buffer+pos);
248 *ptr=GWEN_ENDIAN_HTOLE32(v);
249 return 0;
250 }
251 }
252 return GWEN_ERROR_GENERIC;
253}
254
255
256
257int GWEN_Msg_WriteUint16At(GWEN_MSG *msg, uint32_t pos, uint16_t v)
258{
259 if (msg) {
260 int rv;
261
262 rv=_ensureWritePos(msg, pos+2);
263 if (rv<0) {
264 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
265 return rv;
266 }
267 else {
268 uint16_t *ptr=(uint16_t*)(msg->buffer+pos);
269 *ptr=GWEN_ENDIAN_HTOLE16(v);
270 return 0;
271 }
272 }
273 return GWEN_ERROR_GENERIC;
274}
275
276
277
278int GWEN_Msg_WriteUint8At(GWEN_MSG *msg, uint32_t pos, uint8_t v)
279{
280 if (msg) {
281 int rv;
282
283 rv=_ensureWritePos(msg, pos+1);
284 if (rv<0) {
285 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
286 return rv;
287 }
288 else {
289 uint8_t *ptr=(uint8_t*)(msg->buffer+pos);
290 *ptr=v;
291 return 0;
292 }
293 }
294 return GWEN_ERROR_GENERIC;
295}
296
297
298
299int GWEN_Msg_WriteBytesAt(GWEN_MSG *msg, uint32_t pos, const uint8_t *bufferPtr, uint32_t bufferLen)
300{
301 if (msg && bufferPtr && bufferLen) {
302 int rv;
303
304 rv=_ensureWritePos(msg, pos+bufferLen);
305 if (rv<0) {
306 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
307 return rv;
308 }
309 else {
310 uint8_t *ptr=(uint8_t*)(msg->buffer+pos);
311 memmove(ptr, bufferPtr, bufferLen);
312 return 0;
313 }
314 }
315 return GWEN_ERROR_INVALID;
316}
317
318
319
320int GWEN_Msg_AddUint64(GWEN_MSG *msg, uint64_t v)
321{
322 if (msg) {
323 int rv;
324
325 rv=GWEN_Msg_WriteUint64At(msg, msg->currentPos, v);
326 if (rv<0) {
327 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
328 return rv;
329 }
330 else {
331 msg->currentPos+=8;
332 msg->bytesInBuffer+=8;
333 return 0;
334 }
335 }
336 return GWEN_ERROR_GENERIC;
337}
338
339
340
341int GWEN_Msg_AddUint32(GWEN_MSG *msg, uint32_t v)
342{
343 if (msg) {
344 int rv;
345
346 rv=GWEN_Msg_WriteUint32At(msg, msg->currentPos, v);
347 if (rv<0) {
348 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
349 return rv;
350 }
351 else {
352 msg->currentPos+=4;
353 msg->bytesInBuffer+=4;
354 return 0;
355 }
356 }
357 return GWEN_ERROR_GENERIC;
358}
359
360
361
362int GWEN_Msg_AddUint16(GWEN_MSG *msg, uint16_t v)
363{
364 if (msg) {
365 int rv;
366
367 rv=GWEN_Msg_WriteUint16At(msg, msg->currentPos, v);
368 if (rv<0) {
369 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
370 return rv;
371 }
372 else {
373 msg->currentPos+=2;
374 msg->bytesInBuffer+=2;
375 return 0;
376 }
377 }
378 return GWEN_ERROR_GENERIC;
379}
380
381
382
383int GWEN_Msg_AddUint8(GWEN_MSG *msg, uint8_t v)
384{
385 if (msg) {
386 int rv;
387
388 rv=GWEN_Msg_WriteUint8At(msg, msg->currentPos, v);
389 if (rv<0) {
390 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
391 return rv;
392 }
393 else {
394 msg->currentPos+=1;
395 msg->bytesInBuffer+=1;
396 return 0;
397 }
398 }
399 return GWEN_ERROR_GENERIC;
400}
401
402
403
404int GWEN_Msg_AddString(GWEN_MSG *msg, const char *s, uint32_t maxSize, uint8_t filler)
405{
406 if (msg) {
407 int len=maxSize;
408 int i;
409
410 if (s) {
411 len=strlen(s);
412 if (len>maxSize) {
413 DBG_ERROR(GWEN_LOGDOMAIN, "String too long (%d > %d)", len, maxSize);
414 return GWEN_ERROR_INVALID;
415 }
416 GWEN_Msg_AddBytes(msg, (const uint8_t*) s, len);
417 len=maxSize-len;
418 }
419 for (i=0; i<len; i++)
420 GWEN_Msg_AddUint8(msg, filler);
421 return 0;
422 }
423 return GWEN_ERROR_INVALID;
424}
425
426
427
428int GWEN_Msg_AddStringWithTrailingNull(GWEN_MSG *msg, const char *s, uint32_t maxSize, uint8_t filler)
429{
430 if (msg) {
431 int len=maxSize;
432 int i;
433
434 if (s) {
435 len=strlen(s)+1;
436 if (len>maxSize) {
437 DBG_ERROR(GWEN_LOGDOMAIN, "String too long (%d > %d)", len, maxSize);
438 return GWEN_ERROR_INVALID;
439 }
440 GWEN_Msg_AddBytes(msg, (const uint8_t*) s, len);
441 len=maxSize-len;
442 }
443 for (i=0; i<len; i++)
444 GWEN_Msg_AddUint8(msg, filler);
445 return 0;
446 }
447 return GWEN_ERROR_INVALID;
448}
449
450
451
452
453
454
456{
457 if (msg) {
458 if ((msg->currentPos<msg->maxSize) &&
459 (msg->currentPos<msg->bytesInBuffer)) {
460 return ((int)(msg->buffer[(msg->currentPos)++])) & 0xff;
461 }
462 }
463 return GWEN_ERROR_EOF;
464}
465
466
467
468int GWEN_Msg_IncCurrentPos(GWEN_MSG *msg, uint32_t i)
469{
470 if (msg) {
471 if (((msg->currentPos+i)<=msg->maxSize) &&
472 ((msg->currentPos+i)<=msg->bytesInBuffer)) {
473 msg->currentPos+=i;
474 return 0;
475 }
476 }
477 return GWEN_ERROR_EOF;
478}
479
480
481
483{
484 if (msg) {
485 msg->currentPos=0;
486 return 0;
487 }
488 return GWEN_ERROR_EOF;
489}
490
491
492
494{
495 if (msg)
496 return msg->bytesInBuffer-msg->currentPos;
497 return 0;
498}
499
500
501
503{
504 if (msg)
505 return msg->parsedPayloadSize;
506 return 0;
507}
508
509
510
512{
513 if (msg)
514 msg->parsedPayloadSize=v;
515}
516
517
518
520{
521 if (msg)
522 return msg->parsedPayloadOffset;
523 return 0;
524}
525
526
527
529{
530 if (msg)
531 msg->parsedPayloadOffset=v;
532}
533
534
535
536uint32_t GWEN_Msg_GetFlags(const GWEN_MSG *msg)
537{
538 if (msg)
539 return msg->flags;
540 return 0;
541}
542
543
544
545void GWEN_Msg_SetFlags(GWEN_MSG *msg, uint32_t f)
546{
547 if (msg)
548 msg->flags=f;
549}
550
551
552
553void GWEN_Msg_AddFlags(GWEN_MSG *msg, uint32_t f)
554{
555 if (msg)
556 msg->flags|=f;
557}
558
559
560
561void GWEN_Msg_DelFlags(GWEN_MSG *msg, uint32_t f)
562{
563 if (msg)
564 msg->flags&=~f;
565}
566
567
568
570{
571 if (msg)
572 return msg->dbParsedInfo;
573 return NULL;
574}
575
576
577
579{
580 if (msg) {
581 if (msg->dbParsedInfo)
582 GWEN_DB_Group_free(msg->dbParsedInfo);
583 msg->dbParsedInfo=db;
584 }
585}
586
587
588
589uint64_t GWEN_Msg_GetUint64At(const GWEN_MSG *msg, int offs, uint64_t defaultValue)
590{
591 if (msg) {
592 if (msg->bytesInBuffer>=offs+8) {
593 const uint64_t *ptr=(uint64_t*)(msg->buffer+offs);
594
595 return GWEN_ENDIAN_LE64TOH(*ptr);
596 }
597 }
598 return defaultValue;
599}
600
601
602
603uint32_t GWEN_Msg_GetUint32At(const GWEN_MSG *msg, int offs, uint32_t defaultValue)
604{
605 if (msg) {
606 if (msg->bytesInBuffer>=offs+4) {
607 const uint32_t *ptr=(uint32_t*)(msg->buffer+offs);
608
609 return GWEN_ENDIAN_LE32TOH(*ptr);
610 }
611 }
612 return defaultValue;
613}
614
615
616
617uint16_t GWEN_Msg_GetUint16At(const GWEN_MSG *msg, int offs, uint16_t defaultValue)
618{
619 if (msg) {
620 if (msg->bytesInBuffer>=offs+2) {
621 const uint16_t *ptr=(uint16_t*)(msg->buffer+offs);
622
623 return GWEN_ENDIAN_LE16TOH(*ptr);
624 }
625 }
626 return defaultValue;
627}
628
629
630
631uint8_t GWEN_Msg_GetUint8At(const GWEN_MSG *msg, int offs, uint8_t defaultValue)
632{
633 if (msg) {
634 if (msg->bytesInBuffer>=offs+1) {
635 const uint8_t *ptr;
636
637 ptr=msg->buffer+offs;
638 return ptr[0];
639 }
640 }
641 return defaultValue;
642}
643
644
645
646void GWEN_Msg_Dump(const GWEN_MSG *msg, GWEN_BUFFER *buf)
647{
648 GWEN_Buffer_AppendArgs(buf, "Msg: bytesInBuffer=%d, maxSize=%d, currentPos=%d",
649 msg->bytesInBuffer, msg->maxSize, msg->currentPos);
650 if (msg->buffer && msg->bytesInBuffer) {
651 GWEN_Buffer_AppendByte(buf, '\n');
652 GWEN_Text_DumpString2Buffer((const char*)(msg->buffer), msg->bytesInBuffer, buf, 2);
653 }
654}
655
656
657
658int _ensureWritePos(GWEN_MSG *msg, uint32_t newPos)
659{
660 if (msg) {
661 if (newPos>=msg->maxSize) {
662 uint32_t newSize;
663 uint8_t *newPtr;
664
665 newSize=(newPos+GWEN_MSG_SIZE_STEP) & GWEN_MSG_SIZE_MASK;
666 DBG_INFO(GWEN_LOGDOMAIN, "Resizing buffer from %u bytes to %u bytes", msg->maxSize, newSize);
667 newPtr=realloc(msg->buffer, newSize);
668 if (newPtr==NULL) {
669 DBG_ERROR(GWEN_LOGDOMAIN, "Memory full");
671 }
672 memset(newPtr+msg->currentPos, 0, newSize-msg->maxSize);
673 msg->buffer=newPtr;
674 msg->maxSize=newSize;
675 }
676 return 0;
677 }
678 return GWEN_ERROR_INVALID;
679}
680
#define NULL
Definition binreloc.c:300
int GWEN_Buffer_AppendArgs(GWEN_BUFFER *bf, const char *fmt,...)
Definition buffer.c:1087
int GWEN_Buffer_AppendByte(GWEN_BUFFER *bf, char c)
Definition buffer.c:393
GWEN_DB_NODE * GWEN_DB_Group_dup(const GWEN_DB_NODE *n)
Definition db.c:428
void GWEN_DB_Group_free(GWEN_DB_NODE *n)
Definition db.c:421
struct GWEN_DB_NODE GWEN_DB_NODE
Definition db.h:228
#define DBG_INFO(dbg_logger, format,...)
Definition debug.h:181
#define DBG_ERROR(dbg_logger, format,...)
Definition debug.h:97
#define GWEN_ENDIAN_HTOLE32(x)
Definition endianfns.h:49
#define GWEN_ENDIAN_HTOLE16(x)
Definition endianfns.h:46
#define GWEN_ENDIAN_LE16TOH(x)
Definition endianfns.h:45
#define GWEN_ENDIAN_LE32TOH(x)
Definition endianfns.h:48
#define GWEN_ENDIAN_LE64TOH(x)
Definition endianfns.h:51
#define GWEN_ENDIAN_HTOLE64(x)
Definition endianfns.h:52
#define GWEN_ERROR_MEMORY_FULL
Definition error.h:77
#define GWEN_ERROR_INVALID
Definition error.h:67
#define GWEN_ERROR_GENERIC
Definition error.h:62
#define GWEN_ERROR_EOF
Definition error.h:96
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
#define GWEN_INHERIT_FUNCTIONS(t)
Definition inherit.h:163
#define GWEN_INHERIT_INIT(t, element)
Definition inherit.h:223
#define GWEN_INHERIT_FINI(t, element)
Definition inherit.h:238
#define GWEN_LIST_FINI(t, element)
Definition list1.h:475
#define GWEN_LIST_FUNCTIONS(t, pr)
Definition list1.h:367
#define GWEN_LIST_INIT(t, element)
Definition list1.h:466
#define GWEN_LOGDOMAIN
Definition logger.h:35
#define GWEN_FREE_OBJECT(varname)
Definition memory.h:61
#define GWEN_NEW_OBJECT(typ, varname)
Definition memory.h:55
uint8_t GWEN_Msg_GetUint8At(const GWEN_MSG *msg, int offs, uint8_t defaultValue)
Definition msg.c:631
uint32_t GWEN_Msg_GetCurrentPos(const GWEN_MSG *msg)
Definition msg.c:176
int GWEN_Msg_AddBytes(GWEN_MSG *msg, const uint8_t *bufferPtr, uint32_t bufferLen)
Definition msg.c:193
void GWEN_Msg_AddFlags(GWEN_MSG *msg, uint32_t f)
Definition msg.c:553
void GWEN_Msg_SetParsedPayloadSize(GWEN_MSG *msg, uint32_t v)
Definition msg.c:511
GWEN_MSG * GWEN_Msg_dup(const GWEN_MSG *srcMsg)
Definition msg.c:95
int GWEN_Msg_GetRemainingBytes(const GWEN_MSG *msg)
Definition msg.c:493
int GWEN_Msg_WriteBytesAt(GWEN_MSG *msg, uint32_t pos, const uint8_t *bufferPtr, uint32_t bufferLen)
Definition msg.c:299
void GWEN_Msg_Dump(const GWEN_MSG *msg, GWEN_BUFFER *buf)
Definition msg.c:646
uint32_t GWEN_Msg_GetMaxSize(const GWEN_MSG *msg)
Definition msg.c:169
int GWEN_Msg_IncCurrentPos(GWEN_MSG *msg, uint32_t i)
Definition msg.c:468
void GWEN_Msg_SetParsedPayloadOffset(GWEN_MSG *msg, uint32_t v)
Definition msg.c:528
uint64_t GWEN_Msg_GetUint64At(const GWEN_MSG *msg, int offs, uint64_t defaultValue)
Definition msg.c:589
int GWEN_Msg_AddString(GWEN_MSG *msg, const char *s, uint32_t maxSize, uint8_t filler)
Definition msg.c:404
void GWEN_Msg_DelFlags(GWEN_MSG *msg, uint32_t f)
Definition msg.c:561
static int _ensureWritePos(GWEN_MSG *msg, uint32_t newPos)
Definition msg.c:658
GWEN_DB_NODE * GWEN_Msg_GetDbParsedInfo(const GWEN_MSG *msg)
Definition msg.c:569
int GWEN_Msg_WriteUint64At(GWEN_MSG *msg, uint32_t pos, uint64_t v)
Definition msg.c:215
int GWEN_Msg_ReadNextByte(GWEN_MSG *msg)
Definition msg.c:455
void GWEN_Msg_SetFlags(GWEN_MSG *msg, uint32_t f)
Definition msg.c:545
uint32_t GWEN_Msg_GetParsedPayloadSize(const GWEN_MSG *msg)
Definition msg.c:502
uint16_t GWEN_Msg_GetUint16At(const GWEN_MSG *msg, int offs, uint16_t defaultValue)
Definition msg.c:617
#define GWEN_MSG_SIZE_MASK
Definition msg.c:26
int GWEN_Msg_WriteUint32At(GWEN_MSG *msg, uint32_t pos, uint32_t v)
Definition msg.c:236
#define GWEN_MSG_SIZE_STEP
Definition msg.c:25
void GWEN_Msg_SetDbParsedInfo(GWEN_MSG *msg, GWEN_DB_NODE *db)
Definition msg.c:578
int GWEN_Msg_AddUint8(GWEN_MSG *msg, uint8_t v)
Definition msg.c:383
void GWEN_Msg_Attach(GWEN_MSG *msg)
Definition msg.c:70
void GWEN_Msg_SetBytesInBuffer(GWEN_MSG *msg, uint32_t i)
Definition msg.c:161
int GWEN_Msg_WriteUint16At(GWEN_MSG *msg, uint32_t pos, uint16_t v)
Definition msg.c:257
int GWEN_Msg_WriteUint8At(GWEN_MSG *msg, uint32_t pos, uint8_t v)
Definition msg.c:278
uint32_t GWEN_Msg_GetFlags(const GWEN_MSG *msg)
Definition msg.c:536
void GWEN_Msg_SetGroupId(GWEN_MSG *msg, int groupId)
Definition msg.c:126
int GWEN_Msg_AddStringWithTrailingNull(GWEN_MSG *msg, const char *s, uint32_t maxSize, uint8_t filler)
Definition msg.c:428
uint32_t GWEN_Msg_GetParsedPayloadOffset(const GWEN_MSG *msg)
Definition msg.c:519
int GWEN_Msg_AddByte(GWEN_MSG *msg, uint8_t b)
Definition msg.c:186
uint32_t GWEN_Msg_GetBytesInBuffer(const GWEN_MSG *msg)
Definition msg.c:151
GWEN_MSG * GWEN_Msg_fromBytes(const uint8_t *ptr, uint32_t len)
Definition msg.c:54
int GWEN_Msg_GetGroupId(const GWEN_MSG *msg)
Definition msg.c:119
const uint8_t * GWEN_Msg_GetConstBuffer(const GWEN_MSG *msg)
Definition msg.c:142
int GWEN_Msg_AddUint32(GWEN_MSG *msg, uint32_t v)
Definition msg.c:341
int GWEN_Msg_AddUint64(GWEN_MSG *msg, uint64_t v)
Definition msg.c:320
uint32_t GWEN_Msg_GetUint32At(const GWEN_MSG *msg, int offs, uint32_t defaultValue)
Definition msg.c:603
uint8_t * GWEN_Msg_GetBuffer(GWEN_MSG *msg)
Definition msg.c:133
void GWEN_Msg_free(GWEN_MSG *msg)
Definition msg.c:78
GWEN_MSG * GWEN_Msg_new(uint32_t bufferSize)
Definition msg.c:37
int GWEN_Msg_AddUint16(GWEN_MSG *msg, uint16_t v)
Definition msg.c:362
int GWEN_Msg_RewindCurrentPos(GWEN_MSG *msg)
Definition msg.c:482
struct GWEN_MSG GWEN_MSG
Definition msg.h:24
void GWEN_Text_DumpString2Buffer(const char *s, unsigned int l, GWEN_BUFFER *mbuf, unsigned int insert)
Definition text.c:1324