version 1.2, 2012/06/20 15:02:24
|
version 1.3, 2013/05/30 09:18:33
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 | Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 54 char mqtt_Error[STRSIZ];
|
Line 54 char mqtt_Error[STRSIZ];
|
#pragma GCC visibility pop |
#pragma GCC visibility pop |
|
|
// mqtt_GetErrno() Get error code of last operation |
// mqtt_GetErrno() Get error code of last operation |
inline int | int |
mqtt_GetErrno() |
mqtt_GetErrno() |
{ |
{ |
return mqtt_Errno; |
return mqtt_Errno; |
} |
} |
|
|
// mqtt_GetError() Get error text of last operation |
// mqtt_GetError() Get error text of last operation |
inline const char * | const char * |
mqtt_GetError() |
mqtt_GetError() |
{ |
{ |
return mqtt_Error; |
return mqtt_Error; |
} |
} |
|
|
// mqtt_SetErr() Set error to variables for internal use!!! |
// mqtt_SetErr() Set error to variables for internal use!!! |
inline void | void |
mqtt_SetErr(int eno, char *estr, ...) |
mqtt_SetErr(int eno, char *estr, ...) |
{ |
{ |
va_list lst; |
va_list lst; |
Line 82 mqtt_SetErr(int eno, char *estr, ...)
|
Line 82 mqtt_SetErr(int eno, char *estr, ...)
|
|
|
#pragma GCC visibility push(hidden) |
#pragma GCC visibility push(hidden) |
/* _mqtt_readHEADER() read fixed header from MQTT message */ |
/* _mqtt_readHEADER() read fixed header from MQTT message */ |
inline struct mqtthdr * | struct mqtthdr * |
_mqtt_readHEADER(mqtt_msg_t * __restrict buf, u_char cmd, int *bytes, int *len) |
_mqtt_readHEADER(mqtt_msg_t * __restrict buf, u_char cmd, int *bytes, int *len) |
{ |
{ |
struct mqtthdr *hdr; |
struct mqtthdr *hdr; |
Line 110 _mqtt_readHEADER(mqtt_msg_t * __restrict buf, u_char c
|
Line 110 _mqtt_readHEADER(mqtt_msg_t * __restrict buf, u_char c
|
* @all = !=0 Destroy entire message, if MQTT Message allocated with mqtt_msgAlloc() |
* @all = !=0 Destroy entire message, if MQTT Message allocated with mqtt_msgAlloc() |
* return: none |
* return: none |
*/ |
*/ |
inline void | void |
mqtt_msgFree(mqtt_msg_t ** __restrict msg, int all) |
mqtt_msgFree(mqtt_msg_t ** __restrict msg, int all) |
{ |
{ |
if (msg && *msg) { |
if (msg && *msg) { |
Line 132 mqtt_msgFree(mqtt_msg_t ** __restrict msg, int all)
|
Line 132 mqtt_msgFree(mqtt_msg_t ** __restrict msg, int all)
|
* @len = >0 Allocate buffer with length |
* @len = >0 Allocate buffer with length |
* return: NULL error or Message, after use must call mqtt_msgFree() with all!=0 |
* return: NULL error or Message, after use must call mqtt_msgFree() with all!=0 |
*/ |
*/ |
inline mqtt_msg_t * | mqtt_msg_t * |
mqtt_msgAlloc(u_short len) |
mqtt_msgAlloc(u_short len) |
{ |
{ |
mqtt_msg_t *m = NULL; |
mqtt_msg_t *m = NULL; |
Line 165 mqtt_msgAlloc(u_short len)
|
Line 165 mqtt_msgAlloc(u_short len)
|
* @len = new length |
* @len = new length |
* return: -1 error or >-1 old buffer length |
* return: -1 error or >-1 old buffer length |
*/ |
*/ |
inline int | int |
mqtt_msgRealloc(mqtt_msg_t * __restrict msg, u_short len) |
mqtt_msgRealloc(mqtt_msg_t * __restrict msg, u_short len) |
{ |
{ |
void *p = NULL; |
void *p = NULL; |
Line 196 mqtt_msgRealloc(mqtt_msg_t * __restrict msg, u_short l
|
Line 196 mqtt_msgRealloc(mqtt_msg_t * __restrict msg, u_short l
|
* @msg = Message |
* @msg = Message |
* return: NULL error or !=NULL duplicated message, after use must call mqtt_msgFree() with all!=0 |
* return: NULL error or !=NULL duplicated message, after use must call mqtt_msgFree() with all!=0 |
*/ |
*/ |
inline mqtt_msg_t * | mqtt_msg_t * |
mqtt_msgDup(mqtt_msg_t * __restrict msg) |
mqtt_msgDup(mqtt_msg_t * __restrict msg) |
{ |
{ |
mqtt_msg_t *m = NULL; |
mqtt_msg_t *m = NULL; |
Line 228 mqtt_msgDup(mqtt_msg_t * __restrict msg)
|
Line 228 mqtt_msgDup(mqtt_msg_t * __restrict msg)
|
* @num = number for encode |
* @num = number for encode |
* return: -1 error or >-1 length |
* return: -1 error or >-1 length |
*/ |
*/ |
inline u_int | u_int |
mqtt_encodeLen(u_int num) |
mqtt_encodeLen(u_int num) |
{ |
{ |
register u_int dig, i; |
register u_int dig, i; |
Line 256 mqtt_encodeLen(u_int num)
|
Line 256 mqtt_encodeLen(u_int num)
|
* @n = sizeof bytes, if !=NULL |
* @n = sizeof bytes, if !=NULL |
* return: -1 error, >-1 length of message |
* return: -1 error, >-1 length of message |
*/ |
*/ |
inline u_int | u_int |
mqtt_decodeLen(void * __restrict len, int * __restrict n) |
mqtt_decodeLen(void * __restrict len, int * __restrict n) |
{ |
{ |
register u_int i, dig, mul; |
register u_int i, dig, mul; |
Line 285 mqtt_decodeLen(void * __restrict len, int * __restrict
|
Line 285 mqtt_decodeLen(void * __restrict len, int * __restrict
|
* @len = length |
* @len = length |
* return: -1 error, >-1 sizeof len in bytes |
* return: -1 error, >-1 sizeof len in bytes |
*/ |
*/ |
inline char | char |
mqtt_sizeLen(u_int len) |
mqtt_sizeLen(u_int len) |
{ |
{ |
register char i; |
register char i; |
Line 307 mqtt_sizeLen(u_int len)
|
Line 307 mqtt_sizeLen(u_int len)
|
* @hdr = MQTT packet header |
* @hdr = MQTT packet header |
* return: packet length |
* return: packet length |
*/ |
*/ |
inline u_int | u_int |
mqtt_pktLen(struct mqtthdr * __restrict hdr) |
mqtt_pktLen(struct mqtthdr * __restrict hdr) |
{ |
{ |
int siz, n = 0; |
int siz, n = 0; |
Line 330 mqtt_pktLen(struct mqtthdr * __restrict hdr)
|
Line 330 mqtt_pktLen(struct mqtthdr * __restrict hdr)
|
* count of elements must be equal with csStr elements |
* count of elements must be equal with csStr elements |
* return: NULL error or != subscribe variables array, must be free after use with mqtt_freeSub() |
* return: NULL error or != subscribe variables array, must be free after use with mqtt_freeSub() |
*/ |
*/ |
inline mqtt_subscr_t * | mqtt_subscr_t * |
mqtt_str2subs(const char **csStr, u_short strnum, u_char *qoses) |
mqtt_str2subs(const char **csStr, u_short strnum, u_char *qoses) |
{ |
{ |
mqtt_subscr_t *v; |
mqtt_subscr_t *v; |
Line 366 mqtt_str2subs(const char **csStr, u_short strnum, u_ch
|
Line 366 mqtt_str2subs(const char **csStr, u_short strnum, u_ch
|
* @subs = Subscribe variables |
* @subs = Subscribe variables |
* return: none |
* return: none |
*/ |
*/ |
inline void | void |
mqtt_subFree(mqtt_subscr_t ** __restrict subs) |
mqtt_subFree(mqtt_subscr_t ** __restrict subs) |
{ |
{ |
mqtt_subscr_t *v; |
mqtt_subscr_t *v; |
Line 396 mqtt_subFree(mqtt_subscr_t ** __restrict subs)
|
Line 396 mqtt_subFree(mqtt_subscr_t ** __restrict subs)
|
* @num = Number of elements |
* @num = Number of elements |
* return: NULL error or subscribe array, after use must call mqtt_subFree() |
* return: NULL error or subscribe array, after use must call mqtt_subFree() |
*/ |
*/ |
inline mqtt_subscr_t * | mqtt_subscr_t * |
mqtt_subAlloc(u_short num) |
mqtt_subAlloc(u_short num) |
{ |
{ |
mqtt_subscr_t *s = NULL; |
mqtt_subscr_t *s = NULL; |
Line 418 mqtt_subAlloc(u_short num)
|
Line 418 mqtt_subAlloc(u_short num)
|
* @num = Number of elements |
* @num = Number of elements |
* return: NULL error or subscribe array, after use must call mqtt_subFree() |
* return: NULL error or subscribe array, after use must call mqtt_subFree() |
*/ |
*/ |
inline mqtt_subscr_t * | mqtt_subscr_t * |
mqtt_subRealloc(mqtt_subscr_t ** __restrict subs, u_short num) |
mqtt_subRealloc(mqtt_subscr_t ** __restrict subs, u_short num) |
{ |
{ |
mqtt_subscr_t *s = NULL; |
mqtt_subscr_t *s = NULL; |
Line 445 mqtt_subRealloc(mqtt_subscr_t ** __restrict subs, u_sh
|
Line 445 mqtt_subRealloc(mqtt_subscr_t ** __restrict subs, u_sh
|
* @src = source subscription |
* @src = source subscription |
* return: =NULL error or !=NULL successful copied a structure |
* return: =NULL error or !=NULL successful copied a structure |
*/ |
*/ |
inline mqtt_subscr_t * | mqtt_subscr_t * |
mqtt_subCopy(mqtt_subscr_t * __restrict dst, mqtt_subscr_t * __restrict src) |
mqtt_subCopy(mqtt_subscr_t * __restrict dst, mqtt_subscr_t * __restrict src) |
{ |
{ |
if (!dst || !src) |
if (!dst || !src) |