[2/2] incubator-mynewt-core git commit: wifi_mgmt; print usage on unrecognized command.
wifi_mgmt; print usage on unrecognized command. 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/66e1361d Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/66e1361d Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/66e1361d Branch: refs/heads/develop Commit: 66e1361db2aeb0af534941a6a268f95a95d6a6cb Parents: aed4343 Author: Marko KiiskilaAuthored: Fri Sep 16 18:19:08 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 18:20:45 2016 -0700 -- libs/wifi_mgmt/src/wifi_cli.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/66e1361d/libs/wifi_mgmt/src/wifi_cli.c -- diff --git a/libs/wifi_mgmt/src/wifi_cli.c b/libs/wifi_mgmt/src/wifi_cli.c index 4cd9552..0b5d852 100644 --- a/libs/wifi_mgmt/src/wifi_cli.c +++ b/libs/wifi_mgmt/src/wifi_cli.c @@ -34,8 +34,8 @@ wifi_cli(int argc, char **argv) struct wifi_if *wi; int i; -if (argc < 1) { -return 0; +if (argc < 2) { +goto usage; } wi = wifi_if_lookup(0); @@ -74,9 +74,12 @@ wifi_cli(int argc, char **argv) strcpy(wi->wi_ssid, argv[2]); if (wifi_connect(wi)) { conn_usage: -console_printf("%s %s [ []]\n", +console_printf("%s %s []\n", argv[0], argv[1]); } +} else { +usage: +console_printf("start|stop|scan|aps|connect []\n"); } return 0; }
[1/2] incubator-mynewt-core git commit: mn_socket; remove unused element from mn_itf.
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop aed4343e6 -> 9dca85e06 mn_socket; remove unused element from mn_itf. 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/9dca85e0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9dca85e0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9dca85e0 Branch: refs/heads/develop Commit: 9dca85e06bbbd43c0291fd30be33d6a11b12e3e7 Parents: 66e1361 Author: Marko KiiskilaAuthored: Fri Sep 16 18:20:04 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 18:20:45 2016 -0700 -- sys/mn_socket/include/mn_socket/mn_socket.h | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9dca85e0/sys/mn_socket/include/mn_socket/mn_socket.h -- diff --git a/sys/mn_socket/include/mn_socket/mn_socket.h b/sys/mn_socket/include/mn_socket/mn_socket.h index 3f7a3af..47c54fb 100644 --- a/sys/mn_socket/include/mn_socket/mn_socket.h +++ b/sys/mn_socket/include/mn_socket/mn_socket.h @@ -198,7 +198,6 @@ struct mn_itf { char mif_name[MN_ITF_NAME_MAX]; uint8_t mif_idx; uint8_t mif_flags; -uint8_t mif_addr_cnt; }; struct mn_itf_addr {
[2/2] incubator-mynewt-core git commit: MYNEWT-388: HCI uart should not assert if a command, event or ACL buffer not available
MYNEWT-388: HCI uart should not assert if a command, event or ACL buffer not available There were a number of changes committed to fix a few BLE HCI issues 1) On HCI sync loss, the controller will now send a HW error and wait to find a reset command in the byyte stream in order to re-sync. 2) If no ACL data buffer available, the ACL packet is skipped and a data buffer overflow event is sent. 3) If no command buffer is available, the current command is simply skipped. No response is sent in this case. The spec was not clear and since this should never happen we simply decided to skip the command. 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/aed4343e Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/aed4343e Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/aed4343e Branch: refs/heads/develop Commit: aed4343e6047a4c837b1db89ac4d6d9500ec8a41 Parents: 622b462 Author: William San FilippoAuthored: Fri Sep 16 16:39:43 2016 -0700 Committer: William San Filippo Committed: Fri Sep 16 16:43:46 2016 -0700 -- apps/blehci/src/main.c | 20 +- .../controller/include/controller/ble_ll.h | 13 + .../controller/include/controller/ble_ll_ctrl.h | 3 + net/nimble/controller/src/ble_ll.c | 53 +++ net/nimble/controller/src/ble_ll_hci_ev.c | 44 +++ net/nimble/include/nimble/ble.h | 4 + net/nimble/include/nimble/hci_common.h | 4 + .../uart/include/transport/uart/ble_hci_uart.h | 4 +- net/nimble/transport/uart/src/ble_hci_uart.c| 377 --- 9 files changed, 465 insertions(+), 57 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/aed4343e/apps/blehci/src/main.c -- diff --git a/apps/blehci/src/main.c b/apps/blehci/src/main.c index 0dd77e8..52aab99 100755 --- a/apps/blehci/src/main.c +++ b/apps/blehci/src/main.c @@ -23,6 +23,7 @@ /* BLE */ #include "nimble/ble.h" +#include "nimble/hci_common.h" #include "controller/ble_ll.h" #include "transport/uart/ble_hci_uart.h" @@ -41,8 +42,6 @@ uint8_t g_dev_addr[BLE_DEV_ADDR_LEN] = { 0 }; /* Our random address (in case we need it) */ uint8_t g_random_addr[BLE_DEV_ADDR_LEN] = { 0 }; -#define HCI_MAX_BUFS(5) - os_membuf_t default_mbuf_mpool_data[MBUF_MEMPOOL_SIZE]; struct os_mbuf_pool default_mbuf_pool; @@ -51,7 +50,7 @@ struct os_mempool default_mbuf_mpool; int main(void) { -const struct ble_hci_uart_cfg *hci_cfg; +struct ble_hci_uart_cfg hci_cfg; int rc; /* Initialize OS */ @@ -74,12 +73,19 @@ main(void) assert(rc == 0); /* Initialize the BLE LL */ -hci_cfg = _hci_uart_cfg_dflt; -rc = ble_ll_init(BLE_LL_TASK_PRI, hci_cfg->num_acl_bufs, - BLE_MBUF_PAYLOAD_SIZE); +hci_cfg = ble_hci_uart_cfg_dflt; +rc = ble_ll_init(BLE_LL_TASK_PRI, hci_cfg.num_acl_bufs, + BLE_MBUF_PAYLOAD_SIZE - BLE_HCI_DATA_HDR_SZ); assert(rc == 0); -rc = ble_hci_uart_init(hci_cfg); +/* + * XXX: for now, the developer MUST configure the number of msys buffers + * and not rely on the default value. The number of msys buffers must + * be >= to the number of pool elements registered to os_msys. In this + * project, we only register the default mbuf pool. + */ +hci_cfg.num_msys_bufs = MBUF_NUM_MBUFS; +rc = ble_hci_uart_init(_cfg); assert(rc == 0); /* Start the OS */ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/aed4343e/net/nimble/controller/include/controller/ble_ll.h -- diff --git a/net/nimble/controller/include/controller/ble_ll.h b/net/nimble/controller/include/controller/ble_ll.h index 7865cf8..ee4fe24 100644 --- a/net/nimble/controller/include/controller/ble_ll.h +++ b/net/nimble/controller/include/controller/ble_ll.h @@ -76,6 +76,12 @@ struct ble_ll_obj /* Packet transmit queue */ struct os_event ll_tx_pkt_ev; struct ble_ll_pkt_q ll_tx_pkt_q; + +/* Data buffer overflow event */ +struct os_event ll_dbuf_overflow_ev; + +/* HW error callout */ +struct os_callout_func ll_hw_err_timer; }; extern struct ble_ll_obj g_ble_ll_data; @@ -130,6 +136,7 @@ extern STATS_SECT_DECL(ble_ll_stats) ble_ll_stats; #define BLE_LL_EVENT_CONN_SPVN_TMO (OS_EVENT_T_PERUSER + 4) #define BLE_LL_EVENT_CONN_EV_END(OS_EVENT_T_PERUSER + 5) #define BLE_LL_EVENT_TX_PKT_IN (OS_EVENT_T_PERUSER + 6) +#define BLE_LL_EVENT_DBUF_OVERFLOW (OS_EVENT_T_PERUSER + 7) /* LL Features */ #define BLE_LL_FEAT_LE_ENCRYPTION (0x01) @@
[1/2] incubator-mynewt-core git commit: Add Apache License header. Not sure why this was omitted.
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 69b5ce5a1 -> aed4343e6 Add Apache License header. Not sure why this was omitted. 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/622b4622 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/622b4622 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/622b4622 Branch: refs/heads/develop Commit: 622b4622f0f35122868d151fa93586b1caf43ce4 Parents: 69b5ce5 Author: William San FilippoAuthored: Fri Sep 16 15:43:47 2016 -0700 Committer: William San Filippo Committed: Fri Sep 16 16:43:45 2016 -0700 -- net/nimble/transport/ram/src/ble_hci_ram.c | 19 +++ 1 file changed, 19 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/622b4622/net/nimble/transport/ram/src/ble_hci_ram.c -- diff --git a/net/nimble/transport/ram/src/ble_hci_ram.c b/net/nimble/transport/ram/src/ble_hci_ram.c index e3d236e..3a4ef54 100644 --- a/net/nimble/transport/ram/src/ble_hci_ram.c +++ b/net/nimble/transport/ram/src/ble_hci_ram.c @@ -1,3 +1,22 @@ +/** + * 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. + */ + #include #include #include
[2/2] incubator-mynewt-core git commit: MYNEWT-388: HCI uart should not assert if a command, event or ACL buffer not available
MYNEWT-388: HCI uart should not assert if a command, event or ACL buffer not available There were a number of changes committed to fix a few BLE HCI issues 1) On HCI sync loss, the controller will now send a HW error and wait to find a reset command in the byyte stream in order to re-sync. 2) If no ACL data buffer available, the ACL packet is skipped and a data buffer overflow event is sent. 3) If no command buffer is available, the current command is simply skipped. No response is sent in this case. The spec was not clear and since this should never happen we simply decided to skip the command. 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/473e050f Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/473e050f Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/473e050f Branch: refs/heads/master Commit: 473e050f7fde744ad198d9ce3234115fa5940750 Parents: dd79d93 Author: William San FilippoAuthored: Fri Sep 16 16:39:43 2016 -0700 Committer: William San Filippo Committed: Fri Sep 16 16:39:43 2016 -0700 -- apps/blehci/src/main.c | 20 +- .../controller/include/controller/ble_ll.h | 13 + .../controller/include/controller/ble_ll_ctrl.h | 3 + net/nimble/controller/src/ble_ll.c | 53 +++ net/nimble/controller/src/ble_ll_hci_ev.c | 44 +++ net/nimble/include/nimble/ble.h | 4 + net/nimble/include/nimble/hci_common.h | 4 + .../uart/include/transport/uart/ble_hci_uart.h | 4 +- net/nimble/transport/uart/src/ble_hci_uart.c| 377 --- 9 files changed, 465 insertions(+), 57 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/473e050f/apps/blehci/src/main.c -- diff --git a/apps/blehci/src/main.c b/apps/blehci/src/main.c index 0dd77e8..52aab99 100755 --- a/apps/blehci/src/main.c +++ b/apps/blehci/src/main.c @@ -23,6 +23,7 @@ /* BLE */ #include "nimble/ble.h" +#include "nimble/hci_common.h" #include "controller/ble_ll.h" #include "transport/uart/ble_hci_uart.h" @@ -41,8 +42,6 @@ uint8_t g_dev_addr[BLE_DEV_ADDR_LEN] = { 0 }; /* Our random address (in case we need it) */ uint8_t g_random_addr[BLE_DEV_ADDR_LEN] = { 0 }; -#define HCI_MAX_BUFS(5) - os_membuf_t default_mbuf_mpool_data[MBUF_MEMPOOL_SIZE]; struct os_mbuf_pool default_mbuf_pool; @@ -51,7 +50,7 @@ struct os_mempool default_mbuf_mpool; int main(void) { -const struct ble_hci_uart_cfg *hci_cfg; +struct ble_hci_uart_cfg hci_cfg; int rc; /* Initialize OS */ @@ -74,12 +73,19 @@ main(void) assert(rc == 0); /* Initialize the BLE LL */ -hci_cfg = _hci_uart_cfg_dflt; -rc = ble_ll_init(BLE_LL_TASK_PRI, hci_cfg->num_acl_bufs, - BLE_MBUF_PAYLOAD_SIZE); +hci_cfg = ble_hci_uart_cfg_dflt; +rc = ble_ll_init(BLE_LL_TASK_PRI, hci_cfg.num_acl_bufs, + BLE_MBUF_PAYLOAD_SIZE - BLE_HCI_DATA_HDR_SZ); assert(rc == 0); -rc = ble_hci_uart_init(hci_cfg); +/* + * XXX: for now, the developer MUST configure the number of msys buffers + * and not rely on the default value. The number of msys buffers must + * be >= to the number of pool elements registered to os_msys. In this + * project, we only register the default mbuf pool. + */ +hci_cfg.num_msys_bufs = MBUF_NUM_MBUFS; +rc = ble_hci_uart_init(_cfg); assert(rc == 0); /* Start the OS */ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/473e050f/net/nimble/controller/include/controller/ble_ll.h -- diff --git a/net/nimble/controller/include/controller/ble_ll.h b/net/nimble/controller/include/controller/ble_ll.h index 7865cf8..ee4fe24 100644 --- a/net/nimble/controller/include/controller/ble_ll.h +++ b/net/nimble/controller/include/controller/ble_ll.h @@ -76,6 +76,12 @@ struct ble_ll_obj /* Packet transmit queue */ struct os_event ll_tx_pkt_ev; struct ble_ll_pkt_q ll_tx_pkt_q; + +/* Data buffer overflow event */ +struct os_event ll_dbuf_overflow_ev; + +/* HW error callout */ +struct os_callout_func ll_hw_err_timer; }; extern struct ble_ll_obj g_ble_ll_data; @@ -130,6 +136,7 @@ extern STATS_SECT_DECL(ble_ll_stats) ble_ll_stats; #define BLE_LL_EVENT_CONN_SPVN_TMO (OS_EVENT_T_PERUSER + 4) #define BLE_LL_EVENT_CONN_EV_END(OS_EVENT_T_PERUSER + 5) #define BLE_LL_EVENT_TX_PKT_IN (OS_EVENT_T_PERUSER + 6) +#define BLE_LL_EVENT_DBUF_OVERFLOW (OS_EVENT_T_PERUSER + 7) /* LL Features */ #define BLE_LL_FEAT_LE_ENCRYPTION (0x01) @@
[1/2] incubator-mynewt-core git commit: Add Apache License header. Not sure why this was omitted.
Repository: incubator-mynewt-core Updated Branches: refs/heads/master 959b38915 -> 473e050f7 Add Apache License header. Not sure why this was omitted. 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/dd79d931 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/dd79d931 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/dd79d931 Branch: refs/heads/master Commit: dd79d9310ae84e9f7090ab09141f9916f2c2e102 Parents: 959b389 Author: William San FilippoAuthored: Fri Sep 16 15:43:47 2016 -0700 Committer: William San Filippo Committed: Fri Sep 16 15:43:47 2016 -0700 -- net/nimble/transport/ram/src/ble_hci_ram.c | 19 +++ 1 file changed, 19 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/dd79d931/net/nimble/transport/ram/src/ble_hci_ram.c -- diff --git a/net/nimble/transport/ram/src/ble_hci_ram.c b/net/nimble/transport/ram/src/ble_hci_ram.c index e3d236e..3a4ef54 100644 --- a/net/nimble/transport/ram/src/ble_hci_ram.c +++ b/net/nimble/transport/ram/src/ble_hci_ram.c @@ -1,3 +1,22 @@ +/** + * 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. + */ + #include #include #include
[4/4] incubator-mynewt-core git commit: mn_socket; wrong return code on error from mn_inet_pton().
mn_socket; wrong return code on error from mn_inet_pton(). 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/8084449d Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/8084449d Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/8084449d Branch: refs/heads/develop Commit: 8084449db7e1daffb94067098790733e5327a52a Parents: b71c9ea Author: Marko KiiskilaAuthored: Fri Sep 16 13:51:13 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 15:23:01 2016 -0700 -- sys/mn_socket/src/mn_socket_aconv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8084449d/sys/mn_socket/src/mn_socket_aconv.c -- diff --git a/sys/mn_socket/src/mn_socket_aconv.c b/sys/mn_socket/src/mn_socket_aconv.c index 1ca6010..7e48d65 100644 --- a/sys/mn_socket/src/mn_socket_aconv.c +++ b/sys/mn_socket/src/mn_socket_aconv.c @@ -53,7 +53,10 @@ mn_inet_pton(int af, const char *src, void *dst) } return 1; } else { -return MN_EAFNOSUPPORT; +/* + * Add code here. XXX + */ +return 0; } }
[2/4] incubator-mynewt-core git commit: mn_socket; add interface flag for multicast ability.
mn_socket; add interface flag for multicast ability. 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/097535b8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/097535b8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/097535b8 Branch: refs/heads/develop Commit: 097535b8e7e1831090b3d3f60b13437a9d473a09 Parents: 8084449 Author: Marko KiiskilaAuthored: Fri Sep 16 15:19:22 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 15:23:01 2016 -0700 -- sys/mn_socket/include/mn_socket/mn_socket.h | 1 + sys/mn_socket/src/arch/sim/native_itf.c | 3 +++ 2 files changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/097535b8/sys/mn_socket/include/mn_socket/mn_socket.h -- diff --git a/sys/mn_socket/include/mn_socket/mn_socket.h b/sys/mn_socket/include/mn_socket/mn_socket.h index 17ee35f..3f7a3af 100644 --- a/sys/mn_socket/include/mn_socket/mn_socket.h +++ b/sys/mn_socket/include/mn_socket/mn_socket.h @@ -192,6 +192,7 @@ const char *mn_inet_ntop(int af, const void *src, void *dst, int len); * Interface flags */ #define MN_ITF_F_UP1 +#define MN_ITF_F_MULTICAST 2 struct mn_itf { char mif_name[MN_ITF_NAME_MAX]; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/097535b8/sys/mn_socket/src/arch/sim/native_itf.c -- diff --git a/sys/mn_socket/src/arch/sim/native_itf.c b/sys/mn_socket/src/arch/sim/native_itf.c index 8f22f49..78607e7 100644 --- a/sys/mn_socket/src/arch/sim/native_itf.c +++ b/sys/mn_socket/src/arch/sim/native_itf.c @@ -37,6 +37,9 @@ itf_flags(int if_flags) if ((if_flags & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING)) { flags |= MN_ITF_F_UP; } +if (if_flags & IFF_MULTICAST) { +flags |= MN_ITF_F_MULTICAST; +} return flags; }
[3/4] incubator-mynewt-core git commit: mn_socket; linux does not have multicast enabled for loopback itf by default.
mn_socket; linux does not have multicast enabled for loopback itf by default. 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/8ab70737 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/8ab70737 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/8ab70737 Branch: refs/heads/develop Commit: 8ab70737e2987ff6614ebd19a62cbd7f8ac27ad3 Parents: 097535b Author: Marko KiiskilaAuthored: Fri Sep 16 15:20:16 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 15:23:01 2016 -0700 -- sys/mn_socket/src/test/mn_sock_test.c | 25 + 1 file changed, 9 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8ab70737/sys/mn_socket/src/test/mn_sock_test.c -- diff --git a/sys/mn_socket/src/test/mn_sock_test.c b/sys/mn_socket/src/test/mn_sock_test.c index d4276a3..7ab4c3b 100644 --- a/sys/mn_socket/src/test/mn_sock_test.c +++ b/sys/mn_socket/src/test/mn_sock_test.c @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -601,13 +602,9 @@ sock_udp_ll(void) } static int -sock_find_loopback_if(void) +sock_find_multicast_if(void) { struct mn_itf itf; -struct mn_itf_addr itf_addr; -struct mn_in_addr addr127; - -mn_inet_pton(MN_PF_INET, "127.0.0.1", ); memset(, 0, sizeof(itf)); @@ -615,15 +612,11 @@ sock_find_loopback_if(void) if (mn_itf_getnext()) { break; } -memset(_addr, 0, sizeof(itf_addr)); -while (1) { -if (mn_itf_addr_getnext(, _addr)) { -break; -} -if (itf_addr.mifa_family == MN_AF_INET && - !memcmp(_addr.mifa_addr, , sizeof(addr127))) { -return itf.mif_idx; -} +if ((itf.mif_flags & MN_ITF_F_UP) == 0) { +continue; +} +if (itf.mif_flags & MN_ITF_F_MULTICAST) { +return itf.mif_idx; } } return -1; @@ -649,7 +642,7 @@ sock_udp_mcast_v4(void) char data[] = "1234567890"; int rc; struct mn_mreq mreq; -loop_if_idx = sock_find_loopback_if(); +loop_if_idx = sock_find_multicast_if(); TEST_ASSERT(loop_if_idx > 0); msin.msin_family = MN_AF_INET; @@ -756,7 +749,7 @@ sock_udp_mcast_v6(void) 0, 0, 0, 2 }; -loop_if_idx = sock_find_loopback_if(); +loop_if_idx = sock_find_multicast_if(); TEST_ASSERT(loop_if_idx > 0); msin6.msin6_family = MN_AF_INET6;
[1/4] incubator-mynewt-core git commit: native sockets; supports running on linux..
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop b71c9eaaa -> 69b5ce5a1 native sockets; supports running on linux.. 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/69b5ce5a Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/69b5ce5a Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/69b5ce5a Branch: refs/heads/develop Commit: 69b5ce5a1e08652d2b8e0e925e6ee700162a758c Parents: 8ab7073 Author: Marko KiiskilaAuthored: Fri Sep 16 15:21:37 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 15:23:01 2016 -0700 -- sys/mn_socket/src/arch/sim/native_sock.c | 30 --- 1 file changed, 22 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/69b5ce5a/sys/mn_socket/src/arch/sim/native_sock.c -- diff --git a/sys/mn_socket/src/arch/sim/native_sock.c b/sys/mn_socket/src/arch/sim/native_sock.c index 64127f5..819120c 100644 --- a/sys/mn_socket/src/arch/sim/native_sock.c +++ b/sys/mn_socket/src/arch/sim/native_sock.c @@ -179,7 +179,8 @@ native_sock_err_to_mn_err(int err) } static int -native_sock_mn_addr_to_addr(struct mn_sockaddr *ms, struct sockaddr *sa) +native_sock_mn_addr_to_addr(struct mn_sockaddr *ms, struct sockaddr *sa, + int *sa_len) { struct sockaddr_in *sin = (struct sockaddr_in *)sa; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; @@ -189,17 +190,23 @@ native_sock_mn_addr_to_addr(struct mn_sockaddr *ms, struct sockaddr *sa) switch (ms->msa_family) { case MN_AF_INET: sin->sin_family = AF_INET; +#ifndef MN_LINUX sin->sin_len = sizeof(*sin); +#endif sin->sin_addr.s_addr = msin->msin_addr.s_addr; sin->sin_port = msin->msin_port; +*sa_len = sizeof(*sin); break; case MN_AF_INET6: sin6->sin6_family = AF_INET6; +#ifndef MN_LINUX sin6->sin6_len = sizeof(*sin6); +#endif sin6->sin6_port = msin6->msin6_port; sin6->sin6_flowinfo = msin6->msin6_flowinfo; memcpy(>sin6_addr, >msin6_addr, sizeof(msin6->msin6_addr)); sin6->sin6_scope_id = msin6->msin6_scope_id; +*sa_len = sizeof(*sin6); break; default: return MN_EPROTONOSUPPORT; @@ -208,7 +215,7 @@ native_sock_mn_addr_to_addr(struct mn_sockaddr *ms, struct sockaddr *sa) } static int -native_sock_addr_to_mn_addr( struct sockaddr *sa, struct mn_sockaddr *ms) +native_sock_addr_to_mn_addr(struct sockaddr *sa, struct mn_sockaddr *ms) { struct mn_sockaddr_in *msin = (struct mn_sockaddr_in *)ms; struct mn_sockaddr_in6 *msin6 = (struct mn_sockaddr_in6 *)ms; @@ -319,13 +326,14 @@ native_sock_connect(struct mn_socket *s, struct mn_sockaddr *addr) struct sockaddr_storage ss; struct sockaddr *sa = (struct sockaddr *) int rc; +int sa_len; -rc = native_sock_mn_addr_to_addr(addr, sa); +rc = native_sock_mn_addr_to_addr(addr, sa, _len); if (rc) { return rc; } os_mutex_pend(>mtx, OS_WAIT_FOREVER); -if (connect(ns->ns_fd, sa, sa->sa_len)) { +if (connect(ns->ns_fd, sa, sa_len)) { rc = errno; os_mutex_release(>mtx); return native_sock_err_to_mn_err(rc); @@ -345,9 +353,10 @@ native_sock_bind(struct mn_socket *s, struct mn_sockaddr *addr) struct sockaddr_storage ss; struct sockaddr *sa = (struct sockaddr *) int rc; +int sa_len; int val = 1; -rc = native_sock_mn_addr_to_addr(addr, sa); +rc = native_sock_mn_addr_to_addr(addr, sa, _len); if (rc) { return rc; } @@ -364,7 +373,7 @@ native_sock_bind(struct mn_socket *s, struct mn_sockaddr *addr) if (rc) { goto err; } -if (bind(ns->ns_fd, sa, sa->sa_len)) { +if (bind(ns->ns_fd, sa, sa_len)) { goto err; } if (ns->ns_type == SOCK_DGRAM) { @@ -455,11 +464,12 @@ native_sock_sendto(struct mn_socket *s, struct os_mbuf *m, struct sockaddr *sa = (struct sockaddr *) uint8_t tmpbuf[NATIVE_SOCK_MAX_UDP]; struct os_mbuf *o; +int sa_len; int off; int rc; if (ns->ns_type == SOCK_DGRAM) { -rc = native_sock_mn_addr_to_addr(addr, sa); +rc = native_sock_mn_addr_to_addr(addr, sa, _len); if (rc) { return rc; } @@ -471,7 +481,7 @@ native_sock_sendto(struct mn_socket *s, struct os_mbuf *m, os_mbuf_copydata(o, 0, o->om_len, [off]); off += o->om_len; } -rc = sendto(ns->ns_fd, tmpbuf, off, 0, sa, sa->sa_len); +rc = sendto(ns->ns_fd, tmpbuf, off, 0, sa, sa_len); if (rc != off) {
[1/2] incubator-mynewt-core git commit: change mode to executable for download scripts
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 7541bded5 -> b71c9eaaa change mode to executable for download scripts 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/d998235b Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d998235b Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d998235b Branch: refs/heads/develop Commit: d998235b4be779df39830470b3dba3ba60945b9e Parents: d11c52f Author: Sterling HughesAuthored: Fri Sep 16 14:51:10 2016 -0700 Committer: Sterling Hughes Committed: Fri Sep 16 14:51:10 2016 -0700 -- hw/bsp/stm32f4discovery/stm32f4discovery_debug.sh| 0 hw/bsp/stm32f4discovery/stm32f4discovery_download.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d998235b/hw/bsp/stm32f4discovery/stm32f4discovery_debug.sh -- diff --git a/hw/bsp/stm32f4discovery/stm32f4discovery_debug.sh b/hw/bsp/stm32f4discovery/stm32f4discovery_debug.sh old mode 100644 new mode 100755 http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d998235b/hw/bsp/stm32f4discovery/stm32f4discovery_download.sh -- diff --git a/hw/bsp/stm32f4discovery/stm32f4discovery_download.sh b/hw/bsp/stm32f4discovery/stm32f4discovery_download.sh old mode 100644 new mode 100755
[2/2] incubator-mynewt-core git commit: Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/incubator-mynewt-core into develop
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/incubator-mynewt-core into develop 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/b71c9eaa Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b71c9eaa Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b71c9eaa Branch: refs/heads/develop Commit: b71c9eaaa5b332112a0dcca8a0e1f874fdcaedd6 Parents: d998235 7541bde Author: Sterling HughesAuthored: Fri Sep 16 14:51:25 2016 -0700 Committer: Sterling Hughes Committed: Fri Sep 16 14:51:25 2016 -0700 -- apps/ocf_sample/pkg.yml | 36 +++ apps/ocf_sample/src/main.c | 198 +++ libs/iotivity/include/iotivity/oc_api.h | 6 +- libs/iotivity/include/iotivity/oc_buffer.h | 4 +- .../iotivity/include/iotivity/oc_client_state.h | 2 +- libs/iotivity/include/iotivity/oc_helpers.h | 4 +- .../include/iotivity/oc_network_events.h| 4 +- libs/iotivity/include/iotivity/oc_rep.h | 2 +- libs/iotivity/include/iotivity/oc_ri.h | 6 +- libs/iotivity/pkg.yml | 3 +- libs/iotivity/src/messaging/coap/coap.h | 10 +- libs/iotivity/src/messaging/coap/conf.h | 2 +- libs/iotivity/src/messaging/coap/observe.h | 4 +- libs/iotivity/src/messaging/coap/oc_coap.h | 2 +- libs/iotivity/src/messaging/coap/separate.h | 2 +- libs/iotivity/src/messaging/coap/transactions.h | 2 +- libs/iotivity/src/port/mynewt/ip_adaptor.c | 123 ++ libs/iotivity/src/port/oc_assert.h | 2 +- libs/iotivity/src/port/oc_clock.h | 2 +- libs/iotivity/src/port/oc_connectivity.h| 8 +- libs/iotivity/src/util/oc_process.h | 2 +- libs/iotivity/src/util/oc_timer.h | 2 +- sys/mn_socket/include/mn_socket/mn_socket.h | 24 +- sys/mn_socket/src/arch/sim/native_itf.c | 30 +++ sys/mn_socket/src/arch/sim/native_sock.c| 94 ++- sys/mn_socket/src/arch/sim/native_sock_priv.h | 1 + sys/mn_socket/src/test/mn_sock_test.c | 245 +++ 27 files changed, 738 insertions(+), 82 deletions(-) --
incubator-mynewt-core git commit: need to turn on c99 for iotivity
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 0ae2adf14 -> 7541bded5 need to turn on c99 for iotivity 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/7541bded Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/7541bded Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/7541bded Branch: refs/heads/develop Commit: 7541bded5722d82e99594ac89a8e314b78870037 Parents: 0ae2adf Author: Paul DietrichAuthored: Fri Sep 16 14:49:28 2016 -0700 Committer: Paul Dietrich Committed: Fri Sep 16 14:49:28 2016 -0700 -- libs/iotivity/pkg.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7541bded/libs/iotivity/pkg.yml -- diff --git a/libs/iotivity/pkg.yml b/libs/iotivity/pkg.yml index c4bf8b2..e5c95fb 100644 --- a/libs/iotivity/pkg.yml +++ b/libs/iotivity/pkg.yml @@ -29,7 +29,8 @@ pkg.deps: - "@apache-mynewt-core/sys/mn_socket" - "@apache-mynewt-core/sys/log" -pkg.cflags: -DDEBUG=1 +pkg.cflags: -std=c99 +-DDEBUG=1 -DSECURE=0 -I./port/mynewt -I../port/mynewt
incubator-mynewt-core git commit: fix codeing standards register for multicast on all interfaces `
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop d27f1f309 -> 0ae2adf14 fix codeing standards register for multicast on all interfaces ` 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/0ae2adf1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0ae2adf1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0ae2adf1 Branch: refs/heads/develop Commit: 0ae2adf148456e98c162a98b320ff35edd2faf88 Parents: d27f1f3 Author: Paul DietrichAuthored: Fri Sep 16 14:14:04 2016 -0700 Committer: Paul Dietrich Committed: Fri Sep 16 14:14:04 2016 -0700 -- libs/iotivity/src/port/mynewt/ip_adaptor.c | 54 - 1 file changed, 26 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0ae2adf1/libs/iotivity/src/port/mynewt/ip_adaptor.c -- diff --git a/libs/iotivity/src/port/mynewt/ip_adaptor.c b/libs/iotivity/src/port/mynewt/ip_adaptor.c index 494ae82..0b6fd1a 100644 --- a/libs/iotivity/src/port/mynewt/ip_adaptor.c +++ b/libs/iotivity/src/port/mynewt/ip_adaptor.c @@ -33,16 +33,12 @@ #endif #define COAP_PORT_UNSECURED (5683) +/* TODO use inet_pton when its available */ const struct mn_in6_addr coap_all_nodes_v6 = { .s_addr = {0xFF,0x02,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFD} }; -/* TODO these should be defined elsewhere but they are here as stubs */ -#define MN_SOL_SOCKET (0) -#define MN_SO_REUSEPORT (1) -#define MN_SO_REUSEADDR (2) - /* need a task to process OCF messages */ #define OC_NET_TASK_STACK_SIZE OS_STACK_ALIGN(300) #define OC_NET_TASK_PRIORITY(4) @@ -131,7 +127,7 @@ oc_attempt_rx(struct mn_socket * rxsock) { int rc; struct os_mbuf *m = NULL; struct os_mbuf_pkthdr *pkt; -oc_message_t *message; +oc_message_t *message = NULL; struct mn_sockaddr_in6 from; LOG_DEBUG(_log, LOG_MODULE_DEFAULT, "attempt rx from %u\n", rxsock); @@ -142,7 +138,7 @@ oc_attempt_rx(struct mn_socket * rxsock) { return NULL; } -if(!OS_MBUF_IS_PKTHDR(m)) { +if (!OS_MBUF_IS_PKTHDR(m)) { goto rx_attempt_err; } @@ -184,7 +180,7 @@ oc_attempt_rx(struct mn_socket * rxsock) { /* add the addr info to the message */ rx_attempt_err: -if(m) { +if (m) { os_mbuf_free_chain(m); } @@ -225,10 +221,9 @@ oc_socks_writable(void *cb_arg, int err) os_sem_release(_write_sem); } - void oc_task_handler(void *arg) { -while(1) { +while (1) { oc_message_t *pmsg; os_sem_pend(_read_sem, OS_TIMEOUT_NEVER); pmsg = oc_attempt_rx_ucast(); @@ -295,17 +290,19 @@ oc_connectivity_shutdown(void) } } - int oc_connectivity_init(void) { int rc; struct mn_sockaddr_in6 sin; +struct mn_itf itf; + +memset(, 0, sizeof(itf)); log_init(); cbmem_buf = malloc(sizeof(uint32_t) * MAX_CBMEM_BUF); -if(cbmem_buf == NULL) { +if (cbmem_buf == NULL) { return -1; } @@ -343,32 +340,33 @@ oc_connectivity_init(void) goto oc_connectivity_init_err; } -/* Set socket option to join multicast group */ -{ +/* Set socket option to join multicast group on all valid interfaces */ +while (1) { struct mn_mreq join; +rc = mn_itf_getnext(); +if (rc) { +break; +} + +if (0 == (itf.mif_flags & MN_ITF_F_UP)) { +continue; +} + join.mm_addr.v6 = coap_all_nodes_v6; -join.mm_idx = 1; +join.mm_idx = itf.mif_idx; join.mm_family = MN_AF_INET6; rc = mn_setsockopt(mcast, MN_SO_LEVEL, MN_MCAST_JOIN_GROUP, ); if (rc != 0) { -goto oc_connectivity_init_err; +LOG_ERROR(_log, LOG_MODULE_DEFAULT, + "Could not join multicast group on %s\n", itf.mif_name); +continue; } -} - -#if 0 -int reuse = 1; -rc = mn_setsockopt(mcast, MN_SOL_SOCKET, MN_SO_REUSEADDR, ); -if (rc != 0) { -goto oc_connectivity_init_err; -} -rc = mn_setsockopt(mcast, MN_SOL_SOCKET, MN_SO_REUSEPORT, ); -if (rc != 0) { -goto oc_connectivity_init_err; +LOG_INFO(_log, LOG_MODULE_DEFAULT, + "Joined Coap multicast grop on %s\n", itf.mif_name); } -#endif sin.msin6_port = htons(COAP_PORT_UNSECURED); rc = mn_bind(mcast, (struct mn_sockaddr *));
incubator-mynewt-site git commit: added instructions to handle gcc6 warnings in get_started.md
Repository: incubator-mynewt-site Updated Branches: refs/heads/asf-site 106051e2a -> c628be34d added instructions to handle gcc6 warnings in get_started.md Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/c628be34 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/c628be34 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/c628be34 Branch: refs/heads/asf-site Commit: c628be34d81b25b76140ae537d85bb9fa1430fcf Parents: 106051e Author: aditihilbertAuthored: Fri Sep 16 13:58:50 2016 -0700 Committer: aditihilbert Committed: Fri Sep 16 13:58:50 2016 -0700 -- develop/mkdocs/search_index.json | 4 ++-- develop/os/get_started/native_tools/index.html | 20 +--- develop/sitemap.xml| 20 ++-- latest/mkdocs/search_index.json| 4 ++-- latest/os/get_started/native_tools/index.html | 20 +--- latest/sitemap.xml | 20 ++-- mkdocs/search_index.json | 4 ++-- os/get_started/native_tools/index.html | 20 +--- sitemap.xml| 20 ++-- v0_9_0/mkdocs/search_index.json| 4 ++-- v0_9_0/os/get_started/native_tools/index.html | 20 +--- v0_9_0/sitemap.xml | 20 ++-- 12 files changed, 116 insertions(+), 60 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/c628be34/develop/mkdocs/search_index.json -- diff --git a/develop/mkdocs/search_index.json b/develop/mkdocs/search_index.json index b63a85a..1b735f4 100644 --- a/develop/mkdocs/search_index.json +++ b/develop/mkdocs/search_index.json @@ -182,7 +182,7 @@ }, { "location": "/os/get_started/native_tools/", -"text": "Installing Native Mynewt Tools\n\n\nThis page shows how to install tools for native Mynewt targets (simulated targets on your laptop/computer) without using a Docker container. In other words, it allows you to run Mynewt OS as a native application on your Mac or Linux machine to simulate a target and use the Newt tool running natively on your machine to manage the simulated target. It also allows you to run the test suites for all packages not requiring HW support. You may choose to do this instead of using the build toolchain and Newt tool available in a Docker container.\n\n\nThis page provides guidance for MAC and Linux. See the relevant sections below.\n\n\n\n\nSet up toolchain for Mac\n\n\nInstall Brew\n\n\nIf you have not already installed Homebrew from the \n\nnewt\n tutorials pages\n, install it. \n\n\n\n\nInstall gcc/libc\n\n\nOS X ships with a C compiler called Clang. To build applications for the Mynewt simulator with, a different compiler is used as default: gcc.\n\n\n$ brew install gcc\n...\n...\n==\n Summary\n\ud83c\udf7a /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M\n\n\n\n\n\n\n\nCheck the gcc version you have installed (either using brew or previously installed). If the gcc version is 6.1 rather the expected 5.x by the default .yml configuration file, you have to modify the \nmynewt-src-directory\n/repos/apache-mynewt-core/compiler/sim/compiler.yml\n file to change the default \ngcc v-5\n defined there.\n\n\nReplace the lines shown highlighted below:\n\n\n# OS X.\n\ncompiler.path.cc.DARWIN.OVERWRITE: \n/usr/local/bin/gcc-5\n\n\ncompiler.path.as.DARWIN.OVERWRITE: \n/usr/local/bin/gcc-5 -x assembler-with-cpp\n\n\ncompiler.path.objdump.DARWIN.OVERWRITE: \ngobjdump\n\ncompiler.path.objsize.DARWIN.OVERWRITE: \nobjsize\n\ncompiler.path.objcopy.DARWIN.OVERWRITE: \ngobjcopy\n\n\n\n\n\n\nwith the following:\n\n\ncompiler.path.cc.DARWIN.OVERWRITE: \n/usr/local/bin/gcc-6\n\ncompiler.path.as.DARWIN.OVERWRITE: \n/usr/local/bin/gcc-6 -x assembler-with-cpp\u201d\n\n\n\n\n\n\n\nIn case you wish to use Clang, you can change your \nmynewt-src-directory\n/repos/apache-mynewt-core/compiler/sim/compiler.yml\n to use Clang. Delete the gcc-5 DARWIN.OVERWRITE lines highlighted below.\n\n\n# OS X.\n\ncompiler.path.cc.DARWIN.OVERWRITE: \n/usr/local/bin/gcc-5\n\n\ncompiler.path.as.DARWIN.OVERWRITE: \n/usr/local/bin/gcc-5 -x assembler-with-cpp\n\n\ncompiler.path.objdump.DARWIN.OVERWRITE: \ngobjdump\n\ncompiler.path.objsize.DARWIN.OVERWRITE: \nobjsize\n\ncompiler.path.objcopy.DARWIN.OVERWRITE: \ngobjcopy\n\n\n\n\n\n\nNote:\n Both the newer gcc 6.x and Clang report a few warnings but they can be ignored.\n\n\n\n\nInstall gdb\n\n\n$ brew install
incubator-mynewt-site git commit: added instructions to handle gcc6 warnings in get_started.md
Repository: incubator-mynewt-site Updated Branches: refs/heads/master fb322da30 -> 0f60210ea added instructions to handle gcc6 warnings in get_started.md Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/0f60210e Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/0f60210e Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/0f60210e Branch: refs/heads/master Commit: 0f60210eacc6a01feb75ba48b8957d3c0ae7ce47 Parents: fb322da Author: aditihilbertAuthored: Fri Sep 16 13:51:50 2016 -0700 Committer: aditihilbert Committed: Fri Sep 16 13:53:44 2016 -0700 -- docs/os/get_started/native_tools.md | 27 +++ 1 file changed, 23 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0f60210e/docs/os/get_started/native_tools.md -- diff --git a/docs/os/get_started/native_tools.md b/docs/os/get_started/native_tools.md index 97a2665..282d919 100644 --- a/docs/os/get_started/native_tools.md +++ b/docs/os/get_started/native_tools.md @@ -29,9 +29,7 @@ $ brew install gcc -Check the gcc version you have installed (either using brew or previously installed). If the gcc version is 6.1 rather the expected 5.x by the default .yml configuration file, you have to modify the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file to change the default `gcc v-5` defined there. - -Replace the lines shown highlighted below: +Check the gcc version you have installed (either using brew or previously installed). The brew-installed version can be checked using `brew list gcc`. The default compiler.yml configuration file in Mynewt expects version 5.x for Mac users, so if the installed version is 6.x and you wish to continue with this newer version, modify the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file to change the default `gcc-5` defined there to `gcc-6`. In other words, replace the lines shown highlighted below: ```hl_lines="2 3" # OS X. @@ -61,7 +59,28 @@ compiler.path.objsize.DARWIN.OVERWRITE: "objsize" compiler.path.objcopy.DARWIN.OVERWRITE: "gobjcopy" ``` -**Note:** Both the newer gcc 6.x and Clang report a few warnings but they can be ignored. + + +**NOTE:** Both the newer gcc 6.x and Clang report a few warnings but they can be ignored. + + + +**FURTHER NOTE:** Mynewt developers mostly use gcc 5.x for sim builds; so it may take a little while to fix issues reported by the newer compiler. One option is to **disable warnings**. To do that, remove the `-Werror` flag as an option for the compiler in the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file as shown below. + +```hl_lines="2" +compiler.flags.base: > +-m32 -Wall -ggdb +``` + +You may alternatively choose to **specify the precise warnings to ignore** depending on the error thrown by the compiler. For example, if you see a `[-Werror=misleading-indentation]` error while building the sim image, add `-Wno-misleading-indentation]` as a compiler flag in the same line from the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file. + +```hl_lines="2" +compiler.flags.base: > +-m32 -Wall -Werror -ggdb -Wno-misleading-indentation +``` + + +A third option is to simply **downgrade to gcc 5.x**.
incubator-mynewt-site git commit: added instructions to handle gcc6 warnings in get_started.md
Repository: incubator-mynewt-site Updated Branches: refs/heads/v0_9_0 7fb86da92 -> e4e2803c5 added instructions to handle gcc6 warnings in get_started.md Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/e4e2803c Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/e4e2803c Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/e4e2803c Branch: refs/heads/v0_9_0 Commit: e4e2803c52bd1b6d690aee447cb5fa300cc8f90f Parents: 7fb86da Author: aditihilbertAuthored: Fri Sep 16 13:51:50 2016 -0700 Committer: aditihilbert Committed: Fri Sep 16 13:52:59 2016 -0700 -- docs/os/get_started/native_tools.md | 27 +++ 1 file changed, 23 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/e4e2803c/docs/os/get_started/native_tools.md -- diff --git a/docs/os/get_started/native_tools.md b/docs/os/get_started/native_tools.md index 97a2665..282d919 100644 --- a/docs/os/get_started/native_tools.md +++ b/docs/os/get_started/native_tools.md @@ -29,9 +29,7 @@ $ brew install gcc -Check the gcc version you have installed (either using brew or previously installed). If the gcc version is 6.1 rather the expected 5.x by the default .yml configuration file, you have to modify the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file to change the default `gcc v-5` defined there. - -Replace the lines shown highlighted below: +Check the gcc version you have installed (either using brew or previously installed). The brew-installed version can be checked using `brew list gcc`. The default compiler.yml configuration file in Mynewt expects version 5.x for Mac users, so if the installed version is 6.x and you wish to continue with this newer version, modify the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file to change the default `gcc-5` defined there to `gcc-6`. In other words, replace the lines shown highlighted below: ```hl_lines="2 3" # OS X. @@ -61,7 +59,28 @@ compiler.path.objsize.DARWIN.OVERWRITE: "objsize" compiler.path.objcopy.DARWIN.OVERWRITE: "gobjcopy" ``` -**Note:** Both the newer gcc 6.x and Clang report a few warnings but they can be ignored. + + +**NOTE:** Both the newer gcc 6.x and Clang report a few warnings but they can be ignored. + + + +**FURTHER NOTE:** Mynewt developers mostly use gcc 5.x for sim builds; so it may take a little while to fix issues reported by the newer compiler. One option is to **disable warnings**. To do that, remove the `-Werror` flag as an option for the compiler in the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file as shown below. + +```hl_lines="2" +compiler.flags.base: > +-m32 -Wall -ggdb +``` + +You may alternatively choose to **specify the precise warnings to ignore** depending on the error thrown by the compiler. For example, if you see a `[-Werror=misleading-indentation]` error while building the sim image, add `-Wno-misleading-indentation]` as a compiler flag in the same line from the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file. + +```hl_lines="2" +compiler.flags.base: > +-m32 -Wall -Werror -ggdb -Wno-misleading-indentation +``` + + +A third option is to simply **downgrade to gcc 5.x**.
incubator-mynewt-site git commit: added instructions to handle gcc6 warnings in get_started.md
Repository: incubator-mynewt-site Updated Branches: refs/heads/develop 09fe1db4b -> fa759882c added instructions to handle gcc6 warnings in get_started.md Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/fa759882 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/fa759882 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/fa759882 Branch: refs/heads/develop Commit: fa759882c54af3fec38e69aec3025358ab871433 Parents: 09fe1db Author: aditihilbertAuthored: Fri Sep 16 13:51:50 2016 -0700 Committer: aditihilbert Committed: Fri Sep 16 13:51:50 2016 -0700 -- docs/os/get_started/native_tools.md | 27 +++ 1 file changed, 23 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/fa759882/docs/os/get_started/native_tools.md -- diff --git a/docs/os/get_started/native_tools.md b/docs/os/get_started/native_tools.md index 97a2665..282d919 100644 --- a/docs/os/get_started/native_tools.md +++ b/docs/os/get_started/native_tools.md @@ -29,9 +29,7 @@ $ brew install gcc -Check the gcc version you have installed (either using brew or previously installed). If the gcc version is 6.1 rather the expected 5.x by the default .yml configuration file, you have to modify the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file to change the default `gcc v-5` defined there. - -Replace the lines shown highlighted below: +Check the gcc version you have installed (either using brew or previously installed). The brew-installed version can be checked using `brew list gcc`. The default compiler.yml configuration file in Mynewt expects version 5.x for Mac users, so if the installed version is 6.x and you wish to continue with this newer version, modify the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file to change the default `gcc-5` defined there to `gcc-6`. In other words, replace the lines shown highlighted below: ```hl_lines="2 3" # OS X. @@ -61,7 +59,28 @@ compiler.path.objsize.DARWIN.OVERWRITE: "objsize" compiler.path.objcopy.DARWIN.OVERWRITE: "gobjcopy" ``` -**Note:** Both the newer gcc 6.x and Clang report a few warnings but they can be ignored. + + +**NOTE:** Both the newer gcc 6.x and Clang report a few warnings but they can be ignored. + + + +**FURTHER NOTE:** Mynewt developers mostly use gcc 5.x for sim builds; so it may take a little while to fix issues reported by the newer compiler. One option is to **disable warnings**. To do that, remove the `-Werror` flag as an option for the compiler in the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file as shown below. + +```hl_lines="2" +compiler.flags.base: > +-m32 -Wall -ggdb +``` + +You may alternatively choose to **specify the precise warnings to ignore** depending on the error thrown by the compiler. For example, if you see a `[-Werror=misleading-indentation]` error while building the sim image, add `-Wno-misleading-indentation]` as a compiler flag in the same line from the `/repos/apache-mynewt-core/compiler/sim/compiler.yml` file. + +```hl_lines="2" +compiler.flags.base: > +-m32 -Wall -Werror -ggdb -Wno-misleading-indentation +``` + + +A third option is to simply **downgrade to gcc 5.x**.
incubator-mynewt-core git commit: basic test app working with the iotivity client that builds with their constrained github repo
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop b359382d5 -> d27f1f309 basic test app working with the iotivity client that builds with their constrained github repo 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/d27f1f30 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d27f1f30 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d27f1f30 Branch: refs/heads/develop Commit: d27f1f3095f34bb1b9261ea425db4e87c0e548af Parents: b359382 Author: Paul DietrichAuthored: Fri Sep 16 10:36:53 2016 -0700 Committer: Paul Dietrich Committed: Fri Sep 16 13:41:36 2016 -0700 -- apps/ocf_sample/pkg.yml | 36 apps/ocf_sample/src/main.c | 198 +++ libs/iotivity/include/iotivity/oc_api.h | 6 +- libs/iotivity/include/iotivity/oc_buffer.h | 4 +- .../iotivity/include/iotivity/oc_client_state.h | 2 +- libs/iotivity/include/iotivity/oc_helpers.h | 4 +- .../include/iotivity/oc_network_events.h| 4 +- libs/iotivity/include/iotivity/oc_rep.h | 2 +- libs/iotivity/include/iotivity/oc_ri.h | 6 +- libs/iotivity/src/messaging/coap/coap.h | 10 +- libs/iotivity/src/messaging/coap/conf.h | 2 +- libs/iotivity/src/messaging/coap/observe.h | 4 +- libs/iotivity/src/messaging/coap/oc_coap.h | 2 +- libs/iotivity/src/messaging/coap/separate.h | 2 +- libs/iotivity/src/messaging/coap/transactions.h | 2 +- libs/iotivity/src/port/mynewt/ip_adaptor.c | 87 +--- libs/iotivity/src/port/oc_assert.h | 2 +- libs/iotivity/src/port/oc_clock.h | 2 +- libs/iotivity/src/port/oc_connectivity.h| 8 +- libs/iotivity/src/util/oc_process.h | 2 +- libs/iotivity/src/util/oc_timer.h | 2 +- 21 files changed, 329 insertions(+), 58 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d27f1f30/apps/ocf_sample/pkg.yml -- diff --git a/apps/ocf_sample/pkg.yml b/apps/ocf_sample/pkg.yml new file mode 100644 index 000..32c96f2 --- /dev/null +++ b/apps/ocf_sample/pkg.yml @@ -0,0 +1,36 @@ +# +# 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: apps/ocf_sample +pkg.type: app +pkg.description: Example application which uses OCF iotivity. +pkg.author: "Apache Mynewt " +pkg.homepage: "http://mynewt.apache.org/; +pkg.keywords: + +pkg.deps: +- libs/console/full +- libs/os +- libs/shell +- libs/util +- sys/log +- libs/iotivity + +# this tells the library that you intend to suppor the server functionality +pkg.cflags: -DOC_SERVER \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d27f1f30/apps/ocf_sample/src/main.c -- diff --git a/apps/ocf_sample/src/main.c b/apps/ocf_sample/src/main.c new file mode 100644 index 000..4d90495 --- /dev/null +++ b/apps/ocf_sample/src/main.c @@ -0,0 +1,198 @@ +/** + * 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
incubator-mynewt-core git commit: native sock; more error code mappings.
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 715394c2b -> b359382d5 native sock; more error code mappings. 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/b359382d Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b359382d Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b359382d Branch: refs/heads/develop Commit: b359382d5442867b71f2a861bb98077b9dba9c69 Parents: 715394c Author: Marko KiiskilaAuthored: Fri Sep 16 12:02:35 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 12:02:35 2016 -0700 -- sys/mn_socket/src/arch/sim/native_sock.c | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b359382d/sys/mn_socket/src/arch/sim/native_sock.c -- diff --git a/sys/mn_socket/src/arch/sim/native_sock.c b/sys/mn_socket/src/arch/sim/native_sock.c index e411f6e..64127f5 100644 --- a/sys/mn_socket/src/arch/sim/native_sock.c +++ b/sys/mn_socket/src/arch/sim/native_sock.c @@ -160,6 +160,13 @@ native_sock_err_to_mn_err(int err) switch (err) { case 0: return 0; +case EAGAIN: +case EINPROGRESS: +return MN_EAGAIN; +case ENOTCONN: +return MN_ENOTCONN; +case ETIMEDOUT: +return MN_ETIMEDOUT; case ENOMEM: return MN_ENOBUFS; case EADDRINUSE:
incubator-mynewt-core git commit: mn_socket; add test for v6 UDP multicast.
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop a2c715065 -> 715394c2b mn_socket; add test for v6 UDP multicast. 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/715394c2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/715394c2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/715394c2 Branch: refs/heads/develop Commit: 715394c2ba6ff154c48a89a5dde0add2b2866080 Parents: a2c7150 Author: Marko KiiskilaAuthored: Fri Sep 16 11:47:01 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 11:47:01 2016 -0700 -- sys/mn_socket/src/test/mn_sock_test.c | 109 + 1 file changed, 109 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/715394c2/sys/mn_socket/src/test/mn_sock_test.c -- diff --git a/sys/mn_socket/src/test/mn_sock_test.c b/sys/mn_socket/src/test/mn_sock_test.c index 1d68f7b..d4276a3 100644 --- a/sys/mn_socket/src/test/mn_sock_test.c +++ b/sys/mn_socket/src/test/mn_sock_test.c @@ -735,6 +735,114 @@ sock_udp_mcast_v4(void) mn_close(tx_sock); } +static void +sock_udp_mcast_v6(void) +{ +int loop_if_idx; +struct mn_socket *rx_sock; +struct mn_socket *tx_sock; +struct mn_sockaddr_in6 msin6; +union mn_socket_cb sock_cbs = { +.socket.readable = sum4_readable +}; +struct os_mbuf *m; +char data[] = "1234567890"; +int rc; +struct mn_mreq mreq; +uint8_t mcast_addr[16] = { +0xff, 2, 0, 0, +0, 0, 0, 0, +0, 0, 0, 0, +0, 0, 0, 2 +}; + +loop_if_idx = sock_find_loopback_if(); +TEST_ASSERT(loop_if_idx > 0); + +msin6.msin6_family = MN_AF_INET6; +msin6.msin6_len = sizeof(msin6); +msin6.msin6_port = htons(44344); +memset(_addr, 0, sizeof(msin6.msin6_addr)); + +rc = mn_socket(_sock, MN_PF_INET6, MN_SOCK_DGRAM, 0); +TEST_ASSERT(rc == 0); +mn_socket_set_cbs(rx_sock, NULL, _cbs); + +rc = mn_bind(rx_sock, (struct mn_sockaddr *)); +TEST_ASSERT(rc == 0); + +rc = mn_socket(_sock, MN_PF_INET6, MN_SOCK_DGRAM, 0); +TEST_ASSERT(rc == 0); + +rc = mn_setsockopt(tx_sock, MN_SO_LEVEL, MN_MCAST_IF, _if_idx); +TEST_ASSERT(rc == 0); + +m = os_msys_get(sizeof(data), 0); +rc = os_mbuf_copyinto(m, 0, data, sizeof(data)); +TEST_ASSERT(rc == 0); + +/* + * multicast tgt + */ +memcpy(_addr, mcast_addr, sizeof(mcast_addr)); + +rc = mn_sendto(tx_sock, (struct os_mbuf *)m, (struct mn_sockaddr *)); +TEST_ASSERT(rc == 0); + +/* + * RX socket has not joined group yet. + */ +rc = os_sem_pend(_sem, OS_TICKS_PER_SEC / 2); +TEST_ASSERT(rc == OS_TIMEOUT); + +mreq.mm_idx = loop_if_idx; +mreq.mm_family = MN_AF_INET6; +memcpy(_addr.v6.s_addr, msin6.msin6_addr.s_addr, + sizeof(msin6.msin6_addr.s_addr)); + +/* + * Now join it. + */ +rc = mn_setsockopt(rx_sock, MN_SO_LEVEL, MN_MCAST_JOIN_GROUP, ); +TEST_ASSERT(rc == 0); + +m = os_msys_get(sizeof(data), 0); +rc = os_mbuf_copyinto(m, 0, data, sizeof(data)); +TEST_ASSERT(rc == 0); + +rc = mn_sendto(tx_sock, (struct os_mbuf *)m, (struct mn_sockaddr *)); +TEST_ASSERT(rc == 0); + +rc = os_sem_pend(_sem, OS_TICKS_PER_SEC); +TEST_ASSERT(rc == 0); + +rc = mn_recvfrom(rx_sock, , NULL); +TEST_ASSERT(rc == 0); +TEST_ASSERT(m != NULL); +TEST_ASSERT(!memcmp(m->om_data, data, sizeof(data))); +os_mbuf_free_chain(m); + +/* + * Then leave + */ +rc = mn_setsockopt(rx_sock, MN_SO_LEVEL, MN_MCAST_LEAVE_GROUP, ); +TEST_ASSERT(rc == 0); + +m = os_msys_get(sizeof(data), 0); +TEST_ASSERT(m); +rc = os_mbuf_copyinto(m, 0, data, sizeof(data)); +TEST_ASSERT(rc == 0); + +rc = mn_sendto(tx_sock, (struct os_mbuf *)m, (struct mn_sockaddr *)); +TEST_ASSERT(rc == 0); + +rc = os_sem_pend(_sem, OS_TICKS_PER_SEC); +TEST_ASSERT(rc == OS_TIMEOUT); + +mn_close(rx_sock); +mn_close(tx_sock); +} + void mn_socket_test_handler(void *arg) { @@ -746,6 +854,7 @@ mn_socket_test_handler(void *arg) sock_itf_list(); sock_udp_ll(); sock_udp_mcast_v4(); +sock_udp_mcast_v6(); os_test_restart(); }
incubator-mynewt-core git commit: mn_socket/native; multicast support.
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop d11c52fca -> a2c715065 mn_socket/native; multicast support. 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/a2c71506 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a2c71506 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a2c71506 Branch: refs/heads/develop Commit: a2c71506504abf8f05e3730ba69f4024432cd6dd Parents: d11c52f Author: Marko KiiskilaAuthored: Fri Sep 16 10:45:42 2016 -0700 Committer: Marko Kiiskila Committed: Fri Sep 16 10:45:42 2016 -0700 -- sys/mn_socket/include/mn_socket/mn_socket.h | 24 +++- sys/mn_socket/src/arch/sim/native_itf.c | 30 + sys/mn_socket/src/arch/sim/native_sock.c | 87 - sys/mn_socket/src/arch/sim/native_sock_priv.h | 1 + sys/mn_socket/src/test/mn_sock_test.c | 136 + 5 files changed, 274 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a2c71506/sys/mn_socket/include/mn_socket/mn_socket.h -- diff --git a/sys/mn_socket/include/mn_socket/mn_socket.h b/sys/mn_socket/include/mn_socket/mn_socket.h index bcbe34f..17ee35f 100644 --- a/sys/mn_socket/include/mn_socket/mn_socket.h +++ b/sys/mn_socket/include/mn_socket/mn_socket.h @@ -49,16 +49,16 @@ #define MN_ETIMEDOUT9 #define MN_EAGAIN 10 #define MN_EUNKNOWN 11 +#define MN_EADDRNOTAVAIL12 /* * Multicast macros */ #define MN_IN_MULTICAST(a) \ -(((a) & 0xf000) == 0xe000) +uint32_t)(a)) & 0xf000) == 0xe000) -/* notyet */ #define MN_IN6_IS_ADDR_MULTICAST(a) \ -0 +((a)->s_addr[0] == 0xff) struct mn_socket; struct mn_socket_ops; @@ -118,6 +118,24 @@ struct mn_sockaddr_in6 { extern const uint32_t nm_in6addr_any[4]; /* + * Structure for multicast join/leave + */ +struct mn_mreq { +uint8_t mm_idx;/* interface index */ +uint8_t mm_family; /* address family */ +union { +struct mn_in_addr v4; +struct mn_in6_addr v6; +} mm_addr; +}; + +#define MN_SO_LEVEL 0xfe + +#define MN_MCAST_JOIN_GROUP 1 +#define MN_MCAST_LEAVE_GROUP2 +#define MN_MCAST_IF 3 + +/* * Socket calls. * * mn_connect() for TCP is asynchronous. Once connection has been established, http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a2c71506/sys/mn_socket/src/arch/sim/native_itf.c -- diff --git a/sys/mn_socket/src/arch/sim/native_itf.c b/sys/mn_socket/src/arch/sim/native_itf.c index 09318b3..8f22f49 100644 --- a/sys/mn_socket/src/arch/sim/native_itf.c +++ b/sys/mn_socket/src/arch/sim/native_itf.c @@ -106,6 +106,36 @@ plen(void *addr, int alen) } int +native_sock_itf_addr(int idx, uint32_t *addr) +{ +struct ifaddrs *ifap; +struct ifaddrs *ifa; +struct sockaddr_in *sin; +int rc; + +rc = getifaddrs(); +if (rc < 0) { +rc = native_sock_err_to_mn_err(errno); +return rc; +} + +rc = MN_EADDRNOTAVAIL; +for (ifa = ifap; ifa; ifa = ifa->ifa_next) { +if (if_nametoindex(ifa->ifa_name) != idx) { +continue; +} +if (ifa->ifa_addr->sa_family == AF_INET) { +sin = (struct sockaddr_in *)ifa->ifa_addr; +*addr = sin->sin_addr.s_addr; +rc = 0; +break; +} +} +freeifaddrs(ifap); +return rc; +} + +int native_sock_itf_addr_getnext(struct mn_itf *mi, struct mn_itf_addr *mia) { struct ifaddrs *ifap; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a2c71506/sys/mn_socket/src/arch/sim/native_sock.c -- diff --git a/sys/mn_socket/src/arch/sim/native_sock.c b/sys/mn_socket/src/arch/sim/native_sock.c index 73ca6c7..e411f6e 100644 --- a/sys/mn_socket/src/arch/sim/native_sock.c +++ b/sys/mn_socket/src/arch/sim/native_sock.c @@ -51,6 +51,11 @@ static int native_sock_sendto(struct mn_socket *, struct os_mbuf *, struct mn_sockaddr *); static int native_sock_recvfrom(struct mn_socket *, struct os_mbuf **, struct mn_sockaddr *); +static int native_sock_getsockopt(struct mn_socket *, uint8_t level, + uint8_t name, void *val); +static int native_sock_setsockopt(struct mn_socket *, uint8_t level, + uint8_t name, void *val); + static int native_sock_getsockname(struct mn_socket *,