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_connection_handler_stub.c Source File

coap_connection_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 <string.h>
00019 #include "coap_connection_handler.h"
00020 #include "coap_security_handler.h"
00021 #include "ns_list.h"
00022 #include "ns_trace.h"
00023 #include "nsdynmemLIB.h"
00024 #include "socket_api.h"
00025 #include "net_interface.h"
00026 #include "eventOS_callback_timer.h"
00027 #include "coap_connection_handler_stub.h"
00028 
00029 thread_conn_handler_stub_def thread_conn_handler_stub;
00030 
00031 int coap_connection_handler_virtual_recv(coap_conn_handler_t *handler, uint8_t address[static 16], uint16_t port, uint8_t *data_ptr, uint16_t data_len)
00032 {
00033     return thread_conn_handler_stub.int_value;
00034 }
00035 
00036 coap_conn_handler_t *connection_handler_create(int (*recv_cb)(int8_t socket_id, int8_t recv_if_id, uint8_t src_address[static 16], uint16_t port, const uint8_t dst_address[static 16], unsigned char *, int),
00037                                                int (*send_cb)(int8_t socket_id, uint8_t const address[static 16], uint16_t port, const void *, int),
00038                                                int (*pw_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, coap_security_keys_t *security_ptr),
00039                                                void(*done_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, uint8_t keyblock[static KEY_BLOCK_LEN]))
00040 {
00041     thread_conn_handler_stub.send_to_sock_cb = send_cb;
00042     thread_conn_handler_stub.receive_from_sock_cb = recv_cb;
00043     thread_conn_handler_stub.get_passwd_cb = pw_cb;
00044     thread_conn_handler_stub.sec_done_cb = done_cb;
00045     thread_conn_handler_stub.cch_function_callback = NULL;
00046     return thread_conn_handler_stub.handler_obj;
00047 }
00048 
00049 void connection_handler_destroy(coap_conn_handler_t *handler, bool multicast_group_leave)
00050 {
00051 
00052 }
00053 void connection_handler_close_secure_connection(coap_conn_handler_t *handler, uint8_t destination_addr_ptr[static 16], uint16_t port)
00054 {
00055 
00056 }
00057 
00058 int coap_connection_handler_open_connection(coap_conn_handler_t *handler, uint16_t listen_port, bool use_ephemeral_port, bool is_secure, bool is_real_socket, bool bypassSec)
00059 {
00060     return thread_conn_handler_stub.int_value;
00061 }
00062 
00063 int coap_connection_handler_send_data(coap_conn_handler_t *handler, const ns_address_t *dest_addr, const uint8_t dst_address[static 16], uint8_t *data_ptr, uint16_t data_len, bool bypass_link_sec)
00064 {
00065     return thread_conn_handler_stub.int_value;
00066 }
00067 
00068 bool coap_connection_handler_socket_belongs_to(coap_conn_handler_t *handler, int8_t socket_id)
00069 {
00070     return thread_conn_handler_stub.bool_value;
00071 }
00072 
00073 int8_t coap_connection_handler_set_timeout(coap_conn_handler_t *handler, uint32_t min, uint32_t max)
00074 {
00075     return 0;
00076 }
00077 
00078 int8_t coap_connection_handler_handshake_limits_set(uint8_t handshakes_limit, uint8_t connections_limit)
00079 {
00080     return 0;
00081 }
00082 
00083 void coap_connection_handler_exec(uint32_t time)
00084 {
00085 }
00086 
00087 int coap_connection_handler_msg_prevalidate_callback_set(coap_conn_handler_t *handler, cch_func_cb *function_callback)
00088 {
00089     thread_conn_handler_stub.cch_function_callback = function_callback;
00090     return 0;
00091 }
00092 
00093 
00094 cch_func_cb *coap_connection_handler_msg_prevalidate_callback_get(coap_conn_handler_t *handler, uint16_t *listen_socket_port)
00095 {
00096     *listen_socket_port = 0;
00097     return thread_conn_handler_stub.cch_function_callback;
00098 }
00099 
00100 coap_conn_handler_t *coap_connection_handler_find_by_socket_port(uint16_t listen_port)
00101 {
00102     return thread_conn_handler_stub.handler_obj;
00103 }