Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os by
libCoap_builder_test.cpp
00001 /* 00002 * Copyright (c) 2015 ARM Limited. All rights reserved. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * Licensed under the Apache License, Version 2.0 (the License); you may 00005 * not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #include "CppUTest/TestHarness.h" 00017 #include <string.h> 00018 #include <stdint.h> 00019 #include "sn_nsdl.h" 00020 #include "sn_coap_header.h" 00021 #include "sn_coap_protocol_internal.h" 00022 00023 #include "sn_coap_header_check_stub.h" 00024 #include "sn_coap_parser_stub.h" 00025 00026 sn_coap_hdr_s coap_header; 00027 sn_coap_options_list_s option_list; 00028 uint8_t buffer[356]; 00029 uint8_t temp[10]; 00030 00031 uint8_t retCounter = 0; 00032 00033 static void *own_alloc(uint16_t size) 00034 { 00035 if( retCounter > 0 ){ 00036 retCounter--; 00037 return malloc(size); 00038 } 00039 return NULL; 00040 } 00041 00042 static void own_free(void *ptr) 00043 { 00044 free(ptr); 00045 } 00046 00047 TEST_GROUP(libCoap_builder) 00048 { 00049 void setup() { 00050 sn_coap_header_check_stub.expectedInt8 = 0; 00051 retCounter = 0; 00052 memset(&coap_header, 0, sizeof(sn_coap_hdr_s)); 00053 memset(&option_list, 0, sizeof(sn_coap_options_list_s)); 00054 00055 coap_header.options_list_ptr = &option_list; 00056 coap_header.msg_type = COAP_MSG_TYPE_ACKNOWLEDGEMENT; 00057 coap_header.msg_code = COAP_MSG_CODE_RESPONSE_CREATED; 00058 coap_header.msg_id = 12; 00059 } 00060 00061 void teardown() { 00062 00063 } 00064 }; 00065 00066 TEST(libCoap_builder, build_confirmable_response) 00067 { 00068 struct coap_s handle; 00069 sn_coap_hdr_s *response = NULL; 00070 00071 handle.sn_coap_protocol_malloc = &own_alloc; 00072 handle.sn_coap_protocol_free = &own_free; 00073 00074 coap_header.msg_type = COAP_MSG_TYPE_RESET; 00075 coap_header.msg_code = COAP_MSG_CODE_REQUEST_GET; 00076 coap_header.msg_id = 12; 00077 00078 //NULL pointer 00079 CHECK(sn_coap_build_response(NULL, NULL, 0) == NULL); 00080 CHECK(sn_coap_build_response(&handle, NULL, 0) == NULL); 00081 CHECK(sn_coap_build_response(NULL, &coap_header, 0) == NULL); 00082 CHECK(sn_coap_build_response(&handle, &coap_header, COAP_MSG_CODE_RESPONSE_CONTENT) == NULL); 00083 00084 retCounter = 1; 00085 CHECK(sn_coap_build_response(&handle, &coap_header, COAP_MSG_CODE_RESPONSE_CONTENT) == NULL); 00086 00087 coap_header.msg_type = COAP_MSG_TYPE_CONFIRMABLE; 00088 00089 retCounter = 2; 00090 response = sn_coap_build_response(&handle, &coap_header, COAP_MSG_CODE_RESPONSE_CONTENT); 00091 00092 CHECK(response != NULL); 00093 CHECK(response->msg_type == COAP_MSG_TYPE_ACKNOWLEDGEMENT); 00094 CHECK(response->msg_id == 12); 00095 CHECK(response->msg_code == COAP_MSG_CODE_RESPONSE_CONTENT); 00096 00097 own_free(response); 00098 } 00099 00100 TEST(libCoap_builder, build_non_confirmable_response) 00101 { 00102 struct coap_s handle; 00103 sn_coap_hdr_s *response = NULL; 00104 uint8_t token_val = 0x99; 00105 00106 handle.sn_coap_protocol_malloc = &own_alloc; 00107 handle.sn_coap_protocol_free = &own_free; 00108 00109 coap_header.msg_type = COAP_MSG_TYPE_NON_CONFIRMABLE; 00110 coap_header.msg_code = COAP_MSG_CODE_REQUEST_GET; 00111 coap_header.msg_id = 12; 00112 coap_header.token_len = 1; 00113 coap_header.token_ptr = &token_val; 00114 00115 retCounter = 1; 00116 CHECK( NULL == sn_coap_build_response(&handle, &coap_header, COAP_MSG_CODE_RESPONSE_CONTENT)); 00117 00118 retCounter = 2; 00119 response = sn_coap_build_response(&handle, &coap_header, COAP_MSG_CODE_RESPONSE_CONTENT); 00120 00121 CHECK(response != NULL); 00122 CHECK(response->msg_type == COAP_MSG_TYPE_NON_CONFIRMABLE); 00123 CHECK(response->msg_code == COAP_MSG_CODE_RESPONSE_CONTENT); 00124 CHECK(response->token_ptr != NULL); 00125 CHECK(memcmp(response->token_ptr, coap_header.token_ptr, coap_header.token_len) == 0); 00126 CHECK(response->token_len == coap_header.token_len); 00127 00128 own_free(response->token_ptr); 00129 response->token_ptr = NULL; 00130 own_free(response); 00131 response = NULL; 00132 } 00133 00134 TEST(libCoap_builder, build_message_negative_cases) 00135 { 00136 // Null pointers as a parameter 00137 CHECK(sn_coap_builder(NULL, NULL) == -2); 00138 CHECK(sn_coap_builder(NULL, &coap_header) == -2); 00139 CHECK(sn_coap_builder(buffer, NULL) == -2); 00140 00141 // Invalid option length 00142 coap_header.token_ptr = temp; 00143 CHECK(sn_coap_builder(buffer, &coap_header) == -1); 00144 } 00145 00146 TEST(libCoap_builder, build_message_ok_cases) 00147 { 00148 CHECK(sn_coap_builder(buffer, &coap_header) == 11); 00149 } 00150 00151 TEST(libCoap_builder, build_message_options_token) 00152 { 00153 coap_header.token_ptr = temp; 00154 coap_header.token_len = 2; 00155 CHECK(sn_coap_builder(buffer, &coap_header) == 13); 00156 } 00157 00158 TEST(libCoap_builder, build_message_options_uri_path) 00159 { 00160 coap_header.uri_path_ptr = temp; 00161 coap_header.uri_path_len = 2; 00162 CHECK(sn_coap_builder(buffer, &coap_header) == 11); 00163 } 00164 00165 TEST(libCoap_builder, build_message_options_content_type) 00166 { 00167 coap_header.content_format = COAP_CT_TEXT_PLAIN; 00168 CHECK(sn_coap_builder(buffer, &coap_header) == 11); 00169 } 00170 00171 TEST(libCoap_builder, build_message_options_max_age) 00172 { 00173 coap_header.options_list_ptr->max_age = 1; 00174 CHECK(sn_coap_builder(buffer, &coap_header) == 12); 00175 } 00176 00177 TEST(libCoap_builder, build_message_options_proxy_uri) 00178 { 00179 coap_header.options_list_ptr->proxy_uri_ptr = temp; 00180 coap_header.options_list_ptr->proxy_uri_len = 2; 00181 CHECK(sn_coap_builder(buffer, &coap_header) == 14); 00182 } 00183 00184 TEST(libCoap_builder, build_message_options_etag) 00185 { 00186 coap_header.options_list_ptr->etag_ptr = temp; 00187 coap_header.options_list_ptr->etag_len = 2; 00188 CHECK(sn_coap_builder(buffer, &coap_header) == 14); 00189 } 00190 00191 TEST(libCoap_builder, build_message_options_uri_host) 00192 { 00193 coap_header.options_list_ptr->uri_host_ptr = temp; 00194 coap_header.options_list_ptr->uri_host_len = 2; 00195 CHECK(sn_coap_builder(buffer, &coap_header) == 14); 00196 } 00197 00198 TEST(libCoap_builder, build_message_options_location_path) 00199 { 00200 coap_header.options_list_ptr->location_path_ptr = temp; 00201 coap_header.options_list_ptr->location_path_len = 2; 00202 CHECK(sn_coap_builder(buffer, &coap_header) == 14); 00203 } 00204 00205 TEST(libCoap_builder, build_message_options_uri_port) 00206 { 00207 coap_header.options_list_ptr->uri_port = 2; 00208 CHECK(sn_coap_builder(buffer, &coap_header) == 12); 00209 } 00210 00211 00212 TEST(libCoap_builder, build_message_options_location_query) 00213 { 00214 coap_header.options_list_ptr->location_query_ptr = temp; 00215 coap_header.options_list_ptr->location_query_len = 2; 00216 CHECK(sn_coap_builder(buffer, &coap_header) == 14); 00217 } 00218 00219 TEST(libCoap_builder, build_message_options_observe) 00220 { 00221 coap_header.options_list_ptr->observe = 0; 00222 CHECK(sn_coap_builder(buffer, &coap_header) == 11); 00223 } 00224 00225 00226 TEST(libCoap_builder, build_message_options_accept) 00227 { 00228 coap_header.options_list_ptr->accept = COAP_CT_TEXT_PLAIN; 00229 CHECK(sn_coap_builder(buffer, &coap_header) == 11); 00230 } 00231 00232 TEST(libCoap_builder, build_message_options_uri_query) 00233 { 00234 coap_header.options_list_ptr->uri_query_ptr = temp; 00235 temp[0] = '1'; 00236 temp[1] = '&'; 00237 temp[2] = '2'; 00238 temp[3] = '&'; 00239 temp[4] = '3'; 00240 temp[5] = '\0'; 00241 coap_header.options_list_ptr->uri_query_len = 6; 00242 uint8_t val = sn_coap_builder(buffer, &coap_header); 00243 CHECK( val == 18); 00244 memset(&temp, 0, 10); 00245 } 00246 00247 00248 TEST(libCoap_builder, build_message_options_block1) 00249 { 00250 coap_header.options_list_ptr->block1 = 267; 00251 CHECK(sn_coap_builder(buffer, &coap_header) == 13); 00252 } 00253 00254 TEST(libCoap_builder, build_message_options_block2) 00255 { 00256 coap_header.options_list_ptr->block2 = 267; 00257 00258 sn_coap_header_check_stub.expectedInt8 = 44; 00259 CHECK(sn_coap_builder(buffer, &coap_header) == -1); 00260 00261 sn_coap_header_check_stub.expectedInt8 = 0; 00262 CHECK(sn_coap_builder(buffer, &coap_header) == 13); 00263 00264 coap_header.options_list_ptr = NULL; //return from sn_coap_builder_options_build immediately 00265 sn_coap_header_check_stub.expectedInt8 = 0; 00266 CHECK( 5 == sn_coap_builder(buffer, &coap_header) ); 00267 } 00268 00269 TEST(libCoap_builder, sn_coap_builder_calc_needed_packet_data_size) 00270 { 00271 CHECK(sn_coap_builder_calc_needed_packet_data_size(NULL) == 0); 00272 00273 sn_coap_hdr_s header; 00274 memset(&header, 0, sizeof(sn_coap_hdr_s)); 00275 header.msg_type = COAP_MSG_TYPE_ACKNOWLEDGEMENT; 00276 header.token_ptr = (uint8_t*)malloc(10); 00277 header.token_len = 10; 00278 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00279 free(header.token_ptr); 00280 header.token_ptr = (uint8_t*)malloc(6); 00281 header.token_len = 6; 00282 00283 //Test variations of sn_coap_builder_options_calc_option_size here --> 00284 header.uri_path_ptr = (uint8_t*)malloc(290); 00285 memset(header.uri_path_ptr, '1', 290); 00286 header.uri_path_len = 290; 00287 header.uri_path_ptr[5] = '/'; 00288 header.uri_path_ptr[285] = '/'; 00289 00290 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00291 00292 header.uri_path_ptr[285] = '1'; 00293 header.uri_path_ptr[170] = '/'; 00294 00295 header.content_format = sn_coap_content_format_e(0xFFFF22); 00296 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00297 00298 header.content_format = COAP_CT_TEXT_PLAIN; 00299 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 304); 00300 00301 sn_coap_options_list_s opt_list; 00302 memset(&opt_list, 0, sizeof(sn_coap_options_list_s)); 00303 header.options_list_ptr = &opt_list; 00304 00305 header.options_list_ptr->accept = sn_coap_content_format_e(0xFFFF22); 00306 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00307 00308 header.options_list_ptr->observe = COAP_OBSERVE_NONE; 00309 header.options_list_ptr->uri_port = COAP_OPTION_URI_PORT_NONE; 00310 free(header.uri_path_ptr); 00311 header.uri_path_ptr = NULL; 00312 header.content_format = COAP_CT_NONE; 00313 header.options_list_ptr->max_age = COAP_OPTION_MAX_AGE_DEFAULT; 00314 header.options_list_ptr->accept = COAP_CT_TEXT_PLAIN; 00315 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 14); 00316 00317 header.options_list_ptr->max_age = 6; 00318 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 16); 00319 00320 //proxy uri tests (4) 00321 header.options_list_ptr->proxy_uri_ptr = (uint8_t*)malloc(270); 00322 header.options_list_ptr->proxy_uri_len = 1800; 00323 header.options_list_ptr->max_age = COAP_OPTION_MAX_AGE_DEFAULT; 00324 header.options_list_ptr->accept = COAP_CT_NONE; 00325 00326 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00327 header.options_list_ptr->proxy_uri_len = 6; 00328 header.options_list_ptr->etag_ptr = (uint8_t*)malloc(6); 00329 header.options_list_ptr->etag_len = 0; 00330 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00331 00332 header.options_list_ptr->proxy_uri_len = 14; 00333 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00334 00335 header.options_list_ptr->proxy_uri_len = 281; 00336 header.options_list_ptr->block1 = COAP_OPTION_BLOCK_NONE; 00337 header.options_list_ptr->block2 = COAP_OPTION_BLOCK_NONE; 00338 header.options_list_ptr->etag_len = 4; 00339 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 300); 00340 00341 header.options_list_ptr->uri_host_ptr = (uint8_t*)malloc(6); 00342 header.options_list_ptr->uri_host_len = 0; 00343 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00344 00345 header.options_list_ptr->uri_host_len = 4; 00346 header.options_list_ptr->location_path_ptr = (uint8_t*)malloc(6); 00347 header.options_list_ptr->location_path_len = 270; 00348 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00349 00350 header.options_list_ptr->uri_host_len = 44; 00351 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00352 00353 header.options_list_ptr->location_path_len = 27; 00354 header.options_list_ptr->uri_port = 0xffff22; 00355 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00356 00357 header.options_list_ptr->uri_port = 6; 00358 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 377); 00359 00360 header.options_list_ptr->location_query_ptr = (uint8_t*)malloc(6); 00361 header.options_list_ptr->location_query_len = 277; 00362 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00363 00364 header.options_list_ptr->location_query_len = 27; 00365 header.options_list_ptr->observe = 0; 00366 free(header.options_list_ptr->location_path_ptr); 00367 header.options_list_ptr->location_path_ptr = NULL; 00368 header.options_list_ptr->location_path_len = 0; 00369 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 379); 00370 00371 header.options_list_ptr->uri_query_ptr = (uint8_t*)malloc(6); 00372 header.options_list_ptr->uri_query_len = 0; 00373 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00374 00375 header.options_list_ptr->uri_query_len = 4; 00376 header.options_list_ptr->block2 = -1; 00377 header.options_list_ptr->observe = 0xFFFFFF22; 00378 header.options_list_ptr->uri_port = COAP_OPTION_URI_PORT_NONE; 00379 free(header.options_list_ptr->etag_ptr); 00380 header.options_list_ptr->etag_ptr = NULL; 00381 header.options_list_ptr->etag_len = 0; 00382 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00383 00384 header.options_list_ptr->observe = COAP_OBSERVE_NONE; 00385 free(header.options_list_ptr->uri_host_ptr); 00386 header.options_list_ptr->uri_host_ptr = NULL; 00387 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 330); 00388 00389 header.options_list_ptr->observe = 1; 00390 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 331); 00391 00392 header.options_list_ptr->block2 = 0xFFFFFF22; 00393 header.options_list_ptr->block1 = -1; 00394 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 0); 00395 00396 header.options_list_ptr->block2 = 267; 00397 free(header.options_list_ptr->location_query_ptr); 00398 header.options_list_ptr->location_query_ptr = NULL; 00399 free(header.options_list_ptr->uri_query_ptr); 00400 header.options_list_ptr->uri_query_ptr = NULL; 00401 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 300); 00402 00403 header.options_list_ptr->block1 = 0xFFFFFF22; 00404 header.payload_len = 1; 00405 CHECK(0 == sn_coap_builder_calc_needed_packet_data_size(&header)); 00406 00407 header.options_list_ptr->block1 = 267; 00408 header.payload_len = 1; 00409 header.options_list_ptr->block2 = COAP_OPTION_BLOCK_NONE; 00410 CHECK(302 == sn_coap_builder_calc_needed_packet_data_size(&header)); 00411 00412 header.options_list_ptr->block1 = COAP_OPTION_BLOCK_NONE; 00413 header.options_list_ptr->size1 = 266; 00414 header.options_list_ptr->use_size1 = true; 00415 00416 CHECK(sn_coap_builder_calc_needed_packet_data_size(&header) == 303); 00417 00418 header.options_list_ptr->size2 = 266; 00419 header.options_list_ptr->use_size2 = true; 00420 header.payload_len = 1; 00421 CHECK(306 == sn_coap_builder_calc_needed_packet_data_size(&header)); 00422 00423 header.options_list_ptr->use_size1 = false; 00424 header.options_list_ptr->use_size2 = false; 00425 // <-- 00426 free(header.options_list_ptr->location_query_ptr); 00427 free(header.options_list_ptr->location_path_ptr); 00428 free(header.options_list_ptr->uri_host_ptr); 00429 free(header.options_list_ptr->etag_ptr); 00430 free(header.options_list_ptr->proxy_uri_ptr); 00431 header.options_list_ptr->location_query_ptr = NULL; 00432 header.options_list_ptr->location_path_ptr = NULL; 00433 header.options_list_ptr->uri_host_ptr = NULL; 00434 header.options_list_ptr->etag_ptr = NULL; 00435 header.options_list_ptr->proxy_uri_ptr = NULL; 00436 CHECK(14 == sn_coap_builder_calc_needed_packet_data_size(&header)); 00437 free(header.options_list_ptr->uri_query_ptr); 00438 00439 //Test sn_coap_builder_options_calculate_jump_need "else" case 00440 header.options_list_ptr = NULL; 00441 uint16_t val = sn_coap_builder_calc_needed_packet_data_size(&header); 00442 CHECK( 12 == val ); 00443 00444 free(header.uri_path_ptr); 00445 free(header.token_ptr); 00446 } 00447 00448 00449 TEST(libCoap_builder, sn_coap_builder_options_build_add_one_option) 00450 { 00451 coap_header.options_list_ptr->proxy_uri_ptr = (uint8_t*)malloc(280); 00452 memset(coap_header.options_list_ptr->proxy_uri_ptr, '1', 280); 00453 coap_header.options_list_ptr->proxy_uri_len = 2; 00454 sn_coap_header_check_stub.expectedInt8 = 0; 00455 CHECK(sn_coap_builder(buffer, &coap_header) == 14); 00456 00457 coap_header.options_list_ptr->proxy_uri_len = 27; 00458 sn_coap_header_check_stub.expectedInt8 = 0; 00459 CHECK(40 == sn_coap_builder(buffer, &coap_header)); 00460 00461 coap_header.options_list_ptr->proxy_uri_len = 277; 00462 sn_coap_header_check_stub.expectedInt8 = 0; 00463 CHECK(291 == sn_coap_builder(buffer, &coap_header)); 00464 00465 free(coap_header.options_list_ptr->proxy_uri_ptr); 00466 coap_header.options_list_ptr->proxy_uri_ptr = NULL; 00467 coap_header.options_list_ptr->proxy_uri_len = 0; 00468 } 00469 00470 TEST(libCoap_builder, sn_coap_builder_options_build_add_zero_length_option) 00471 { 00472 coap_header.options_list_ptr->proxy_uri_ptr = (uint8_t*)malloc(280); 00473 memset(coap_header.options_list_ptr->proxy_uri_ptr, '1', 280); 00474 coap_header.options_list_ptr->proxy_uri_len = 2; 00475 sn_coap_header_check_stub.expectedInt8 = 0; 00476 coap_header.options_list_ptr->observe = 1; 00477 int16_t val = sn_coap_builder(buffer, &coap_header); 00478 CHECK(val == 15); 00479 00480 free(coap_header.options_list_ptr->proxy_uri_ptr); 00481 } 00482 00483 TEST(libCoap_builder, sn_coap_builder_options_get_option_part_position) 00484 { 00485 sn_coap_hdr_s header; 00486 memset(&header, 0, sizeof(sn_coap_hdr_s)); 00487 sn_coap_options_list_s opt_list; 00488 memset(&opt_list, 0, sizeof(sn_coap_options_list_s)); 00489 header.options_list_ptr = &opt_list; 00490 header.options_list_ptr->accept = COAP_CT_TEXT_PLAIN; 00491 uint16_t val = sn_coap_builder(buffer, &header); 00492 CHECK(val == 11); 00493 00494 header.options_list_ptr->accept = COAP_CT_TEXT_PLAIN; 00495 val = sn_coap_builder(buffer, &header); 00496 CHECK(val == 11); 00497 } 00498 00499 TEST(libCoap_builder, sn_coap_builder_payload_build) 00500 { 00501 sn_coap_hdr_s header; 00502 memset(&header, 0, sizeof(sn_coap_hdr_s)); 00503 header.payload_ptr = (uint8_t*)malloc(5); 00504 header.payload_len = 5; 00505 sn_coap_options_list_s opt_list; 00506 memset(&opt_list, 0, sizeof(sn_coap_options_list_s)); 00507 header.options_list_ptr = &opt_list; 00508 header.options_list_ptr->accept = COAP_CT_TEXT_PLAIN; 00509 uint16_t val = sn_coap_builder(buffer, &header); 00510 CHECK(val == 17); 00511 00512 header.content_format = COAP_CT_NONE; 00513 header.options_list_ptr->uri_port = -1; 00514 header.options_list_ptr->observe = COAP_OBSERVE_NONE; 00515 header.options_list_ptr->accept = COAP_CT_NONE; 00516 header.options_list_ptr->block2 = COAP_OPTION_BLOCK_NONE; 00517 header.options_list_ptr->block1 = 13; 00518 header.options_list_ptr->use_size1 = true; 00519 header.options_list_ptr->use_size2 = true; 00520 header.options_list_ptr->max_age = COAP_OPTION_MAX_AGE_DEFAULT; 00521 00522 val = sn_coap_builder(buffer, &header); 00523 CHECK(val == 16); 00524 00525 free(header.payload_ptr); 00526 }
Generated on Tue Jul 12 2022 13:15:52 by
