summaryrefslogtreecommitdiff
path: root/cesar/cl/brg_rx.h
blob: 768c27a598c3c124c3f5556bf9267a8ca0edd1e1 (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
#ifndef cl_brg_rx_h
#define cl_brg_rx_h
/* Cesar project {{{
 *
 * Copyright (C) 2011 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cl/brg_rx.h
 * \brief   RX bridge Table for data only.
 * \ingroup cl
 *
 * Allow the CL to learn the source mac address of the packets received and
 * associate it with the TEI of the MFS. Those entries should be added in the
 * mac to TEI table by a non real time process.
 * An entry is invalid if it is not present in the CM_BRG_TABLE sent by
 * the associated station.
 */

/** Number of entries for the temporary RX bridge table. */
#define CL_BRG_RX_ENTRY_NB 10

struct cl_brg_rx_entry_t
{
    /** Mac address. */
    mac_t mac;
    /** TEI associated with the mac address bridged. */
    uint tei;
};
typedef struct cl_brg_rx_entry_t cl_brg_rx_entry_t;

struct cl_brg_rx_t
{
    /** Number of entries. */
    uint nb_entry;
    /** Table of entries. */
    cl_brg_rx_entry_t entry[CL_BRG_RX_ENTRY_NB];
};
typedef struct cl_brg_rx_t cl_brg_rx_t;

BEGIN_DECLS

/**
 * Add an entry to the table.
 * \param  ctx  the module context.
 * \param  mac  the source mac address.
 * \param  tei  the TEI associated.
 */
void
cl_brg_rx_add (cl_t *ctx, mac_t smac, uint tei);

/**
 * Get the table.
 * \param  ctx  the module context.
 * \return  the table.
 *
 * This function will return the temporary table stored in a dynamic blk, the
 * client is responsible for releasing the block. Once the table is returned,
 * the CL will not use it anymore, if it receives a new Mac address bridged it
 * will create a new table.
 */
cl_brg_rx_t *
cl_brg_rx_get (cl_t *ctx);

/**
 * Release the Bridge RX table.
 * \param  ctx  the module context.
 *
 * The bridge table is destroyed and the CL will create another one to add new
 * bridged entries.
 */
void
cl_brg_rx_release (cl_t *ctx);

END_DECLS

#endif /* cl_brg_rx_h */