|
26 | 26 | #include "6LoWPAN/Bootstraps/protocol_6lowpan_interface.h"
|
27 | 27 | #include "6LoWPAN/MAC/mac_helper.h"
|
28 | 28 | #include "6LoWPAN/MAC/mac_data_poll.h"
|
| 29 | +#include "6LoWPAN/MAC/mpx_api.h" |
29 | 30 | #include "6LoWPAN/ws/ws_common.h"
|
30 | 31 | #include "6LoWPAN/ws/ws_bootstrap.h"
|
31 | 32 | #include "RPL/rpl_control.h"
|
32 | 33 | #include "RPL/rpl_data.h"
|
33 | 34 | #include "Common_Protocols/icmpv6.h"
|
34 | 35 | #include "Common_Protocols/icmpv6_radv.h"
|
| 36 | +#include "6LoWPAN/ws/ws_common_defines.h" |
| 37 | +#include "6LoWPAN/ws/ws_llc.h" |
| 38 | +#include "6LoWPAN/lowpan_adaptation_interface.h" |
35 | 39 |
|
36 | 40 | #include "net_rpl.h"
|
37 | 41 | #include "mac_api.h"
|
@@ -111,6 +115,7 @@ static int8_t ws_bootstrap_down(protocol_interface_info_entry_t *cur)
|
111 | 115 |
|
112 | 116 | // Reset WS information
|
113 | 117 | // ws_common_reset(cur)
|
| 118 | + ws_llc_reset(cur); |
114 | 119 |
|
115 | 120 | return nwk_6lowpan_down(cur);
|
116 | 121 | }
|
@@ -147,6 +152,32 @@ void ws_bootstrap_configuration_reset(protocol_interface_info_entry_t *cur)
|
147 | 152 | return;
|
148 | 153 | }
|
149 | 154 |
|
| 155 | +static void ws_bootstrap_asynch_ind(struct protocol_interface_info_entry *interface, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type) |
| 156 | +{ |
| 157 | + (void)interface; |
| 158 | + (void)data; |
| 159 | + (void)ie_ext; |
| 160 | + |
| 161 | + switch (message_type) { |
| 162 | + case WS_FT_PAN_ADVERT: |
| 163 | + break; |
| 164 | + case WS_FT_PAN_ADVERT_SOL: |
| 165 | + break; |
| 166 | + case WS_FT_PAN_CONF: |
| 167 | + break; |
| 168 | + case WS_FT_PAN_CONF_SOL: |
| 169 | + break; |
| 170 | + default: |
| 171 | + break; |
| 172 | + } |
| 173 | +} |
| 174 | + |
| 175 | +static void ws_bootstrap_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message) |
| 176 | +{ |
| 177 | + (void)interface; |
| 178 | + (void)asynch_message; |
| 179 | +} |
| 180 | + |
150 | 181 | int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
|
151 | 182 | {
|
152 | 183 | (void) bootstrap_mode;
|
@@ -182,13 +213,30 @@ int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
|
182 | 213 | default:
|
183 | 214 | return -3;
|
184 | 215 | }
|
| 216 | + //Disable allways by default |
| 217 | + lowpan_adaptation_interface_mpx_register(interface_id, NULL, 0); |
| 218 | + |
| 219 | + ws_llc_create(cur, &ws_bootstrap_asynch_ind, &ws_bootstrap_asynch_confirm); |
185 | 220 |
|
| 221 | + mpx_api_t *mpx_api = ws_llc_mpx_api_get(cur); |
| 222 | + if (!mpx_api) { |
| 223 | + ws_llc_delete(cur); |
| 224 | + return -4; |
| 225 | + } |
186 | 226 |
|
187 | 227 | if (ws_common_allocate_and_init(cur) < 0) {
|
| 228 | + ws_llc_delete(cur); |
188 | 229 | return -4;
|
189 | 230 | }
|
190 | 231 |
|
191 | 232 | if (ws_bootstrap_tasklet_init(cur) != 0) {
|
| 233 | + ws_llc_delete(cur); |
| 234 | + return -4; |
| 235 | + } |
| 236 | + |
| 237 | + //Register MPXUser to adapatation layer |
| 238 | + if (lowpan_adaptation_interface_mpx_register(interface_id, mpx_api, MPX_LOWPAN_ENC_USER_ID) != 0) { |
| 239 | + ws_llc_delete(cur); |
192 | 240 | return -4;
|
193 | 241 | }
|
194 | 242 |
|
|
0 commit comments