summaryrefslogtreecommitdiff
path: root/cleopatre/application/libspid/inc/defs.h
blob: 43a9ddd86ae47971965f1e2893ddcace1d073a62 (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
/* SPC300 project {{{
 *
 * Copyright (C) 2010 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    application/libspid/inc/defs.h
 * \brief   define all item sizes used inside configuration / info files
 * \ingroup libspid
 *
 * All item sizes of config / info files are defined here to avoid some possible length mistakes
 */
#ifndef LIBSPID_DEFS_H
#define LIBSPID_DEFS_H

#include <stdint.h>

/* BOOLEAN */
#define LIBSPID_BOOLEAN_STR_MAX_LEN 8

/* IP/MAC ADDRESS */
/** Size of buffer to manage ip address */
#define LIBSPID_IP_STR_MAX_LEN 16
/** Size of buffer to manage mac address */
#define LIBSPID_MAC_STR_LEN 18
/** Size of mac address */ 
#define LIBSPID_MAC_BIN_LEN 6

#define LIBSPID_WIFI_DATA_ITEMS_COUNT           16
#define LIBSPID_WIFI_DATA_ITEMS_COMPARE_COUNT   1

#define LIBSPID_WIFI_DATA_LABEL_SSID            "SSID"
#define LIBSPID_WIFI_DATA_LABEL_CHANNEL         "Channel"
#define LIBSPID_WIFI_DATA_LABEL_WIRELESS_MODE   "WirelessMode"
#define LIBSPID_WIFI_DATA_LABEL_AUTH_MODE       "AuthMode"
#define LIBSPID_WIFI_DATA_LABEL_ENCRYP_TYPE     "EncrypType"
#define LIBSPID_WIFI_DATA_LABEL_IEEE8021X       "IEEE8021X"
#define LIBSPID_WIFI_DATA_LABEL_WPAPSK          "WPAPSK"
#define LIBSPID_WIFI_DATA_LABEL_REKEY_INTERVAL  "RekeyInterval"
#define LIBSPID_WIFI_DATA_LABEL_REKEY_METHOD    "RekeyMethod"
#define LIBSPID_WIFI_DATA_LABEL_RADIUS_SERVER   "RADIUS_Server"
#define LIBSPID_WIFI_DATA_LABEL_RADIUS_PORT     "RADIUS_Port"
#define LIBSPID_WIFI_DATA_LABEL_RADIUS_KEY      "RADIUS_Key"
#define LIBSPID_WIFI_DATA_LABEL_DEFAULTKEYID    "DefaultKeyID"
#define LIBSPID_WIFI_DATA_LABEL_KEY1TYPE        "Key1Type"
#define LIBSPID_WIFI_DATA_LABEL_KEY1STR         "Key1Str"
#define LIBSPID_WIFI_DATA_LABEL_OWN_IP_ADDR     "own_ip_addr"



#define LIBSPID_WIFI_DATA_SSID_MAX_LEN              33
#define LIBSPID_WIFI_DATA_CHANNEL_MAX_LEN           3
#define LIBSPID_WIFI_DATA_WIRELESS_MODE_MAX_LEN     3
#define LIBSPID_WIFI_DATA_AUTH_MODE_MAX_LEN         14
#define LIBSPID_WIFI_DATA_ENCRYP_TYPE_MAX_LEN       8
#define LIBSPID_WIFI_DATA_IEEE8021X_MAX_LEN         2
#define LIBSPID_WIFI_DATA_WPAPSK_MAX_LEN            65
#define LIBSPID_WIFI_DATA_REKEY_INTERVAL_MAX_LEN    8
#define LIBSPID_WIFI_DATA_REKEY_METHOD_MAX_LEN      8
#define LIBSPID_WIFI_DATA_RADIUS_SERVER_LEN         16
#define LIBSPID_WIFI_DATA_RADIUS_PORT_MAX_LEN       6
#define LIBSPID_WIFI_DATA_RADIUS_KEY_MAX_LEN        65
#define LIBSPID_WIFI_DATA_DEFAULTKEYID_MAX_LEN      2
#define LIBSPID_WIFI_DATA_KEY1TYPE_MAX_LEN          2   //0:HEX, 1::ASCII
#define LIBSPID_WIFI_DATA_KEY1STR_MAX_LEN           27
#define LIBSPID_WIFI_DATA_OWN_IP_ADDR_MAX_LEN       16


/* CONFIG ITEM/LINE */
#define LIBSPID_CONFIG_LINE_MAX_LEN 1024
#define LIBSPID_CONFIG_KEY_MAX_LEN 63
#define LIBSPID_CONFIG_ELT_MAX_NB 32
#define LIBSPID_CONFIG_DELIMITER "="

/* SECURITY */
/** size of pbkdf1 salt */
#define LIBSPID_SECU_SALT_SIZE 8
/** max password size. */
#define LIBSPID_SECU_PWD_SIZE_MAX 64
/** SHA 256 size. */
#define LIBSPID_SECU_SHA256_SIZE 32
/** pbkdf1 generated key size */
#define LIBSPID_SECU_OUTPUT_KEY_SIZE 16
/** PBKDF1 iteration. */
#define LIBSPID_SECU_PBKDF1_ITERATION 1000

/* LIBSPID_HPAV_CONF_PATH */
/** Network PassWord */
#define LIBSPID_HPAV_CONF_NPW_DEFAULT "HomePlugAV0123"
#define LIBSPID_HPAV_CONF_NPW_MIN_LEN 8
#define LIBSPID_HPAV_CONF_NPW_ADVISED_MIN_LEN 24
#define LIBSPID_HPAV_CONF_NPW_MAX_LEN 64
/** Network Management Key */
#define LIBSPID_HPAV_CONF_NMK_STR_LEN 64
#define LIBSPID_HPAV_CONF_NMK_BIN_LEN LIBSPID_SECU_OUTPUT_KEY_SIZE
/** Network IDentifier */
#define LIBSPID_HPAV_CONF_NID_STR_LEN 32
#define LIBSPID_HPAV_CONF_NID_BIN_LEN 7
/** Security Level */
#define LIBSPID_HPAV_CONF_SL_STR_MAX_LEN 8
/** Human-Friendly IDentifiers string maximum length (in bytes) */
#define LIBSPID_HPAV_CONF_HFID_MAX_LEN 64

#define LIBSPID_HPAV_CONF_FORCE_ROLE_MAX_LEN 5

/* LIBSPID_HPAV_INFO_PATH */
/** PLC stack status string maximum length */
#define LIBSPID_HPAV_INFO_STATUS_MAX_LEN 16
/** PLC stack CCo string maximum length */
#define LIBSPID_HPAV_INFO_CCO_MAX_LEN 8
/** Number of items in hpav.info */
#define LIBSPID_HPAV_INFO_ITEMS_COUNT (5)

/* LIBSPID_SIGNAL_INFO_PATH */
/** Delimiter of "signal.info" file. */
#define LIBSPID_SIGNAL_INFO_DELIMITER " "

#define LIBSPID_LINE_MAX_LEN  LIBSPID_CONFIG_LINE_MAX_LEN

/** web_reset.info*/
#define LIBSPID_WEB_RESET_INFO_RESET_BY_WEB_YES     "yes"
#define LIBSPID_WEB_RESET_INFO_RESET_BY_WEB_NO      "no"

/* Multicast_info */
/** Delimiter of "mcast.info" file */
#define LIBSPID_MULTICAST_INFO_DELIMITER    " "

/** Maximum number of multicast groups in the multicast info file. */
/* uint8_t because it goes into an uint8_t field in an mme sent by plcd. */
#define LIBSPID_MULTICAST_INFO_GROUP_MAX_NB      ((uint8_t)12)

/** Maximum number of members in a group of the multicast info file. */
/* uint8_t because it goes into an uint8_t field in an mme sent by plcd. */
#define LIBSPID_MULTICAST_INFO_MEMBER_MAX_NB     ((uint8_t)1)

#endif /* LIBSPID_DEFS_H */