WORKS
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
sn_coap_protocol_stub.c
00001 /* 00002 * Copyright (c) 2011-2015 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_nsdl.h" 00015 #include "sn_coap_protocol.h" 00016 #include "sn_coap_header_internal.h" 00017 #include "sn_coap_protocol_internal.h" 00018 #include "sn_coap_protocol_stub.h" 00019 00020 uint16_t sn_coap_block_data_size = 0; 00021 00022 uint8_t sn_coap_resending_queue_msgs = 0; 00023 uint8_t sn_coap_resending_queue_bytes = 0; 00024 uint8_t sn_coap_resending_count = 0; 00025 uint8_t sn_coap_resending_intervall = 0; 00026 00027 uint8_t sn_coap_duplication_buffer_size = 0; 00028 00029 sn_coap_protocol_stub_def sn_coap_protocol_stub; 00030 00031 int8_t sn_coap_protocol_destroy(struct coap_s *handle) 00032 { 00033 return sn_coap_protocol_stub.expectedInt8; 00034 } 00035 00036 struct coap_s *sn_coap_protocol_init(void *(*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void *), 00037 uint8_t (*used_tx_callback_ptr)(uint8_t *, uint16_t, sn_nsdl_addr_s *, void *), 00038 int8_t (*used_rx_callback_ptr)(sn_coap_hdr_s *, sn_nsdl_addr_s *, void *param)) 00039 { 00040 if( sn_coap_protocol_stub.expectedCoap ){ 00041 sn_coap_protocol_stub.expectedCoap->sn_coap_protocol_free = used_free_func_ptr; 00042 sn_coap_protocol_stub.expectedCoap->sn_coap_protocol_malloc = used_malloc_func_ptr; 00043 sn_coap_protocol_stub.expectedCoap->sn_coap_rx_callback = used_rx_callback_ptr; 00044 sn_coap_protocol_stub.expectedCoap->sn_coap_tx_callback = used_tx_callback_ptr; 00045 } 00046 return sn_coap_protocol_stub.expectedCoap; 00047 } 00048 00049 int8_t sn_coap_protocol_set_block_size(struct coap_s *handle, uint16_t block_size) 00050 { 00051 return sn_coap_protocol_stub.expectedInt8; 00052 } 00053 00054 int8_t sn_coap_protocol_set_duplicate_buffer_size(struct coap_s *handle, uint8_t size) 00055 { 00056 return sn_coap_protocol_stub.expectedInt8; 00057 } 00058 00059 int8_t sn_coap_protocol_set_retransmission_parameters(struct coap_s *handle, uint8_t resending_count, uint8_t resending_intervall) 00060 { 00061 return sn_coap_protocol_stub.expectedInt8; 00062 } 00063 00064 int8_t sn_coap_protocol_set_retransmission_buffer(struct coap_s *handle, uint8_t buffer_size_messages, uint16_t buffer_size_bytes) 00065 { 00066 return sn_coap_protocol_stub.expectedInt8; 00067 } 00068 00069 void sn_coap_protocol_clear_retransmission_buffer(struct coap_s *handle) 00070 { 00071 } 00072 00073 00074 int16_t sn_coap_protocol_build(struct coap_s *handle, sn_nsdl_addr_s *dst_addr_ptr, 00075 uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, void *param) 00076 { 00077 //TODO: check if needed here 00078 src_coap_msg_ptr->msg_id = 2; 00079 return sn_coap_protocol_stub.expectedInt16; 00080 } 00081 00082 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) 00083 { 00084 return sn_coap_protocol_stub.expectedHeader; 00085 } 00086 00087 int8_t sn_coap_protocol_exec(struct coap_s *handle, uint32_t current_time) 00088 { 00089 return sn_coap_protocol_stub.expectedInt8; 00090 } 00091 00092 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) 00093 { 00094 return sn_coap_protocol_stub.expectedSendMsg; 00095 } 00096
Generated on Tue Jul 12 2022 12:28:48 by
1.7.2
