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, 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     return thread_conn_handler_stub.handler_obj;
00046 }
00047 
00048 void connection_handler_destroy( coap_conn_handler_t *handler, bool multicast_group_leave)
00049 {
00050 
00051 }
00052 void connection_handler_close_secure_connection( coap_conn_handler_t *handler, uint8_t destination_addr_ptr[static 16], uint16_t port )
00053 {
00054 
00055 }
00056 
00057 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)
00058 {
00059     return thread_conn_handler_stub.int_value;
00060 }
00061 
00062 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)
00063 {
00064     return thread_conn_handler_stub.int_value;
00065 }
00066 
00067 bool coap_connection_handler_socket_belongs_to(coap_conn_handler_t *handler, int8_t socket_id)
00068 {
00069     return thread_conn_handler_stub.bool_value;
00070 }
00071 
00072 int8_t coap_connection_handler_set_timeout(coap_conn_handler_t *handler, uint32_t min, uint32_t max)
00073 {
00074     return 0;
00075 }
00076 
00077 int8_t coap_connection_handler_handshake_limits_set(uint8_t handshakes_limit, uint8_t connections_limit)
00078 {
00079     return 0;
00080 }
00081 
00082 void coap_connection_handler_exec(uint32_t time)
00083 {
00084 
00085 }