summaryrefslogtreecommitdiff
path: root/cesar/cp/msg/inc/msg_drv.h
blob: 304f382b014203ee07411aaf4694d0b43f9df28f (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
#ifndef cp_msg_inc_msg_drv_h
#define cp_msg_inc_msg_drv_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/msg/inc/msg_drv.h
 * \brief   DRV family MME.
 * \ingroup cp_msg
 */

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

/** Result of a DRV family request. */
enum cp_msg_drv_result_t
{
    CP_MSG_DRV_RESULT_SUCCESS,
    CP_MSG_DRV_RESULT_FAILURE,
    CP_MSG_DRV_RESULT_NB,
};
typedef enum cp_msg_drv_result_t cp_msg_drv_result_t;

BEGIN_DECLS

/**
 * Receive a DRV_STA_SET_MAC_ADDR.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  mac  received mac address
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_mac_addr_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                         mac_t *mac);

/**
 * Receive a DRV_STA_SET_CCO_PREF.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  cco_pref  received CCo preferred flag
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_cco_pref_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                         bool *cco_pref);

/**
 * Receive a DRV_STA_SET_WAS_CCO.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  was_cco  received was CCo flag
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_was_cco_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                        bool *was_cco);

/**
 * Receive a DRV_STA_SET_NPW.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  npw  received NPW
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_npw_req_receive (cp_t *ctx, cp_mme_rx_t *mme, char *npw);

/**
 * Receive a DRV_STA_SET_DPW.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  dpw  received device password
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_dpw_req_receive (cp_t *ctx, cp_mme_rx_t *mme, char *dpw);

/**
 * Receive a DRV_STA_SET_SL.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  sl  received SL
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_sl_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                   cp_security_level_t *sl);

/**
 * Receive a DRV_STA_SET_NID.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  nid  received NID
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_nid_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                    cp_nid_t *nid);

/**
 * Receive a DRV_STA_SET_M_STA_HFID.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  m_sta_hfid  received manufacturer STA HFID
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_m_sta_hfid_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                           char *m_sta_hfid);

/**
 * Receive a DRV_STA_SET_U_STA_HFID.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  u_sta_hfid  received user STA HFID
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_u_sta_hfid_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                           char *u_sta_hfid);

/**
 * Receive a DRV_STA_SET_AVLN_HFID.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  avln_hfid  received AVLN HFID
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_avln_hfid_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                          char *avln_hfid);

/**
 * Receive a DRV_STA_SET_TONEMASK.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \param  tonemask  received tonemask
 * \return  true on success
 */
bool
cp_msg_drv_sta_set_tonemask_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                         u32 *tonemask);

/**
 * Receive a DRV_STA_MAC_START.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \return  true on success
 */
bool
cp_msg_drv_sta_mac_start_req_receive (cp_t *ctx, cp_mme_rx_t *mme);

/**
 * Receive a DRV_STA_MAC_STOP.REQ.
 * \param  ctx  control plane context
 * \param  mme  MME handle
 * \return  true on success
 */
bool
cp_msg_drv_sta_mac_stop_req_receive (cp_t *ctx, cp_mme_rx_t *mme);

/**
 * Receive a DRV_STA_SC.REQ.
 * \param  ctx  control plane context.
 * \param  mme  MME to handle.
 * \param  sc_join  true if we are ask to start an SC_JOIN, otherwise false
 * for an SC_ADD.
 * \return  true on success.
 */
bool
cp_msg_drv_sta_sc_req_receive (cp_t *ctx, cp_mme_rx_t *mme, bool *sc_join);

/**
 * Receive a DRV_STA_SET_KEY.REQ.
 * \param  ctx  control plane context.
 * \param  mme  MME to handle.
 * \param  nmk  the Network Membership Key.
 * \param  type Change type of security data.
 * \param  nid  the Network identifier.
 * \param  sl  the security level.
 * \return  true on success.
 *
 * type:
 *   - 0x00 = change the NID
 *   - 0x01 = change the security level (SL)
 *   - 0x02 - 0xff = reserved
 *
 * nid no meaning if type != 0x00
 * sl no meaning of type != 0x01
 */
bool
cp_msg_drv_sta_set_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme, u8 *nmk,
                                enum cp_msg_drv_sta_set_key_type_t *type,
                                cp_nid_t *nid,
                                cp_security_level_t *sl);

/**
 * Send a DRV_STA_SET_KEY.CNF.
 * \param  ctx  control plane context.
 * \param  peer  the peer info.
 * \param  nmk  the Network Membership Key.
 * \param  type  the key type.
 * \param  nid  the Network identifier.
 * \param  sl  the security level.
 */
void
cp_msg_drv_sta_set_key_ind_send (cp_t *ctx, cp_mme_peer_t *peer, u8 *nmk,
                                enum cp_msg_drv_sta_set_key_type_t type,
                                cp_nid_t nid,
                                cp_security_level_t sl);


/**
 * Send a DRV_....CNF, works for any DRV messages.
 * \param  ctx  control plane context
 * \param  peer  peer information
 * \param  mmtype  MMTYPE to respond to
 * \param  result  result code
 * \param  error_code  the error code.
 */
void
cp_msg_drv_any_cnf_send (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype,
                         cp_msg_drv_result_t result);

END_DECLS

#endif /* cp_msg_inc_msg_drv_h */