Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mac_data_buffer.h Source File

mac_data_buffer.h

00001 /*
00002  * Copyright (c) 2019, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef MAC_DATA_BUFFER_H_
00019 #define MAC_DATA_BUFFER_H_
00020 
00021 #include "mac_mcps.h"
00022 
00023 /**
00024  * @brief struct mac_aux_security_header_t MAC auxiliarity security header structure
00025  * INTERNAL use only
00026  */
00027 typedef struct mac_aux_security_header_s {
00028     uint32_t frameCounter;
00029     uint8_t Keysource[8];
00030     uint8_t KeyIndex;
00031     unsigned securityLevel: 3;
00032     unsigned KeyIdMode: 2;
00033 } mac_aux_security_header_t;
00034 
00035 typedef struct mac_fcf_sequence_s {
00036     unsigned frametype: 3;
00037     bool securityEnabled: 1;
00038     bool framePending : 1;
00039     bool ackRequested: 1;
00040     bool intraPan: 1;
00041     bool sequenceNumberSuppress: 1;
00042     bool informationElementsPresets: 1;
00043     bool DstPanPresents: 1;
00044     bool SrcPanPresents: 1;
00045     unsigned DstAddrMode: 2; /*0x00 = no address 0x01 = reserved 0x02 = 16-bit short address 0x03 = 64-bit extended address */
00046     unsigned frameVersion: 2;
00047     unsigned SrcAddrMode: 2; /*0x00 = no address 0x01 = reserved 0x02 = 16-bit short address 0x03 = 64-bit extended address */
00048     uint8_t DSN;
00049 } mac_fcf_sequence_t;
00050 
00051 typedef struct mac_pre_parsed_frame_s {
00052     void *mac_class_ptr;
00053     uint8_t *payloadsIePtr;
00054     uint8_t *headerIePtr;
00055     uint8_t *macPayloadPtr;
00056     mlme_device_descriptor_t *neigh_info;
00057     uint32_t timestamp;
00058     mac_fcf_sequence_t fcf_dsn;
00059     uint16_t frameLength; //Encoded or open payload length
00060     uint16_t payloadsIeLength;
00061     uint16_t headerIeLength;
00062     uint16_t mac_header_length;
00063     uint16_t header_ie_length;
00064     uint16_t mac_payload_length;
00065     uint8_t security_aux_header_length;
00066     uint8_t LQI;
00067     int8_t dbm;
00068     bool ack_pendinfg_status;
00069     uint8_t buf[]; /*!< Trailing buffer data */
00070 } mac_pre_parsed_frame_t;
00071 
00072 typedef struct mac_pre_build_frame {
00073     mac_fcf_sequence_t fcf_dsn;
00074     uint16_t DstPANId;
00075     uint8_t DstAddr[8];
00076     uint16_t SrcPANId;
00077     uint8_t SrcAddr[8];
00078     mac_aux_security_header_t aux_header;
00079     uint8_t mac_command_id; //For MLME
00080     uint16_t payloadsIeLength;
00081     uint16_t headerIeLength;
00082     uint16_t mac_payload_length;
00083     uint16_t mac_header_length_with_security;
00084     uint8_t msduHandle;
00085     uint16_t buffer_ttl;
00086     struct mcps_data_req_ie_list ie_elements;
00087     struct channel_list_s asynch_channel_list;
00088     uint8_t *mac_payload;
00089     uint8_t status;
00090     uint8_t asynch_channel;
00091     uint8_t csma_periods_left;
00092     uint8_t fhss_retry_count;
00093     uint8_t fhss_cca_retry_count;
00094     uint32_t tx_time;
00095     bool upper_layer_request: 1;
00096     bool mac_allocated_payload_ptr: 1;
00097     bool asynch_request: 1;
00098     bool message_builded: 1;
00099     unsigned security_mic_len: 5;   //Max possible lengths 0, 4, 8, 16 bytes
00100     unsigned priority: 2;
00101     struct mac_pre_build_frame *next; //Pointer for queue purpose
00102 } mac_pre_build_frame_t;
00103 
00104 
00105 #endif /* MAC_DATA_BUFFER_H_ */