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.
simple-mbed-cloud-client/mbed-cloud-client/certificate-enrollment-client/source/CertificateEnrollmentClientCommon.cpp@0:8f0bb79ddd48, 2021-05-04 (annotated)
- Committer:
- leothedragon
- Date:
- Tue May 04 08:55:12 2021 +0000
- Revision:
- 0:8f0bb79ddd48
nmn
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
leothedragon | 0:8f0bb79ddd48 | 1 | // ---------------------------------------------------------------------------- |
leothedragon | 0:8f0bb79ddd48 | 2 | // Copyright 2018 ARM Ltd. |
leothedragon | 0:8f0bb79ddd48 | 3 | // |
leothedragon | 0:8f0bb79ddd48 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
leothedragon | 0:8f0bb79ddd48 | 5 | // you may not use this file except in compliance with the License. |
leothedragon | 0:8f0bb79ddd48 | 6 | // You may obtain a copy of the License at |
leothedragon | 0:8f0bb79ddd48 | 7 | // |
leothedragon | 0:8f0bb79ddd48 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
leothedragon | 0:8f0bb79ddd48 | 9 | // |
leothedragon | 0:8f0bb79ddd48 | 10 | // Unless required by applicable law or agreed to in writing, software |
leothedragon | 0:8f0bb79ddd48 | 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
leothedragon | 0:8f0bb79ddd48 | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
leothedragon | 0:8f0bb79ddd48 | 13 | // See the License for the specific language governing permissions and |
leothedragon | 0:8f0bb79ddd48 | 14 | // limitations under the License. |
leothedragon | 0:8f0bb79ddd48 | 15 | // ---------------------------------------------------------------------------- |
leothedragon | 0:8f0bb79ddd48 | 16 | |
leothedragon | 0:8f0bb79ddd48 | 17 | #include "CertificateEnrollmentClientCommon.h" |
leothedragon | 0:8f0bb79ddd48 | 18 | |
leothedragon | 0:8f0bb79ddd48 | 19 | namespace CertificateEnrollmentClient { |
leothedragon | 0:8f0bb79ddd48 | 20 | |
leothedragon | 0:8f0bb79ddd48 | 21 | // User callback to be invoked when server POSTs g_cert_enroll_lwm2m_resource |
leothedragon | 0:8f0bb79ddd48 | 22 | // Important: Do not call directly, always call call_user_cert_renewal_cb() instead |
leothedragon | 0:8f0bb79ddd48 | 23 | static cert_renewal_cb_f cert_renewal_cb = NULL; |
leothedragon | 0:8f0bb79ddd48 | 24 | |
leothedragon | 0:8f0bb79ddd48 | 25 | // Certificate Renewal LWM2M Resource - save the pointer for easy access to the resource |
leothedragon | 0:8f0bb79ddd48 | 26 | M2MResource* g_cert_enroll_lwm2m_resource = NULL; |
leothedragon | 0:8f0bb79ddd48 | 27 | |
leothedragon | 0:8f0bb79ddd48 | 28 | // Pointer to object containing an instance containing the g_cert_enroll_lwm2m_resource resource. |
leothedragon | 0:8f0bb79ddd48 | 29 | // CertificateEnrollmentClient is owner of the pointer and must release it when module is destroyed |
leothedragon | 0:8f0bb79ddd48 | 30 | M2MObject *g_cert_enroll_lwm2m_obj = NULL; |
leothedragon | 0:8f0bb79ddd48 | 31 | |
leothedragon | 0:8f0bb79ddd48 | 32 | const CERT_ENROLLMENT_EST_CLIENT *g_est_client; |
leothedragon | 0:8f0bb79ddd48 | 33 | |
leothedragon | 0:8f0bb79ddd48 | 34 | void call_user_cert_renewal_cb(const char *cert_name, ce_status_e status, ce_initiator_e initiator) |
leothedragon | 0:8f0bb79ddd48 | 35 | { |
leothedragon | 0:8f0bb79ddd48 | 36 | if (cert_renewal_cb) { |
leothedragon | 0:8f0bb79ddd48 | 37 | cert_renewal_cb(cert_name, status, initiator); |
leothedragon | 0:8f0bb79ddd48 | 38 | } |
leothedragon | 0:8f0bb79ddd48 | 39 | } |
leothedragon | 0:8f0bb79ddd48 | 40 | |
leothedragon | 0:8f0bb79ddd48 | 41 | void set_user_cert_renewal_cb(cert_renewal_cb_f user_cb) |
leothedragon | 0:8f0bb79ddd48 | 42 | { |
leothedragon | 0:8f0bb79ddd48 | 43 | cert_renewal_cb = user_cb; |
leothedragon | 0:8f0bb79ddd48 | 44 | } |
leothedragon | 0:8f0bb79ddd48 | 45 | } |
leothedragon | 0:8f0bb79ddd48 | 46 |