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