mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-03 03:01:05 +03:00
coap_net.c: Check for invalid PDU class codes
This commit is contained in:
1 parent
e7105286f6
commit
cc1cc1ad27
5 files changed
+90
-7
No files matched your search
@@ -393,6 +393,16 @@ coap_pdu_t *coap_wellknown_response(coap_context_t *context,
|
||||
*/
|
||||
unsigned int coap_calc_timeout(coap_session_t *session, unsigned char r);
|
||||
|
||||
/**
|
||||
* Check whether the pdu contains a valid code class
|
||||
*
|
||||
* @param session The CoAP session.
|
||||
* @param pdu The PDU to check.
|
||||
*
|
||||
* @return @c 1 valid, @c 0 invalid.
|
||||
*/
|
||||
int coap_check_code_class(coap_session_t *session, coap_pdu_t *pdu);
|
||||
|
||||
/**
|
||||
* Sends a CoAP message to given peer. The memory that is
|
||||
* allocated for the pdu will be released by coap_send_internal().
|
||||
|
||||
@@ -100,7 +100,8 @@
|
||||
|
||||
#define COAP_PDU_IS_EMPTY(pdu) ((pdu)->code == 0)
|
||||
#define COAP_PDU_IS_REQUEST(pdu) (!COAP_PDU_IS_EMPTY(pdu) && (pdu)->code < 32)
|
||||
#define COAP_PDU_IS_RESPONSE(pdu) ((pdu)->code >= 64 && (pdu)->code < 224)
|
||||
/* Code 1.xx (32-63) and 6.xx (192-224) currently invalid */
|
||||
#define COAP_PDU_IS_RESPONSE(pdu) ((pdu)->code >= 64 && (pdu)->code < 192)
|
||||
#define COAP_PDU_IS_SIGNALING(pdu) ((pdu)->code >= 224)
|
||||
#define COAP_PDU_IS_PING(pdu) ((COAP_PDU_IS_EMPTY(pdu) && \
|
||||
((pdu)->type == COAP_MESSAGE_CON)) || \
|
||||
|
||||
Reference in new issue
Block a user