Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
m2msecurity_stub.cpp
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 #include "m2msecurity_stub.h" 00017 00018 bool m2msecurity_stub::has_value; 00019 uint32_t m2msecurity_stub::int_value; 00020 uint32_t m2msecurity_stub::sec_mode; 00021 bool m2msecurity_stub::bool_value; 00022 String *m2msecurity_stub::string_value; 00023 M2MResource* m2msecurity_stub::resource; 00024 00025 void m2msecurity_stub::clear() 00026 { 00027 has_value = false; 00028 int_value = -1; 00029 bool_value = false; 00030 string_value = NULL; 00031 resource = NULL; 00032 } 00033 00034 M2MSecurity::M2MSecurity(ServerType ser_type) 00035 : M2MObject("0", stringdup("0")), 00036 _server_type(ser_type), 00037 _server_instance(NULL) 00038 { 00039 } 00040 00041 M2MSecurity::~M2MSecurity() 00042 { 00043 } 00044 00045 M2MResource* M2MSecurity::create_resource(SecurityResource, uint32_t) 00046 { 00047 return m2msecurity_stub::resource; 00048 } 00049 00050 bool M2MSecurity::delete_resource(SecurityResource) 00051 { 00052 return m2msecurity_stub::bool_value; 00053 } 00054 00055 bool M2MSecurity::set_resource_value(SecurityResource, 00056 const String &) 00057 { 00058 return m2msecurity_stub::bool_value; 00059 } 00060 00061 bool M2MSecurity::set_resource_value(SecurityResource, 00062 uint32_t) 00063 { 00064 return m2msecurity_stub::bool_value; 00065 } 00066 00067 bool M2MSecurity::set_resource_value(SecurityResource, 00068 const uint8_t *, 00069 const uint16_t) 00070 { 00071 return m2msecurity_stub::bool_value; 00072 } 00073 00074 String M2MSecurity::resource_value_string(SecurityResource) const 00075 { 00076 return *m2msecurity_stub::string_value; 00077 } 00078 00079 uint32_t M2MSecurity::resource_value_buffer(SecurityResource, 00080 uint8_t *&value) const 00081 { 00082 if( m2msecurity_stub::has_value ){ 00083 value = (uint8_t *)malloc(5); 00084 return 5; 00085 } 00086 return m2msecurity_stub::int_value; 00087 } 00088 00089 uint32_t M2MSecurity::resource_value_buffer(SecurityResource, 00090 const uint8_t *&value) const 00091 { 00092 if( m2msecurity_stub::has_value ){ 00093 value = NULL; 00094 return 5; 00095 } 00096 return m2msecurity_stub::int_value; 00097 } 00098 00099 uint32_t M2MSecurity::resource_value_int(SecurityResource res) const 00100 { 00101 if (res == M2MSecurity::SecurityMode) { 00102 return m2msecurity_stub::sec_mode; 00103 } 00104 else if(res == M2MSecurity::BootstrapServer) { 00105 return m2msecurity_stub::bool_value; 00106 } 00107 else { 00108 return m2msecurity_stub::int_value; 00109 } 00110 } 00111 00112 bool M2MSecurity::is_resource_present(SecurityResource) const 00113 { 00114 return m2msecurity_stub::bool_value; 00115 } 00116 00117 uint16_t M2MSecurity::total_resource_count() const 00118 { 00119 return (uint16_t)m2msecurity_stub::int_value; 00120 } 00121 00122 M2MSecurity::ServerType M2MSecurity::server_type() const 00123 { 00124 return _server_type; 00125 } 00126 00127 void M2MSecurity::clear_resources() 00128 { 00129 00130 } 00131 00132 M2MResource* M2MSecurity::get_resource(SecurityResource res) const 00133 { 00134 return m2msecurity_stub::resource; 00135 }
Generated on Tue Jul 12 2022 21:20:28 by
1.7.2