forked from ffainelli/faifa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
homeplug.h
159 lines (143 loc) · 5.07 KB
/
homeplug.h
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
/*
* Homeplug 1.0 Ethernet frame definitions
*
* Copyright (C) 2007-2008 Xavier Carcelle <[email protected]>
* Florian Fainelli <[email protected]>
* Nicolas Thill <[email protected]>
*
* The BSD License
* ===============
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of OpenLink Software Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*/
#ifndef __HOMEPLUG_H__
#define __HOMEPLUG_H__
#include <sys/types.h>
#define ETHERTYPE_HOMEPLUG 0x887b
/**
* hp10_mmentry - HomePlug 1.0 MAC Management Entry (MME)
* @mmetype: MME type
* @mmelength: MME data length
* @mmedata: MME data
*/
struct hp10_mmentry {
u_int8_t mmetype:5;
u_int8_t mmeversion:3;
u_int8_t mmelength;
u_int8_t mmedata[0];
} __attribute__((__packed__));
/**
* hp10_frame - HomePlug 1.0 frame
* @mecount: Number of MAC entries in this frame
* @mentries: MAC Entries
*/
struct hp10_frame {
u_int8_t mmecount:7;
u_int8_t reserved:1;
struct hp10_mmentry mmentries[0];
} __attribute__((__packed__));
/**
* hp10_frame_ops - Homeplug 1.0 ethernet frames operations
* @mmtype: frame specific MM type
* @desc: frame description
* @init_frame: frame specific initialisation callback
* @dump_frame: frame specific dump callback
*/
struct hp10_frame_ops {
u_int8_t mmtype;
char *desc;
int (*init_frame)(void *buf, int len, void *user);
int (*dump_frame)(void *buf, int len);
};
/* 00 - Channel Estimation Request */
struct hp10_channel_estimation_request {
u_int8_t reserved1:4;
u_int8_t version:4;
} __attribute__((__packed__));
/* 08 - Network parameters Confirm */
struct hp10_parameters_stats_confirm {
u_int16_t tx_ack_cnt;
u_int16_t tx_nack_cnt;
u_int16_t tx_fail_cnt;
u_int16_t tx_cont_loss_cnt;
u_int16_t tx_coll_cnt;
u_int16_t tx_ca3_cnt;
u_int16_t tx_ca2_cnt;
u_int16_t tx_ca1_cnt;
u_int16_t tx_ca0_cnt;
u_int32_t rx_cumul;
} __attribute__((__packed__));
/* 1a - Network statistics Confirm */
struct hp10_tonemap {
u_int8_t netw_da[6];
u_int16_t bytes40;
u_int16_t fails;
u_int16_t drops;
} __attribute__((__packed__));
#define HP10_NUM_TONE_MAP 15
/* 1c - Extended network statistics Confirm */
struct hp10_network_stats_confirm {
u_int8_t icid:7;
u_int8_t ac:1;
u_int16_t bytes40_robo;
u_int16_t fails_robo;
u_int16_t drops_robo;
struct hp10_tonemap nstone[HP10_NUM_TONE_MAP];
} __attribute__((__packed__));
/* 1f - Performance statistics confirm */
struct hp10_perf_stats_confirm {
u_int8_t rsvd:7;
u_int8_t perf_ctrl:1;
u_int16_t max_delay;
u_int16_t max_delay_jitter_ca[4];
u_int16_t max_latency_ca[4];
u_int16_t max_latency_bin_ca0[10];
u_int16_t max_latency_bin_ca1[10];
u_int16_t max_latency_bin_ca2[10];
u_int16_t max_latency_bin_ca3[10];
u_int16_t rst_cnt;
u_int16_t txack; // [31 - 16]
u_int16_t txnack; // [31 - 16]
u_int16_t txcoll; // [31 - 16]
u_int16_t tcloss; // [31 - 16]
u_int16_t txcalat[4]; // [31 - 16]
u_int16_t rxbp40; //[63 - 32]
} __attribute__((__packed__));
#endif /* __INTELLON_H__ */