Wirepas SDK
dsap_frames.h
Go to the documentation of this file.
1 /* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
7 #ifndef DSAP_FRAMES_H_
8 #define DSAP_FRAMES_H_
9 
11 typedef enum
12 {
18  DSAP_TX_UNKNOWN_DST = 5, // Not used as of version 5.0
25 
26 typedef enum
27 {
31 
33 typedef enum
34 {
40 
41 // Offset for hop limit
42 #define TX_OPTS_HOPLIMIT_OFFSET 2
43 
45 typedef enum
46 {
50 } dsap_qos_e;
51 
52 /* WAPS-DSAP-DATA_TX-REQUEST */
53 
54 typedef struct __attribute__ ((__packed__))
55 {
60  uint8_t qos;
61  uint8_t tx_opts;
62  uint8_t apdu_len;
63  uint8_t apdu[APDU_MAX_SIZE];
65 
66 #define FRAME_DSAP_DATA_TX_REQ_HEADER_SIZE \
67  (sizeof(dsap_data_tx_req_t) - APDU_MAX_SIZE)
68 
69 /* WAPS-DSAP-DATA_TX_TT-REQUEST */
70 
71 typedef struct __attribute__ ((__packed__))
72 {
77  uint8_t qos;
78  uint8_t tx_opts;
79  uint32_t reserved;
80  uint8_t apdu_len;
81  uint8_t apdu[APDU_MAX_SIZE];
83 
84 #define FRAME_DSAP_DATA_TX_TT_REQ_HEADER_SIZE \
85  (sizeof(dsap_data_tx_tt_req_t) - APDU_MAX_SIZE)
86 
87 typedef struct __attribute__ ((__packed__))
88 {
93  uint8_t qos;
94  uint8_t tx_opts;
95  uint32_t reserved;
96  uint16_t full_packet_id : 12;
97  // Fragment offset + flag
99  uint8_t apdu_len;
100  uint8_t apdu[APDU_MAX_SIZE];
102 
103 #define FRAME_DSAP_DATA_TX_FRAG_REQ_HEADER_SIZE \
104  (sizeof(dsap_data_tx_frag_req_t) - APDU_MAX_SIZE)
105 /* WAPS-DSAP-DATA_RX-INDICATION */
106 
107 // info field masks and offsets
108 
109 // Qos: Lowest 2 bits
110 #define RX_IND_INFO_QOS_MASK 0x3
111 #define RX_IND_INFO_QOS_OFFSET 0
112 // Hop count, 6 next LSB bits
113 #define RX_IND_INFO_HOPCOUNT_MASK 0xfc
114 #define RX_IND_INFO_HOPCOUNT_OFFSET 2
115 #define RX_IND_INFO_MAX_HOPCOUNT \
116  (RX_IND_INFO_HOPCOUNT_MASK >> RX_IND_INFO_HOPCOUNT_OFFSET)
117 
118 // fragment_offset_flag field access
119 
120 // Fragment offset: Lowest 12 bits
121 #define DSAP_FRAG_LENGTH_MASK 0x0fff
122 
123 // Last fragment: Highest bit
124 #define DSAP_FRAG_LAST_FLAG_MASK 0x8000
125 
126 typedef struct __attribute__ ((__packed__))
127 {
133  // Qos + hop count
134  uint8_t info;
135  uint32_t delay;
136  uint8_t apdu_len;
137  uint8_t apdu[APDU_MAX_SIZE];
139 
140 #define FRAME_DSAP_DATA_RX_IND_HEADER_SIZE \
141  (sizeof(dsap_data_rx_ind_t) - APDU_MAX_SIZE)
142 
143 
144 /* WAPS-DSAP-DATA_RX_FRAG-INDICATION */
145 
146 typedef struct __attribute__ ((__packed__))
147 {
153  // Qos + hop count
154  uint8_t info;
155  uint32_t delay;
156  uint16_t full_packet_id;
157  // Fragment offset + flag
159  uint8_t apdu_len;
160  uint8_t apdu[APDU_MAX_SIZE];
162 
163 #define FRAME_DSAP_DATA_RX_FRAG_IND_HEADER_SIZE \
164  (sizeof(dsap_data_rx_frag_ind_t) - APDU_MAX_SIZE)
165 
166 /* WAPS-DSAP-DATA_TX-INDICATION */
167 
168 typedef struct __attribute__ ((__packed__))
169 {
175  uint32_t queue_delay;
176  uint8_t result;
178 
179 /* WAPS-DSAP-DATA_TX-CONFIRMATION */
180 
181 typedef struct __attribute__ ((__packed__))
182 {
184  uint8_t result;
185  uint8_t buff_cap;
187 
188 typedef union
189 {
197 } frame_dsap;
198 
199 
200 #endif /* DSAP_FRAMES_H_ */
pduid_t
uint16_t pduid_t
Definition: waps_frames.h:23
dsap_data_tx_cnf_t
Definition: dsap_frames.h:181
dsap_data_tx_req_t::dst_addr
w_addr_t dst_addr
Definition: dsap_frames.h:58
dsap_data_tx_tt_req_t
Definition: dsap_frames.h:71
dsap_indication_e
dsap_indication_e
Definition: dsap_frames.h:26
frame_dsap
Definition: dsap_frames.h:188
frame_dsap::data_rx_frag_ind
dsap_data_rx_frag_ind_t data_rx_frag_ind
Definition: dsap_frames.h:196
DSAP_TX_OUT_OF_MEMORY
@ DSAP_TX_OUT_OF_MEMORY
Definition: dsap_frames.h:17
frame_dsap::data_rx_ind
dsap_data_rx_ind_t data_rx_ind
Definition: dsap_frames.h:195
DSAP_TX_INV_PDU_ID
@ DSAP_TX_INV_PDU_ID
Definition: dsap_frames.h:21
dsap_data_rx_ind_t::src_addr
w_addr_t src_addr
Definition: dsap_frames.h:129
dsap_data_tx_frag_req_t::fragment_offset_flag
uint16_t fragment_offset_flag
Definition: dsap_frames.h:98
dsap_data_rx_ind_t::queued_indications
uint8_t queued_indications
Definition: dsap_frames.h:128
TX_OPTS_NO_IND_REQ
@ TX_OPTS_NO_IND_REQ
Definition: dsap_frames.h:35
dsap_qos_e
dsap_qos_e
Definition: dsap_frames.h:45
dsap_data_tx_frag_req_t
Definition: dsap_frames.h:87
TX_OPTS_HOPLIMIT_MASK
@ TX_OPTS_HOPLIMIT_MASK
Definition: dsap_frames.h:38
dsap_data_tx_ind_t::result
uint8_t result
Definition: dsap_frames.h:176
TX_OPTS_UNACK_CSMA_CA
@ TX_OPTS_UNACK_CSMA_CA
Definition: dsap_frames.h:37
ep_t
uint8_t ep_t
Definition: waps_frames.h:14
DSAP_IND_TIMEOUT
@ DSAP_IND_TIMEOUT
Definition: dsap_frames.h:29
dsap_data_tx_req_t::apdu_len
uint8_t apdu_len
Definition: dsap_frames.h:62
DSAP_IND_SUCCESS
@ DSAP_IND_SUCCESS
Definition: dsap_frames.h:28
dsap_data_tx_req_t
Definition: dsap_frames.h:54
dsap_tx_options_e
dsap_tx_options_e
Definition: dsap_frames.h:33
DSAP_TX_INV_OPTS_PARAM
@ DSAP_TX_INV_OPTS_PARAM
Definition: dsap_frames.h:16
dsap_data_tx_frag_req_t::full_packet_id
uint16_t full_packet_id
Definition: dsap_frames.h:96
DSAP_TX_STACK_STOPPED
@ DSAP_TX_STACK_STOPPED
Definition: dsap_frames.h:14
DSAP_TX_RESV_EP
@ DSAP_TX_RESV_EP
Definition: dsap_frames.h:22
dsap_data_tx_tt_req_t::reserved
uint32_t reserved
Definition: dsap_frames.h:79
DSAP_QOS_UNACKED
@ DSAP_QOS_UNACKED
Definition: dsap_frames.h:49
dsap_data_tx_req_t::qos
uint8_t qos
Definition: dsap_frames.h:60
dsap_data_rx_ind_t::delay
uint32_t delay
Definition: dsap_frames.h:135
dsap_data_tx_req_t::src_endpoint
ep_t src_endpoint
Definition: dsap_frames.h:57
DSAP_QOS_HIGH
@ DSAP_QOS_HIGH
Definition: dsap_frames.h:48
frame_dsap::data_tx_tt_req
dsap_data_tx_tt_req_t data_tx_tt_req
Definition: dsap_frames.h:191
dsap_data_rx_ind_t
Definition: dsap_frames.h:126
TX_OPTS_IND_REQ
@ TX_OPTS_IND_REQ
Definition: dsap_frames.h:36
DSAP_TX_INV_LEN
@ DSAP_TX_INV_LEN
Definition: dsap_frames.h:19
DSAP_TX_ACCESS_DENIED
@ DSAP_TX_ACCESS_DENIED
Definition: dsap_frames.h:23
dsap_data_rx_frag_ind_t
Definition: dsap_frames.h:146
frame_dsap::data_tx_ind
dsap_data_tx_ind_t data_tx_ind
Definition: dsap_frames.h:193
dsap_data_tx_req_t::apdu_id
pduid_t apdu_id
Definition: dsap_frames.h:56
DSAP_TX_INV_QOS_PARAM
@ DSAP_TX_INV_QOS_PARAM
Definition: dsap_frames.h:15
DSAP_TX_UNKNOWN_DST
@ DSAP_TX_UNKNOWN_DST
Definition: dsap_frames.h:18
dsap_data_tx_req_t::tx_opts
uint8_t tx_opts
Definition: dsap_frames.h:61
DSAP_TX_IND_FULL
@ DSAP_TX_IND_FULL
Definition: dsap_frames.h:20
frame_dsap::data_tx_req
dsap_data_tx_req_t data_tx_req
Definition: dsap_frames.h:190
dsap_data_tx_req_t::dst_endpoint
ep_t dst_endpoint
Definition: dsap_frames.h:59
frame_dsap::data_tx_frag_req
dsap_data_tx_frag_req_t data_tx_frag_req
Definition: dsap_frames.h:192
dsap_data_tx_ind_t::queue_delay
uint32_t queue_delay
Definition: dsap_frames.h:175
dsap_data_tx_cnf_t::buff_cap
uint8_t buff_cap
Definition: dsap_frames.h:185
dsap_data_tx_ind_t
Definition: dsap_frames.h:168
dsap_tx_result_e
dsap_tx_result_e
Definition: dsap_frames.h:11
w_addr_t
uint32_t w_addr_t
Definition: waps_frames.h:17
DSAP_QOS_NORMAL
@ DSAP_QOS_NORMAL
Definition: dsap_frames.h:47
frame_dsap::data_tx_cnf
dsap_data_tx_cnf_t data_tx_cnf
Definition: dsap_frames.h:194
dsap_data_rx_ind_t::info
uint8_t info
Definition: dsap_frames.h:134
DSAP_TX_SUCCESS
@ DSAP_TX_SUCCESS
Definition: dsap_frames.h:13