Simple interface for Mbed Cloud Client

Dependents:  

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CloudClientStorage.h Source File

CloudClientStorage.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2017 ARM Ltd.
00003 //
00004 // SPDX-License-Identifier: Apache-2.0
00005 //
00006 // Licensed under the Apache License, Version 2.0 (the "License");
00007 // you may not use this file except in compliance with the License.
00008 // You may obtain a copy of the License at
00009 //
00010 //     http://www.apache.org/licenses/LICENSE-2.0
00011 //
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 // ----------------------------------------------------------------------------
00018 
00019 #ifndef CLOUD_CLIENT_STORAGE_H
00020 #define CLOUD_CLIENT_STORAGE_H
00021 
00022 #define KEY_ACCOUNT_ID                          "mbed.AccountID"
00023 #define KEY_INTERNAL_ENDPOINT                   "mbed.InternalEndpoint"
00024 #define KEY_DEVICE_SOFTWAREVERSION              "mbed.SoftwareVersion"
00025 #define KEY_FIRST_TO_CLAIM                      "mbed.FirstToClaim"
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 typedef enum {
00032     CCS_STATUS_MEMORY_ERROR = -4,
00033     CCS_STATUS_VALIDATION_FAIL = -3,
00034     CCS_STATUS_KEY_DOESNT_EXIST = -2,
00035     CCS_STATUS_ERROR = -1,
00036     CCS_STATUS_SUCCESS = 0
00037 } ccs_status_e;
00038 
00039 /**
00040 *  \brief Uninitializes the CFStore handle.
00041 */
00042 ccs_status_e uninitialize_storage(void);
00043 
00044 /**
00045 *  \brief Initializes the CFStore handle.
00046 */
00047 ccs_status_e initialize_storage(void);
00048 
00049 /* Bootstrap credential handling methods */
00050 ccs_status_e get_config_parameter(const char* key, uint8_t *buffer, const size_t buffer_size, size_t *value_length);
00051 ccs_status_e get_config_parameter_string(const char* key, uint8_t *buffer, const size_t buffer_size);
00052 ccs_status_e set_config_parameter(const char* key, const uint8_t *buffer, const size_t buffer_size);
00053 ccs_status_e delete_config_parameter(const char* key);
00054 ccs_status_e size_config_parameter(const char* key, size_t* size_out);
00055 
00056 ccs_status_e get_config_private_key(const char* key, uint8_t *buffer, const size_t buffer_size, size_t *value_length);
00057 ccs_status_e set_config_private_key(const char* key, const uint8_t *buffer, const size_t buffer_size);
00058 ccs_status_e delete_config_private_key(const char* key);
00059 
00060 ccs_status_e get_config_public_key(const char* key, uint8_t *buffer, const size_t buffer_size, size_t *value_length);
00061 ccs_status_e set_config_public_key(const char* key, const uint8_t *buffer, const size_t buffer_size);
00062 ccs_status_e delete_config_public_key(const char* key);
00063 
00064 ccs_status_e get_config_certificate(const char* key, uint8_t *buffer, const size_t buffer_size, size_t *value_length);
00065 ccs_status_e set_config_certificate(const char* key, const uint8_t *buffer, const size_t buffer_size);
00066 ccs_status_e delete_config_certificate(const char* key);
00067 
00068 
00069 
00070 #ifdef __cplusplus
00071 }
00072 #endif
00073 #endif // CLOUD_CLIENT_STORAGE_H