summaryrefslogtreecommitdiff
path: root/cesar/cp2/conn/link.h
blob: 2a1966b9cf1142cb27a273be39b36f03461dec6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#ifndef cp_link_h
#define cp_link_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    link.h
 * \brief   link management
 * \ingroup cp2/conn
 *
 * « long description »
 */

/**
 * cinfo structure
 */
struct cp_link_cinfo_t
{
    /**
     * Validity : 0x00 not valid ; 0x01 valid
     */
    u8 valid_cinfo;

    /**
     * type of connection requested
     */
    u8 mac_service_t;

    /**
     * CAP
     */
    u8 user_priority;

    /**
     * Transfer of the ATS to the HLE : 0x00 not 0x01 passed
     */
    u8 ats;

    /**
     * 0x00 no smoothing 0x01 smoothing if possible
     */
    u8 smoothing;


};
typedef struct cp_link_cinfo_t cp_link_cinfo_t;

/**
 * ble interval values
 */
struct cp_link_ble_interval_t
{
    /**
     * ble value
     */
    u8 ble;

    /**
     * end time
     */
    u16 et;


};
typedef struct cp_link_ble_interval_t cp_link_ble_interval_t;

enum cp_link_presence_t
{
    CP_LINK_PRESENCE_FILLED,
    CP_LINK_PRESENCE_NOT_FILLED
};
typedef cp_link_presence_t cp_link_presence_t;
/**
 * table used for 2 purposes. To know if a field has been informed and
 * how to access the data into the structure with only the FID.
 */
struct cp_link_cspec_field_status_t
{
    /**
     * Field identifier
     */
    u8 fid;

    /**
     * presence status
     */
    cp_link_presence_t presence;

    /**
     * memory access too the value of a field.
     */
    u32 fid_position;


};
typedef struct cp_link_cspec_field_status_t cp_link_cspec_field_status_t;


/**
 * Connection Specification
 */
struct cp_link_cspec_t
{
    /**
     * Delay Bound
     */
    u32 delay;

    /**
     * jitter bound
     */
    u32 jitter;

    /**
     * Average MPDU size
     */
    u16 av_MPDU_size;

    /**
     * Maximum MPDU size
     */
    u16 max_MPDU_size;

    /**
     * Average data rate
     */
    u16 av_data_rate;

    /**
     * Minimum data rate
     */
    u16 min_data_rate;

    /**
     * Maximum data rate
     */
    u16 max_data_rate;

    /**
     * Maximum inter-TXOP time
     */
    u16 max_inter_TXOP;

    /**
     * Minimum inter TXOP time
     */
    u16 min_inter_TXOP;

    /**
     * Maximum burst time
     */
    u16 max_burst;

    /**
     * Exception Policy
     */
    u8 exception;

    /**
     * Inatictivity interval
     */
    u32 inactivity;

    /**
     * MSDU error rate
     */
    u16 MSDU_error_rate;

    /**
     * Convergence Layer SAP Type
     */
    u8 CLST;

    /**
     * ATS tolerance
     */
    u16 ATS;

    /**
     * Smallest Tolerable Average Data rate
     */
    u16 min_tol_data;

    /**
     * Original average Data rate
     */
    u16 ori_av_data_rate;

    /**
     * RX window size
     */
    u16 rx_window;

    /**
     * Smoothing buffer size
     */
    u32 smoothing:24;

    /**
     * Bidirectional burst
     */
    u8 bidir_burst;

    /**
     * Number of TXOPs per beacon
     */
    u8 nb_TXOP;

    /**
     * Average number of PBs per TXOP
     */
    u16 av_nb_pb;

    /**
     * Maximum number of PBs per TXOP
     */
    u16 max_nb_pb;

    /**
     * Pending PB threshold
     */
    u16 ppb_threshold;

    /**
     * Surplus of Bandwidth
     */
    u16 surplus_bw;

    /**
     * table used for 2 purposes. To know if a field has been informed
     * and how to access the data into the structure with only the FID.
     */
    cp_link_cspec_field_status_t* presence_table[25];


};
typedef struct cp_link_cspec_t cp_link_cspec_t;

/**
 * Structure of a link.
 */
struct cp_link_t
{
    /**
     * global link identifier
     */
    u8 lid;

    /**
     * connection information
     */
    cp_link_cinfo_t* cinfo;

    /**
     * forward BLE
     */
    cp_link_ble_interval_t *ble;

    /**
     * expiration date of the connection used by the garbadge collector
     */
    u16 expiration;

    /**
     * PCO status of the connection : 0 not PCO 1 PCO
     */
    bool pco_status;

    /**
     * MAC addr of the Destination STAs
     */
    u64 oda:48;

    /**
     * MAC addr of the Source STA
     */
    u64 osa:48;

    /**
    \todo fill the comment.
     */
    cp_link_cspec_t* cspec;

    /**
     * 0 forward link - 1 reverse link
     */
    bool side;


};
typedef struct cp_link_t cp_link_t;


/**
 * del a connection regarding to its CID.
 * \param  ctx  conn context.
 * \param  lid  Connection identifier
 *
 */
void
cp_conn_del_link (cp_conn_t *ctx, u8 lid);

/**
 * function that add a connection to the list using the first connection
 * to get to the last and add it to the end.
 * \param  ctx Conn context.
 * \param  new_link  null
 *
 */
void
cp_conn_add_link (cp_conn_t *ctx, cp_conn_link_t* new_link);

/**
 * return a link regarding to its LID.
 * \param  ctx  conn context.
 * \param  lid  connection identifier
 * \return  \todo fill this
 *
 */
cp_link_t*
cp_link_get_link (cp_conn_t *ctx, u8 lid);

#endif /* cp_link_h */