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

Commit 2531c49

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
WS LLC and MAC MPX API definition and IE types definition.
Define MPX API and WS LLC configure and Asynch data API.
1 parent 7237796 commit 2531c49

File tree

3 files changed

+278
-0
lines changed

3 files changed

+278
-0
lines changed

source/6LoWPAN/MAC/mpx_api.h

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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 MPX_API_H_
19+
#define MPX_API_H_
20+
21+
struct mcps_data_req_s;
22+
struct mcps_data_conf_s;
23+
struct mcps_data_ind_s;
24+
struct mcps_purge_s;
25+
26+
typedef struct mpx_api_s mpx_api_t;
27+
28+
/**
29+
* @brief mpx_data_request MPX_DATA request with user ID
30+
* @param api API to handle the request
31+
* @param data MCPS-DATA.request specific values
32+
* @param user_id MPX user ID
33+
*
34+
*/
35+
typedef void mpx_data_request(const mpx_api_t *api, const struct mcps_data_req_s *data, uint16_t user_id);
36+
37+
/**
38+
* @brief mpx_data_queue_clean clean MPX user data
39+
* @param api API to handle the request
40+
* @param purge MCPS-purge request
41+
* @param user_id MPX user ID
42+
*
43+
*/
44+
typedef void mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);
45+
46+
/**
47+
* @brief mpx_data_confirm MPX-DATA confirm is called as a response to MPX-DATA request
48+
* @param api The API which handled the response
49+
* @param data MCPS-DATA.confirm specific values
50+
* @param user_id MPX user ID
51+
*/
52+
typedef void mpx_data_confirm(const mpx_api_t* api, const struct mcps_data_conf_s *data);
53+
54+
/**
55+
* @brief mpx_data_indication MPX-DATA confirm is called as a response to MPX-DATA request
56+
* @param api The API which handled the response
57+
* @param data MCPS-DATA.indication specific values
58+
* @param user_id MPX user ID
59+
*/
60+
typedef void mpx_data_indication(const mpx_api_t* api, const struct mcps_data_ind_s *data);
61+
62+
/**
63+
* @brief mpx_header_size_get Function for request MPX user head room size
64+
* @param api The API which handled the response
65+
* @param user_id MPX user ID
66+
*
67+
* @return >0 Head room size in bytes
68+
* @return 0 When Unknown User Id
69+
*/
70+
typedef uint16_t mpx_header_size_get(const mpx_api_t * api, uint16_t user_id);
71+
72+
/**
73+
* @brief mpx_data_cb_register MPX-DATA confirm cb register by user
74+
* @param api The API which handled the response
75+
* @param confirm_cb MPX Data Confirm call back
76+
* @param indication_cb MPX Data indication
77+
* @param user_id MPX user ID
78+
*
79+
* @return 0 register OK
80+
* @return -1 Unknown User ID
81+
*/
82+
typedef int8_t mpx_data_cb_register(const mpx_api_t* api, mpx_data_confirm *confirm_cb, mpx_data_indication *indication_cb, uint16_t user_id);
83+
84+
/**
85+
* \brief Struct mpx_api_s defines functions for MPX user for register call backs and send data.
86+
*/
87+
struct mpx_api_s {
88+
mpx_data_request * mpx_data_request; /**< MPX data request. */
89+
mpx_data_purge_request *mpx_data_purge; /**< MPX data Purge. */
90+
mpx_header_size_get * mpx_headroom_size_get; /**< MPX headroom size get in bytes. */
91+
mpx_data_cb_register * mpx_user_registration; /**< MPX User cb registration must be call before enable to send or RX data*/
92+
};
93+
94+
95+
#endif /* MPX_API_H_ */

source/6LoWPAN/ws/ws_common_defines.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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_COMMON_DEFINES_H_
19+
#define WS_COMMON_DEFINES_H_
20+
21+
22+
/* Header IE Sub elements */
23+
#define WH_IE_UTT_TYPE 1 /**< Unicast Timing and Frame type information */
24+
#define WH_IE_BT_TYPE 2 /**< Broadcast timing information */
25+
#define WH_IE_FC_TYPE 3 /**< Flow Control for Extended Direct Frame Exchange */
26+
#define WH_IE_RSL_TYPE 4 /**< Received Signal Level information */
27+
#define WH_IE_MHDS_TYPE 5 /**< MHDS information for mesh routing */
28+
#define WH_IE_VH_TYPE 6 /**< Vendor header information */
29+
30+
#define WS_WP_NESTED_IE 4 /**< WS nested Payload IE element'selement could include mltiple sub payload IE */
31+
32+
/* Payload IE sub elements in side WS_WP_NESTED_IE */
33+
#define WP_PAYLOAD_IE_US_TYPE 1 /**< Unicast Schedule information */
34+
#define WP_PAYLOAD_IE_BS_TYPE 2 /**< Broadcast Schedule information */
35+
#define WP_PAYLOAD_IE_VP_TYPE 3 /**< Vendor Payload information */
36+
#define WP_PAYLOAD_IE_PAN_TYPE 4 /**< PAN Information */
37+
#define WP_PAYLOAD_IE_NETNAME_TYPE 5 /**< Network Name information */
38+
#define WP_PAYLOAD_IE_PAN_VER_TYPE 6 /**< Pan configuration version */
39+
#define WP_PAYLOAD_IE_GTKHASH_TYPE 7 /**< GTK Hash information */
40+
41+
/* WS frame types to WH_IE_UTT_TYPE */
42+
#define WS_FT_PAN_ADVERT 0 /**< PAN Advert */
43+
#define WS_FT_PAN_ADVERT_SOL 1 /**< PAN Advert Solicit */
44+
#define WS_FT_PAN_CONF 2 /**< PAN Config */
45+
#define WS_FT_PAN_CONF_SOL 3 /**< PAN Config Solicit */
46+
#define WS_FT_DATA 4 /**< data type inside MPX */
47+
#define WS_FT_ACK 5 /**< Enhanced ACK */
48+
#define WS_FT_EAPOL 6 /**< EAPOL message inside MPX */
49+
50+
51+
/**
52+
* @brief ws_pan_information_t PAN information
53+
*/
54+
typedef struct ws_pan_information_s {
55+
uint16_t pan_size; /**< Number devices connected to Border Router. */
56+
uint16_t routing_cost; /**< ETX to border Router. */
57+
uint16_t pan_version; /**< Pan configuration version will be updatd by Border router at PAN. */
58+
bool use_parent_bs:1; /**< 1 for force to follow parent broadcast schedule. 0 node may define own schedule. */
59+
bool rpl_routing_method:1; /**< 1 when RPL routing is selected and 0 when L2 routing. */
60+
unsigned version:3; /**< Pan version support. */
61+
} ws_pan_information_t;
62+
63+
#endif /* WS_COMMON_DEFINES_H_ */

source/6LoWPAN/ws/ws_llc.h

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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_LLC_H_
19+
#define WS_LLC_H_
20+
21+
struct protocol_interface_info_entry;
22+
struct mcps_data_ind_s;
23+
struct mcps_data_ie_list;
24+
struct channel_list_s;
25+
struct ws_pan_information_s;
26+
27+
28+
/**
29+
* @brief ws_asynch_ind ws asynch data indication
30+
* @param interface Interface pointer
31+
* @param data MCPS-DATA.indication specific values
32+
* @param ie_ext Information element list
33+
*/
34+
typedef void ws_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);
35+
36+
/**
37+
* @brief ws_asynch_confirm ws asynch data confirmation to asynch message request
38+
* @param api The API which handled the response
39+
* @param data MCPS-DATA.confirm specific values
40+
* @param user_id MPX user ID
41+
*/
42+
typedef void ws_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message);
43+
44+
/**
45+
* @brief ws_llc_create ws LLC module create
46+
* @param interface Interface pointer
47+
* @param data MCPS-DATA.indication specific values
48+
* @param ie_ext Information element list
49+
*
50+
* Function allocate and init LLC class and init it 2 supported 2 API: ws asynch and MPX user are internally registered.
51+
*/
52+
int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_ind *asynch_ind_cb, ws_asynch_confirm *asynch_cnf_cb);
53+
54+
/**
55+
* @brief ws_llc_reset Reset ws LLC parametrs and clean messages
56+
* @param interface Interface pointer
57+
*
58+
*/
59+
void ws_llc_reset(struct protocol_interface_info_entry *interface);
60+
61+
/**
62+
* @brief ws_llc_asynch_request ws asynch message request to all giving channels
63+
* @param interface Interface pointer
64+
* @param asynch_message Asynch message type: WS_FT_PAN_ADVERT, WS_FT_PAN_ADVERT_SOL, WS_FT_PAN_CONF or WS_FT_PAN_CONF_SOL
65+
* @param channel_list Channel list where message is pushed
66+
*
67+
* @return 0 Asynch message pushed to MAC
68+
* @return -1 memory allocate problem
69+
* @return -2 Parameter problem
70+
* LLC allocate message spesific IE element itself how it is configured
71+
*
72+
*/
73+
int8_t ws_llc_asynch_request(struct protocol_interface_info_entry *interface, uint8_t asynch_message, struct channel_list_s channel_list);
74+
75+
76+
/**
77+
* @brief ws_llc_set_vendor_header_data Configure WS vendor Header data information (Data of WH_IE_VH_TYPE IE element)
78+
* @param interface Interface pointer
79+
* @param vendor_header_length configured vendor header length
80+
* @param vendor_header pointer to vendor header this pointer must keep alive when it is configured to LLC
81+
*
82+
*/
83+
void ws_llc_set_vendor_header_data(struct protocol_interface_info_entry *interface, uint8_t vendor_header_length, uint8_t *vendor_header);
84+
85+
/**
86+
* @brief ws_llc_set_vendor_payload_data Configure WS vendor payload data information (Data of WP_PAYLOAD_IE_VP_TYPE IE element)
87+
* @param interface Interface pointer
88+
* @param vendor_payload_length configured vendor payload length
89+
* @param vendor_payload pointer to vendor payload this pointer must keep alive when it is configured to LLC
90+
*
91+
*/
92+
void ws_llc_set_vendor_payload_data(struct protocol_interface_info_entry *interface, uint8_t vendor_payload_length, uint8_t *vendor_payload);
93+
94+
/**
95+
* @brief ws_llc_set_network_name Configure WS Network name (Data of WP_PAYLOAD_IE_NETNAME_TYPE IE element)
96+
* @param interface Interface pointer
97+
* @param name_length configured network name length
98+
* @param net_name pointer to network name this pointer must keep alive when it is configured to LLC
99+
*
100+
*/
101+
void ws_llc_set_network_name(struct protocol_interface_info_entry *interface, uint8_t name_length, uint8_t *net_name);
102+
103+
/**
104+
* @brief ws_llc_set_gtkhash Configure WS GTK hash information (Data of WP_PAYLOAD_IE_GTKHASH_TYPE IE element)
105+
* @param interface Interface pointer
106+
* @param gtkhash pointer to GTK hash which length is 32 bytes this pointer must keep alive when it is configured to LLC
107+
*
108+
*/
109+
void ws_llc_set_gtkhash(struct protocol_interface_info_entry *interface, uint8_t *gtkhash);
110+
111+
/**
112+
* @brief ws_llc_set_pan_information_pointer Configure WS PAN information (Data of WP_PAYLOAD_IE_PAN_TYPE IE element)
113+
* @param interface Interface pointer
114+
* @param pan_information_pointer pointer to Pan information this pointer must keep alive when it is configured to LLC
115+
*
116+
*/
117+
void ws_llc_set_pan_information_pointer(struct protocol_interface_info_entry *interface, struct ws_pan_information_s *pan_information_pointer);
118+
119+
120+
#endif /* WS_LLC_H_ */

0 commit comments

Comments
 (0)