summaryrefslogtreecommitdiff
path: root/cesar/cp2/cco/action/cco_action.h
blob: 63fb0972b60e617c86cffa76a5e073b549d5aa9a (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
#ifndef cp2_cco_action_h
#define cp2_cco_action_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp2/cco/cco_action.h
 * \brief   CCo Public functions.
 * \ingroup cp2_cco
 *
 */

#include "cp2/cp.h"
#include "cp2/mme.h"
#include "cp2/beacon/beacon.h"
#include "cp2/sta/mgr/sta.h"

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

/**
 * initialisation of CCo action module.
 * \param  ctx  the module context.
 *
 */
void
cp_cco_action_init (cp_t *ctx);

/**
 * Uninitialisation of CCo action module.
 * \param  ctx  the module context.
 *
 */
void
cp_cco_action_uninit (cp_t *ctx);

/**
 * Change the SNID.
 * \param  ctx  the module context.
 *
 *  It shall request the SNIDs in use from the station manager to choose
 * one randomly in the available SNIDs
 */
void
cp_cco_action_snid_change (cp_t *ctx);

/**
 * perform garbage actions of CCo's responsibility.
 * \param  ctx  the module context.
 */
void
cp_cco_action_garbage (cp_t *ctx);

/**
 * generate a new NEK value.
 * \param  ctx  the module context.
 * \param  sl  security level
 *
 * NEK shall be used no more than 1 hour, so must be changed after 1
 * hour  for that purpose, NEK expiration date is checked at every occurrence
 * of  the global garbage collector timer and if current NEK expiration
 * date reached,  a new NEK value shall be generated by calling this function
 */
void
cp_cco_action_gen_nek (cp_t *ctx, u8 sl);

/**
 * manage association of a station.
 * \param  ctx  the module context.
 * \param  assoc_req  CM_ASSOC.REQ MME msg having being received
 */
void
cp_cco_action_manage_sta_assoc (cp_t *ctx, cp_mme_rx_t * assoc_req);

/**
 * manage authentication of a station.
 * \param  ctx  the module context.
 * \param  get_key_req  CM_GET_KEY.REQ MME msg having being decrypted
 */
void
cp_cco_action_manage_sta_auth (cp_t *ctx, cp_mme_rx_t * get_key_req);

/**
 * manage explicit leave request of a station.
 * \param  ctx  the module context.
 * \param  leave_req  The MME leave req message.
 * \param  sta  provided by the garbage function to send a CC_LEAVE_IND.
 *
 *   Remove the station from the station manager
 */
void
cp_cco_action_manage_sta_leave (cp_t *ctx, cp_mme_rx_t * leave_req,
                                cp_sta_t *sta);

/**
 * manage explicit leave request of a station.
 * \param  ctx  the module context.
 * \param  leave_req  The MME leave req message.
 *
 * Remove the station from the station manager
 */
extern inline void
cp_cco_action_manage_sta_leave_req (cp_t *ctx, cp_mme_rx_t * leave_req)
{
    dbg_assert (ctx);
    dbg_assert (leave_req);

    cp_cco_action_manage_sta_leave (ctx, leave_req, NULL);
}


#endif /* cp2_cco_action_h */