mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 18:13:49 +01:00
net/asymcute: make cli ID len conform to standard
This commit is contained in:
parent
16fa111c76
commit
785f59fb7f
@ -95,15 +95,6 @@ extern "C" {
|
|||||||
#define ASYMCUTE_LISTENER_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
|
#define ASYMCUTE_LISTENER_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ASYMCUTE_ID_MAXLEN
|
|
||||||
/**
|
|
||||||
* @brief Maximum client ID length
|
|
||||||
*
|
|
||||||
* @note Must be less than (256 - 8) and less than (ASYMCUTE_BUFSIZE - 8)
|
|
||||||
*/
|
|
||||||
#define ASYMCUTE_ID_MAXLEN (32U)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ASYMCUTE_TOPIC_MAXLEN
|
#ifndef ASYMCUTE_TOPIC_MAXLEN
|
||||||
/**
|
/**
|
||||||
* @brief Maximum topic length
|
* @brief Maximum topic length
|
||||||
@ -273,7 +264,7 @@ struct asymcute_con {
|
|||||||
uint8_t keepalive_retry_cnt; /**< keep alive transmission counter */
|
uint8_t keepalive_retry_cnt; /**< keep alive transmission counter */
|
||||||
uint8_t state; /**< connection state */
|
uint8_t state; /**< connection state */
|
||||||
uint8_t rxbuf[ASYMCUTE_BUFSIZE]; /**< connection specific receive buf */
|
uint8_t rxbuf[ASYMCUTE_BUFSIZE]; /**< connection specific receive buf */
|
||||||
char cli_id[ASYMCUTE_ID_MAXLEN + 1];/**< buffer to store client ID */
|
char cli_id[MQTTSN_CLI_ID_MAXLEN + 1]; /**< buffer to store client ID */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -712,7 +712,7 @@ int asymcute_connect(asymcute_con_t *con, asymcute_req_t *req,
|
|||||||
return ASYMCUTE_NOTSUP;
|
return ASYMCUTE_NOTSUP;
|
||||||
}
|
}
|
||||||
/* make sure the client ID will fit into the dedicated buffer */
|
/* make sure the client ID will fit into the dedicated buffer */
|
||||||
if (id_len > ASYMCUTE_ID_MAXLEN) {
|
if ((id_len < MQTTSN_CLI_ID_MINLEN) || (id_len > MQTTSN_CLI_ID_MAXLEN)) {
|
||||||
return ASYMCUTE_OVERFLOW;
|
return ASYMCUTE_OVERFLOW;
|
||||||
}
|
}
|
||||||
/* check if the context is not already connected to any gateway */
|
/* check if the context is not already connected to any gateway */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user