summaryrefslogtreecommitdiff
path: root/cp2/sta/data/net_list.h
blob: 52f1ff1d8e1f6409e29412379cbd7e09add9bddd (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
#ifndef cp2_sta_data_net_list_h
#define cp2_sta_data_net_list_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp2/sta/data/net_list.h
 * \brief   CP Net list managing an AVLN. 
 * \ingroup cp_sta_data
 *
 * The Network list data for one AVLN.
 */

#include "cp2/sta/data/sta_list.h"

struct cp_net_list_t
{
    /** Short Network ID. */
    u16 snid;
    /** Network ID. */
    u64 nid;
    /** Network Membership Key. */
    uint nmk;
    /** Network password. */
    u128 npw;
    /** Network present. */
    bool present;
    /** CCo in the AVLN. */
    cp_sta_t cco;
    /** PCo in the AVLN. */
    cp_sta_t pco;
};
typedef struct cp_net_list_t cp_net_list_t;

/** Add a sta to this AVLN.
 * \param  net_list  the net list to add the sta.
 * \param  sta  the sta to add.
 */
void
cp_net_list_add_sta(cp_net_list_t *net_list, cp_sta_t *sta);

/** Remove a station from the AVLN.
 * \param  net_list  the list to remove ths sta.
 * \param  the sta to remove.
 */
void
cp_net_list_remove_sta(cp_net_list_t *net_list, cp_sta_t *sta);

/** Remove the sta by providing the STA's tei from this AVLN.
 * \param  net_list  the net_list from the one the sta shall be removed.
 * \param  tei  the station's tei.
 */
void
cp_net_list_remove_sta_from_tei(cp_net_list_t *net_list, u8 tei);

/** Get the station from the AVLN.
 * \param  net_list  the net_list to get the station.
 * \param  tei  the tei of the station.
 * \return  the station if it is in the AVLN, NULL otherwise.
 */
cp_sta_t *
cp_net_list_get_sta(cp_net_list_t *net_list, u8 tei);

/** Get the first station of the AVLN.
 * \param  net_list  the AVLN list to get it's first sta.
 * \return  the first station if the AVLN has one.
 */
cp_sta_t *
cp_net_list_first_sta(cp_net_list_t *net_list);

/** Get the next station from the AVLN.
 * \param  net_list  the AVLN net list.
 * \param  sta  the current station to get the next one.
 * \return   the next station of the one provided.
 */
cp_sta_t *
cp_sta_t cp_net_list_next_sta(cp_net_list_t *net_list, cp_sta_t *sta);

#endif /* cp2_sta_data_net_list_h */