summaryrefslogtreecommitdiff
path: root/cesar/cp/beacon/inc/beacon.h
blob: f0395dbdac02d91dbb2a8183292665bdba52e4fb (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
#ifndef cp_beacon_inc_beacon_h
#define cp_beacon_inc_beacon_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    inc/cp_beacon_private.h
 * \brief   Beacon private data.
 * \ingroup cp_beacon
 *
 */
#include "lib/circular_buffer.h"

// Public ones.
#include "hal/timer/timer.h"
#include "cp/sta/mgr/net.h"

// Private ones.
#include "cp/beacon/inc/common.h"
#include "cp/beacon/inc/beacon_discover.h"
#include "cp/beacon/inc/unpack.h"

/* Countdown on 5 beacon periods. */
#define CP_BEACON_COUNTDOWN_DEFAULT 5
#define CP_BEACON_COUNTDOWN_SNID CP_BEACON_COUNTDOWN_DEFAULT
#define CP_BEACON_COUNTDOWN_HM CP_BEACON_COUNTDOWN_DEFAULT
#define CP_BEACON_COUNTDOWN_HOIP CP_BEACON_COUNTDOWN_DEFAULT

struct cp_beacon_snid_t
{
    /** The new SNID of the AVLN. */
    cp_snid_t snid;
    /** The snid countdown. */
    uint snidcd;
};

struct cp_beacon_hybrid_mode_t
{
    /** The Hybrid mode countdown. */
    uint hmcd;
    /** The new hybrid mode value. */
    mac_coexistence_mode_t hm;
};

struct cp_beacon_hoip_t
{
    /** The handover in progress countdown */
    uint hoipcd;
    /** The new CCo's TEI. */
    cp_tei_t cco;
    /** Hoip bit. */
    enum cp_beacon_hoip_e hoip_flag;
};

/**
 * Beacon module. Use to generate and read a beacon.
 */
struct cp_beacon_t
{
    /** circular list manager for the beacon reception. */
    cp_beacon_desc_t *list;
    cp_beacon_desc_t *list_tail;

    /**
     * Central beacon environment.
     */
    cp_beacon_common_t common[3];

    /**
     * Schedules index corresponding to the one in the Channel Access.
     */
    u16 ca_schedule_index;
    /**
     * First Shoot.
     */
    bool ca_sched_first_shoot;

    /**
     * The leon timer to be programmed and awake each beacon period.
     * Each time the timer expires, the function register by the beacon
     * shall post an event in the FSM.
     */
    hal_timer_instance_t leon_timer;

    /**
     * Nek index.
     */
    uint nek_index;

    /**
     * Discover process use by the CCo. */
    cp_beacon_discover_t discover;
    cp_beacon_bentry_discover_info_t discover_info_last;

    /** Snid countdown structure. */
    struct cp_beacon_snid_t snids;

    /** Hybrid mode countdown structure. */
    struct cp_beacon_hybrid_mode_t hm;

    /** Handover in progress structure. */
    struct cp_beacon_hoip_t hoip;
};
typedef struct cp_beacon_t cp_beacon_t;

#endif /* cp_beacon_inc_beacon_h */