Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sn_coap_parser_stub.c Source File

sn_coap_parser_stub.c

00001 /*
00002  * Copyright (c) 2011-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 /**
00019  *\file sn_coap_parser.c
00020  *
00021  * \brief CoAP Header parser
00022  *
00023  * Functionality: Parses CoAP Header
00024  *
00025  */
00026 
00027 #include "ns_types.h"
00028 #include "sn_coap_protocol.h"
00029 #include "sn_coap_parser_stub.h"
00030 
00031 sn_coap_parser_def sn_coap_parser_stub;
00032 
00033 sn_coap_hdr_s *sn_coap_parser(struct coap_s *handle, uint16_t packet_data_len, uint8_t *packet_data_ptr, coap_version_e *coap_version_ptr)
00034 {
00035     return sn_coap_parser_stub.expectedHeader;
00036 }
00037 
00038 void sn_coap_parser_release_allocated_coap_msg_mem(struct coap_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr)
00039 {
00040     if (freed_coap_msg_ptr != NULL) {
00041         if (freed_coap_msg_ptr->uri_path_ptr != NULL) {
00042             free(freed_coap_msg_ptr->uri_path_ptr);
00043         }
00044 
00045         if (freed_coap_msg_ptr->token_ptr != NULL) {
00046             free(freed_coap_msg_ptr->token_ptr);
00047         }
00048 
00049         if (freed_coap_msg_ptr->options_list_ptr != NULL) {
00050             if (freed_coap_msg_ptr->options_list_ptr->proxy_uri_ptr != NULL) {
00051                 free(freed_coap_msg_ptr->options_list_ptr->proxy_uri_ptr);
00052             }
00053 
00054             if (freed_coap_msg_ptr->options_list_ptr->etag_ptr != NULL) {
00055                 free(freed_coap_msg_ptr->options_list_ptr->etag_ptr);
00056             }
00057 
00058             if (freed_coap_msg_ptr->options_list_ptr->uri_host_ptr != NULL) {
00059                 free(freed_coap_msg_ptr->options_list_ptr->uri_host_ptr);
00060             }
00061 
00062             if (freed_coap_msg_ptr->options_list_ptr->location_path_ptr != NULL) {
00063                 free(freed_coap_msg_ptr->options_list_ptr->location_path_ptr);
00064             }
00065 
00066             if (freed_coap_msg_ptr->options_list_ptr->location_query_ptr != NULL) {
00067                 free(freed_coap_msg_ptr->options_list_ptr->location_query_ptr);
00068             }
00069 
00070             if (freed_coap_msg_ptr->options_list_ptr->uri_query_ptr != NULL) {
00071                 free(freed_coap_msg_ptr->options_list_ptr->uri_query_ptr);
00072             }
00073 
00074             free(freed_coap_msg_ptr->options_list_ptr);
00075         }
00076 
00077         free(freed_coap_msg_ptr);
00078         freed_coap_msg_ptr = NULL;
00079     }
00080 }