Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 7ace04b

Browse files
author
Tero Heinonen
authored
Initial commit for ws_bootstrap (ARMmbed#1556)
WS bootstrap files created.
1 parent 9e46cf9 commit 7ace04b

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

nanostack/net_interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ typedef enum {
166166
NET_6LOWPAN_ND_WITHOUT_MLE, /**< **UNSUPPORTED** */
167167
NET_6LOWPAN_ND_WITH_MLE, /**< 6LoWPAN ND with MLE. */
168168
NET_6LOWPAN_THREAD, /**< 6LoWPAN Thread with MLE attached. */
169+
NET_6LOWPAN_WS, /**< **TBD** */
169170
NET_6LOWPAN_ZIGBEE_IP /**< **UNSUPPORTED** */
170171
} net_6lowpan_mode_extension_e;
171172

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (c) 2018, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "nsconfig.h"
19+
#include "ns_types.h"
20+
#include "net_interface.h"
21+
#include "ns_trace.h"
22+
#include "eventOS_event.h"
23+
#include "NWK_INTERFACE/Include/protocol.h"
24+
25+
#include "ws_bootstrap.h"
26+
27+
#define TRACE_GROUP "wsbs"
28+
29+
static void ws_bootstrap_tasklet(arm_event_s *event)
30+
{
31+
ws_bootsrap_event_type_e event_type;
32+
event_type = (ws_bootsrap_event_type_e)event->event_type;
33+
34+
switch (event_type) {
35+
case WS_INIT_EVENT:
36+
tr_debug("WS tasklet init");
37+
break;
38+
default:
39+
break;
40+
}
41+
42+
}
43+
44+
static int ws_bootstrap_tasklet_init(protocol_interface_info_entry_t *cur)
45+
{
46+
if (cur->bootStrapId < 0) {
47+
cur->bootStrapId = eventOS_event_handler_create(&ws_bootstrap_tasklet, WS_INIT_EVENT);
48+
tr_debug("WS tasklet init");
49+
}
50+
51+
if (cur->bootStrapId < 0) {
52+
tr_error("tasklet init failed");
53+
return -1;
54+
}
55+
56+
return 0;
57+
}
58+
59+
int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
60+
{
61+
(void) bootstrap_mode;
62+
63+
protocol_interface_info_entry_t *cur;
64+
65+
cur = protocol_stack_interface_info_get_by_id(interface_id);
66+
if (!cur) {
67+
return -1;
68+
}
69+
70+
ws_bootstrap_tasklet_init(cur);
71+
72+
return 0;
73+
}

source/6LoWPAN/ws/ws_bootstrap.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2018, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef WS_BOOTSTRAP_H_
19+
#define WS_BOOTSTRAP_H_
20+
21+
22+
typedef enum {
23+
WS_INIT_EVENT = 0 /**< WS tasklet initializion event*/
24+
} ws_bootsrap_event_type_e;
25+
26+
27+
int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode);
28+
29+
#endif /* WS_BOOTSTRAP_H_ */

sources.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ SRCS += \
2020
source/6LoWPAN/NVM/nwk_nvm.c \
2121
source/6LoWPAN/ws/ws_llc_data_service.c \
2222
source/6LoWPAN/ws/ws_mpx_header.c \
23+
source/6LoWPAN/ws/ws_bootstrap.c \
2324
source/BorderRouter/border_router.c \
2425
source/Common_Protocols/icmpv6.c \
2526
source/Common_Protocols/icmpv6_prefix.c \

0 commit comments

Comments
 (0)