summaryrefslogtreecommitdiff
path: root/cesar/cp/sta/mgr/sta_own_data.h
blob: 6d1478bde86d8de4023836a033068fa964b95696 (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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
#ifndef cp_sta_data_sta_own_data_h
#define cp_sta_data_sta_own_data_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/sta/data/sta_own_data.h
 * \brief   Station own data.
 * \ingroup cp_sta_data
 *
 */

#include "cp/defs.h"
#include "cp/cp.h"

#include "cp/sta/mgr/sta.h"
#include "cp/msg/inc/drv_sta_set_key.h"

#include <string.h>

/** Forward declaration. */
typedef struct cp_sta_own_data_private_t cp_sta_own_data_private_t;

/**
 * Station own data.
 */
struct cp_sta_own_data_t
{
    /**
     * Indicate if the station was CCo preferred.
     */
    bool cco_prefered;

    /**
     * The AVLN HFID.
     */
    const char hfid_avln [CP_HFID_SIZE + 1];

    /**
     * The user HFID.
     */
    const char hfid_user [CP_HFID_SIZE + 1];

    /**
     * The manufacturer HFID.
     */
    const char hfid_manufacturer [CP_HFID_SIZE + 1];

    /**
     * Current hybrid mode.
     */
    mac_coexistence_mode_t hybrid_mode;

    /**
     * The current NID being track for the NTB synchronization.
     */
    cp_nid_t nid_track;

    /**
     * TEI tracked.
     */
    cp_tei_t tei_track;

    /**
     * The PCo to discuss with.
     */
    cp_sta_t * pco;
};
typedef struct cp_sta_own_data_t cp_sta_own_data_t;

BEGIN_DECLS

/**
 * Initialise the station own data to default values.
 * \param  ctx  the module context.
 */
void
cp_sta_own_data_init (cp_t *ctx);

/**
 * Uninitialise the station own data to default values.
 * \param  ctx  the module context.
 */
void
cp_sta_own_data_uninit (cp_t *ctx);

/**
 * Set the TEI of the station.
 * \param  ctx  the module context.
 * \param  tei  The TEI station.
 */
void
cp_sta_own_data_set_tei (cp_t * ctx, u8 tei);

/**
 * Get the value of the constant TEI.
 * \param  ctx  the module context.
 * \return  Get the station TEI.
 *
 */
cp_tei_t
cp_sta_own_data_get_tei (cp_t *ctx);

/**
 * Set the station Mac address.
 * \param  ctx  the module context.
 * \param  mac_addr  The Mac address of the station.
 */
void
cp_sta_own_data_set_mac_address (cp_t *ctx, mac_t mac_addr);

/**
 * Get the station mac address.
 * \param  ctx  the module context.
 * \return  Get the station Mac address.
 */
mac_t
cp_sta_own_data_get_mac_address (cp_t *ctx);

/**
 * Set the Station NPW.
 * \param  ctx  the module context.
 * \param  sta  the station own data.
 * \param  npw  The new NPW.
 *
 * TODO : inform the driver ?
 */
void
cp_sta_own_data_set_npw (cp_t *ctx, const char * npw);

/**
 * Return the pointer to the NPW as a constant data.
 * \param  ctx  the module context.
 * \return  Get the station NPW.
 *
 *  The user shall call the set_npw function to modify the NPW
 */
const char *
cp_sta_own_data_get_npw (cp_t *ctx);

/**
 * Set the station NMK.
 * \param  ctx  the module context.
 * \param  nmk  The NMK to set.
 * \param  type  type of data the nmk is modify after.
 * \return  true if the nmk was changed.
 */
bool
cp_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk,
                         cp_msg_drv_sta_set_key_type_t type);

/**
 * Get the NMK of the AVLN.
 * \param  ctx  the module context.
 * \return  Get the station NMK
 *
 */
cp_key_t
cp_sta_own_data_get_nmk (cp_t *ctx);

/**
 * Set the device password.
 * \param  ctx  the module context.
 * \param  dpw  The new device password.
 *
 * // TODO : inform the driver ?
 */
void
cp_sta_own_data_set_dpw (cp_t *ctx, const char *dpw);

/**
 * Return the Device password.
 * \param  ctx  the module context.
 * \return  Get the station DPW.
 */
const char *
cp_sta_own_data_get_dpw (cp_t *ctx);

/**
 * Set the security level.
 * \param  ctx  the module context.
 * \param  sl  The security level.
 *
 *  And send a message to the HLE
 */
void
cp_sta_own_data_set_security_level (cp_t *ctx,
                                    cp_security_level_t sl);

/**
 * Return the security level.
 * \param  ctx  the module context.
 * \param  sta  the station own data.
 * \return Get the security level.
 *
 */
cp_security_level_t
cp_sta_own_data_get_security_level (cp_t *ctx);

/**
 * Set the CCo status of the station.
 * \param  ctx  the module context.
 * \param  status  The current CCo status of the station.
 *
 *  It shall send a message to the Linux Driver
 */
void
cp_sta_own_data_set_was_cco (cp_t *ctx, bool status);

/**
 * Get the the CCo status of the station after a reboot.
 * \param  ctx  the module context.
 * \return  the CCo status.
 */
bool
cp_sta_own_data_get_was_cco (cp_t *ctx);


/**
 * Set the AVLN HFID.
 *
 * \param  ctx  the module context.
 * \param  data  the human identifier.
 */
void
cp_sta_own_data_set_hfid_avln (cp_t *ctx, const char* data);

/**
 * Set the User HFID.
 *
 * \param  ctx  the module context.
 * \param  data  the human identifier.
 */
void
cp_sta_own_data_set_hfid_user (cp_t *ctx, const char* data);

/**
 * Set the Manufacturer HFID.
 *
 * \param  ctx  the module context.
 * \param  data  the human identifier.
 */
void
cp_sta_own_data_set_hfid_manufacturer (cp_t *ctx, const char* data);

/**
 * Set the GLID to send proxy data.
 * \param  ctx  the module context.
 * \param  glid  The GLID to use when a proxy beacon shall be sent.
 */
void
cp_sta_own_data_set_pco_glid (cp_t *ctx, u8 glid);

/**
 * Get the PCO GLID.
 * \param  ctx  the module context.
 * \param  sta  the station own data.
 * \return  The GLID to send proxy data.
 */
u8
cp_sta_own_data_get_pco_glid (cp_t *ctx);

/**
 * Get the PCO status.
 * \param  ctx  the module context.
 * \param  sta  the station own data.
 * \return  True if the station is PCO, false otherwise.
 */
bool
cp_sta_own_data_get_pco_status (cp_t *ctx);

/**
 * Set the PCO status.
 * \param  ctx  the module context.
 * \param  sta  the station own data.
 * \param  pco  The PCO status.
 */
void
cp_sta_own_data_set_pco_status (cp_t *ctx, bool pco);

/**
 * Set the CCo status of the station.
 * \param  ctx  the CP context.
 */
void
cp_sta_own_data_set_cco_status (cp_t *ctx, bool cco);


/**
 * Get the CCo status of the station.
 * \param  ctx  the CP context.
 * \return  the boolean indicating the state.
 */
bool
cp_sta_own_data_get_cco_status (cp_t *ctx);

/**
 * Set the authentication status.
 * \param  ctx  the CP context.
 * \param  authenticated  the station status.
 */
void
cp_sta_own_data_set_authenticated_status (cp_t *ctx, bool authenticated);

/**
 * Get the authentication status.
 * \param  ctx  the CP context.
 * \return  the station authentication status.
 */
bool
cp_sta_own_data_get_authenticated_status (cp_t *ctx);

/**
 * Update the Station NID.
 * \param  ctx  the Control plane context.
 * \param  nid  the station NID.
 */
void
cp_sta_own_data_set_nid (cp_t *ctx, cp_nid_t nid);

/**
 * Get the Station NID.
 * \param  ctx  the Control plane context.
 * \param  nid  the station NID.
 */
cp_nid_t
cp_sta_own_data_get_nid (cp_t *ctx);

/**
 * Update the Station SNID.
 * \param  ctx  the Control plane context.
 * \param  nid  the station NID.
 */
void
cp_sta_own_data_set_snid (cp_t *ctx, cp_snid_t snid);

/**
 * Get the Station SNID.
 * \param  ctx  the Control plane context.
 * \return  the station SNID.
 */
cp_snid_t
cp_sta_own_data_get_snid (cp_t *ctx);

/**
 * Set the current TEK.
 * \param  ctx  the module context.
 * \param  key  the TEK.
 */
void
cp_sta_own_data_set_tek (cp_t *ctx, const cp_key_t key);

/**
 * Get the current TEK.
 * \param  ctx  the module context.
 * \return  the TEK.
 */
cp_key_t
cp_sta_own_data_get_tek (cp_t *ctx);

/**
 * Get backup CCo status.
 * \param  ctx  the control plane context.
 * \return  true if we are backup CCo.
 */
bool
cp_sta_own_data_get_backup_cco_status (cp_t *ctx);

/**
 * Set the DAK in the station.
 * \param  ctx  the control plane context.
 * \param  dak  the DAK of the station.
 */
void
cp_sta_own_data_set_dak (cp_t *ctx, cp_key_t dak);

/**
 * Get the DAK of the station.
 * \param  ctx  the control plane context.
 * \return  the DAK of the station.
 */
cp_key_t
cp_sta_own_data_get_dak (cp_t *ctx);

/**
 * Set the Simple connect station's status.
 * \param  ctx  the control plane context.
 * \param  status  true if currently in SC, false otherwise.
 */
void
cp_sta_own_data_set_sc (cp_t *ctx, bool status);

/**
 * Get the Simple connect station's status.
 * \param  ctx  the control plane context.
 * \return  true if the station is currently in SC procedure, false otherwise.
 */
bool
cp_sta_own_data_get_sc (cp_t *ctx);

END_DECLS

#endif /* cp_sta_data_sta_own_data_h */