net: lwm2m: add custom TLS credential load function pointer

Current implementation of LwM2M engine doesn't allow users a way
of overriding TLS credential load with custom function.  This
would be needed by an offloaded TLS stack where we don't want
to use standard Zephyr functions.

Let's add a load_credential function pointer to the LwM2M client
context which will be called when it's available.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/17408

Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
Michael Scott 2019-07-08 11:04:15 -07:00 committed by Jukka Rissanen
commit e7155622a2
2 changed files with 19 additions and 7 deletions

View file

@ -71,6 +71,11 @@ struct lwm2m_ctx {
* LwM2M engine calls tls_credential_(add|delete)
*/
int tls_tag;
/** Client can set load_credentials function as a way of overriding
* the default behavior of load_tls_credential() in lwm2m_engine.c
*/
int (*load_credentials)(struct lwm2m_ctx *client_ctx);
#endif
/** Flag to indicate if context should use DTLS.
* Enabled via the use of coaps:// protocol prefix in connection