Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CertificateEnrollmentClientCommon.h Source File

CertificateEnrollmentClientCommon.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2018 ARM Ltd.
00003 //  
00004 // Licensed under the Apache License, Version 2.0 (the "License");
00005 // you may not use this file except in compliance with the License.
00006 // You may obtain a copy of the License at
00007 //  
00008 //     http://www.apache.org/licenses/LICENSE-2.0
00009 //  
00010 // Unless required by applicable law or agreed to in writing, software
00011 // distributed under the License is distributed on an "AS IS" BASIS,
00012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 // See the License for the specific language governing permissions and
00014 // limitations under the License.
00015 // ----------------------------------------------------------------------------
00016 
00017 #ifndef __CERTIFICATE_ENROLLMENT_COMMON_H__
00018 #define __CERTIFICATE_ENROLLMENT_COMMON_H__
00019 
00020 #include "mbed-client/m2mresource.h"
00021 #include "ce_defs.h"
00022 #include "CertificateEnrollmentClient.h"
00023 #include "EstClient.h"
00024 
00025 #ifdef CERT_ENROLLMENT_EST_MOCK
00026 #include "ce_est_mock.h"
00027 #define CERT_ENROLLMENT_EST_CLIENT EstClientMock
00028 #else 
00029 #define CERT_ENROLLMENT_EST_CLIENT EstClient
00030 #endif
00031 
00032 /*
00033 * This file declares common functions, and extern's common global variables needed by multiple C++ CertificateEnrollmentClient files.
00034 * The definitions are in CertificateEnrollmentClientCommon.cpp
00035 */
00036 
00037 namespace CertificateEnrollmentClient {
00038 
00039     /**
00040     * \brief Call the user registered certificate renewal callback if it is not NULL
00041     * All calls to the user must be with this function so that if the callback is NULL - do nothing.
00042     * The event will have an application level priority
00043     * \param cert_name A null terminated string - the renewed certificate name. Persistence guaranteed only in context of the callback.
00044     * \param ce_status_e The return status of the renewal operation
00045     * \param initiator whether the renewal was initiated by the device or by the server
00046     */
00047     void call_user_cert_renewal_cb(const char *cert_name, ce_status_e  status, ce_initiator_e initiator);
00048 
00049     /**
00050     * \brief Set the user callback
00051     * Simply set the cert_renewal_cb static pointer to whatever the user passed.
00052     *
00053     * \param user_cb Pointer to the user callback. May be NULL
00054     */
00055     void set_user_cert_renewal_cb(cert_renewal_cb_f user_cb);
00056 
00057     // The certificate renewal LwM2M resource. the pointer to this object is needed in order to set the resource value and set delayed responses.
00058     extern M2MResource* g_cert_enroll_lwm2m_resource;
00059     extern M2MObject *g_cert_enroll_lwm2m_obj;
00060 
00061 }
00062 
00063 #endif // __CERTIFICATE_ENROLLMENT_COMMON_H__