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.
mbed-client/test/mbedclient/utest/stub/m2mconnectionsecurity_stub.cpp@0:06ee5f8a484a, 2017-03-18 (annotated)
- Committer:
- djmeyers
- Date:
- Sat Mar 18 22:37:16 2017 +0000
- Revision:
- 0:06ee5f8a484a
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| djmeyers | 0:06ee5f8a484a | 1 | /* |
| djmeyers | 0:06ee5f8a484a | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
| djmeyers | 0:06ee5f8a484a | 3 | * SPDX-License-Identifier: Apache-2.0 |
| djmeyers | 0:06ee5f8a484a | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| djmeyers | 0:06ee5f8a484a | 5 | * not use this file except in compliance with the License. |
| djmeyers | 0:06ee5f8a484a | 6 | * You may obtain a copy of the License at |
| djmeyers | 0:06ee5f8a484a | 7 | * |
| djmeyers | 0:06ee5f8a484a | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| djmeyers | 0:06ee5f8a484a | 9 | * |
| djmeyers | 0:06ee5f8a484a | 10 | * Unless required by applicable law or agreed to in writing, software |
| djmeyers | 0:06ee5f8a484a | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| djmeyers | 0:06ee5f8a484a | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| djmeyers | 0:06ee5f8a484a | 13 | * See the License for the specific language governing permissions and |
| djmeyers | 0:06ee5f8a484a | 14 | * limitations under the License. |
| djmeyers | 0:06ee5f8a484a | 15 | */ |
| djmeyers | 0:06ee5f8a484a | 16 | |
| djmeyers | 0:06ee5f8a484a | 17 | #include "m2mconnectionhandler.h" |
| djmeyers | 0:06ee5f8a484a | 18 | #include "m2mconnectionsecurity.h" |
| djmeyers | 0:06ee5f8a484a | 19 | #include "m2mtimer.h" |
| djmeyers | 0:06ee5f8a484a | 20 | #include "m2msecurity.h" |
| djmeyers | 0:06ee5f8a484a | 21 | #include <string.h> |
| djmeyers | 0:06ee5f8a484a | 22 | #include "m2mconnectionsecurity_stub.h" |
| djmeyers | 0:06ee5f8a484a | 23 | |
| djmeyers | 0:06ee5f8a484a | 24 | bool m2mconnectionsecurityimpl_stub::use_inc_int; |
| djmeyers | 0:06ee5f8a484a | 25 | int m2mconnectionsecurityimpl_stub::inc_int_value; |
| djmeyers | 0:06ee5f8a484a | 26 | int m2mconnectionsecurityimpl_stub::int_value; |
| djmeyers | 0:06ee5f8a484a | 27 | |
| djmeyers | 0:06ee5f8a484a | 28 | void m2mconnectionsecurityimpl_stub::clear() |
| djmeyers | 0:06ee5f8a484a | 29 | { |
| djmeyers | 0:06ee5f8a484a | 30 | int_value = -1; |
| djmeyers | 0:06ee5f8a484a | 31 | use_inc_int = false; |
| djmeyers | 0:06ee5f8a484a | 32 | inc_int_value = 0; |
| djmeyers | 0:06ee5f8a484a | 33 | } |
| djmeyers | 0:06ee5f8a484a | 34 | |
| djmeyers | 0:06ee5f8a484a | 35 | M2MConnectionSecurity::M2MConnectionSecurity(M2MConnectionSecurity::SecurityMode mode) |
| djmeyers | 0:06ee5f8a484a | 36 | { |
| djmeyers | 0:06ee5f8a484a | 37 | |
| djmeyers | 0:06ee5f8a484a | 38 | } |
| djmeyers | 0:06ee5f8a484a | 39 | |
| djmeyers | 0:06ee5f8a484a | 40 | M2MConnectionSecurity::~M2MConnectionSecurity(){ |
| djmeyers | 0:06ee5f8a484a | 41 | } |
| djmeyers | 0:06ee5f8a484a | 42 | |
| djmeyers | 0:06ee5f8a484a | 43 | void M2MConnectionSecurity::reset(){ |
| djmeyers | 0:06ee5f8a484a | 44 | } |
| djmeyers | 0:06ee5f8a484a | 45 | |
| djmeyers | 0:06ee5f8a484a | 46 | int M2MConnectionSecurity::init(const M2MSecurity *security){ |
| djmeyers | 0:06ee5f8a484a | 47 | if(m2mconnectionsecurityimpl_stub::use_inc_int){ |
| djmeyers | 0:06ee5f8a484a | 48 | return m2mconnectionsecurityimpl_stub::inc_int_value++; |
| djmeyers | 0:06ee5f8a484a | 49 | } |
| djmeyers | 0:06ee5f8a484a | 50 | return m2mconnectionsecurityimpl_stub::int_value; |
| djmeyers | 0:06ee5f8a484a | 51 | } |
| djmeyers | 0:06ee5f8a484a | 52 | |
| djmeyers | 0:06ee5f8a484a | 53 | int M2MConnectionSecurity::connect(M2MConnectionHandler* connHandler){ |
| djmeyers | 0:06ee5f8a484a | 54 | if(m2mconnectionsecurityimpl_stub::use_inc_int){ |
| djmeyers | 0:06ee5f8a484a | 55 | return m2mconnectionsecurityimpl_stub::inc_int_value++; |
| djmeyers | 0:06ee5f8a484a | 56 | } |
| djmeyers | 0:06ee5f8a484a | 57 | return m2mconnectionsecurityimpl_stub::int_value; |
| djmeyers | 0:06ee5f8a484a | 58 | } |
| djmeyers | 0:06ee5f8a484a | 59 | |
| djmeyers | 0:06ee5f8a484a | 60 | int M2MConnectionSecurity::start_connecting_non_blocking(M2MConnectionHandler* connHandler) |
| djmeyers | 0:06ee5f8a484a | 61 | { |
| djmeyers | 0:06ee5f8a484a | 62 | if(m2mconnectionsecurityimpl_stub::use_inc_int){ |
| djmeyers | 0:06ee5f8a484a | 63 | return m2mconnectionsecurityimpl_stub::inc_int_value++; |
| djmeyers | 0:06ee5f8a484a | 64 | } |
| djmeyers | 0:06ee5f8a484a | 65 | return m2mconnectionsecurityimpl_stub::int_value; |
| djmeyers | 0:06ee5f8a484a | 66 | } |
| djmeyers | 0:06ee5f8a484a | 67 | |
| djmeyers | 0:06ee5f8a484a | 68 | int M2MConnectionSecurity::continue_connecting() |
| djmeyers | 0:06ee5f8a484a | 69 | { |
| djmeyers | 0:06ee5f8a484a | 70 | if(m2mconnectionsecurityimpl_stub::use_inc_int){ |
| djmeyers | 0:06ee5f8a484a | 71 | return m2mconnectionsecurityimpl_stub::inc_int_value++; |
| djmeyers | 0:06ee5f8a484a | 72 | } |
| djmeyers | 0:06ee5f8a484a | 73 | return m2mconnectionsecurityimpl_stub::int_value; |
| djmeyers | 0:06ee5f8a484a | 74 | } |
| djmeyers | 0:06ee5f8a484a | 75 | |
| djmeyers | 0:06ee5f8a484a | 76 | int M2MConnectionSecurity::send_message(unsigned char *message, int len){ |
| djmeyers | 0:06ee5f8a484a | 77 | if(m2mconnectionsecurityimpl_stub::use_inc_int){ |
| djmeyers | 0:06ee5f8a484a | 78 | return m2mconnectionsecurityimpl_stub::inc_int_value++; |
| djmeyers | 0:06ee5f8a484a | 79 | } |
| djmeyers | 0:06ee5f8a484a | 80 | return m2mconnectionsecurityimpl_stub::int_value; |
| djmeyers | 0:06ee5f8a484a | 81 | } |
| djmeyers | 0:06ee5f8a484a | 82 | |
| djmeyers | 0:06ee5f8a484a | 83 | int M2MConnectionSecurity::read(unsigned char* buffer, uint16_t len){ |
| djmeyers | 0:06ee5f8a484a | 84 | if(m2mconnectionsecurityimpl_stub::use_inc_int){ |
| djmeyers | 0:06ee5f8a484a | 85 | return m2mconnectionsecurityimpl_stub::inc_int_value++; |
| djmeyers | 0:06ee5f8a484a | 86 | } |
| djmeyers | 0:06ee5f8a484a | 87 | return m2mconnectionsecurityimpl_stub::int_value; |
| djmeyers | 0:06ee5f8a484a | 88 | } |
| djmeyers | 0:06ee5f8a484a | 89 | |
| djmeyers | 0:06ee5f8a484a | 90 | void M2MConnectionSecurity::set_random_number_callback(random_number_cb) |
| djmeyers | 0:06ee5f8a484a | 91 | { |
| djmeyers | 0:06ee5f8a484a | 92 | |
| djmeyers | 0:06ee5f8a484a | 93 | } |
| djmeyers | 0:06ee5f8a484a | 94 | |
| djmeyers | 0:06ee5f8a484a | 95 | void M2MConnectionSecurity::set_entropy_callback(mbedtls_entropy) |
| djmeyers | 0:06ee5f8a484a | 96 | { |
| djmeyers | 0:06ee5f8a484a | 97 | |
| djmeyers | 0:06ee5f8a484a | 98 | } |