You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/10/04 19:04:05 UTC
[13/13] incubator-mynewt-core git commit: move libs/iotivity ->
net/oic.
move libs/iotivity -> net/oic.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f88168c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f88168c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f88168c2
Branch: refs/heads/develop
Commit: f88168c211aa5276010a1bce66e086ad56a24bd5
Parents: 5565270
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Oct 4 12:02:57 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Oct 4 12:03:35 2016 -0700
----------------------------------------------------------------------
apps/ocf_sample/pkg.yml | 2 +-
apps/ocf_sample/src/main.c | 5 +-
libs/iotivity/include/iotivity/oc_api.h | 174 ---
libs/iotivity/include/iotivity/oc_buffer.h | 40 -
.../iotivity/include/iotivity/oc_client_state.h | 96 --
libs/iotivity/include/iotivity/oc_constants.h | 51 -
libs/iotivity/include/iotivity/oc_core_res.h | 60 -
libs/iotivity/include/iotivity/oc_discovery.h | 30 -
libs/iotivity/include/iotivity/oc_gatt.h | 38 -
libs/iotivity/include/iotivity/oc_helpers.h | 86 --
.../include/iotivity/oc_network_events.h | 37 -
libs/iotivity/include/iotivity/oc_rep.h | 236 ----
libs/iotivity/include/iotivity/oc_ri.h | 184 ---
libs/iotivity/include/iotivity/oc_uuid.h | 39 -
libs/iotivity/pkg.yml | 50 -
libs/iotivity/src/api/oc_buffer.c | 138 --
libs/iotivity/src/api/oc_client_api.c | 287 -----
libs/iotivity/src/api/oc_core_res.c | 280 -----
libs/iotivity/src/api/oc_discovery.c | 298 -----
libs/iotivity/src/api/oc_events.h | 42 -
libs/iotivity/src/api/oc_helpers.c | 164 ---
libs/iotivity/src/api/oc_main.c | 119 --
libs/iotivity/src/api/oc_network_events.c | 57 -
libs/iotivity/src/api/oc_rep.c | 301 -----
libs/iotivity/src/api/oc_ri.c | 1016 ---------------
libs/iotivity/src/api/oc_server_api.c | 291 -----
libs/iotivity/src/api/oc_uuid.c | 119 --
libs/iotivity/src/messaging/coap/coap.c | 1186 ------------------
libs/iotivity/src/messaging/coap/coap.h | 305 -----
libs/iotivity/src/messaging/coap/conf.h | 79 --
libs/iotivity/src/messaging/coap/constants.h | 166 ---
libs/iotivity/src/messaging/coap/engine.c | 333 -----
libs/iotivity/src/messaging/coap/engine.h | 56 -
libs/iotivity/src/messaging/coap/observe.c | 319 -----
libs/iotivity/src/messaging/coap/observe.h | 88 --
libs/iotivity/src/messaging/coap/oc_coap.h | 47 -
libs/iotivity/src/messaging/coap/separate.c | 152 ---
libs/iotivity/src/messaging/coap/separate.h | 79 --
libs/iotivity/src/messaging/coap/transactions.c | 202 ---
libs/iotivity/src/messaging/coap/transactions.h | 83 --
libs/iotivity/src/port/mynewt/abort.c | 25 -
libs/iotivity/src/port/mynewt/adaptor.c | 231 ----
libs/iotivity/src/port/mynewt/adaptor.h | 64 -
libs/iotivity/src/port/mynewt/ble_adaptor.c | 509 --------
libs/iotivity/src/port/mynewt/clock.c | 41 -
libs/iotivity/src/port/mynewt/config.h | 81 --
libs/iotivity/src/port/mynewt/ip_adaptor.c | 315 -----
libs/iotivity/src/port/mynewt/log.c | 43 -
libs/iotivity/src/port/mynewt/oc_loop.c | 26 -
libs/iotivity/src/port/mynewt/random.c | 31 -
libs/iotivity/src/port/mynewt/serial_adaptor.c | 164 ---
libs/iotivity/src/port/mynewt/storage.c | 38 -
libs/iotivity/src/port/oc_assert.h | 50 -
libs/iotivity/src/port/oc_clock.h | 110 --
libs/iotivity/src/port/oc_connectivity.h | 93 --
libs/iotivity/src/port/oc_log.h | 82 --
.../iotivity/src/port/oc_network_events_mutex.h | 34 -
libs/iotivity/src/port/oc_random.h | 64 -
libs/iotivity/src/port/oc_signal_main_loop.h | 30 -
libs/iotivity/src/port/oc_storage.h | 35 -
libs/iotivity/src/security/oc_acl.c | 412 ------
libs/iotivity/src/security/oc_acl.h | 71 --
libs/iotivity/src/security/oc_cred.c | 200 ---
libs/iotivity/src/security/oc_cred.h | 48 -
libs/iotivity/src/security/oc_doxm.c | 128 --
libs/iotivity/src/security/oc_doxm.h | 53 -
libs/iotivity/src/security/oc_dtls.c | 372 ------
libs/iotivity/src/security/oc_dtls.h | 58 -
libs/iotivity/src/security/oc_pstat.c | 119 --
libs/iotivity/src/security/oc_pstat.h | 47 -
libs/iotivity/src/security/oc_store.c | 158 ---
libs/iotivity/src/security/oc_store.h | 34 -
libs/iotivity/src/security/oc_svr.c | 51 -
libs/iotivity/src/security/oc_svr.h | 30 -
libs/iotivity/src/util/oc_etimer.c | 263 ----
libs/iotivity/src/util/oc_etimer.h | 255 ----
libs/iotivity/src/util/oc_list.c | 317 -----
libs/iotivity/src/util/oc_list.h | 152 ---
libs/iotivity/src/util/oc_memb.c | 111 --
libs/iotivity/src/util/oc_memb.h | 135 --
libs/iotivity/src/util/oc_mmem.c | 154 ---
libs/iotivity/src/util/oc_mmem.h | 61 -
libs/iotivity/src/util/oc_process.c | 346 -----
libs/iotivity/src/util/oc_process.h | 535 --------
libs/iotivity/src/util/oc_timer.c | 131 --
libs/iotivity/src/util/oc_timer.h | 96 --
libs/iotivity/src/util/pt/lc-addrlabels.h | 94 --
libs/iotivity/src/util/pt/lc-switch.h | 87 --
libs/iotivity/src/util/pt/lc.h | 138 --
libs/iotivity/src/util/pt/pt-sem.h | 241 ----
libs/iotivity/src/util/pt/pt.h | 341 -----
libs/iotivity/syscfg.yml | 27 -
libs/newtmgr_oic/pkg.yml | 2 +-
libs/newtmgr_oic/src/newtmgr.c | 2 +-
net/oic/include/oic/oc_api.h | 174 +++
net/oic/include/oic/oc_buffer.h | 40 +
net/oic/include/oic/oc_client_state.h | 96 ++
net/oic/include/oic/oc_constants.h | 51 +
net/oic/include/oic/oc_core_res.h | 60 +
net/oic/include/oic/oc_discovery.h | 30 +
net/oic/include/oic/oc_gatt.h | 38 +
net/oic/include/oic/oc_helpers.h | 86 ++
net/oic/include/oic/oc_network_events.h | 37 +
net/oic/include/oic/oc_rep.h | 236 ++++
net/oic/include/oic/oc_ri.h | 184 +++
net/oic/include/oic/oc_uuid.h | 39 +
net/oic/pkg.yml | 51 +
net/oic/src/api/oc_buffer.c | 138 ++
net/oic/src/api/oc_client_api.c | 287 +++++
net/oic/src/api/oc_core_res.c | 280 +++++
net/oic/src/api/oc_discovery.c | 298 +++++
net/oic/src/api/oc_events.h | 42 +
net/oic/src/api/oc_helpers.c | 164 +++
net/oic/src/api/oc_main.c | 119 ++
net/oic/src/api/oc_network_events.c | 57 +
net/oic/src/api/oc_rep.c | 301 +++++
net/oic/src/api/oc_ri.c | 1016 +++++++++++++++
net/oic/src/api/oc_server_api.c | 291 +++++
net/oic/src/api/oc_uuid.c | 119 ++
net/oic/src/messaging/coap/coap.c | 1186 ++++++++++++++++++
net/oic/src/messaging/coap/coap.h | 305 +++++
net/oic/src/messaging/coap/conf.h | 79 ++
net/oic/src/messaging/coap/constants.h | 166 +++
net/oic/src/messaging/coap/engine.c | 333 +++++
net/oic/src/messaging/coap/engine.h | 56 +
net/oic/src/messaging/coap/observe.c | 319 +++++
net/oic/src/messaging/coap/observe.h | 88 ++
net/oic/src/messaging/coap/oc_coap.h | 47 +
net/oic/src/messaging/coap/separate.c | 152 +++
net/oic/src/messaging/coap/separate.h | 79 ++
net/oic/src/messaging/coap/transactions.c | 202 +++
net/oic/src/messaging/coap/transactions.h | 83 ++
net/oic/src/port/mynewt/abort.c | 25 +
net/oic/src/port/mynewt/adaptor.c | 231 ++++
net/oic/src/port/mynewt/adaptor.h | 64 +
net/oic/src/port/mynewt/ble_adaptor.c | 509 ++++++++
net/oic/src/port/mynewt/clock.c | 41 +
net/oic/src/port/mynewt/config.h | 81 ++
net/oic/src/port/mynewt/ip_adaptor.c | 315 +++++
net/oic/src/port/mynewt/log.c | 43 +
net/oic/src/port/mynewt/oc_loop.c | 26 +
net/oic/src/port/mynewt/random.c | 31 +
net/oic/src/port/mynewt/serial_adaptor.c | 164 +++
net/oic/src/port/mynewt/storage.c | 38 +
net/oic/src/port/oc_assert.h | 50 +
net/oic/src/port/oc_clock.h | 110 ++
net/oic/src/port/oc_connectivity.h | 93 ++
net/oic/src/port/oc_log.h | 82 ++
net/oic/src/port/oc_network_events_mutex.h | 34 +
net/oic/src/port/oc_random.h | 64 +
net/oic/src/port/oc_signal_main_loop.h | 30 +
net/oic/src/port/oc_storage.h | 35 +
net/oic/src/security/oc_acl.c | 412 ++++++
net/oic/src/security/oc_acl.h | 71 ++
net/oic/src/security/oc_cred.c | 200 +++
net/oic/src/security/oc_cred.h | 48 +
net/oic/src/security/oc_doxm.c | 128 ++
net/oic/src/security/oc_doxm.h | 53 +
net/oic/src/security/oc_dtls.c | 372 ++++++
net/oic/src/security/oc_dtls.h | 58 +
net/oic/src/security/oc_pstat.c | 119 ++
net/oic/src/security/oc_pstat.h | 47 +
net/oic/src/security/oc_store.c | 158 +++
net/oic/src/security/oc_store.h | 34 +
net/oic/src/security/oc_svr.c | 51 +
net/oic/src/security/oc_svr.h | 30 +
net/oic/src/util/oc_etimer.c | 263 ++++
net/oic/src/util/oc_etimer.h | 255 ++++
net/oic/src/util/oc_list.c | 317 +++++
net/oic/src/util/oc_list.h | 152 +++
net/oic/src/util/oc_memb.c | 111 ++
net/oic/src/util/oc_memb.h | 135 ++
net/oic/src/util/oc_mmem.c | 154 +++
net/oic/src/util/oc_mmem.h | 61 +
net/oic/src/util/oc_process.c | 346 +++++
net/oic/src/util/oc_process.h | 535 ++++++++
net/oic/src/util/oc_timer.c | 131 ++
net/oic/src/util/oc_timer.h | 96 ++
net/oic/src/util/pt/lc-addrlabels.h | 94 ++
net/oic/src/util/pt/lc-switch.h | 87 ++
net/oic/src/util/pt/lc.h | 138 ++
net/oic/src/util/pt/pt-sem.h | 241 ++++
net/oic/src/util/pt/pt.h | 341 +++++
net/oic/syscfg.yml | 27 +
184 files changed, 14666 insertions(+), 14664 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/apps/ocf_sample/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/ocf_sample/pkg.yml b/apps/ocf_sample/pkg.yml
index cb69117..2ffe3de 100644
--- a/apps/ocf_sample/pkg.yml
+++ b/apps/ocf_sample/pkg.yml
@@ -28,7 +28,7 @@ pkg.deps:
- kernel/os
- libs/util
- sys/log
- - libs/iotivity
+ - net/oic
pkg.deps.OC_TRANSPORT_SERIAL:
- sys/shell
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/apps/ocf_sample/src/main.c
----------------------------------------------------------------------
diff --git a/apps/ocf_sample/src/main.c b/apps/ocf_sample/src/main.c
index b2c1a45..92506a9 100644
--- a/apps/ocf_sample/src/main.c
+++ b/apps/ocf_sample/src/main.c
@@ -18,10 +18,11 @@
*/
#include <assert.h>
#include <os/os.h>
+#include <sysinit/sysinit.h>
#include <bsp/bsp.h>
#include <log/log.h>
#include <hal/hal_cputime.h>
-#include <iotivity/oc_api.h>
+#include <oic/oc_api.h>
#if (MYNEWT_VAL(OC_TRANSPORT_SERIAL) == 1)
#include <console/console.h>
@@ -35,7 +36,7 @@
#endif
#if (MYNEWT_VAL(OC_TRANSPORT_GATT) == 1)
-#include <iotivity/oc_gatt.h>
+#include <oic/oc_gatt.h>
#include "nimble/ble.h"
#include "host/ble_hs.h"
#include "controller/ble_ll.h"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_api.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_api.h b/libs/iotivity/include/iotivity/oc_api.h
deleted file mode 100644
index 83e91f7..0000000
--- a/libs/iotivity/include/iotivity/oc_api.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_API_H
-#define OC_API_H
-
-#include "../src/port/mynewt/config.h"
-#include "../src/messaging/coap/oc_coap.h"
-#include "oc_ri.h"
-#include "../src/port/oc_signal_main_loop.h"
-#include "../src/port/oc_storage.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct
-{
- void (*init)(void);
-
-#ifdef OC_SECURITY
- void (*get_credentials)(void);
-#endif /* OC_SECURITY */
-
-#ifdef OC_SERVER
- void (*register_resources)(void);
-#endif /* OC_SERVER */
-
-#ifdef OC_CLIENT
- void (*requests_entry)(void);
-#endif /* OC_CLIENT */
-} oc_handler_t;
-
-typedef void (*oc_init_platform_cb_t)(void *data);
-typedef void (*oc_add_device_cb_t)(void *data);
-
-int oc_main_init(oc_handler_t *handler);
-
-oc_clock_time_t oc_main_poll(void);
-
-void oc_main_shutdown(void);
-
-void oc_add_device(const char *uri, const char *rt, const char *name,
- const char *spec_version, const char *data_model_version,
- oc_add_device_cb_t add_device_cb, void *data);
-
-#define oc_set_custom_device_property(prop, value) \
- oc_rep_set_text_string(root, prop, value)
-
-void oc_init_platform(const char *mfg_name,
- oc_init_platform_cb_t init_platform_cb, void *data);
-
-#define oc_set_custom_platform_property(prop, value) \
- oc_rep_set_text_string(root, prop, value)
-
-/** Server side */
-oc_resource_t *oc_new_resource(const char *uri, uint8_t num_resource_types,
- int device);
-void oc_resource_bind_resource_interface(oc_resource_t *resource,
- uint8_t interface);
-void oc_resource_set_default_interface(oc_resource_t *resource,
- oc_interface_mask_t interface);
-void oc_resource_bind_resource_type(oc_resource_t *resource, const char *type);
-
-void oc_process_baseline_interface(oc_resource_t *resource);
-
-#ifdef OC_SECURITY
-void oc_resource_make_secure(oc_resource_t *resource);
-#endif /* OC_SECURITY */
-
-void oc_resource_set_discoverable(oc_resource_t *resource);
-void oc_resource_set_observable(oc_resource_t *resource);
-void oc_resource_set_periodic_observable(oc_resource_t *resource,
- uint16_t seconds);
-void oc_resource_set_request_handler(oc_resource_t *resource,
- oc_method_t method,
- oc_request_handler_t handler);
-bool oc_add_resource(oc_resource_t *resource);
-void oc_delete_resource(oc_resource_t *resource);
-void oc_deactivate_resource(oc_resource_t *resource);
-
-void oc_init_query_iterator(oc_request_t *request);
-int oc_interate_query(oc_request_t *request, char **key, int *key_len,
- char **value, int *value_len);
-int oc_get_query_value(oc_request_t *request, const char *key, char **value);
-
-void oc_send_response(oc_request_t *request, oc_status_t response_code);
-void oc_ignore_request(oc_request_t *request);
-
-void oc_indicate_separate_response(oc_request_t *request,
- oc_separate_response_t *response);
-void oc_set_separate_response_buffer(oc_separate_response_t *handle);
-void oc_send_separate_response(oc_separate_response_t *handle,
- oc_status_t response_code);
-
-int oc_notify_observers(oc_resource_t *resource);
-
-/** Client side */
-#include "oc_client_state.h"
-
-bool oc_do_ip_discovery(const char *rt, oc_discovery_cb_t handler);
-
-bool oc_do_get(const char *uri, oc_server_handle_t *server, const char *query,
- oc_response_handler_t handler, oc_qos_t qos);
-
-bool oc_do_delete(const char *uri, oc_server_handle_t *server,
- oc_response_handler_t handler, oc_qos_t qos);
-
-bool oc_init_put(const char *uri, oc_server_handle_t *server, const char *query,
- oc_response_handler_t handler, oc_qos_t qos);
-
-bool oc_do_put(void);
-
-bool oc_init_post(const char *uri, oc_server_handle_t *server,
- const char *query, oc_response_handler_t handler,
- oc_qos_t qos);
-
-bool oc_do_post(void);
-
-bool oc_do_observe(const char *uri, oc_server_handle_t *server,
- const char *query, oc_response_handler_t handler,
- oc_qos_t qos);
-
-bool oc_stop_observe(const char *uri, oc_server_handle_t *server);
-
-/** Common operations */
-
-void oc_set_delayed_callback(void *cb_data, oc_trigger_t callback,
- uint16_t seconds);
-void oc_remove_delayed_callback(void *cb_data, oc_trigger_t callback);
-
-/** API for setting handlers for interrupts */
-
-#define oc_signal_interrupt_handler(name) \
- do { \
- oc_process_poll(&(name##_interrupt_x)); \
- oc_signal_main_loop(); \
- } while (0)
-
-#define oc_activate_interrupt_handler(name) \
- (oc_process_start(&(name##_interrupt_x), 0))
-
-#define oc_define_interrupt_handler(name) \
- void name##_interrupt_x_handler(void); \
- OC_PROCESS(name##_interrupt_x, ""); \
- OC_PROCESS_THREAD(name##_interrupt_x, ev, data) \
- { \
- OC_PROCESS_POLLHANDLER(name##_interrupt_x_handler()); \
- OC_PROCESS_BEGIN(); \
- while (oc_process_is_running(&(name##_interrupt_x))) { \
- OC_PROCESS_YIELD(); \
- } \
- OC_PROCESS_END(); \
- } \
- void name##_interrupt_x_handler(void)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_API_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_buffer.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_buffer.h b/libs/iotivity/include/iotivity/oc_buffer.h
deleted file mode 100644
index 0bbf8a7..0000000
--- a/libs/iotivity/include/iotivity/oc_buffer.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_BUFFER_H
-#define OC_BUFFER_H
-
-#include "../../src/port/oc_connectivity.h"
-#include "../../src/util/oc_process.h"
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-OC_PROCESS_NAME(message_buffer_handler);
-oc_message_t *oc_allocate_message(void);
-void oc_message_add_ref(oc_message_t *message);
-void oc_message_unref(oc_message_t *message);
-
-void oc_recv_message(oc_message_t *message);
-void oc_send_message(oc_message_t *message);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_BUFFER_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_client_state.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_client_state.h b/libs/iotivity/include/iotivity/oc_client_state.h
deleted file mode 100644
index 43c25ac..0000000
--- a/libs/iotivity/include/iotivity/oc_client_state.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_CLIENT_STATE_H
-#define OC_CLIENT_STATE_H
-
-#include "../../src/messaging/coap/constants.h"
-#include "oc_ri.h"
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum { HIGH_QOS = 0, LOW_QOS } oc_qos_t;
-
-typedef struct
-{
- oc_rep_t *payload;
- oc_status_t code;
- int observe_option;
-} oc_client_response_t;
-
-typedef struct
-{
- oc_endpoint_t endpoint;
-} oc_server_handle_t;
-
-typedef enum {
- OC_STOP_DISCOVERY = 0,
- OC_CONTINUE_DISCOVERY
-} oc_discovery_flags_t;
-
-typedef oc_discovery_flags_t(oc_discovery_cb_t)(const char *, const char *,
- oc_string_array_t,
- oc_interface_mask_t,
- oc_server_handle_t *);
-
-typedef void (*oc_response_handler_t)(oc_client_response_t *);
-
-typedef struct oc_client_cb_s
-{
- struct oc_client_cb_s *next;
- oc_string_t uri;
- uint8_t token[COAP_TOKEN_LEN];
- uint8_t token_len;
- uint16_t mid;
-
- oc_server_handle_t server;
-
- void *handler;
-
- bool discovery;
- int32_t observe_seq;
- oc_clock_time_t timestamp;
- oc_qos_t qos;
- oc_method_t method;
-} oc_client_cb_t;
-
-bool oc_ri_invoke_client_cb(void *response, oc_endpoint_t *endpoint);
-
-oc_client_cb_t *oc_ri_alloc_client_cb(const char *uri,
- oc_server_handle_t *server,
- oc_method_t method, void *handler,
- oc_qos_t qos);
-
-oc_client_cb_t *oc_ri_get_client_cb(const char *uri, oc_server_handle_t *server,
- oc_method_t method);
-
-void oc_ri_remove_client_cb_by_mid(uint16_t mid);
-
-oc_discovery_flags_t oc_ri_process_discovery_payload(uint8_t *payload, int len,
- oc_discovery_cb_t *handler,
- oc_endpoint_t *endpoint);
-
-bool oc_ri_send_rst(oc_endpoint_t *endpoint, uint8_t *token, uint8_t token_len,
- uint16_t mid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_CLIENT_STATE_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_constants.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_constants.h b/libs/iotivity/include/iotivity/oc_constants.h
deleted file mode 100644
index cde1acf..0000000
--- a/libs/iotivity/include/iotivity/oc_constants.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_CONSTANTS_H
-#define OC_CONSTANTS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* OCF standard resource interfaces */
-#define OC_NUM_STD_INTERFACES (7)
-#define OC_RSRVD_IF_BASELINE "oic.if.baseline"
-#define OC_BASELINE_IF_LEN (15)
-#define OC_RSRVD_IF_LL "oic.if.ll"
-#define OC_LL_IF_LEN (9)
-#define OC_RSRVD_IF_B "oic.if.b"
-#define OC_B_IF_LEN (8)
-#define OC_RSRVD_IF_R "oic.if.r"
-#define OC_R_IF_LEN (8)
-#define OC_RSRVD_IF_RW "oic.if.rw"
-#define OC_RW_IF_LEN (9)
-#define OC_RSRVD_IF_A "oic.if.a"
-#define OC_A_IF_LEN (8)
-#define OC_RSRVD_IF_S "oic.if.s"
-#define OC_S_IF_LEN (8)
-
-/* OCF Core resource URIs */
-#define OC_RSRVD_WELL_KNOWN_URI "/oic/res"
-#define OC_MULTICAST_DISCOVERY_URI "/oic/res"
-#define OC_RSRVD_DEVICE_URI "/oic/d"
-#define OC_RSRVD_PLATFORM_URI "/oic/p"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_CONSTANTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_core_res.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_core_res.h b/libs/iotivity/include/iotivity/oc_core_res.h
deleted file mode 100644
index baf9fe8..0000000
--- a/libs/iotivity/include/iotivity/oc_core_res.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_CORE_RES_H
-#define OC_CORE_RES_H
-
-#include "oc_ri.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*oc_core_init_platform_cb_t)(void *data);
-typedef void (*oc_core_add_device_cb_t)(void *data);
-
-oc_string_t *oc_core_init_platform(const char *mfg_name,
- oc_core_init_platform_cb_t init_cb,
- void *data);
-
-oc_string_t *oc_core_add_new_device(const char *uri, const char *rt,
- const char *name, const char *spec_version,
- const char *data_model_version,
- oc_core_add_device_cb_t add_device_cb,
- void *data);
-
-int oc_core_get_num_devices(void);
-
-oc_uuid_t *oc_core_get_device_id(int device);
-
-void oc_core_encode_interfaces_mask(CborEncoder *parent,
- oc_interface_mask_t interface);
-
-oc_resource_t *oc_core_get_resource_by_index(int type);
-
-oc_resource_t *oc_core_get_resource_by_uri(const char *uri);
-
-void oc_core_populate_resource(
- int type, const char *uri, const char *rt, oc_interface_mask_t interfaces,
- oc_interface_mask_t default_interface, oc_resource_properties_t properties,
- oc_request_handler_t get, oc_request_handler_t put, oc_request_handler_t post,
- oc_request_handler_t delete, int device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_CORE_RES_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_discovery.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_discovery.h b/libs/iotivity/include/iotivity/oc_discovery.h
deleted file mode 100644
index 5b59a06..0000000
--- a/libs/iotivity/include/iotivity/oc_discovery.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_DISCOVERY_H
-#define OC_DISCOVERY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void oc_create_discovery_resource(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_DISCOVERY_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_gatt.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_gatt.h b/libs/iotivity/include/iotivity/oc_gatt.h
deleted file mode 100644
index ae6c59c..0000000
--- a/libs/iotivity/include/iotivity/oc_gatt.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef OC_GATT_H
-#define OC_GATT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ble_hs_cfg;
-
-/* returns the event q for bluetooth to use */
-int
-ble_coap_gatt_srv_init(struct os_eventq **out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_GATT_H */
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_helpers.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_helpers.h b/libs/iotivity/include/iotivity/oc_helpers.h
deleted file mode 100644
index 7520c7b..0000000
--- a/libs/iotivity/include/iotivity/oc_helpers.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_HELPERS_H
-#define OC_HELPERS_H
-
-#include "../../src/util/oc_list.h"
-#include "../../src/util/oc_mmem.h"
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct oc_mmem oc_handle_t, oc_string_t, oc_array_t, oc_string_array_t;
-
-#define oc_cast(block, type) ((type *)(OC_MMEM_PTR(&(block))))
-#define oc_string(ocstring) (oc_cast(ocstring, char))
-
-void oc_new_string(oc_string_t *ocstring, const char str[]);
-void oc_alloc_string(oc_string_t *ocstring, int size);
-void oc_free_string(oc_string_t *ocstring);
-void oc_concat_strings(oc_string_t *concat, const char *str1, const char *str2);
-#define oc_string_len(ocstring) ((ocstring).size ? (ocstring).size - 1 : 0)
-
-void _oc_new_array(oc_array_t *ocarray, uint8_t size, pool type);
-void _oc_free_array(oc_array_t *ocarray, pool type);
-#define oc_new_int_array(ocarray, size) (_oc_new_array(ocarray, size, INT_POOL))
-#define oc_new_bool_array(ocarray, size) \
- (_oc_new_array(ocarray, size, BYTE_POOL))
-#define oc_new_double_array(ocarray, size) \
- (_oc_new_array(ocarray, size, DOUBLE_POOL))
-#define oc_free_int_array(ocarray) (_oc_free_array(ocarray, INT_POOL))
-#define oc_free_bool_array(ocarray) (_oc_free_array(ocarray, BYTE_POOL))
-#define oc_free_double_array(ocarray) (_oc_free_array(ocarray, DOUBLE_POOL))
-#define oc_int_array_size(ocintarray) ((ocintarray).size / sizeof(int64_t))
-#define oc_bool_array_size(ocboolarray) ((ocboolarray).size / sizeof(bool))
-#define oc_double_array_size(ocdoublearray) \
- ((ocdoublearray).size / sizeof(double))
-#define oc_int_array(ocintarray) (oc_cast(ocintarray, int64_t))
-#define oc_bool_array(ocboolarray) (oc_cast(ocboolarray, bool))
-#define oc_double_array(ocdoublearray) (oc_cast(ocdoublearray, double))
-
-#define STRING_ARRAY_ITEM_MAX_LEN 24
-void _oc_alloc_string_array(oc_string_array_t *ocstringarray, uint8_t size);
-bool _oc_copy_string_to_string_array(oc_string_array_t *ocstringarray,
- const char str[], uint8_t index);
-bool _oc_string_array_add_item(oc_string_array_t *ocstringarray,
- const char str[]);
-void oc_join_string_array(oc_string_array_t *ocstringarray,
- oc_string_t *ocstring);
-#define oc_new_string_array(ocstringarray, size) \
- (_oc_alloc_string_array(ocstringarray, size))
-#define oc_free_string_array(ocstringarray) (oc_free_string(ocstringarray))
-#define oc_string_array_add_item(ocstringarray, str) \
- (_oc_string_array_add_item(&(ocstringarray), str))
-#define oc_string_array_get_item(ocstringarray, index) \
- (oc_string(ocstringarray) + index * STRING_ARRAY_ITEM_MAX_LEN)
-#define oc_string_array_set_item(ocstringarray, str, index) \
- (_oc_copy_string_to_string_array(&(ocstringarray), str, index))
-#define oc_string_array_get_item_size(ocstringarray, index) \
- (strlen((const char *)oc_string_array_get_item(ocstringarray, index)))
-#define oc_string_array_get_allocated_size(ocstringarray) \
- ((ocstringarray).size / STRING_ARRAY_ITEM_MAX_LEN)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_HELPERS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_network_events.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_network_events.h b/libs/iotivity/include/iotivity/oc_network_events.h
deleted file mode 100644
index d0f5d41..0000000
--- a/libs/iotivity/include/iotivity/oc_network_events.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_NETWORK_EVENTS_H
-#define OC_NETWORK_EVENTS_H
-
-#include "../../src/port/oc_network_events_mutex.h"
-#include "../../src/util/oc_process.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-OC_PROCESS_NAME(oc_network_events);
-
-typedef struct oc_message_s oc_message_t;
-
-void oc_network_event(oc_message_t *message);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_NETWORK_EVENTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_rep.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_rep.h b/libs/iotivity/include/iotivity/oc_rep.h
deleted file mode 100644
index f0f80a6..0000000
--- a/libs/iotivity/include/iotivity/oc_rep.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_REP_H
-#define OC_REP_H
-
-#include <tinycbor/cbor.h>
-#include "oc_constants.h"
-#include "oc_helpers.h"
-#include "../src/port/mynewt/config.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern CborEncoder g_encoder, root_map, links_array;
-extern CborError g_err;
-
-void oc_rep_new(uint8_t *payload, int size);
-void oc_rep_reset(void);
-int oc_rep_finalize(void);
-
-#define oc_rep_object(name) &name##_map
-#define oc_rep_array(name) &name##_array
-
-#define oc_rep_set_double(object, key, value) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- g_err |= cbor_encode_double(&object##_map, value); \
- } while (0)
-
-#define oc_rep_set_int(object, key, value) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- g_err |= cbor_encode_int(&object##_map, value); \
- } while (0)
-
-#define oc_rep_set_uint(object, key, value) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- g_err |= cbor_encode_uint(&object##_map, value); \
- } while (0)
-
-#define oc_rep_set_boolean(object, key, value) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- g_err |= cbor_encode_boolean(&object##_map, value); \
- } while (0)
-
-#define oc_rep_set_text_string(object, key, value) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- g_err |= cbor_encode_text_string(&object##_map, value, strlen(value)); \
- } while (0)
-
-#define oc_rep_set_byte_string(object, key, value) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- g_err |= cbor_encode_byte_string(&object##_map, value, strlen(value)); \
- } while (0)
-
-#define oc_rep_start_array(parent, key) \
- do { \
- CborEncoder key##_array; \
- g_err |= \
- cbor_encoder_create_array(&parent, &key##_array, CborIndefiniteLength)
-
-#define oc_rep_end_array(parent, key) \
- g_err |= cbor_encoder_close_container(&parent, &key##_array); \
- } \
- while (0)
-
-#define oc_rep_start_links_array() \
- g_err |= \
- cbor_encoder_create_array(&g_encoder, &links_array, CborIndefiniteLength)
-
-#define oc_rep_end_links_array() \
- g_err |= cbor_encoder_close_container(&g_encoder, &links_array)
-
-#define oc_rep_start_root_object() \
- g_err |= cbor_encoder_create_map(&g_encoder, &root_map, CborIndefiniteLength)
-
-#define oc_rep_end_root_object() \
- g_err |= cbor_encoder_close_container(&g_encoder, &root_map)
-
-#define oc_rep_add_byte_string(parent, value) \
- g_err |= cbor_encode_byte_string(&parent##_array, value, strlen(value))
-
-#define oc_rep_add_text_string(parent, value) \
- g_err |= cbor_encode_text_string(&parent##_array, value, strlen(value))
-
-#define oc_rep_set_key(parent, key) \
- g_err |= cbor_encode_text_string(&parent, key, strlen(key))
-
-#define oc_rep_set_array(object, key) \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- oc_rep_start_array(object##_map, key)
-
-#define oc_rep_close_array(object, key) oc_rep_end_array(object##_map, key)
-
-#define oc_rep_start_object(parent, key) \
- do { \
- CborEncoder key##_map; \
- g_err |= cbor_encoder_create_map(&parent, &key##_map, CborIndefiniteLength)
-
-#define oc_rep_end_object(parent, key) \
- g_err |= cbor_encoder_close_container(&parent, &key##_map); \
- } \
- while (0)
-
-#define oc_rep_object_array_start_item(key) \
- oc_rep_start_object(key##_array, key)
-
-#define oc_rep_object_array_end_item(key) oc_rep_end_object(key##_array, key)
-
-#define oc_rep_set_object(object, key) \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- oc_rep_start_object(object##_map, key)
-
-#define oc_rep_close_object(object, key) oc_rep_end_object(object##_map, key)
-
-#define oc_rep_set_int_array(object, key, values, length) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- CborEncoder key##_value_array; \
- g_err |= \
- cbor_encoder_create_array(&object##_map, &key##_value_array, length); \
- int i; \
- for (i = 0; i < length; i++) { \
- g_err |= cbor_encode_int(&key##_value_array, values[i]); \
- } \
- g_err |= cbor_encoder_close_container(&object##_map, &key##_value_array); \
- } while (0)
-
-#define oc_rep_set_bool_array(object, key, values, length) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- CborEncoder key##_value_array; \
- g_err |= \
- cbor_encoder_create_array(&object##_map, &key##_value_array, length); \
- int i; \
- for (i = 0; i < length; i++) { \
- g_err |= cbor_encode_boolean(&key##_value_array, values[i]); \
- } \
- g_err |= cbor_encoder_close_container(&object##_map, &key##_value_array); \
- } while (0)
-
-#define oc_rep_set_double_array(object, key, values, length) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- CborEncoder key##_value_array; \
- g_err |= \
- cbor_encoder_create_array(&object##_map, &key##_value_array, length); \
- int i; \
- for (i = 0; i < length; i++) { \
- g_err |= cbor_encode_floating_point(&key##_value_array, CborDoubleType, \
- &values[i]); \
- } \
- g_err |= cbor_encoder_close_container(&object##_map, &key##_value_array); \
- } while (0)
-
-#define oc_rep_set_string_array(object, key, values) \
- do { \
- g_err |= cbor_encode_text_string(&object##_map, #key, strlen(#key)); \
- CborEncoder key##_value_array; \
- g_err |= \
- cbor_encoder_create_array(&object##_map, &key##_value_array, \
- oc_string_array_get_allocated_size(values)); \
- int i; \
- for (i = 0; i < oc_string_array_get_allocated_size(values); i++) { \
- g_err |= cbor_encode_text_string( \
- &key##_value_array, oc_string_array_get_item(values, i), \
- oc_string_array_get_item_size(values, i)); \
- } \
- g_err |= cbor_encoder_close_container(&object##_map, &key##_value_array); \
- } while (0)
-
-typedef enum {
- NIL = 0,
- INT = 0x01,
- DOUBLE = 0x02,
- BOOL = 0x03,
- BYTE_STRING = 0x04,
- STRING = 0x05,
- OBJECT = 0x06,
- ARRAY = 0x08,
- INT_ARRAY = 0x09,
- DOUBLE_ARRAY = 0x0A,
- BOOL_ARRAY = 0x0B,
- BYTE_STRING_ARRAY = 0x0C,
- STRING_ARRAY = 0x0D,
- OBJECT_ARRAY = 0x0E
-} oc_rep_value_type_t;
-
-typedef struct oc_rep_s
-{
- oc_rep_value_type_t type;
- struct oc_rep_s *next;
- oc_string_t name;
- union
- {
- int64_t value_int;
- bool value_boolean;
- double value_double;
- oc_string_t value_string;
- oc_array_t value_array;
- struct oc_rep_s *value_object;
- struct oc_rep_s *value_object_array;
- };
-} oc_rep_t;
-
-uint16_t oc_parse_rep(const uint8_t *payload, uint16_t payload_size,
- oc_rep_t **value_list);
-
-void oc_free_rep(oc_rep_t *rep);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_REP_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_ri.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_ri.h b/libs/iotivity/include/iotivity/oc_ri.h
deleted file mode 100644
index a5bce1d..0000000
--- a/libs/iotivity/include/iotivity/oc_ri.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_RI_H
-#define OC_RI_H
-
-#include "../src/port/mynewt/config.h"
-#include "oc_rep.h"
-#include "oc_uuid.h"
-#include "../../src/port/oc_connectivity.h"
-#include "../../src/util/oc_etimer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum { OC_GET = 1, OC_POST, OC_PUT, OC_DELETE } oc_method_t;
-
-typedef enum {
- OC_DISCOVERABLE = (1 << 0),
- OC_OBSERVABLE = (1 << 1),
- OC_ACTIVE = (1 << 2),
- OC_SECURE = (1 << 4),
- OC_PERIODIC = (1 << 6),
-} oc_resource_properties_t;
-
-typedef enum {
- OC_STATUS_OK = 0,
- OC_STATUS_CREATED,
- OC_STATUS_CHANGED,
- OC_STATUS_DELETED,
- OC_STATUS_NOT_MODIFIED,
- OC_STATUS_BAD_REQUEST,
- OC_STATUS_UNAUTHORIZED,
- OC_STATUS_BAD_OPTION,
- OC_STATUS_FORBIDDEN,
- OC_STATUS_NOT_FOUND,
- OC_STATUS_METHOD_NOT_ALLOWED,
- OC_STATUS_NOT_ACCEPTABLE,
- OC_STATUS_REQUEST_ENTITY_TOO_LARGE,
- OC_STATUS_UNSUPPORTED_MEDIA_TYPE,
- OC_STATUS_INTERNAL_SERVER_ERROR,
- OC_STATUS_NOT_IMPLEMENTED,
- OC_STATUS_BAD_GATEWAY,
- OC_STATUS_SERVICE_UNAVAILABLE,
- OC_STATUS_GATEWAY_TIMEOUT,
- OC_STATUS_PROXYING_NOT_SUPPORTED,
- __NUM_OC_STATUS_CODES__,
- OC_IGNORE
-} oc_status_t;
-
-typedef struct oc_separate_response_s oc_separate_response_t;
-
-typedef struct oc_response_buffer_s oc_response_buffer_t;
-
-typedef struct
-{
- oc_separate_response_t *separate_response;
- oc_response_buffer_t *response_buffer;
-} oc_response_t;
-
-typedef enum {
- OC_IF_BASELINE = 1 << 1,
- OC_IF_LL = 1 << 2,
- OC_IF_B = 1 << 3,
- OC_IF_R = 1 << 4,
- OC_IF_RW = 1 << 5,
- OC_IF_A = 1 << 6,
- OC_IF_S = 1 << 7,
-} oc_interface_mask_t;
-
-typedef enum {
- OCF_RES = 0,
- OCF_P,
-#ifdef OC_SECURITY
- OCF_SEC_DOXM,
- OCF_SEC_PSTAT,
- OCF_SEC_ACL,
- OCF_SEC_CRED,
-#endif
- __NUM_OC_CORE_RESOURCES__
-} oc_core_resource_t;
-
-#define NUM_OC_CORE_RESOURCES (__NUM_OC_CORE_RESOURCES__ + MAX_NUM_DEVICES)
-
-typedef struct oc_resource_s oc_resource_t;
-
-typedef struct
-{
- oc_endpoint_t *origin;
- oc_resource_t *resource;
- const char *query;
- int query_len;
- oc_rep_t *request_payload;
- oc_response_t *response;
-} oc_request_t;
-
-typedef void (*oc_request_handler_t)(oc_request_t *, oc_interface_mask_t);
-
-typedef struct oc_resource_s
-{
- struct oc_resource_s *next;
- int device;
- oc_string_t uri;
- oc_string_array_t types;
- oc_interface_mask_t interfaces;
- oc_interface_mask_t default_interface;
- oc_resource_properties_t properties;
- oc_request_handler_t get_handler;
- oc_request_handler_t put_handler;
- oc_request_handler_t post_handler;
- oc_request_handler_t delete_handler;
- uint16_t observe_period_seconds;
- uint8_t num_observers;
-} oc_resource_t;
-
-typedef enum { DONE = 0, CONTINUE } oc_event_callback_retval_t;
-
-typedef oc_event_callback_retval_t (*oc_trigger_t)(void *);
-
-typedef struct oc_event_callback_s
-{
- struct oc_event_callback_s *next;
- struct oc_etimer timer;
- oc_trigger_t callback;
- void *data;
-} oc_event_callback_t;
-
-void oc_ri_init(void);
-
-void oc_ri_shutdown(void);
-
-void oc_ri_add_timed_event_callback_ticks(void *cb_data,
- oc_trigger_t event_callback,
- oc_clock_time_t ticks);
-
-#define oc_ri_add_timed_event_callback_seconds(cb_data, event_callback, \
- seconds) \
- do { \
- oc_ri_add_timed_event_callback_ticks( \
- cb_data, event_callback, (oc_clock_time_t)(seconds * OC_CLOCK_SECOND)); \
- } while (0)
-
-void oc_ri_remove_timed_event_callback(void *cb_data,
- oc_trigger_t event_callback);
-
-int oc_status_code(oc_status_t key);
-
-oc_resource_t *oc_ri_get_app_resource_by_uri(const char *uri);
-
-oc_resource_t *oc_ri_get_app_resources(void);
-
-#ifdef OC_SERVER
-oc_resource_t *oc_ri_alloc_resource(void);
-bool oc_ri_add_resource(oc_resource_t *resource);
-void oc_ri_delete_resource(oc_resource_t *resource);
-#endif
-
-int oc_ri_get_query_nth_key_value(const char *query, int query_len, char **key,
- int *key_len, char **value, int *value_len,
- int n);
-int oc_ri_get_query_value(const char *query, int query_len, const char *key,
- char **value);
-
-oc_interface_mask_t oc_ri_get_interface_mask(char *iface, int if_len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_RI_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/include/iotivity/oc_uuid.h
----------------------------------------------------------------------
diff --git a/libs/iotivity/include/iotivity/oc_uuid.h b/libs/iotivity/include/iotivity/oc_uuid.h
deleted file mode 100644
index 03a8740..0000000
--- a/libs/iotivity/include/iotivity/oc_uuid.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#ifndef OC_UUID_H
-#define OC_UUID_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct
-{
- uint8_t id[16];
-} oc_uuid_t;
-
-void oc_str_to_uuid(const char *str, oc_uuid_t *uuid);
-void oc_uuid_to_str(const oc_uuid_t *uuid, char *buffer, int buflen);
-void oc_gen_uuid(oc_uuid_t *uuid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OC_UUID_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/pkg.yml
----------------------------------------------------------------------
diff --git a/libs/iotivity/pkg.yml b/libs/iotivity/pkg.yml
deleted file mode 100644
index ddc3fba..0000000
--- a/libs/iotivity/pkg.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-pkg.name: libs/iotivity
-pkg.description: OCF contstrained iotivity stack
-pkg.author: "https://github.com/iotivity/iotivity-constrained"
-pkg.homepage: "https://www.iotivity.org/"
-pkg.keywords:
-
-pkg.deps:
- - "@apache-mynewt-core/encoding/tinycbor"
- - "@apache-mynewt-core/kernel/os"
- - "@apache-mynewt-core/sys/log"
-
-pkg.deps.OC_TRANSPORT_GATT:
- - "@apache-mynewt-core/net/nimble/host"
- - "@apache-mynewt-core/net/nimble/host/services/gap"
- - "@apache-mynewt-core/net/nimble/host/services/gatt"
-
-pkg.deps.OC_TRANSPORT_IP:
- - "@apache-mynewt-core/net/ip/mn_socket"
-
-pkg.deps.OC_TRANSPORT_SERIAL:
- - "@apache-mynewt-core/sys/shell"
-
-# remove debug option to save logging
-pkg.cflags: -std=c99
- -DSECURE=0
- -I./port/mynewt
- -I../port/mynewt
- -I../../port/mynewt
- -I../include/iotivity
- -I../../include/iotivity
- -I../../../include/iotivity
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/src/api/oc_buffer.c
----------------------------------------------------------------------
diff --git a/libs/iotivity/src/api/oc_buffer.c b/libs/iotivity/src/api/oc_buffer.c
deleted file mode 100644
index e623221..0000000
--- a/libs/iotivity/src/api/oc_buffer.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#include "messaging/coap/engine.h"
-#include "port/oc_signal_main_loop.h"
-#include "util/oc_memb.h"
-#include <stdint.h>
-#include <stdio.h>
-
-#ifdef OC_SECURITY
-#include "security/oc_dtls.h"
-#endif
-
-#include "config.h"
-#include "oc_buffer.h"
-#include "oc_events.h"
-
-OC_PROCESS(message_buffer_handler, "OC Message Buffer Handler");
-OC_MEMB(oc_buffers_s, oc_message_t, (MAX_NUM_CONCURRENT_REQUESTS * 2));
-
-oc_message_t *
-oc_allocate_message(void)
-{
- oc_message_t *message = (oc_message_t *)oc_memb_alloc(&oc_buffers_s);
- if (message) {
- message->length = 0;
- message->next = 0;
- message->ref_count = 1;
- LOG("buffer: Allocated TX/RX buffer; num free: %d\n",
- oc_memb_numfree(&oc_buffers_s));
- } else
- LOG("buffer: No free TX/RX buffers!\n");
- return message;
-}
-
-void
-oc_message_add_ref(oc_message_t *message)
-{
- if (message)
- message->ref_count++;
-}
-
-void
-oc_message_unref(oc_message_t *message)
-{
- if (message) {
- message->ref_count--;
- if (message->ref_count == 0) {
- oc_memb_free(&oc_buffers_s, message);
- LOG("buffer: freed TX/RX buffer; num free: %d\n",
- oc_memb_numfree(&oc_buffers_s));
- }
- }
-}
-
-void
-oc_recv_message(oc_message_t *message)
-{
- oc_process_post(&message_buffer_handler, oc_events[INBOUND_NETWORK_EVENT],
- message);
-}
-
-void
-oc_send_message(oc_message_t *message)
-{
- oc_process_post(&message_buffer_handler, oc_events[OUTBOUND_NETWORK_EVENT],
- message);
-
- oc_signal_main_loop();
-}
-
-OC_PROCESS_THREAD(message_buffer_handler, ev, data)
-{
- OC_PROCESS_BEGIN();
- LOG("Started buffer handler process\n");
- while (1) {
- OC_PROCESS_YIELD();
-
- if (ev == oc_events[INBOUND_NETWORK_EVENT]) {
-#ifdef OC_SECURITY
- uint8_t b = (uint8_t)((oc_message_t *)data)->data[0];
- if (b > 19 && b < 64) {
- LOG("Inbound network event: encrypted request\n");
- oc_process_post(&oc_dtls_handler, oc_events[UDP_TO_DTLS_EVENT], data);
- } else {
- LOG("Inbound network event: decrypted request\n");
- oc_process_post(&coap_engine, oc_events[INBOUND_RI_EVENT], data);
- }
-#else
- LOG("Inbound network event: decrypted request\n");
- oc_process_post(&coap_engine, oc_events[INBOUND_RI_EVENT], data);
-#endif
- } else if (ev == oc_events[OUTBOUND_NETWORK_EVENT]) {
- oc_message_t *message = (oc_message_t *)data;
-
-#ifdef OC_CLIENT
- if (message->endpoint.flags & MULTICAST) {
- LOG("Outbound network event: multicast request\n");
- oc_send_multicast_message(message);
- oc_message_unref(message);
- } else
-#endif
-#ifdef OC_SECURITY
- if (message->endpoint.flags & SECURED) {
- LOG("Outbound network event: forwarding to DTLS\n");
-
- if (!oc_sec_dtls_connected(&message->endpoint)) {
- LOG("Posting INIT_DTLS_CONN_EVENT\n");
- oc_process_post(&oc_dtls_handler, oc_events[INIT_DTLS_CONN_EVENT],
- data);
- } else {
- LOG("Posting RI_TO_DTLS_EVENT\n");
- oc_process_post(&oc_dtls_handler, oc_events[RI_TO_DTLS_EVENT], data);
- }
- } else
-#endif
- {
- LOG("Outbound network event: unicast message\n");
- oc_send_buffer(message);
- oc_message_unref(message);
- }
- }
- }
- OC_PROCESS_END();
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/src/api/oc_client_api.c
----------------------------------------------------------------------
diff --git a/libs/iotivity/src/api/oc_client_api.c b/libs/iotivity/src/api/oc_client_api.c
deleted file mode 100644
index bd73da3..0000000
--- a/libs/iotivity/src/api/oc_client_api.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
-// Copyright (c) 2016 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#include "messaging/coap/coap.h"
-#include "messaging/coap/transactions.h"
-#include "oc_api.h"
-
-#ifdef OC_CLIENT
-#define OC_CLIENT_CB_TIMEOUT_SECS COAP_RESPONSE_TIMEOUT
-
-static oc_message_t *message;
-static coap_transaction_t *transaction;
-coap_packet_t request[1];
-
-static bool
-dispatch_coap_request(void)
-{
- int response_length = oc_rep_finalize();
- if (!transaction) {
- if (message) {
- if (response_length) {
- coap_set_payload(request, message->data + COAP_MAX_HEADER_SIZE,
- response_length);
- coap_set_header_content_format(request, APPLICATION_CBOR);
- }
- message->length = coap_serialize_message(request, message->data);
- coap_send_message(message);
- message = 0;
- return true;
- }
- } else {
- if (response_length) {
- coap_set_payload(request,
- transaction->message->data + COAP_MAX_HEADER_SIZE,
- response_length);
- coap_set_header_content_format(request, APPLICATION_CBOR);
- }
- transaction->message->length =
- coap_serialize_message(request, transaction->message->data);
- coap_send_transaction(transaction);
- transaction = 0;
- return true;
- }
- return false;
-}
-
-static bool
-prepare_coap_request(oc_client_cb_t *cb, oc_string_t *query)
-{
- coap_message_type_t type = COAP_TYPE_NON;
-
- if (cb->qos == HIGH_QOS) {
- type = COAP_TYPE_CON;
- transaction = coap_new_transaction(cb->mid, &cb->server.endpoint);
- if (!transaction)
- return false;
- oc_rep_new(transaction->message->data + COAP_MAX_HEADER_SIZE,
- COAP_MAX_BLOCK_SIZE);
- } else {
- message = oc_allocate_message();
- if (!message)
- return false;
- memcpy(&message->endpoint, &cb->server.endpoint, sizeof(oc_endpoint_t));
- oc_rep_new(message->data + COAP_MAX_HEADER_SIZE, COAP_MAX_BLOCK_SIZE);
- }
-
- coap_init_message(request, type, cb->method, cb->mid);
-
- coap_set_header_accept(request, APPLICATION_CBOR);
-
- coap_set_token(request, cb->token, cb->token_len);
-
- coap_set_header_uri_path(request, oc_string(cb->uri));
-
- if (cb->observe_seq != -1)
- coap_set_header_observe(request, cb->observe_seq);
-
- if (query && oc_string_len(*query))
- coap_set_header_uri_query(request, oc_string(*query));
-
- if (cb->observe_seq == -1 && cb->qos == LOW_QOS) {
- extern oc_event_callback_retval_t oc_ri_remove_client_cb(void *data);
-
- oc_set_delayed_callback(cb, &oc_ri_remove_client_cb,
- OC_CLIENT_CB_TIMEOUT_SECS);
- }
-
- return true;
-}
-
-bool
-oc_do_delete(const char *uri, oc_server_handle_t *server,
- oc_response_handler_t handler, oc_qos_t qos)
-{
- oc_client_cb_t *cb =
- oc_ri_alloc_client_cb(uri, server, OC_DELETE, handler, qos);
- if (!cb)
- return false;
-
- bool status = false;
-
- status = prepare_coap_request(cb, NULL);
-
- if (status)
- status = dispatch_coap_request();
-
- return status;
-}
-
-bool
-oc_do_get(const char *uri, oc_server_handle_t *server, const char *query,
- oc_response_handler_t handler, oc_qos_t qos)
-{
- oc_client_cb_t *cb = oc_ri_alloc_client_cb(uri, server, OC_GET, handler, qos);
- if (!cb)
- return false;
-
- bool status = false;
-
- if (query && strlen(query)) {
- oc_string_t q;
- oc_concat_strings(&q, "?", query);
- status = prepare_coap_request(cb, &q);
- oc_free_string(&q);
- } else {
- status = prepare_coap_request(cb, NULL);
- }
-
- if (status)
- status = dispatch_coap_request();
-
- return status;
-}
-
-bool
-oc_init_put(const char *uri, oc_server_handle_t *server, const char *query,
- oc_response_handler_t handler, oc_qos_t qos)
-{
- oc_client_cb_t *cb = oc_ri_alloc_client_cb(uri, server, OC_PUT, handler, qos);
- if (!cb)
- return false;
-
- bool status = false;
-
- if (query && strlen(query)) {
- oc_string_t q;
- oc_concat_strings(&q, "?", query);
- status = prepare_coap_request(cb, &q);
- oc_free_string(&q);
- } else {
- status = prepare_coap_request(cb, NULL);
- }
-
- return status;
-}
-
-bool
-oc_init_post(const char *uri, oc_server_handle_t *server, const char *query,
- oc_response_handler_t handler, oc_qos_t qos)
-{
- oc_client_cb_t *cb =
- oc_ri_alloc_client_cb(uri, server, OC_POST, handler, qos);
- if (!cb)
- return false;
-
- bool status = false;
-
- if (query && strlen(query)) {
- oc_string_t q;
- oc_concat_strings(&q, "?", query);
- status = prepare_coap_request(cb, &q);
- oc_free_string(&q);
- } else {
- status = prepare_coap_request(cb, NULL);
- }
-
- return status;
-}
-
-bool
-oc_do_put(void)
-{
- return dispatch_coap_request();
-}
-
-bool
-oc_do_post(void)
-{
- return dispatch_coap_request();
-}
-
-bool
-oc_do_observe(const char *uri, oc_server_handle_t *server, const char *query,
- oc_response_handler_t handler, oc_qos_t qos)
-{
- oc_client_cb_t *cb = oc_ri_alloc_client_cb(uri, server, OC_GET, handler, qos);
- if (!cb)
- return false;
-
- cb->observe_seq = 0;
-
- bool status = false;
-
- if (query && strlen(query)) {
- oc_string_t q;
- oc_concat_strings(&q, "?", query);
- status = prepare_coap_request(cb, &q);
- oc_free_string(&q);
- } else {
- status = prepare_coap_request(cb, NULL);
- }
-
- if (status)
- status = dispatch_coap_request();
-
- return status;
-}
-
-bool
-oc_stop_observe(const char *uri, oc_server_handle_t *server)
-{
- oc_client_cb_t *cb = oc_ri_get_client_cb(uri, server, OC_GET);
-
- if (!cb)
- return false;
-
- cb->observe_seq = 1;
-
- bool status = false;
-
- status = prepare_coap_request(cb, NULL);
-
- if (status)
- status = dispatch_coap_request();
-
- return status;
-}
-
-bool
-oc_do_ip_discovery(const char *rt, oc_discovery_cb_t handler)
-{
- oc_make_ip_endpoint(mcast, IP | MULTICAST, 5683, 0xff, 0x02, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xfd);
- mcast.ipv6_addr.scope = 0;
-
- oc_server_handle_t handle;
- memcpy(&handle.endpoint, &mcast, sizeof(oc_endpoint_t));
-
- oc_client_cb_t *cb =
- oc_ri_alloc_client_cb("/oic/res", &handle, OC_GET, handler, LOW_QOS);
-
- if (!cb)
- return false;
-
- cb->discovery = true;
-
- bool status = false;
-
- oc_string_t query;
-
- if (rt && strlen(rt) > 0) {
- oc_concat_strings(&query, "if=oic.if.ll&rt=", rt);
- } else {
- oc_new_string(&query, "if=oic.if.ll");
- }
- status = prepare_coap_request(cb, &query);
- oc_free_string(&query);
-
- if (status)
- status = dispatch_coap_request();
-
- return status;
-}
-#endif /* OC_CLIENT */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f88168c2/libs/iotivity/src/api/oc_core_res.c
----------------------------------------------------------------------
diff --git a/libs/iotivity/src/api/oc_core_res.c b/libs/iotivity/src/api/oc_core_res.c
deleted file mode 100644
index ced0f88..0000000
--- a/libs/iotivity/src/api/oc_core_res.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- // Copyright (c) 2016 Intel Corporation
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- */
-
-#include "oc_core_res.h"
-#include "messaging/coap/oc_coap.h"
-#include "oc_rep.h"
-#include "oc_ri.h"
-
-#ifdef OC_SECURITY
-#include "security/oc_pstat.h"
-#endif /* OC_SECURITY */
-
-static oc_resource_t core_resources[NUM_OC_CORE_RESOURCES];
-struct oc_device_info_t
-{
- oc_uuid_t uuid;
- oc_string_t payload;
-} oc_device_info[MAX_NUM_DEVICES];
-static int device_count;
-static oc_string_t oc_platform_payload;
-
-void
-oc_core_encode_interfaces_mask(CborEncoder *parent,
- oc_interface_mask_t interface)
-{
- oc_rep_set_key((*parent), "if");
- oc_rep_start_array((*parent), if);
- if (interface & OC_IF_LL) {
- oc_rep_add_text_string(if, OC_RSRVD_IF_LL);
- }
- if (interface & OC_IF_B) {
- oc_rep_add_text_string(if, OC_RSRVD_IF_B);
- }
- if (interface & OC_IF_R) {
- oc_rep_add_text_string(if, OC_RSRVD_IF_R);
- }
- if (interface & OC_IF_RW) {
- oc_rep_add_text_string(if, OC_RSRVD_IF_RW);
- }
- if (interface & OC_IF_A) {
- oc_rep_add_text_string(if, OC_RSRVD_IF_A);
- }
- if (interface & OC_IF_S) {
- oc_rep_add_text_string(if, OC_RSRVD_IF_S);
- }
- oc_rep_add_text_string(if, OC_RSRVD_IF_BASELINE);
- oc_rep_end_array((*parent), if);
-}
-
-static void
-oc_core_device_handler(oc_request_t *request, oc_interface_mask_t interface)
-{
- uint8_t *buffer = request->response->response_buffer->buffer;
- uint16_t buffer_size = request->response->response_buffer->buffer_size;
- int payload_size = oc_device_info[request->resource->device].payload.size;
-
- if (buffer_size < payload_size) {
- request->response->response_buffer->response_length = 0;
- request->response->response_buffer->code =
- oc_status_code(OC_STATUS_INTERNAL_SERVER_ERROR);
- return;
- }
-
- switch (interface) {
- case OC_IF_R:
- case OC_IF_BASELINE:
- memcpy(buffer,
- oc_cast(oc_device_info[request->resource->device].payload, uint8_t),
- payload_size);
- request->response->response_buffer->response_length = payload_size;
- request->response->response_buffer->code = oc_status_code(OC_STATUS_OK);
- break;
- default:
- break;
- }
-}
-
-int
-oc_core_get_num_devices(void)
-{
- return device_count;
-}
-
-static int
-finalize_payload(oc_string_t *temp_buffer, oc_string_t *payload)
-{
- oc_rep_end_root_object();
- int size = oc_rep_finalize();
- if (size != -1) {
- oc_alloc_string(payload, size);
- memcpy(oc_cast(*payload, uint8_t), oc_cast(*temp_buffer, uint8_t), size);
- oc_free_string(temp_buffer);
- return 1;
- }
-
- oc_free_string(temp_buffer);
- return -1;
-}
-
-oc_string_t *
-oc_core_add_new_device(const char *uri, const char *rt, const char *name,
- const char *spec_version, const char *data_model_version,
- oc_core_add_device_cb_t add_device_cb, void *data)
-{
- if (device_count == MAX_NUM_DEVICES)
- return false;
-
- oc_string_t temp_buffer;
-/* Once provisioned, UUID is retrieved from the credential store.
- If not yet provisioned, a default is generated in the security
- layer.
-*/
-#ifdef OC_SECURITY /*fix if add new devices after provisioning, need to reset \
- or it will generate non-standard uuid */
- /* where are secondary device ids persisted? */
- if (!oc_sec_provisioned() && device_count > 0)
- oc_gen_uuid(&oc_device_info[device_count].uuid);
-#else
- oc_gen_uuid(&oc_device_info[device_count].uuid);
-#endif
-
- int ocf_d = NUM_OC_CORE_RESOURCES - 1 - device_count;
-
- /* Construct device resource */
- oc_core_populate_resource(ocf_d, uri, rt, OC_IF_R | OC_IF_BASELINE,
- OC_IF_BASELINE, OC_ACTIVE | OC_DISCOVERABLE,
- oc_core_device_handler, 0, 0, 0, device_count);
-
- /* Encoding device resource payload */
- oc_alloc_string(&temp_buffer, MAX_DEVICE_PAYLOAD_SIZE);
- oc_rep_new(oc_cast(temp_buffer, uint8_t), MAX_DEVICE_PAYLOAD_SIZE);
-
- oc_rep_start_root_object();
-
- oc_rep_set_string_array(root, rt, core_resources[ocf_d].types);
- oc_core_encode_interfaces_mask(oc_rep_object(root),
- core_resources[ocf_d].interfaces);
- oc_rep_set_uint(root, p, core_resources[ocf_d].properties);
-
- char uuid[37];
- oc_uuid_to_str(&oc_device_info[device_count].uuid, uuid, 37);
- oc_rep_set_text_string(root, di, uuid);
- oc_rep_set_text_string(root, n, name);
- oc_rep_set_text_string(root, icv, spec_version);
- oc_rep_set_text_string(root, dmv, data_model_version);
-
- if (add_device_cb)
- add_device_cb(data);
- if (!finalize_payload(&temp_buffer, &oc_device_info[device_count].payload))
- return NULL;
-
- return &oc_device_info[device_count++].payload;
-}
-
-void
-oc_core_platform_handler(oc_request_t *request, oc_interface_mask_t interface)
-{
- uint8_t *buffer = request->response->response_buffer->buffer;
- uint16_t buffer_size = request->response->response_buffer->buffer_size;
- int payload_size = oc_platform_payload.size;
-
- if (buffer_size < payload_size) {
- request->response->response_buffer->response_length = 0;
- request->response->response_buffer->code =
- oc_status_code(OC_STATUS_INTERNAL_SERVER_ERROR);
- return;
- }
-
- switch (interface) {
- case OC_IF_R:
- case OC_IF_BASELINE:
- memcpy(buffer, oc_cast(oc_platform_payload, uint8_t), payload_size);
- request->response->response_buffer->response_length = payload_size;
- request->response->response_buffer->code = oc_status_code(OC_STATUS_OK);
- break;
- default:
- break;
- }
-}
-
-oc_string_t *
-oc_core_init_platform(const char *mfg_name, oc_core_init_platform_cb_t init_cb,
- void *data)
-{
- if (oc_platform_payload.size > 0)
- return NULL;
-
- oc_string_t temp_buffer;
- /* Populating resource obuject */
- oc_core_populate_resource(OCF_P, OC_RSRVD_PLATFORM_URI, "oic.wk.p",
- OC_IF_R | OC_IF_BASELINE, OC_IF_BASELINE,
- OC_ACTIVE | OC_DISCOVERABLE,
- oc_core_platform_handler, 0, 0, 0, 0);
-
- /* Encoding platform resource payload */
- oc_alloc_string(&temp_buffer, MAX_PLATFORM_PAYLOAD_SIZE);
- oc_rep_new(oc_cast(temp_buffer, uint8_t), MAX_PLATFORM_PAYLOAD_SIZE);
- oc_rep_start_root_object();
- oc_rep_set_string_array(root, rt, core_resources[OCF_P].types);
-
- oc_core_encode_interfaces_mask(oc_rep_object(root),
- core_resources[OCF_P].interfaces);
- oc_rep_set_uint(root, p, core_resources[OCF_P].properties & ~OC_PERIODIC);
-
- oc_uuid_t uuid; /*fix uniqueness of platform id?? */
- oc_gen_uuid(&uuid);
- char uuid_str[37];
-
- oc_uuid_to_str(&uuid, uuid_str, 37);
- oc_rep_set_text_string(root, pi, uuid_str);
- oc_rep_set_text_string(root, mnmn, mfg_name);
-
- if (init_cb)
- init_cb(data);
-
- if (!finalize_payload(&temp_buffer, &oc_platform_payload))
- return NULL;
-
- return &oc_platform_payload;
-}
-
-void
-oc_core_populate_resource(int type, const char *uri, const char *rt,
- oc_interface_mask_t interfaces,
- oc_interface_mask_t default_interface,
- oc_resource_properties_t properties,
- oc_request_handler_t get, oc_request_handler_t put,
- oc_request_handler_t post,
- oc_request_handler_t delete, int device)
-{
- oc_resource_t *r = &core_resources[type];
- r->device = device;
- oc_new_string(&r->uri, uri);
- r->properties = properties;
- oc_new_string_array(&r->types, 1);
- oc_string_array_add_item(r->types, rt);
- r->interfaces = interfaces;
- r->default_interface = default_interface;
- r->get_handler = get;
- r->put_handler = put;
- r->post_handler = post;
- r->delete_handler = delete;
-}
-
-oc_uuid_t *
-oc_core_get_device_id(int device)
-{
- return &oc_device_info[device].uuid;
-}
-
-oc_resource_t *
-oc_core_get_resource_by_index(int type)
-{
- return &core_resources[type];
-}
-
-oc_resource_t *
-oc_core_get_resource_by_uri(const char *uri)
-{
- int i;
- for (i = 0; i < NUM_OC_CORE_RESOURCES; i++) {
- if (oc_string_len(core_resources[i].uri) == strlen(uri) &&
- strncmp(uri, oc_string(core_resources[i].uri), strlen(uri)) == 0)
- return &core_resources[i];
- }
- return NULL;
-}