Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers coap_message_handler_stub.c Source File

coap_message_handler_stub.c

00001 /*
00002  * Copyright (c) 2015-2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #include "coap_message_handler_stub.h"
00019 
00020 coap_message_handler_stub_def coap_message_handler_stub;
00021 
00022 coap_msg_handler_t *coap_message_handler_init(void *(*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void *),
00023                                               uint8_t (*used_tx_callback_ptr)(uint8_t *, uint16_t, sn_nsdl_addr_s *, void *))
00024 {
00025     if (coap_message_handler_stub.coap_ptr) {
00026         coap_message_handler_stub.coap_ptr->sn_coap_service_malloc = used_malloc_func_ptr;
00027         coap_message_handler_stub.coap_ptr->sn_coap_service_free = used_free_func_ptr;
00028         coap_message_handler_stub.coap_ptr->sn_coap_tx_callback = used_tx_callback_ptr;
00029     }
00030     return coap_message_handler_stub.coap_ptr;
00031 }
00032 
00033 void transaction_delete(coap_transaction_t *this)
00034 {
00035 
00036 }
00037 
00038 void transactions_delete_all(uint8_t *address_ptr, uint16_t port)
00039 {
00040 
00041 }
00042 
00043 int8_t coap_message_handler_destroy(coap_msg_handler_t *handle)
00044 {
00045     return coap_message_handler_stub.int8_value;
00046 }
00047 
00048 coap_transaction_t *coap_message_handler_transaction_valid(coap_transaction_t *tr_ptr)
00049 {
00050     return coap_message_handler_stub.coap_ptr;
00051 }
00052 
00053 coap_transaction_t *coap_message_handler_find_transaction(uint8_t *address_ptr, uint16_t port)
00054 {
00055     return coap_message_handler_stub.coap_tx_ptr;
00056 }
00057 
00058 extern int16_t coap_message_handler_coap_msg_process(coap_msg_handler_t *handle, int8_t socket_id, int8_t recv_if_id, const uint8_t source_addr_ptr[static 16], uint16_t port,
00059                                                      const uint8_t dst_addr_ptr[static 16], uint8_t *data_ptr, uint16_t data_len, coap_msg_process_cb *msg_process_callback)
00060 {
00061     coap_message_handler_stub.msg_process_cb = msg_process_callback;
00062     return coap_message_handler_stub.int16_value;
00063 }
00064 
00065 uint16_t coap_message_handler_request_send(coap_msg_handler_t *handle, int8_t service_id, uint8_t options,
00066                                            const uint8_t destination_addr[static 16], uint16_t destination_port, sn_coap_msg_type_e msg_type, sn_coap_msg_code_e msg_code,
00067                                            const char *uri, sn_coap_content_format_e cont_type, const uint8_t *payload_ptr, uint16_t payload_len, coap_message_handler_response_recv *request_response_cb)
00068 {
00069     return coap_message_handler_stub.uint16_value;
00070 }
00071 
00072 int8_t coap_message_handler_response_send(coap_msg_handler_t *handle, int8_t service_id, uint8_t options, sn_coap_hdr_s *request_ptr,  sn_coap_msg_code_e message_code, sn_coap_content_format_e content_type, const uint8_t *payload_ptr, uint16_t payload_len)
00073 {
00074     return coap_message_handler_stub.int8_value;
00075 }
00076 
00077 int8_t coap_message_handler_request_delete(coap_msg_handler_t *handle, int8_t service_id, uint16_t msg_id)
00078 {
00079     return 0;
00080 }
00081 
00082 int8_t coap_message_handler_request_delete_by_service_id(coap_msg_handler_t *handle, int8_t service_id)
00083 {
00084     return 0;
00085 }
00086 
00087 int8_t coap_message_handler_exec(coap_msg_handler_t *handle, uint32_t current_time)
00088 {
00089     return coap_message_handler_stub.int8_value;
00090 }
00091 
00092 int8_t coap_message_handler_response_send_by_msg_id(coap_msg_handler_t *handle, int8_t service_id, uint8_t options, uint16_t msg_id, sn_coap_msg_code_e message_code,
00093                                                     sn_coap_content_format_e content_type, const uint8_t *payload_ptr, uint16_t payload_len)
00094 {
00095     return coap_message_handler_stub.int8_value;
00096 }