summaryrefslogtreecommitdiff
path: root/cesar/mac/pbproc/test/pbproc_eoc/inc/utils.h
blob: 8de5d1f8b51fad354e1a8835cd760c8655ca1d6f (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
#ifndef inc_utils_h
#define inc_utils_h
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    inc/utils.h
 * \brief   Utilities.
 * \ingroup test
 */
#include "mac/common/mfs.h"
#include "mac/common/tonemap.h"
#include "mac/common/store.h"
#include "inc/test_pbproc.h"

/** Step between created PBs' expiration date.  Needed, because of the hysteresis
 * offset used in the expiration process, to have some control on the number of
 * expired PBs. */
#define UTILS_MFS_EXPIRATION_NTB_STEP PBPROC_EXPIRATION_HYSTERESIS_OFFSET

/** Define interval properties. */
struct utils_interval_t
{
    /** Interval end offset, 0 to stop. */
    uint end_offset_tck;
    /** TMI for this interval. */
    u8 tmi;
    /** Number of bits in this tonemap if it has to be created, else 0. */
    uint tm_mod;
};
typedef struct utils_interval_t utils_interval_t;

BEGIN_DECLS

mfs_tx_t *
utils_mfs_tx_prepare (bool bcast, bool mme, uint lid, uint tei, int seg_nb);

mfs_tx_t *
utils_mfs_tx_holes_prepare (bool bcast, bool mme, uint lid, uint tei,
                            int seg_nb, u64 holes_bmp, mac_store_t *store);

void
utils_mfs_tx_cleanup (mfs_tx_t *mfs);

tonemap_t *
utils_sta_prepare_default_tonemap (test_pbproc_t *tp, bool tx, uint tei,
                                   uint tmi, uint tm_mod, uint tm_max_fl_tck,
                                   uint *dx);

/**
 * Prepare tonemaps intervals.
 * \param  tp  test context
 * \param  tei  STA TEI
 * \param  intervals  list of intervals to prepare
 * \param  default_tmi  new default TMI
 * \return  intervals version
 *
 * utils_sta_prepare_default_tonemap should have been called before.
 */
uint
utils_sta_prepare_intervals (test_pbproc_t *tp, uint tei,
                             utils_interval_t *intervals, uint default_tmi);

void
utils_prepare_encryption (test_pbproc_t *tp, bool encrypted, bool sta_auth,
                          uint tei, uint nek_switch);

void
utils_delete_mfs_saved(void);

mfs_tx_t *
utils_mfs_tx_prepare_save (bool bcast, bool mme, uint lid, uint tei,
                           uint seg_nb);


END_DECLS

#endif /* inc_utils_h */