WORKS
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
sn_coap_protocol_stub.c
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 00017 00018 #include <stdio.h> 00019 #include <stdlib.h> /* For libary malloc() */ 00020 #include <string.h> /* For memset() and memcpy() */ 00021 #ifdef __linux__ 00022 #include <time.h> 00023 #endif 00024 00025 #include "ns_types.h" 00026 #include "sn_nsdl.h" 00027 #include "sn_coap_protocol.h" 00028 #include "sn_coap_header_internal.h" 00029 #include "sn_coap_protocol_internal.h" 00030 #include "sn_coap_protocol_stub.h" 00031 00032 uint16_t sn_coap_block_data_size = 0; 00033 00034 uint8_t sn_coap_resending_queue_msgs = 0; 00035 uint8_t sn_coap_resending_queue_bytes = 0; 00036 uint8_t sn_coap_resending_count = 0; 00037 uint8_t sn_coap_resending_intervall = 0; 00038 00039 uint8_t sn_coap_duplication_buffer_size = 0; 00040 00041 sn_coap_protocol_stub_def sn_coap_protocol_stub; 00042 00043 int8_t sn_coap_protocol_destroy(struct coap_s *handle) 00044 { 00045 return sn_coap_protocol_stub.expectedInt8; 00046 } 00047 00048 struct coap_s *sn_coap_protocol_init(void *(*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void *), 00049 uint8_t (*used_tx_callback_ptr)(uint8_t *, uint16_t, sn_nsdl_addr_s *, void *), 00050 int8_t (*used_rx_callback_ptr)(sn_coap_hdr_s *, sn_nsdl_addr_s *, void *param)) 00051 { 00052 if( sn_coap_protocol_stub.expectedCoap ){ 00053 sn_coap_protocol_stub.expectedCoap->sn_coap_protocol_free = used_free_func_ptr; 00054 sn_coap_protocol_stub.expectedCoap->sn_coap_protocol_malloc = used_malloc_func_ptr; 00055 sn_coap_protocol_stub.expectedCoap->sn_coap_rx_callback = used_rx_callback_ptr; 00056 sn_coap_protocol_stub.expectedCoap->sn_coap_tx_callback = used_tx_callback_ptr; 00057 //sn_coap_protocol_stub.expectedCoap->linked_list_resent_msgs = 00058 } 00059 return sn_coap_protocol_stub.expectedCoap; 00060 } 00061 00062 int8_t sn_coap_protocol_set_block_size(struct coap_s *handle, uint16_t block_size) 00063 { 00064 return sn_coap_protocol_stub.expectedInt8; 00065 } 00066 00067 int8_t sn_coap_protocol_set_duplicate_buffer_size(struct coap_s *handle, uint8_t message_count) 00068 { 00069 return sn_coap_protocol_stub.expectedInt8; 00070 } 00071 00072 int8_t sn_coap_protocol_set_retransmission_parameters(struct coap_s *handle, uint8_t resending_count, uint8_t resending_intervall) 00073 { 00074 return sn_coap_protocol_stub.expectedInt8; 00075 } 00076 00077 int8_t sn_coap_protocol_set_retransmission_buffer(struct coap_s *handle, uint8_t buffer_size_messages, uint16_t buffer_size_bytes) 00078 { 00079 return sn_coap_protocol_stub.expectedInt8; 00080 } 00081 00082 void sn_coap_protocol_clear_retransmission_buffer(struct coap_s *handle) 00083 { 00084 } 00085 00086 00087 int16_t sn_coap_protocol_build(struct coap_s *handle, sn_nsdl_addr_s *dst_addr_ptr, 00088 uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, void *param) 00089 { 00090 return sn_coap_protocol_stub.expectedInt16; 00091 } 00092 00093 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) 00094 { 00095 return sn_coap_protocol_stub.expectedHeader; 00096 } 00097 00098 int8_t sn_coap_protocol_exec(struct coap_s *handle, uint32_t current_time) 00099 { 00100 return sn_coap_protocol_stub.expectedInt8; 00101 } 00102 00103 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) 00104 { 00105 return sn_coap_protocol_stub.expectedSendMsg; 00106 } 00107 00108 00109
Generated on Tue Jul 12 2022 12:28:48 by
1.7.2
