summaryrefslogtreecommitdiff
path: root/cesar/cp2/beacon/inc/bentry_size.h
blob: 96f4c6240fa407e5e6665bae98b974bc8e41a88b (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
#ifndef cp2_beacon_inc_bentry_size_h
#define cp2_beacon_inc_bentry_size_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp2/beacon/inc/bentry_size.h
 * \brief   Define the size in bytes off all beacon entries. 
 * \ingroup cp2_beacon
 *
 * Each beacon entries is define here, and all macros necessary to compute the
 * length of any bentry payload.
 *
 * \warn  all definition here are in BYTES, to convert in bits use the 
 * BYTES_SIZE_TO_BITS macro define in lib/utils.h
 */

/* Static size bentry. */

/** Bentry header size. */
#define CP_BEACON_ENTRY_HEADER 2

/** Mac Address bentry size. */
#define CP_BEACON_ENTRY_MAC_ADDRESS 6

/** Discover Bentry. */
#define CP_BEACON_ENTRY_DISCOVER 1

/** Discover Info Bentry. */
#define CP_BEACON_ENTRY_DISCOVER_INFO 4

/** Beacon Period Start Time Offset. */
#define CP_BEACON_ENTRY_BPSTO 3

/** Encryption key change. */
#define CP_BEACON_ENTRY_EKC 2

/** Handover. */
#define CP_BEACON_ENTRY_HOIP 2

/** Beacon Relocation. */
#define CP_BEACON_ENTRY_RLO 3

/** AC Line synchronisation. */
#define CP_BEACON_ENTRY_ACL 2

/** Change Num Slots. */
#define CP_BEACON_ENTRY_CHANGE_NUMSLOTS 2

/** Change hybrid mode. */
#define CP_BEACON_ENTRY_CHANGE_HM 1

/** Change SNID. */
#define CP_BEACON_ENTRY_CHANGE_SNID 1

/* Variable ones. */

/** Define the size in bytes of a SAI with start time. */
#define CP_BEACON_ENTRY_SCHED_SAI_STPF 4

/** Define the size in bytes of a SAI without start time. */
#define CP_BEACON_ENTRY_SCHED_SAI_NSTPF 3

/** Define the macro to compute a non persistent schedule bentry. */
#define CP_BEACON_ENTRY_NON_PERSISTENT_SCHED(sai, nsai) (1 + \
                                (sai * CP_BEACON_ENTRY_SCHED_SAI_STPF) + \
                                (nsai * CP_BEACON_ENTRY_SCHED_SAI_NSTPF))


/** Define the macro to compute a persistent schedule bentry. */
#define CP_BEACON_ENTRY_PERSISTENT_SCHED(sai, nsai) (2 + \
                                (sai * CP_BEACON_ENTRY_SCHED_SAI_STPF) + \
                                (nsai * CP_BEACON_ENTRY_SCHED_SAI_NSTPF))

/** Define the size in bytes of a region definition. */
#define CP_BEACON_ENTRY_REGION_SIZE 2

/** Define the Macro to compute a region bentry. */
#define CP_BEACON_ENTRY_REGION(nr) (1 + CP_BEACON_ENTRY_REGION_SIZE * nr)

#endif /* cp2_beacon_inc_bentry_size_h */