Merge pull request #613 from mrdeep1/message_id

message id: clean up documentation usage of transaction which is message id
This commit is contained in:
obgm authored and GitHub committed 2021-03-18 13:52:10 +01:00
commit 7906bcf2a3
29 files changed
+207 -228

No files matched your search

+4 -4
View File
@@ -115,7 +115,7 @@ typedef unsigned char method_t;
method_t method = 1; /* the method we are using in our requests */
coap_block_t block = { .num = 0, .m = 0, .szx = 6 };
uint16_t last_block1_tid = 0;
uint16_t last_block1_mid = 0;
unsigned int wait_seconds = 90; /* default timeout in seconds */
@@ -197,7 +197,7 @@ coap_new_request(coap_context_t *ctx,
return NULL;
pdu->type = msgtype;
pdu->tid = coap_new_message_id(session);
pdu->mid = coap_new_message_id(session);
pdu->code = m;
if ( !coap_add_token(pdu, the_token.length, the_token.s)) {
@@ -292,7 +292,7 @@ nack_handler(coap_context_t *context COAP_UNUSED,
coap_session_t *session COAP_UNUSED,
coap_pdu_t *sent COAP_UNUSED,
coap_nack_reason_t reason,
const coap_tid_t id COAP_UNUSED) {
const coap_mid_t id COAP_UNUSED) {
switch(reason) {
case COAP_NACK_TOO_MANY_RETRIES:
@@ -316,7 +316,7 @@ message_handler(struct coap_context_t *ctx COAP_UNUSED,
coap_session_t *session COAP_UNUSED,
coap_pdu_t *sent,
coap_pdu_t *received,
const coap_tid_t id COAP_UNUSED) {
const coap_mid_t id COAP_UNUSED) {
coap_opt_t *block_opt;
coap_opt_iterator_t opt_iter;
+2 -2
View File
@@ -212,7 +212,7 @@ hnd_put_resource(coap_context_t *ctx COAP_UNUSED,
if (request->hdr->token_length)
coap_add_token(response, request->hdr->token_length, request->hdr->token);
if (coap_send(ctx, peer, response) == COAP_INVALID_TID) {
if (coap_send(ctx, peer, response) == COAP_INVALID_MID) {
coap_log(LOG_DEBUG, "hnd_get_rd: cannot send response for mid=0x%x\n",
request->hdr->id);
}
@@ -457,7 +457,7 @@ hnd_post_rd(coap_context_t *ctx,
} else { /* generate node identifier */
loc_size +=
snprintf((char *)(loc + loc_size), LOCSIZE - loc_size - 1,
"%x", request->tid);
"%x", request->mid);
if (loc_size > 1) {
if (ins.length) {
+6 -6
View File
@@ -375,7 +375,7 @@ hnd_get_async(coap_context_t *ctx,
size_t size;
if (async) {
if (async->id != request->tid) {
if (async->id != request->mid) {
coap_opt_filter_t f;
coap_option_filter_clear(&f);
response->code = COAP_RESPONSE_CODE_SERVICE_UNAVAILABLE;
@@ -433,14 +433,14 @@ check_async(coap_context_t *ctx,
return;
}
response->tid = coap_new_message_id(async->session);
response->mid = coap_new_message_id(async->session);
if (async->tokenlen)
coap_add_token(response, async->tokenlen, async->token);
coap_add_data(response, 4, (const uint8_t *)"done");
if (coap_send_large(async->session, response) == COAP_INVALID_TID) {
if (coap_send_large(async->session, response) == COAP_INVALID_MID) {
coap_log(LOG_DEBUG, "check_async: cannot send response for message\n");
}
coap_remove_async(ctx, async->session, async->id, &tmp);
@@ -895,7 +895,7 @@ remove_proxy_association(coap_session_t *session, int send_failure) {
}
if (coap_send_large(proxy_list[i].incoming, response) ==
COAP_INVALID_TID) {
COAP_INVALID_MID) {
coap_log(LOG_INFO, "Failed to send PDU with 5.02 gateway issue\n");
}
break;
@@ -1637,7 +1637,7 @@ proxy_message_handler(struct coap_context_t *ctx COAP_UNUSED,
coap_session_t *session,
coap_pdu_t *sent COAP_UNUSED,
coap_pdu_t *received,
const coap_tid_t id COAP_UNUSED) {
const coap_mid_t id COAP_UNUSED) {
coap_pdu_t *pdu = NULL;
coap_session_t *incoming = NULL;
@@ -1758,7 +1758,7 @@ proxy_nack_handler(coap_context_t *context COAP_UNUSED,
coap_session_t *session,
coap_pdu_t *sent COAP_UNUSED,
coap_nack_reason_t reason,
const coap_tid_t id COAP_UNUSED) {
const coap_mid_t id COAP_UNUSED) {
switch(reason) {
case COAP_NACK_TOO_MANY_RETRIES:
+4 -4
View File
@@ -371,7 +371,7 @@ hnd_get_separate(coap_context_t *ctx,
unsigned long delay = 5;
if (async) {
if (async->id != request->tid) {
if (async->id != request->mid) {
coap_option_filter_clear(&f);
response->code = COAP_RESPONSE_CODE_SERVICE_UNAVAILABLE;
}
@@ -441,16 +441,16 @@ check_async(coap_context_t *ctx,
return;
}
response->tid = coap_new_message_id(async->session);
response->mid = coap_new_message_id(async->session);
if (async->tokenlen)
coap_add_token(response, async->tokenlen, async->token);
coap_add_data(response, 4, (const uint8_t *)"done");
if (coap_send(async->session, response) == COAP_INVALID_TID) {
if (coap_send(async->session, response) == COAP_INVALID_MID) {
coap_log(LOG_DEBUG, "check_async: cannot send response for mid=0x%x\n",
response->tid);
response->mid);
}
coap_remove_async(ctx, async->session, async->id, &tmp);
coap_free_async(async);
+2 -2
View File
@@ -40,7 +40,7 @@ COAP_PSEUDOFP_ENCODE_8_4_DOWN(unsigned int v, int *ls) {
}
#define COAP_PSEUDOFP_ENCODE_8_4_UP(v,ls,s) (v < HIBIT ? v : (ls = coap_fls(v) - Nn, (s = (((v + ((1<<ENCODE_HEADER_SIZE<<ls)-1)) >> ls) & MMASK)), s == 0 ? HIBIT + ls + 1 : s + ls))
static coap_tid_t id;
static coap_mid_t id;
static int quit = 0;
/* SIGINT handler: set quit to 1 for graceful termination */
@@ -61,7 +61,7 @@ make_pdu( unsigned int value ) {
pdu->type = COAP_MESSAGE_NON;
pdu->code = COAP_REQUEST_POST;
pdu->tid = id++;
pdu->mid = id++;
enc = COAP_PSEUDOFP_ENCODE_8_4_DOWN(value, &ls);