summaryrefslogtreecommitdiff
path: root/cesar/cp2/cco/bw/inc/bw.h
blob: e98b42b8cb2b0a391adda3244fd5243db20059a9 (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
#ifndef cp_cco_inc_bw_h
#define cp_cco_inc_bw_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    inc/cp_cco_bw_private.h
 * \brief   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */
#include "lib/set.h"
#include "cp2/cco/bw/bw.h"
#include "cp2/conn/link.h"
/**
 * Bandwidth Manager Module. - Create the schedule  - Allocate a specific
 * connection - finalise and return a schedule (used by the Beacon module
 * only)
 */
struct cp_cco_bw_private_t
{
    /** Public data. */
    cp_cco_bw_t public_data;

    /**
     * The actual schedule is the one is motion during the beacon period.
     * It receives modifications regarding on the incoming MMEs.
     */

};
typedef struct cp_cco_bw_private_t cp_cco_bw_private_t;



/**
 * Release the schedule after finaliseing it and sending it.
 * \param  sched  schedule to release
 * \return  \todo fill this
 *
 *  Initialise the new schedule
 */
cp_cco_bw_alloc_t*
cp_cco_bw_release_sched (cp_cco_bw_alloc_t* sched);

/**
 * Return the next connection
 * \param  conn  actual conncetion
 * \return  The next connection
 *
 */
cp_cco_bw_alloc_t*
cp_cco_bw_get_next_alloc_global(cp_cco_bw_alloc_t *alloc);


/**
 * Return the first connection of a heap
 * \param  heap  Heap
 * \return  The first connection of the heap
 *
 */
cp_cco_bw_alloc_t*
cp_cco_bw_get_first_alloc_global(cp_t *ctx);

/**
 * Tells if the connection is the last of the heap
 * \param  conn  connection
 * \return  bool true if last connection
 *
 */
bool
cp_cco_bw_is_last_alloc_global(cp_t *ctx, 
                               cp_cco_bw_alloc_t *alloc);

/**
 * Modifies the alloc and next alloc to the 
 * \param  ctx  Control plane context
 * \param  alloc  actual allocation 
 * \param  next_alloc  next allocation
 * \return  bool  true if allocs modified successfully
 */
bool
cp_cco_bw_set_next_free_allocation_time(cp_t *ctx, cp_cco_bw_alloc_t *alloc,
                                        cp_cco_bw_alloc_t *next_alloc);


/**
 * Returns the last ble and checks if the end of the free time has been
 * reached
 * \param  first_ble  First ble of the calculation spot
 * \param  last_ble  Last ble of this allocation spot
 * \param  nb_pb  Number of PBs to allocate
 * \param  alloc  allocation before the free time spot
 * \param  next_alloc  next allocation
 * \return  false we have reached the end of the spot before finishing the
 * allocation
 *
 */
bool
cp_cco_bw_get_last_ble(cp_link_ble_interval_t *first_ble,
                       cp_link_ble_interval_t * last_ble, 
                       u16 nb_pb, 
                       cp_cco_bw_alloc_t *alloc, 
                       cp_cco_bw_alloc_t *next_alloc);

bool
cp_cco_bw_calculation_of_alloc_time(cp_link_ble_interval_t *first_ble,
                          cp_link_ble_interval_t *last_ble, 
                          u16 nb_pb,
                          u16 *alloc_st, 
                          u16 *alloc_et, 
                          cp_cco_bw_alloc_t *alloc, 
                          cp_cco_bw_alloc_t *next_alloc);

#endif /* cp_cco_bw_private_h */