summaryrefslogtreecommitdiff
path: root/cesar/cp/defs.h
blob: ff3f9aac792f24933d95aa478e4adf1041675601 (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
#ifndef cp_defs_h
#define cp_defs_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/defs.h
 * \brief   Definition for the Control Plane.
 * \ingroup cp
 */

#include "build_info.h"

/* Timeout value. */
#define CP_TIMEOUT_MS 1000

/* Bentry countdown. */
#define CP_BENTRY_COUNTDOWN_DEFAULT 5

/* Default time lease for associated STA (in minutes.) . */
#define CP_LEASE_ASSOC_MIN 0xF   /* 15 minutes. */
#define CP_LEASE_AUTH_MIN 0xB40 /* 48 hours. */

/** The time since the last assoc.req emitted by a station to be considered as
 * fully associated. */
#define CP_ASSOC_FULL_TIMEOUT_MS 2000

/** CCo level. */
#define CP_CCO_LEVEL_MAX 3
#define CP_CCO_LEVEL 0

/** AV Version. */
#define CP_AV_VERSION 0

/** PCo capability. */
#define CP_PCO_CAP_MAX 1
#define CP_PCO_CAP false

/** Backup CCo Cap. */
#define CP_BACKUP_CCO_CAP_MAX 1
#define CP_BACKUP_CCO_CAP false

/** Auto Connect Capability (ACS). */
#define CP_ACS_CAP false
#define CP_ACS_CAP_MAX 1

/** Smoothing Capability. */
#define CP_SMOOTHING_CAP false
#define CP_SMOOTHING_CAP_MAX 1

/** Soft Handover Support. */
#define CP_SOFT_HANDOVER_CAP false
#define CP_SOFT_HANDOVER_CAP_MAX 1

/** Two Symbol Frame Control Support. */
#define CP_TWO_SYM_FC_CAP false
#define CP_TWO_SYM_FC_CAP_MAX 1

/** Capability of Operating in Various Regulatory Domains. */
#define CP_REGULATORY_CAP 0x00 // North America Only
#define CP_REGULATORY_CAP_MAX 0

/** Bidirectional Bursting Capability. */
#define CP_BIDIRECTIONAL_BURSTING_CAP false
#define CP_BIDIRECTIONAL_BURSTING_CAP_MAX 2

/** Implementation Version. */
#define CP_IMPLEMENTATION_VERSION BUILD_INFO_IMPLEMENTATION

/** Minimum size of NPW password. */
#define CP_NPW_MIN_SIZE 8  // bytes
#define CP_NPW_MAX_SIZE 64 // bytes

/** Maximum size of HFID (human-friendly identifier). */
#define CP_HFID_SIZE 64 // bytes

/** NMK size. */
#define CP_NMK_SIZE 16 // bytes

/** Device password length. */
#define CP_DPW_MIN_SIZE 16 // bytes
#define CP_DPW_MAX_SIZE 64 // bytes

/** Hash key size. */
#define CP_HASH_KEY_SIZE 384

/** Expiration delay for the station in seconds. */
#define CP_STA_EXPIRATION_DELAY_S 1

/** Expiration delay for the networks. */
#define CP_NET_EXPIRATION_DELAY_S 70

/** Minimum CCo Beacon scan time (BTT). */
#define CP_CCO_BEACON_SCAN_MIN_MS 1000

/** Maximum CCo Beacon scan time (BTT). */
#define CP_CCO_BEACON_SCAN_MAX_MS 2000

/** Minimum Beacon scan time (BTT). */
#define CP_BEACON_SCAN_MIN_MS 2000

/** Maximum Beacon scan time (BTT). */
#define CP_BEACON_SCAN_MAX_MS 4000

/** Approximated unassociated STA advertisement interval. */
#define CP_USTA_IND_INTERVAL_MS 1000

/** Discover period. */
#define CP_DISCOVER_PERIOD_MAX_S 10
#define CP_DISCOVER_PERIOD_MAX_MS (CP_DISCOVER_PERIOD_MAX_S * 1000)

/** Maximum number of beacon loss because an AVLN failure. */
#define CP_MAX_NO_BEACON 10

/** Max schedules beacon periods. */
#define CP_SCHED_BEACON_PERIODS_MAX 4

/** Define the size of the NID. */
#define CP_NID_SIZE 7
#define CP_NID_SIZE_BITS 54

/** Specific allocation time in ATU. Calulated from their size in byte and their
 * transmission in ROBO modulation*/

/*Beacon size 136 bytes, repetition 5 time*/
#define CP_CCO_BW_ALLOC_TIME_BEACON_ATU 141

/*CFPI size 4 ms recommended*/
#define CP_CCO_BW_ALLOC_TIME_CFPI_ATU 390

/*MinCSMA size 1500 µs recommended*/
#define CP_CCO_BW_ALLOC_TIME_MINCSMA_ATU 147

/*Protection of overrun. Value not into the hpAV spec.*/
#define CP_CCO_BW_ALLOC_TIME_END_TDMA_PROTECTION_ATU 10

/** Size of a PB in octet used to transport a MSDU */
#define CP_CCO_BW_PB_SIZE_OCTET 520

/** Number of Priority heaps */
#define CP_CCO_BW_NB_PRIORITY_HEAPS 4

/** minimal size of a CSMA allocation */
#define CP_CCO_BW_MIN_CSMA_ALLOC_ATU 5

/* Order of MAC address comparison is reversed to determine who will become
 * CCo! As a direct consequence, some manufacturer will always become CCo. */
#define MAC_REVERSE(mac) \
    (  ((mac) & 0xff0000000000ull) >> 40 \
     | ((mac) & 0x00ff00000000ull) >> 24 \
     | ((mac) & 0x0000ff000000ull) >> 8 \
     | ((mac) & 0x000000ff0000ull) << 8 \
     | ((mac) & 0x00000000ff00ull) << 24 \
     | ((mac) & 0x0000000000ffull) << 40)

/** Macro to verify the ASCII string validity. */
#define ASCII_IS_VALID(val) \
    ((((u8)(val) >= 32) && ((u8)(val) <= 127)) || ((u8) (val) == 0))

/** Ability to support Enhanced Coexistence with Homeplug AV 1.1. */
#define CP_HOMEPLUG_AV11_MAX 1
#define CP_HOMEPLUG_AV11 0

/** Homeplug AV 1.0.1 Interoperability Capability. */
#define CP_HOMEPLUG_AV101_MAX 1
#define CP_HOMEPLUG_AV101 0

/** Timer offset for beacon data update. */
#define CP_TIMER_OFFSET_CCO 500000
#define CP_TIMER_OFFSET_STA 250000


#endif /* cp_defs_h */