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 
53 #define APDU_MAX_SIZE 102
54 
55 /* WAPS-DSAP-DATA_TX-REQUEST */
56 
57 typedef struct __attribute__ ((__packed__))
58 {
63  uint8_t qos;
64  uint8_t tx_opts;
65  uint8_t apdu_len;
66  uint8_t apdu[APDU_MAX_SIZE];
68 
69 #define FRAME_DSAP_DATA_TX_REQ_HEADER_SIZE \
70  (sizeof(dsap_data_tx_req_t) - APDU_MAX_SIZE)
71 
72 /* WAPS-DSAP-DATA_TX_TT-REQUEST */
73 
74 typedef struct __attribute__ ((__packed__))
75 {
80  uint8_t qos;
81  uint8_t tx_opts;
82  uint32_t travel_time;
83  uint8_t apdu_len;
84  uint8_t apdu[APDU_MAX_SIZE];
86 
87 #define FRAME_DSAP_DATA_TX_TT_REQ_HEADER_SIZE \
88  (sizeof(dsap_data_tx_tt_req_t) - APDU_MAX_SIZE)
89 
90 typedef struct __attribute__ ((__packed__))
91 {
96  uint8_t qos;
97  uint8_t tx_opts;
98  uint32_t travel_time;
99  uint16_t full_packet_id : 12;
100  // Fragment offset + flag
102  uint8_t apdu_len;
103  uint8_t apdu[APDU_MAX_SIZE];
105 
106 #define FRAME_DSAP_DATA_TX_FRAG_REQ_HEADER_SIZE \
107  (sizeof(dsap_data_tx_frag_req_t) - APDU_MAX_SIZE)
108 /* WAPS-DSAP-DATA_RX-INDICATION */
109 
110 // info field masks and offsets
111 
112 // Qos: Lowest 2 bits
113 #define RX_IND_INFO_QOS_MASK 0x3
114 #define RX_IND_INFO_QOS_OFFSET 0
115 // Hop count, 6 next LSB bits
116 #define RX_IND_INFO_HOPCOUNT_MASK 0xfc
117 #define RX_IND_INFO_HOPCOUNT_OFFSET 2
118 #define RX_IND_INFO_MAX_HOPCOUNT \
119  (RX_IND_INFO_HOPCOUNT_MASK >> RX_IND_INFO_HOPCOUNT_OFFSET)
120 
121 // fragment_offset_flag field access
122 
123 // Fragment offset: Lowest 12 bits
124 #define DSAP_FRAG_LENGTH_MASK 0x0fff
125 
126 // Last fragment: Highest bit
127 #define DSAP_FRAG_LAST_FLAG_MASK 0x8000
128 
129 typedef struct __attribute__ ((__packed__))
130 {
136  // Qos + hop count
137  uint8_t info;
138  uint32_t delay;
139  uint8_t apdu_len;
140  uint8_t apdu[APDU_MAX_SIZE];
142 
143 #define FRAME_DSAP_DATA_RX_IND_HEADER_SIZE \
144  (sizeof(dsap_data_rx_ind_t) - APDU_MAX_SIZE)
145 
146 
147 /* WAPS-DSAP-DATA_RX_FRAG-INDICATION */
148 
149 typedef struct __attribute__ ((__packed__))
150 {
156  // Qos + hop count
157  uint8_t info;
158  uint32_t delay;
159  uint16_t full_packet_id;
160  // Fragment offset + flag
162  uint8_t apdu_len;
163  uint8_t apdu[APDU_MAX_SIZE];
165 
166 #define FRAME_DSAP_DATA_RX_FRAG_IND_HEADER_SIZE \
167  (sizeof(dsap_data_rx_frag_ind_t) - APDU_MAX_SIZE)
168 
169 /* WAPS-DSAP-DATA_TX-INDICATION */
170 
171 typedef struct __attribute__ ((__packed__))
172 {
178  uint32_t queue_delay;
179  uint8_t result;
181 
182 /* WAPS-DSAP-DATA_TX-CONFIRMATION */
183 
184 typedef struct __attribute__ ((__packed__))
185 {
187  uint8_t result;
188  uint8_t buff_cap;
190 
191 typedef union
192 {
200 } frame_dsap;
201 
202 
203 #endif /* DSAP_FRAMES_H_ */
pduid_t
uint16_t pduid_t
Definition: waps_frames.h:23
dsap_data_tx_cnf_t
Definition: dsap_frames.h:184
dsap_data_tx_req_t::dst_addr
w_addr_t dst_addr
Definition: dsap_frames.h:61
dsap_data_tx_tt_req_t
Definition: dsap_frames.h:74
dsap_indication_e
dsap_indication_e
Definition: dsap_frames.h:26
frame_dsap
Definition: dsap_frames.h:191
frame_dsap::data_rx_frag_ind
dsap_data_rx_frag_ind_t data_rx_frag_ind
Definition: dsap_frames.h:199
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:198
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:132
dsap_data_tx_frag_req_t::fragment_offset_flag
uint16_t fragment_offset_flag
Definition: dsap_frames.h:101
dsap_data_rx_ind_t::queued_indications
uint8_t queued_indications
Definition: dsap_frames.h:131
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:90
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:179
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:65
DSAP_IND_SUCCESS
@ DSAP_IND_SUCCESS
Definition: dsap_frames.h:28
dsap_data_tx_req_t
Definition: dsap_frames.h:57
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:99
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::travel_time
uint32_t travel_time
Definition: dsap_frames.h:82
DSAP_QOS_UNACKED
@ DSAP_QOS_UNACKED
Definition: dsap_frames.h:49
dsap_data_tx_req_t::qos
uint8_t qos
Definition: dsap_frames.h:63
dsap_data_rx_ind_t::delay
uint32_t delay
Definition: dsap_frames.h:138
dsap_data_tx_req_t::src_endpoint
ep_t src_endpoint
Definition: dsap_frames.h:60
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:194
dsap_data_rx_ind_t
Definition: dsap_frames.h:129
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:149
frame_dsap::data_tx_ind
dsap_data_tx_ind_t data_tx_ind
Definition: dsap_frames.h:196
dsap_data_tx_req_t::apdu_id
pduid_t apdu_id
Definition: dsap_frames.h:59
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:64
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:193
dsap_data_tx_req_t::dst_endpoint
ep_t dst_endpoint
Definition: dsap_frames.h:62
frame_dsap::data_tx_frag_req
dsap_data_tx_frag_req_t data_tx_frag_req
Definition: dsap_frames.h:195
dsap_data_tx_ind_t::queue_delay
uint32_t queue_delay
Definition: dsap_frames.h:178
dsap_data_tx_cnf_t::buff_cap
uint8_t buff_cap
Definition: dsap_frames.h:188
dsap_data_tx_ind_t
Definition: dsap_frames.h:171
dsap_tx_result_e
dsap_tx_result_e
Definition: dsap_frames.h:11
APDU_MAX_SIZE
#define APDU_MAX_SIZE
Definition: dsap_frames.h:53
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:197
dsap_data_rx_ind_t::info
uint8_t info
Definition: dsap_frames.h:137
DSAP_TX_SUCCESS
@ DSAP_TX_SUCCESS
Definition: dsap_frames.h:13