summaryrefslogtreecommitdiff
path: root/cesar/cp/sta/mgr/sta.h
blob: 9f6dec99afd7512d265e5cd5c6d108a6e4987f93 (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
#ifndef cp_sta_mgr_sta_h
#define cp_sta_mgr_sta_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/sta/mgr/sta.h
 * \brief   Stations data.
 * \ingroup cp_sta_mgr
 *
 */
#include "common/defs/homeplugAV.h"
#include "lib/set.h"
#include "cp/types.h"
#include "cp/mme.h"
#include "mac/common/store.h"

/** Enum */
enum cp_sta_visible_status_t
{
    CP_STA_VISIBLE_STATE_HIDDEN,
    CP_STA_VISIBLE_STATE_VISIBLE,
    CP_STA_VISIBLE_STATE_ASSERT
};
typedef enum cp_sta_visible_status_t cp_sta_visible_status_t;

/** Reassembly context block. */
struct cp_sta_reassembly_ctx_blk_t
{
    /** Pointer on the next block. */
    struct cp_sta_reassembly_ctx_blk_t *next;
    /** Pointer on the MME payload. */
    u8 *data;
    /** Length of the payload in the block. */
    uint length;
    /** Sequence number (FMI SSN). */
    uint ssn;
};
typedef struct cp_sta_reassembly_ctx_blk_t cp_sta_reassembly_ctx_blk_t;

/** Reassembly context. */
struct cp_sta_reassembly_ctx_t
{
    /** Last segment received. */
    uint last_seg_ssn;
    /** Encrypted by the hardware. */
    bool encrypt;
    /** MME fragment head. */
    cp_sta_reassembly_ctx_blk_t *head;
    /** MMe fragment tail. */
    cp_sta_reassembly_ctx_blk_t *tail;
};
typedef struct cp_sta_reassembly_ctx_t cp_sta_reassembly_ctx_t;

/**
 * Control plane station.
 */
struct cp_sta_t
{
    /**
     * Indicate if the station is  Backup CCo.
     */
    bool is_backup_cco;

    /**
     * Last date seen in the AVLN.
     */
    uint last_seen_ms;

    /**
     * The Reassembly context for the cl_interf.
     */
    cp_sta_reassembly_ctx_t reassembly_ctx;

    /**
     * The tei expiration date.
     */
    uint tei_lease_ms;

    /**
     * The station CCo capability.
     */
    u8 cco_cap;

    /**
     * Indicate if the station can be PCo.
     */
    bool pco_cap;

    /**
     * Indicate if the stations can be backup CCo.
     */
    bool backup_cco_cap;

    /**
     * Number of discover stations.
     */
    u8 numDisSta;

    /**
     * Number of discover networks.
     */
    u8 numDisNet;

    /**
     * The average BLE.
     */
    u8 average_ble;

    /**
     * PCo  the station acting as Proxy for this station.
     */
    cp_tei_t pco;

    /**
     * The last assoc request date emitted by the station.
     */
    uint assoc_req_last_ms;

    /**
     * Soft handover
     */
    bool soft_handover;

    /** Set net node. */
    set_node_t node_net;

    /** Set sta_mgr node*/
    set_node_t node_sta_mgr;

    /** Release list node. */
    list_node_t release_node;

    /** Heap CCo selection node. */
    heap_node_t cco_selection_node;
};
typedef struct cp_sta_t cp_sta_t;

BEGIN_DECLS

/**
 * Get the station's TEI.
 * \param  ctx  the module context.
 * \return  The station TEI.
 *
 */
cp_tei_t
cp_sta_get_tei (cp_sta_t *ctx);

/**
 * Get the station's mac address.
 * \param  ctx  the module context.
 * \return  The station mac address.
 *
 */
mac_t
cp_sta_get_mac_address (cp_sta_t *ctx);

/**
 * Fill peer structure with station TEI and MAC address.
 * \param  ctx  the module context.
 * \param  peer  peer structure to fill.
 */
void
cp_sta_get_peer (cp_sta_t *ctx, cp_mme_peer_t *peer);

/**
 * Get the station's cco status.
 * \param  ctx  the module context.
 * \return  the CCo status of the station.
 */
bool
cp_sta_get_cco_status (cp_sta_t *ctx);

/**
 * Get the Proxy CCo status of the station.
 * \param  ctx  the module context.
 * \return  The PCo status of the station.
 *
 */
bool
cp_sta_get_pco_status (cp_sta_t *ctx);

/**
 * Return the PCO GLID.
 * \param  ctx  the module context.
 * \return  return the GLID.
 *
 */
u8
cp_sta_get_pco_glid (cp_sta_t *ctx);

/**
 * Set the station GLID to use as PCO.
 * \param  ctx  the module context.
 * \param  glid  The station GLID.
 */
void
cp_sta_set_pco_glid (cp_sta_t *ctx, u8 glid);

/**
 * Set the visible status of the station.
 * \param  ctx  the module context.
 * \param  sta  Set the visible status of the station.
 * \param  status  the status.
 */
void
cp_sta_set_visible_status (cp_t *ctx, cp_sta_t * sta,
                           cp_sta_visible_status_t status);

/**
 * Get the visible status of the station.
 * \param  ctx  the module context.
 * \param  sta  Set the visible status of the station.
 * \param  status  the status.
 *
 */
cp_sta_visible_status_t
cp_sta_get_visible_status (cp_sta_t * sta);

/**
 * Set the Station authenticated state.
 * \param  ctx  the CP context.
 * \param  sta  the station to update
 * \param  auth  the authenticated status.
 */
void
cp_sta_set_authenticated (cp_t *ctx, cp_sta_t *sta, bool auth);

/**
 * Get the Station authenticated state.
 * \param  ctx  the CP context.
 * \param  sta  the station to update
 * \param  auth  the authenticated status.
 */
bool
cp_sta_get_authenticated (cp_t *ctx, cp_sta_t *sta);

/**
 * Set the multi unicast reception of the station.
 * \param  ctx  the CP context.
 * \param  sta  the station to set the state.
 * \param  state  the multi unicast capability.
 */
void
cp_sta_set_assoc_confirmed (cp_t *ctx, cp_sta_t *sta, bool state);

/**
 * Get the multi unicast reception of the station.
 * \param  ctx  the CP context.
 * \param  sta  the station to set the state.
 * \return  the multi unicast capability.
 */
bool
cp_sta_get_assoc_confirmed (cp_t *ctx, cp_sta_t *sta);

END_DECLS

#endif /* cp_sta_mgr_sta_h */