Dependencies:   MMA7660 LM75B

Committer:
MACRUM
Date:
Sat Jun 30 01:40:30 2018 +0000
Revision:
0:119624335925
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:119624335925 1 /*
MACRUM 0:119624335925 2 * Copyright (c) 2015 ARM Limited. All rights reserved.
MACRUM 0:119624335925 3 * SPDX-License-Identifier: Apache-2.0
MACRUM 0:119624335925 4 * Licensed under the Apache License, Version 2.0 (the License); you may
MACRUM 0:119624335925 5 * not use this file except in compliance with the License.
MACRUM 0:119624335925 6 * You may obtain a copy of the License at
MACRUM 0:119624335925 7 *
MACRUM 0:119624335925 8 * http://www.apache.org/licenses/LICENSE-2.0
MACRUM 0:119624335925 9 *
MACRUM 0:119624335925 10 * Unless required by applicable law or agreed to in writing, software
MACRUM 0:119624335925 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
MACRUM 0:119624335925 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 0:119624335925 13 * See the License for the specific language governing permissions and
MACRUM 0:119624335925 14 * limitations under the License.
MACRUM 0:119624335925 15 */
MACRUM 0:119624335925 16
MACRUM 0:119624335925 17 #include <string.h>
MACRUM 0:119624335925 18 #include "mbed-client/m2mconnectionhandler.h"
MACRUM 0:119624335925 19 #include "mbed-client/m2mconnectionsecurity.h"
MACRUM 0:119624335925 20 #include "mbed-client-mbedtls/m2mconnectionsecuritypimpl.h"
MACRUM 0:119624335925 21
MACRUM 0:119624335925 22 M2MConnectionSecurity::M2MConnectionSecurity(SecurityMode mode)
MACRUM 0:119624335925 23 {
MACRUM 0:119624335925 24 _private_impl = new M2MConnectionSecurityPimpl(mode);
MACRUM 0:119624335925 25 }
MACRUM 0:119624335925 26
MACRUM 0:119624335925 27 M2MConnectionSecurity::~M2MConnectionSecurity(){
MACRUM 0:119624335925 28 delete _private_impl;
MACRUM 0:119624335925 29 }
MACRUM 0:119624335925 30
MACRUM 0:119624335925 31 void M2MConnectionSecurity::reset(){
MACRUM 0:119624335925 32 _private_impl->reset();
MACRUM 0:119624335925 33 }
MACRUM 0:119624335925 34
MACRUM 0:119624335925 35 int M2MConnectionSecurity::init(const M2MSecurity *security, uint16_t security_instance_id){
MACRUM 0:119624335925 36 return _private_impl->init(security, security_instance_id);
MACRUM 0:119624335925 37 }
MACRUM 0:119624335925 38
MACRUM 0:119624335925 39 int M2MConnectionSecurity::connect(M2MConnectionHandler* connHandler){
MACRUM 0:119624335925 40 return _private_impl->connect(connHandler);
MACRUM 0:119624335925 41 }
MACRUM 0:119624335925 42
MACRUM 0:119624335925 43 int M2MConnectionSecurity::send_message(unsigned char *message, int len){
MACRUM 0:119624335925 44 return _private_impl->send_message(message, len);
MACRUM 0:119624335925 45 }
MACRUM 0:119624335925 46
MACRUM 0:119624335925 47 int M2MConnectionSecurity::read(unsigned char* buffer, uint16_t len){
MACRUM 0:119624335925 48 return _private_impl->read(buffer, len);
MACRUM 0:119624335925 49 }
MACRUM 0:119624335925 50
MACRUM 0:119624335925 51 void M2MConnectionSecurity::set_random_number_callback(random_number_cb callback)
MACRUM 0:119624335925 52 {
MACRUM 0:119624335925 53 _private_impl->set_random_number_callback(callback);
MACRUM 0:119624335925 54 }
MACRUM 0:119624335925 55
MACRUM 0:119624335925 56 void M2MConnectionSecurity::set_entropy_callback(entropy_cb callback)
MACRUM 0:119624335925 57 {
MACRUM 0:119624335925 58 _private_impl->set_entropy_callback(callback);
MACRUM 0:119624335925 59 }
MACRUM 0:119624335925 60
MACRUM 0:119624335925 61 void M2MConnectionSecurity::set_socket(void *socket, void *address)
MACRUM 0:119624335925 62 {
MACRUM 0:119624335925 63 _private_impl->set_socket((palSocket_t) socket, (palSocketAddress_t*) address);
MACRUM 0:119624335925 64 }