summaryrefslogtreecommitdiff
path: root/cesar/cp/msg/inc/msg_vs.h
blob: 0ebae22bd6ad73a22f8a0d85c2cdc8fb08a9a653 (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
#ifndef cp_msg_inc_msg_vs_h
#define cp_msg_inc_msg_vs_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/msg/inc/msg_vs.h
 * \brief   VS family MME.
 * \ingroup cp_msg
 */
#include "cp/msg/inc/vs_get_tonemap.h"
#include "cp/msg/inc/vs_get_snr.h"
#include "cp/msg/inc/vs_get_spectrum.h"
#include "cp/msg/inc/vs_get_link_stat.h"
#include "cp/msg/inc/vs_get_amp_map.h"
#include "cp/msg/inc/vs_get_stats.h"
#include "cp/msg/inc/vs_get_pb_stats.h"
#include "cp/msg/inc/imac_get_discover_list.h"
#include "cp/msg/inc/vs_get_snr.h"
#include "cp/msg/inc/vs_get_ce_stats.h"

#include "mac/common/tonemap.h"
#include "lib/stats.h"

BEGIN_DECLS


/**
 * Receive a VS_GET_TONEMAP.REQ.
 * \param  ctx  the control plane context.
 * \param  mme  the MME handle.
 * \param  mac_addr  the MAC address of remote station.
 * \param  tmi  the tonemap index.
 * \param  int_id  the current tonemap interval list identifier.
 * \param  dir  the direction of tonemap.
 * \return  true on success.
 */
bool
cp_msg_vs_get_tonemap_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                   mac_t *mac_addr,
                                   cp_msg_vs_get_tonemap_tmi_t *tmi,
                                   u8 *int_id,
                                   cp_msg_vs_get_tonemap_req_dir_t *dir);

/**
 * Start sending of a VS_GET_TONEMAP.CNF.
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \param  result  the result.
 * \param  beacon_delta  the Delta t btwn beacon priod strt & 50/60Hz 0 cross.
 * \param  int_id  the Current tonemap interval list identifier.
 * \param  tms  the tone maps parameters.
 * \param  tmi  the requested tonemap.
 */
void
cp_msg_vs_get_tonemap_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
        cp_msg_vs_get_tonemap_cnf_result_t result,
        uint beacon_delta, u8 int_id,tonemaps_t *tms,
        cp_msg_vs_get_tonemap_tmi_t tmi);

/**
 * Receive a VS_GET_SNR.REQ.
 * \param  ctx  the control plane context.
 * \param  mme  the MME handle.
 * \param  mac_addr  the MAC address of remote station.
 * \param  tm_int_i  the tonemap interval index.
 * \param  int_id  the current tonemap interval list identifier.
 * \param  carrier_gr  the carrier group.
 * \return  true on success.
 */
bool
cp_msg_vs_get_snr_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                               mac_t *mac_addr,
                               cp_msg_vs_get_snr_req_int_t *tm_int_i,
                               u8 *int_id,
                               u8 *carrier_gr);

/**
 * Send VS_GET_SNR.CNF
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \param  data  MME data to send
 */
void
cp_msg_vs_get_snr_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
                            const cp_msg_vs_get_snr_cnf_t *data);

/**
 * Receive a VS_GET_SPECTRUM.REQ.
 * \param  ctx  the control plane context.
 * \param  mme  the MME handle.
 * \param  mac_addr  the MAC address of remote station.
 * \param  carrier_gr  the carrier group.
 * \return  true on success.
 */
bool
cp_msg_vs_get_spectrum_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                    mac_t *mac_addr,
                                    cp_msg_vs_get_spectrum_req_carrier_gr_t
                                    *carrier_gr);

/**
 * Start sending of a VS_GET_SPECTRUM.CNF.
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \param  result  the result.
 * \param  AvgAGC  the Average AGC.
 * \return  the message context.
 */
cp_mme_tx_t *
cp_msg_vs_get_spectrum_cnf_send_begin (cp_t *ctx, cp_mme_peer_t *peer,
                                       cp_msg_vs_get_spectrum_cnf_result_t
                                       result, u8 AvgAGC);

/**
 * Fill the MME with lst of spectrum values for requested carrier group modulo
 * \param  ctx  the module context.
 * \param  mme  the MME message.
 * \param  spectrum  the struct that contains the spectrum value.
 */
void
cp_msg_vs_get_spectrum_cnf_send_spectrum (cp_t *ctx, cp_mme_tx_t *mme,
                                          cp_msg_vs_get_spectrum_cnf_spec_t
                                          *spectrum);

/**
 * End sending of a VS_GET_SPECTRUM.CNF.
 * \param  ctx  the control plane context.
 * \param  mme  the MME to send.
 */
void
cp_msg_vs_get_spectrum_cnf_send_end (cp_t *ctx, cp_mme_tx_t *mme);

/**
 * Receive a VS_GET_LINK_STATS.REQ.
 * \param  ctx  the control plane context.
 * \param  mme  the MME handle.
 * \param  data  the received MME data.
 * \return  true on success.
 */
bool
cp_msg_vs_get_link_stats_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                      cp_msg_vs_get_link_stats_req_t *data);

/**
 * Send a VS_GET_LINK_STATS.CNF.
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \param  ReqID  the Request Identifier from the corresponding request.
 * \param  result  the result.
 * \param  Bad_CRC  the Bad CRC number from received PBs.
 * \return  the message context.
 */
void
cp_msg_vs_get_link_stats_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
                                   u8 ReqID,
                                   cp_msg_vs_get_link_stats_cnf_result_t
                                   result,
                                   u32 Bad_CRC);

/**
 * Start sending of a VS_GET_AMP_MAP.CNF.
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \param  result  the result.
 * \param  amlen  the Number of amplitude map data entries.
 * \return  the message context.
 */
cp_mme_tx_t *
cp_msg_vs_get_amp_map_cnf_send_begin (cp_t *ctx, cp_mme_peer_t *peer,
                                      cp_msg_vs_get_amp_map_cnf_result_t
                                      result, u16 amlen);

/**
 * Fill the MME with lst of amp map data used for the 1536 max carriers
 * \param  ctx  the module context.
 * \param  mme  the MME message.
 * \param  ampmap  the amplitude map value.
 */
void
cp_msg_vs_get_amp_map_cnf_send_ampmap (cp_t *ctx, cp_mme_tx_t *mme,
                                       u8 ampmap);

/**
 * End sending of a VS_GET_AMP_MAP.CNF.
 * \param  ctx  the control plane context.
 * \param  mme  the MME to send.
 */
void
cp_msg_vs_get_amp_map_cnf_send_end (cp_t *ctx, cp_mme_tx_t *mme);

/**
 * Receive a VS_GET_STATS.REQ.
 * \param  ctx  the control plane context.
 * \param  mme  the MME handle.
 * \param  page_number  the page requested.
 * \return  true on success.
 */
bool
cp_msg_vs_get_stats_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                 u8 *page_number, u8* level);

/**
 * Start sending of a VS_GET_STATS.CNF.
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \return  the message context.
 */
cp_mme_tx_t *
cp_msg_vs_get_stats_cnf_send_begin (cp_t *ctx, cp_mme_peer_t *peer);

/**
 * Sending the VS_GET_STATS.CNF
 * \param  ctx  the ctx module.
 * \param  mme  the MME handle.
 * \param  page  the page to send.
 * \param  nb_pages  the total number of pages available.
 * \param  level  the level if the statistics.
 * \param  result  the result of the command.
 */
void
cp_msg_vs_get_stats_cnf_send (cp_t *ctx, cp_mme_tx_t *mme, u8 page,
                              u8 nb_pages, lib_stats_level_t level,
                              cp_msg_vs_get_stats_cnf_result_t result);

/**
 * Ends sending the VS_GET_STATS.CNF
 * \param  ctx  the ctx module.
 * \param  mme  the MME handle.
 */
void
cp_msg_vs_get_stats_cnf_send_end (cp_t *ctx, cp_mme_tx_t *mme);

/**
 * Receive a VS_GET_PB_STATS.REQ.
 * \param  ctx  the control plane context.
 * \param  mme  the MME handle.
 * \param  stei_filter  return the value read inside the MME.REQ.
 * \return  true on success.
 */
bool
cp_msg_vs_get_pb_stats_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                    cp_tei_t *stei_filter);

/**
 * Start sending of a VS_GET_PB_STATS.CNF.
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \param  nb_measures  the number of measure to send
 * \return  the message context.
 */
cp_mme_tx_t *
cp_msg_vs_get_pb_stats_cnf_send_begin (cp_t *ctx, cp_mme_peer_t *peer,
                                       int nb_measures);

/**
 * Send one station info field of VS_GET_PB_STATS.CNF
 * \param  ctx  the ctx module.
 * \param  mme  the MME handle.
 * \param  start_to_read  index on the first entry in the pb stats table.
 * \param  nb_entries  Amount of entries to read.
 */
void
cp_msg_vs_get_pb_stats_cnf_send_measure (cp_t *ctx, cp_mme_tx_t *mme,
                                         int start_to_read, int nb_entries);

/**
 * Ends sending the VS_GET_PB_STATS.CNF
 * \param  ctx  the ctx module.
 * \param  mme  the MME handle.
 */
void
cp_msg_vs_get_pb_stats_cnf_send_end (cp_t *ctx, cp_mme_tx_t *mme);

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

/**
 * Start sending of a IMAC_GET_DISCOVER_LIST.CNF.
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \param  result  the result of the request
 * \param  version  the format version of station list
 * \param  num_stations  the number of discovered stations
 * \return  the message context.
 */
cp_mme_tx_t *
cp_msg_imac_get_discover_list_cnf_send_begin (cp_t *ctx, cp_mme_peer_t *peer,
        cp_msg_imac_get_discover_list_cnf_result_t result, u8 version,
        u8 num_stations);

/**
 * Send one station info field of IMAC_GET_DISCOVER_LIST.CNF
 * \param  ctx  the ctx module.
 * \param  mme  the MME handle.
 * \param  data  data to be sent.
 */
void
cp_msg_imac_get_discover_list_cnf_send (cp_t *ctx, cp_mme_tx_t *mme,
        const cp_msg_imac_discover_list_sta_info_t *data);

/**
 * Ends sending the IMAC_GET_DISCOVER_LIST.CNF
 * \param  ctx  the ctx module.
 * \param  mme  the MME handle.
 */
void
cp_msg_imac_get_discover_list_cnf_send_end (cp_t *ctx, cp_mme_tx_t *mme);

/**
 * Receive a VS_GET_CE_STATS.REQ
 * \param  ctx  the control plane context.
 * \param  mme  the handled MME.
 * \param  mac_addr  the MAC address of remote station.
 * \return  true on success.
 */
bool
cp_msg_vs_get_ce_stats_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
                                    mac_t *mac_addr);

/**
 * Send a VS_GET_CE_STATS.CNF.
 * \param  ctx  the control plane context.
 * \param  peer  the peer info.
 * \param  version  version of the mme.
 * \param  result  result of VS_GET_CE_STATS.CNF.
 * 0 if peer exists (success), 1 otherwise (failure).
 * \param  sta  peer to stat. Ignored if result corresponds to failure.
 * \param  ti  tonemask. Ignored if result corresponds to failure.
 */
void
cp_msg_vs_get_ce_stats_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
                                 u8 version,
                                 u8 result,
                                 sta_t *sta,
                                 tonemask_info_t *ti);
END_DECLS

#endif /* cp_msg_inc_msg_vs_h */