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