joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sn_nsdl_stub.c Source File

sn_nsdl_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 #include <string.h>
00018 
00019 #include "ns_types.h"
00020 #include "sn_nsdl.h"
00021 #include "sn_coap_header.h"
00022 #include "sn_coap_protocol.h"
00023 #include "sn_nsdl_lib.h"
00024 #include "sn_grs.h"
00025 
00026 /* Defines */
00027 #define RESOURCE_DIR_LEN                2
00028 #define EP_NAME_PARAMETERS_LEN          3
00029 #define ET_PARAMETER_LEN                3
00030 #define LT_PARAMETER_LEN                3
00031 #define DOMAIN_PARAMETER_LEN            2
00032 #define RT_PARAMETER_LEN                3
00033 #define IF_PARAMETER_LEN                3
00034 #define OBS_PARAMETER_LEN               3
00035 #define AOBS_PARAMETER_LEN              8
00036 #define COAP_CON_PARAMETER_LEN          3
00037 #define BS_EP_PARAMETER_LEN             3
00038 #define BS_QUEUE_MODE_PARAMATER_LEN     2
00039 
00040 #define SN_NSDL_EP_REGISTER_MESSAGE     1
00041 #define SN_NSDL_EP_UPDATE_MESSAGE       2
00042 
00043 #define SN_NSDL_MSG_UNDEFINED           0
00044 #define SN_NSDL_MSG_REGISTER            1
00045 #define SN_NSDL_MSG_UNREGISTER          2
00046 #define SN_NSDL_MSG_UPDATE              3
00047 
00048 #include "sn_nsdl_stub.h"
00049 
00050 sn_nsdl_stub_def sn_nsdl_stub;
00051 
00052 int8_t sn_nsdl_destroy(struct nsdl_s *handle)
00053 {
00054     return sn_nsdl_stub.expectedInt8;
00055 }
00056 
00057 struct nsdl_s *sn_nsdl_init(uint8_t (*sn_nsdl_tx_cb)(struct nsdl_s *, sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *),
00058                             uint8_t (*sn_nsdl_rx_cb)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *),
00059                             void *(*sn_nsdl_alloc)(uint16_t), void (*sn_nsdl_free)(void *))
00060 {
00061     return NULL;
00062 }
00063 
00064 uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr)
00065 {
00066     return sn_nsdl_stub.expectedUint16;
00067 }
00068 
00069 uint16_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle)
00070 {
00071     return sn_nsdl_stub.expectedUint16;
00072 }
00073 
00074 uint16_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len)
00075 {
00076     return sn_nsdl_stub.expectedUint16;
00077 }
00078 
00079 int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *loc_ptr, uint8_t loc_len)
00080 {
00081     return sn_nsdl_stub.expectedInt8;
00082 }
00083 
00084 void sn_nsdl_nsp_lost(struct nsdl_s *handle)
00085 {
00086 }
00087 
00088 int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle)
00089 {
00090     return sn_nsdl_stub.expectedInt8;
00091 }
00092 
00093 uint16_t sn_nsdl_send_observation_notification_with_uri_path(struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len,
00094        uint8_t *payload_ptr, uint16_t payload_len,
00095        uint8_t *observe_ptr, uint8_t observe_len,
00096        sn_coap_msg_type_e message_type,
00097        uint8_t content_type,
00098        uint8_t *uri_path_ptr,
00099        uint16_t uri_path_len)
00100 {
00101     return sn_nsdl_stub.expectedUint16;
00102 }
00103 
00104 uint16_t sn_nsdl_send_observation_notification(struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len,
00105        uint8_t *payload_ptr, uint16_t payload_len,
00106        uint8_t *observe_ptr, uint8_t observe_len,
00107        sn_coap_msg_type_e message_type,
00108        uint8_t content_type)
00109 {
00110     return sn_nsdl_stub.expectedUint16;
00111 }
00112 
00113 /* * * * * * * * * * */
00114 /* ~ OMA functions ~ */
00115 /* * * * * * * * * * */
00116 
00117 uint16_t sn_nsdl_oma_bootstrap(struct nsdl_s *handle, sn_nsdl_addr_s *bootstrap_address_ptr, sn_nsdl_ep_parameters_s *endpoint_info_ptr, sn_nsdl_bs_ep_info_t *bootstrap_endpoint_info_ptr)
00118 {
00119     return sn_nsdl_stub.expectedUint16;
00120 }
00121 
00122 omalw_certificate_list_t *sn_nsdl_get_certificates(struct nsdl_s *handle)
00123 {
00124     return NULL;
00125 }
00126 
00127 int8_t sn_nsdl_update_certificates(struct nsdl_s *handle, omalw_certificate_list_t *certificate_ptr, uint8_t certificate_chain)
00128 {
00129     return sn_nsdl_stub.expectedInt8;
00130 }
00131 
00132 int8_t sn_nsdl_create_oma_device_object(struct nsdl_s *handle, sn_nsdl_oma_device_t *device_object_ptr)
00133 {
00134     return sn_nsdl_stub.expectedInt8;
00135 }
00136 
00137 char *sn_nsdl_get_version(void)
00138 {
00139     return NULL;
00140 }
00141 
00142 
00143 int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet_ptr, uint16_t packet_len, sn_nsdl_addr_s *src_ptr)
00144 {
00145     return sn_nsdl_stub.expectedInt8;
00146 }
00147 
00148 int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time)
00149 {
00150     return sn_nsdl_stub.expectedInt8;
00151 }
00152 
00153 sn_nsdl_resource_info_s *sn_nsdl_get_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path_ptr)
00154 {
00155     return NULL;
00156 }
00157 
00158 int8_t sn_nsdl_build_registration_body(struct nsdl_s *handle, sn_coap_hdr_s *message_ptr, uint8_t updating_registeration)
00159 {
00160     if( sn_nsdl_stub.allocatePayloadPtr && message_ptr && handle){
00161         message_ptr->payload_ptr = handle->sn_nsdl_alloc(2);
00162         message_ptr->payload_len = 2;
00163     }
00164     return sn_nsdl_stub.expectedInt8;
00165 }
00166 
00167 int8_t set_NSP_address(struct nsdl_s *handle, uint8_t *NSP_address, uint16_t port, sn_nsdl_addr_type_e address_type)
00168 {
00169     return sn_nsdl_stub.expectedInt8;
00170 }
00171 
00172 int8_t sn_nsdl_process_oma_tlv(struct nsdl_s *handle, uint8_t *data_ptr, uint16_t data_len)
00173 {
00174     return sn_nsdl_stub.expectedInt8;
00175 }
00176 
00177 /* Wrapper */
00178 sn_grs_resource_list_s *sn_nsdl_list_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path)
00179 {
00180     return NULL;
00181 }
00182 
00183 void sn_nsdl_free_resource_list(struct nsdl_s *handle, sn_grs_resource_list_s *list)
00184 {
00185 }
00186 
00187 extern int8_t sn_nsdl_update_resource(struct nsdl_s *handle, sn_nsdl_resource_info_s *res)
00188 {
00189     return sn_nsdl_stub.expectedInt8;
00190 }
00191 
00192 extern int8_t sn_nsdl_send_coap_message(struct nsdl_s *handle, sn_nsdl_addr_s *address_ptr, sn_coap_hdr_s *coap_hdr_ptr)
00193 {
00194     return sn_nsdl_stub.expectedInt8;
00195 }
00196 
00197 extern int8_t sn_nsdl_create_resource(struct nsdl_s *handle, sn_nsdl_resource_info_s *res)
00198 {
00199     return sn_nsdl_stub.expectedInt8;
00200 }
00201 
00202 extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path)
00203 {
00204     return sn_nsdl_stub.expectedInt8;
00205 }
00206 
00207 extern const sn_nsdl_resource_info_s *sn_nsdl_get_first_resource(struct nsdl_s *handle)
00208 {
00209     return NULL;
00210 }
00211 
00212 extern const sn_nsdl_resource_info_s *sn_nsdl_get_next_resource(struct nsdl_s *handle, const sn_nsdl_resource_info_s *resource)
00213 {
00214     return NULL;
00215 }
00216 
00217 extern sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code)
00218 {
00219     return NULL;
00220 }
00221 
00222 extern void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr)
00223 {
00224 }