summaryrefslogtreecommitdiff
path: root/cesar/cp/sta/mgr/net_list.h
blob: a4c7c641399b4cc1e9b630ef8df59ab9a69a5331 (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
#ifndef cp_sta_mgr_net_list_h
#define cp_sta_mgr_net_list_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/sta/mgr/net_list_h
 * \brief   Public interface for the net list.
 * \ingroup cp_sta_mgr
 *
 */
#include "cp/types.h"

#include "cp/sta/mgr/net.h"

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

BEGIN_DECLS

/**
 * Initialise the lists.
 * \param  ctx  the module context.
 * \param  network  the network list.
 */
void
cp_net_list_init (cp_t *ctx, cp_net_list_t *network);

/** Uninitialise the network list.
 * \param  ctx  the module context.
 * \param  network  the network list.
 */
void
cp_net_list_uninit (cp_t *ctx, cp_net_list_t *network);

/**
 * Calls the sub modules garbage to remove old data.
 * \param  ctx  the module context.
 * \param  network  the network list.
 * \param  date_ms the current date in milliseconds.
 */
void
cp_net_list_garbage_net (cp_t *ctx, cp_net_list_t *network, u32 date_ms);

/**
 * Add an AVLN to the list.
 * \param  ctx  the module context.
 * \param  network  the network list.
 * \param  snid  The AVLN's SNID to add.
 * \param  nid  The AVLN's NID to add.
 * \return  return the network added.
 */
cp_net_t *
cp_net_list_add_avln (cp_t *ctx, cp_net_list_t *network,
                      cp_snid_t snid, cp_nid_t nid);

/**
 * Removes an AVLN from the sta manager.
 * \param  ctx  the module context.
 * \param  network  the network list.
 * \param  snid  The AVLN's SNID to remove.
 * \param  nid  The AVLN's NID to remove.
 */
void
cp_net_list_remove_avln (cp_t *ctx, cp_net_list_t *network,
                         cp_snid_t snid, cp_nid_t nid);

/**
 * Returns the AVLN corresponding to the snid and nid.
 * \param  ctx  the module context.
 * \param  network  the network list.
 * \param  snid  The AVLN's snid to get.
 * \param  nid  The AVLN's NID to get.
 * \return  return the network.
 */
cp_net_t *
cp_net_list_get_avln (cp_t *ctx, cp_net_list_t *network,
                      cp_snid_t snid, cp_nid_t nid);

/**
 * Verify if the network list is empty and return true if it is.
 * \param  ctx  the module context.
 * \param  network  the network module.
 * \return  true if network list is empty, false otherwise.
 */
bool
cp_net_list_is_empty (cp_t *ctx, cp_net_list_t *network);

/**
 * Create a 16 bits flag indicating which SNID are in use.
 * \param  ctx  the module context.
 * \param  network the network list.
 * \return  A 16 bits flag
 */
u16
cp_net_list_get_snid_present (cp_t *ctx, cp_net_list_t *network);

/**
 * Get the slot usage of the AVLNs.
 * \param  ctx  the module context.
 * \param  network the network list.
 * \return  the slot usage mask.
 *
 *  It corresponds to a 8 bits field
 */
u8
cp_net_list_get_slot_usage (cp_t *ctx, cp_net_list_t *network);

/**
 * Get the number of discovered station on all AVLNs.
 * \param  ctx  the module context.
 * \param  network  the network list.
 * \return  the number of discovered station.
 */
u8
cp_net_list_get_num_discovered_stas (cp_t *ctx, cp_net_list_t *network);

/**
 * Get the number of discovered networks.
 * \param  ctx  the module context.
 * \param  network  the network list.
 * \return  the number of discovered networks.
 */
u8
cp_net_list_get_num_discovered_net (cp_t *ctx, cp_net_list_t *network);

END_DECLS

#endif /* cp_sta_mgr_net_list_h */