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.
sn_coap_protocol_stub.c
00001 /* 00002 * Copyright (c) 2011-2017 ARM Limited. All Rights Reserved. 00003 */ 00004 00005 00006 #include <stdio.h> 00007 #include <stdlib.h> /* For libary malloc() */ 00008 #include <string.h> /* For memset() and memcpy() */ 00009 #ifdef __linux__ 00010 #include <time.h> 00011 #endif 00012 00013 #include "ns_types.h" 00014 #include "sn_coap_protocol.h" 00015 #include "sn_coap_header_internal.h" 00016 #include "sn_coap_protocol_internal.h" 00017 #include "sn_coap_protocol_stub.h" 00018 00019 uint16_t sn_coap_block_data_size = 0; 00020 00021 uint8_t sn_coap_resending_queue_msgs = 0; 00022 uint8_t sn_coap_resending_queue_bytes = 0; 00023 uint8_t sn_coap_resending_count = 0; 00024 uint8_t sn_coap_resending_intervall = 0; 00025 00026 uint8_t sn_coap_duplication_buffer_size = 0; 00027 00028 sn_coap_protocol_stub_def sn_coap_protocol_stub; 00029 00030 int8_t sn_coap_protocol_destroy(struct coap_s *handle) 00031 { 00032 return sn_coap_protocol_stub.expectedInt8; 00033 } 00034 00035 struct coap_s *sn_coap_protocol_init(void *(*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void *), 00036 uint8_t (*used_tx_callback_ptr)(uint8_t *, uint16_t, sn_nsdl_addr_s *, void *), 00037 int8_t (*used_rx_callback_ptr)(sn_coap_hdr_s *, sn_nsdl_addr_s *, void *param)) 00038 { 00039 if( sn_coap_protocol_stub.expectedCoap ){ 00040 sn_coap_protocol_stub.expectedCoap->sn_coap_protocol_free = used_free_func_ptr; 00041 sn_coap_protocol_stub.expectedCoap->sn_coap_protocol_malloc = used_malloc_func_ptr; 00042 sn_coap_protocol_stub.expectedCoap->sn_coap_rx_callback = used_rx_callback_ptr; 00043 sn_coap_protocol_stub.expectedCoap->sn_coap_tx_callback = used_tx_callback_ptr; 00044 } 00045 return sn_coap_protocol_stub.expectedCoap; 00046 } 00047 00048 int8_t sn_coap_protocol_set_block_size(struct coap_s *handle, uint16_t block_size) 00049 { 00050 return sn_coap_protocol_stub.expectedInt8; 00051 } 00052 00053 int8_t sn_coap_protocol_set_duplicate_buffer_size(struct coap_s *handle, uint8_t size) 00054 { 00055 return sn_coap_protocol_stub.expectedInt8; 00056 } 00057 00058 int8_t sn_coap_protocol_set_retransmission_parameters(struct coap_s *handle, uint8_t resending_count, uint8_t resending_intervall) 00059 { 00060 return sn_coap_protocol_stub.expectedInt8; 00061 } 00062 00063 int8_t sn_coap_protocol_set_retransmission_buffer(struct coap_s *handle, uint8_t buffer_size_messages, uint16_t buffer_size_bytes) 00064 { 00065 return sn_coap_protocol_stub.expectedInt8; 00066 } 00067 00068 void sn_coap_protocol_clear_retransmission_buffer(struct coap_s *handle) 00069 { 00070 } 00071 00072 00073 int16_t sn_coap_protocol_build(struct coap_s *handle, sn_nsdl_addr_s *dst_addr_ptr, 00074 uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, void *param) 00075 { 00076 //TODO: check if needed here 00077 src_coap_msg_ptr->msg_id = 2; 00078 return sn_coap_protocol_stub.expectedInt16; 00079 } 00080 00081 sn_coap_hdr_s *sn_coap_protocol_parse(struct coap_s *handle, sn_nsdl_addr_s *src_addr_ptr, uint16_t packet_data_len, uint8_t *packet_data_ptr, void *param) 00082 { 00083 return sn_coap_protocol_stub.expectedHeader; 00084 } 00085 00086 int8_t sn_coap_protocol_exec(struct coap_s *handle, uint32_t current_time) 00087 { 00088 return sn_coap_protocol_stub.expectedInt8; 00089 } 00090 00091 coap_send_msg_s *sn_coap_protocol_allocate_mem_for_msg(struct coap_s *handle, sn_nsdl_addr_s *dst_addr_ptr, uint16_t packet_data_len) 00092 { 00093 return sn_coap_protocol_stub.expectedSendMsg; 00094 } 00095 00096 int8_t sn_coap_protocol_delete_retransmission(struct coap_s *handle, uint16_t msg_id) 00097 { 00098 return 0; 00099 }
Generated on Thu Jul 14 2022 14:36:21 by
