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/11/30 16:58:01 UTC
[13/16] incubator-mynewt-core git commit: oic;
in preparation to moving to os_mbufs.
oic; in preparation to moving to os_mbufs.
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/5c7b8859
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5c7b8859
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5c7b8859
Branch: refs/heads/develop
Commit: 5c7b8859e1a85a8238ea4fbb0296a4a317200a38
Parents: 425e06f
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Nov 22 16:03:47 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Nov 30 08:54:51 2016 -0800
----------------------------------------------------------------------
net/oic/include/oic/oc_buffer.h | 12 +++---
net/oic/include/oic/oc_network_events.h | 4 +-
net/oic/src/api/oc_buffer.c | 16 +++----
net/oic/src/api/oc_network_events.c | 2 +-
net/oic/src/port/mynewt/adaptor.h | 18 ++++----
net/oic/src/port/oc_connectivity.h | 62 +++++++++++++---------------
6 files changed, 54 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c7b8859/net/oic/include/oic/oc_buffer.h
----------------------------------------------------------------------
diff --git a/net/oic/include/oic/oc_buffer.h b/net/oic/include/oic/oc_buffer.h
index 852e427..7dab610 100644
--- a/net/oic/include/oic/oc_buffer.h
+++ b/net/oic/include/oic/oc_buffer.h
@@ -21,13 +21,13 @@
extern "C" {
#endif
-struct oc_message_s;
-struct oc_message_s *oc_allocate_message(void);
-void oc_message_add_ref(struct oc_message_s *message);
-void oc_message_unref(struct oc_message_s *message);
+struct oc_message;
+struct oc_message *oc_allocate_message(void);
+void oc_message_add_ref(struct oc_message *message);
+void oc_message_unref(struct oc_message *message);
-void oc_recv_message(struct oc_message_s *message);
-void oc_send_message(struct oc_message_s *message);
+void oc_recv_message(struct oc_message *message);
+void oc_send_message(struct oc_message *message);
#ifdef __cplusplus
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c7b8859/net/oic/include/oic/oc_network_events.h
----------------------------------------------------------------------
diff --git a/net/oic/include/oic/oc_network_events.h b/net/oic/include/oic/oc_network_events.h
index 61a274c..f786390 100644
--- a/net/oic/include/oic/oc_network_events.h
+++ b/net/oic/include/oic/oc_network_events.h
@@ -21,9 +21,9 @@
extern "C" {
#endif
-typedef struct oc_message_s oc_message_t;
+struct oc_message;
-void oc_network_event(oc_message_t *message);
+void oc_network_event(struct oc_message *message);
#ifdef __cplusplus
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c7b8859/net/oic/src/api/oc_buffer.c
----------------------------------------------------------------------
diff --git a/net/oic/src/api/oc_buffer.c b/net/oic/src/api/oc_buffer.c
index b7201d7..bd3bbd1 100644
--- a/net/oic/src/api/oc_buffer.c
+++ b/net/oic/src/api/oc_buffer.c
@@ -37,8 +37,8 @@ static uint8_t oc_buffer_area[OS_MEMPOOL_BYTES(MAX_NUM_CONCURRENT_REQUESTS * 2,
static void oc_buffer_handler(struct os_event *);
-static struct oc_message_s *oc_buffer_inq;
-static struct oc_message_s *oc_buffer_outq;
+static struct oc_message *oc_buffer_inq;
+static struct oc_message *oc_buffer_outq;
static struct os_event oc_buffer_ev = {
.ev_cb = oc_buffer_handler
};
@@ -89,11 +89,11 @@ oc_message_unref(oc_message_t *message)
}
static void
-oc_queue_msg(struct oc_message_s **head, struct oc_message_s *msg)
+oc_queue_msg(struct oc_message **head, struct oc_message *msg)
{
- struct oc_message_s *tmp;
+ struct oc_message *tmp;
- msg->next = NULL; /* oc_message_s has been oc_list once, clear next */
+ msg->next = NULL; /* oc_message has been oc_list once, clear next */
if (!*head) {
*head = msg;
} else {
@@ -117,7 +117,7 @@ oc_send_message(oc_message_t *message)
}
static void
-oc_buffer_tx(struct oc_message_s *message)
+oc_buffer_tx(struct oc_message *message)
{
#ifdef OC_CLIENT
if (message->endpoint.flags & MULTICAST) {
@@ -153,7 +153,7 @@ oc_buffer_tx(struct oc_message_s *message)
}
static void
-oc_buffer_rx(struct oc_message_s *msg)
+oc_buffer_rx(struct oc_message *msg)
{
#ifdef OC_SECURITY
uint8_t b = (uint8_t)(msg->data[0];
@@ -175,7 +175,7 @@ oc_buffer_rx(struct oc_message_s *msg)
static void
oc_buffer_handler(struct os_event *ev)
{
- struct oc_message_s *msg;
+ struct oc_message *msg;
while (oc_buffer_outq || oc_buffer_inq) {
msg = oc_buffer_outq;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c7b8859/net/oic/src/api/oc_network_events.c
----------------------------------------------------------------------
diff --git a/net/oic/src/api/oc_network_events.c b/net/oic/src/api/oc_network_events.c
index fd5ba38..6f33189 100644
--- a/net/oic/src/api/oc_network_events.c
+++ b/net/oic/src/api/oc_network_events.c
@@ -33,7 +33,7 @@ static struct os_event oc_network_ev = {
static void
oc_network_ev_process(struct os_event *ev)
{
- struct oc_message_s *head;
+ struct oc_message *head;
oc_network_event_handler_mutex_lock();
while (1) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c7b8859/net/oic/src/port/mynewt/adaptor.h
----------------------------------------------------------------------
diff --git a/net/oic/src/port/mynewt/adaptor.h b/net/oic/src/port/mynewt/adaptor.h
index e9062e0..a40d2e8 100644
--- a/net/oic/src/port/mynewt/adaptor.h
+++ b/net/oic/src/port/mynewt/adaptor.h
@@ -27,29 +27,29 @@ extern "C" {
struct os_eventq *oc_evq_get(void);
void oc_evq_set(struct os_eventq *evq);
-struct oc_message_s;
+struct oc_message;
#if (MYNEWT_VAL(OC_TRANSPORT_IP) == 1)
int oc_connectivity_init_ip(void);
void oc_connectivity_shutdown_ip(void);
-void oc_send_buffer_ip(struct oc_message_s *message);
-void oc_send_buffer_ip_mcast(struct oc_message_s *message);
-struct oc_message_s *oc_attempt_rx_ip(void);
+void oc_send_buffer_ip(struct oc_message *message);
+void oc_send_buffer_ip_mcast(struct oc_message *message);
+struct oc_message *oc_attempt_rx_ip(void);
#endif
#if (MYNEWT_VAL(OC_TRANSPORT_GATT) == 1)
int oc_connectivity_init_gatt(void);
void oc_connectivity_shutdown_gatt(void);
-void oc_send_buffer_gatt(struct oc_message_s *message);
-void oc_send_buffer_gatt_mcast(struct oc_message_s *message);
-struct oc_message_s *oc_attempt_rx_gatt(void);
+void oc_send_buffer_gatt(struct oc_message *message);
+void oc_send_buffer_gatt_mcast(struct oc_message *message);
+struct oc_message *oc_attempt_rx_gatt(void);
#endif
#if (MYNEWT_VAL(OC_TRANSPORT_SERIAL) == 1)
int oc_connectivity_init_serial(void);
void oc_connectivity_shutdown_serial(void);
-void oc_send_buffer_serial(struct oc_message_s *message);
-struct oc_message_s *oc_attempt_rx_serial(void);
+void oc_send_buffer_serial(struct oc_message *message);
+struct oc_message *oc_attempt_rx_serial(void);
#endif
#ifdef __cplusplus
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c7b8859/net/oic/src/port/oc_connectivity.h
----------------------------------------------------------------------
diff --git a/net/oic/src/port/oc_connectivity.h b/net/oic/src/port/oc_connectivity.h
index 1380442..3f84541 100644
--- a/net/oic/src/port/oc_connectivity.h
+++ b/net/oic/src/port/oc_connectivity.h
@@ -26,37 +26,32 @@
extern "C" {
#endif
-typedef struct
-{
- uint16_t port;
- uint8_t address[16];
- uint8_t scope;
+typedef struct {
+ uint16_t port;
+ uint8_t address[16];
+ uint8_t scope;
} oc_ipv6_addr_t;
-typedef struct
-{
- uint8_t type;
- uint8_t address[6];
- uint16_t conn_handle;
+typedef struct {
+ uint8_t type;
+ uint8_t address[6];
+ uint16_t conn_handle;
} oc_le_addr_t;
-typedef struct
-{
- enum transport_flags
- {
- IP = 1 << 0,
- GATT = 1 << 1,
- IPSP = 1 << 2,
- MULTICAST = 1 << 3,
- SECURED = 1 << 4,
- SERIAL = 1 <<5,
- } flags;
-
- union
- {
- oc_ipv6_addr_t ipv6_addr;
- oc_le_addr_t bt_addr;
- };
+typedef struct oc_endpoint {
+ enum transport_flags {
+ IP = 1 << 0,
+ GATT = 1 << 1,
+ IPSP = 1 << 2,
+ MULTICAST = 1 << 3,
+ SECURED = 1 << 4,
+ SERIAL = 1 <<5,
+ } flags;
+
+ union {
+ oc_ipv6_addr_t ipv6_addr;
+ oc_le_addr_t bt_addr;
+ };
} oc_endpoint_t;
#define oc_make_ip_endpoint(__name__, __flags__, __port__, ...) \
@@ -64,13 +59,12 @@ typedef struct
.ipv6_addr = {.port = __port__, \
.address = { __VA_ARGS__ } } }
-typedef struct oc_message_s
-{
- struct oc_message_s *next;
- oc_endpoint_t endpoint;
- size_t length;
- uint8_t ref_count;
- uint8_t data[MAX_PAYLOAD_SIZE];
+typedef struct oc_message {
+ struct oc_message *next;
+ oc_endpoint_t endpoint;
+ size_t length;
+ uint8_t ref_count;
+ uint8_t data[MAX_PAYLOAD_SIZE];
} oc_message_t;
void oc_send_buffer(oc_message_t *message);