summaryrefslogtreecommitdiff
path: root/cesar/common/defs/homeplugAV.h
blob: fb3650c0a8eeca819e3357120b344242193b8f5d (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
#ifndef common_defs_homeplugAV_h
#define common_defs_homeplugAV_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    common/defs/homeplugAV.h
 * \brief   Home Plug AV constants.
 * \ingroup common_defs
 *
 * Defines for all the HPAV constants.
 */

/** Define the MTYPE for MME. */
#define HPAV_MTYPE_MME 0x88E1
/** Define the MTYPE size. */
#define HPAV_MTYPE_SIZE 2
/** Define the mtype offset where it is if the vlan is not present. */
#define HPAV_MTYPE_OFFSET 12
/** The vlan tag size in bytes. */
#define HPAV_VLANTAG_SIZE 4
/** Define the offset of the MMTYPE when the vlan is not present. */
#define HPAV_MMTYPE_OFFSET 15

/** Max payload size in bytes. */
#define HPAV_MME_PAYLOAD_MAX_SIZE_WITH_VLAN 1495
#define HPAV_MME_PAYLOAD_MAX_SIZE 1499

/** MMV version for the MME HomePlug 1.0 see section 11.1.5 */
#define HPAV_MMV0 0x0
/** MMV version for the MME HomePlug 1.1 see section 11.1.5 */
#define HPAV_MMV1 0x1
/** MMV version max for MME HomePlug. */
#define HPAV_MMV_MAX HPAV_MMV1

/** Define the MMV default type for HPAV. */
#define HPAV_MMV HPAV_MMV1

/** Define MMV Size. */
#define HPAV_MMV_SIZE 1

/** Define length of the MME HEADER with Vlan tag. */
#define HPAV_MME_HEADER_LEN_WITH_VLAN 23

/** Define length of the MME HEADER without Vlan tag. */
#define HPAV_MME_HEADER 19

/** Define MMTYPE size. */
#define HPAV_MMTYPE_SIZE 2

/** Define FMI Size. */
#define HPAV_FMI_SIZE 2

/** CRC Data. */
#define HPAV_CRC32_GENERATOR 0x04c11db7
#define HPAV_CRC32_INIT      0xffffffff
#define HPAV_CRC32_MAGIC     0x2144df1c

/** Nek change. */
#define HPAV_NEK_CHANGE_MS 3600000

/** Access or in home value. */
enum hpav_access_t
{
    HPAV_ACCESS_IN_HOME,
    HPAV_ACCESS_ACCESS,
    HPAV_ACCESS_NB
};
typedef enum hpav_access_t hpav_access_t;

/** Maximum number of visible AVLNs. See HPAV specification 1.1 on
 * MaxBeaconSlot */
#define HPAV_AVLNS_NB_MAX 8

/** Number maximum of slots in the beacon region. */
#define HPAV_BEACON_NUMSLOTS_MAX HPAV_AVLNS_NB_MAX

/** Number of Beacon Time Offset present in a beacon. */
#define HPAV_BEACON_BTO_NB 4

/** Invalid value for the BTO.*/
#define HPAV_BEACON_BTO_INVALID ((s16)0x8000)

/** Value of the permanent persistent schedule CSCD
 * Only valid if operating in CSMA only mode.. */
#define HPAV_SCHEDULE_PERMAMENT_VALUE 0x7

/** Define the size of the NID. */
#define HPAV_NID_SIZE 7
#define HPAV_NID_SIZE_BITS 54

/** Test if the NID is valid. */
#define HPAV_NID_IS_VALID(nid) \
    ((nid) >> HPAV_NID_SIZE_BITS == 0)

#endif /* common_defs_homeplugAV_h */