You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/05/31 09:07:19 UTC
[GitHub] mkiiskila closed pull request #1146: oicmgr;
add config knob to enable transport level security.
mkiiskila closed pull request #1146: oicmgr; add config knob to enable transport level security.
URL: https://github.com/apache/mynewt-core/pull/1146
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/mgmt/oicmgr/src/oicmgr.c b/mgmt/oicmgr/src/oicmgr.c
index b268d7714e..664df22756 100644
--- a/mgmt/oicmgr/src/oicmgr.c
+++ b/mgmt/oicmgr/src/oicmgr.c
@@ -37,16 +37,11 @@ struct omgr_cbuf {
struct omgr_state {
struct os_eventq *os_evq;
- struct os_event os_event;
struct os_task os_task;
struct omgr_cbuf os_cbuf; /* CBOR buffer for NMGR task */
};
-static void omgr_event_start(struct os_event *ev);
-
-static struct omgr_state omgr_state = {
- .os_event.ev_cb = omgr_event_start,
-};
+static struct omgr_state omgr_state;
struct os_eventq *
mgmt_evq_get(void)
@@ -255,31 +250,12 @@ omgr_oic_put(oc_request_t *req, oc_interface_mask_t mask)
oc_send_response(req, rc);
}
-static void
-omgr_event_start(struct os_event *ev)
-{
- uint8_t mode;
- oc_resource_t *res = NULL;
- char name[12];
-
- /*
- * net/oic must be initialized before now.
- */
- snprintf(name, sizeof(name), "/omgr");
- res = oc_new_resource(name, 1, 0);
- oc_resource_bind_resource_type(res, "x.mynewt.nmgr");
- mode = OC_IF_RW;
- oc_resource_bind_resource_interface(res, mode);
- oc_resource_set_default_interface(res, mode);
- oc_resource_set_discoverable(res);
- oc_resource_set_request_handler(res, OC_PUT, omgr_oic_put);
- oc_add_resource(res);
-}
-
int
oicmgr_init(void)
{
int rc;
+ uint8_t mode;
+ oc_resource_t *res = NULL;
/* Ensure this function only gets called by sysinit. */
SYSINIT_ASSERT_ACTIVE();
@@ -291,11 +267,18 @@ oicmgr_init(void)
mgmt_evq_set(os_eventq_dflt_get());
- /* Enqueue the start event to the default event queue. Using the default
- * queue ensures the event won't run until the end of main(). This allows
- * the application to configure this package in the meantime.
+ /*
+ * net/oic must be initialized before now.
*/
- os_eventq_put(os_eventq_dflt_get(), &omgr_state.os_event);
+ res = oc_new_resource("/omgr", 1, 0);
+ oc_resource_bind_resource_type(res, "x.mynewt.nmgr");
+ mode = OC_IF_RW;
+ oc_resource_bind_resource_interface(res, mode);
+ oc_resource_set_default_interface(res, mode);
+ oc_resource_set_discoverable(res);
+ oc_resource_set_request_handler(res, OC_PUT, omgr_oic_put);
+ res->properties |= MYNEWT_VAL(OICMGR_TRANS_SECURITY);
+ oc_add_resource(res);
return (0);
err:
diff --git a/mgmt/oicmgr/syscfg.yml b/mgmt/oicmgr/syscfg.yml
index 01c2e77f2e..23e0f1229b 100644
--- a/mgmt/oicmgr/syscfg.yml
+++ b/mgmt/oicmgr/syscfg.yml
@@ -17,3 +17,11 @@
# under the License.
#
syscfg.defs:
+ OICMGR_TRANS_SECURITY:
+ description: >
+ Configure transport security for oicmgr resource.
+ Can be OC_TRANS_ENC | OC_TRANS_AUTH, OC_TRANS_ENC or OC_TRANS_AUTH.
+ 0 means no security checing.
+ value: 0
+ restrictions:
+ - OC_TRANS_SECURITY
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services