File: faifa.8

package info (click to toggle)
faifa 0.2~svn82-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch, wheezy
  • size: 304 kB
  • ctags: 844
  • sloc: ansic: 3,523; sh: 169; makefile: 90
file content (154 lines) | stat: -rw-r--r-- 5,740 bytes parent folder | download | duplicates (2)
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
.TH FAIFA 8 "April 2011" Linux "User manual"
.SH NAME
faifa \- configure HomePlug 1.0/AV devices
.SH SYNOPSIS
.B faifa [OPTIONS]
.br
\-i	specify network interface to use
.br
\-m	show the menu asking for known MM types
.br
\-a	destination MAC address to send frames to
.br
\-k	network key to set
.br
\-v	be verbose (default: no)
.br
\-e	set error stream (default: stderr)
.br
\-o	set output stream (default: stdout)
.br
\-s	set input stream (default: stdin)
.br
\-h	show the usage
.br
.SH DESCRIPTION
faifa can configure any Intellon-based PowerLine Communication device using the Intellon INT5000 and INT6000 HomePlug AV (200Mbits) chips. It supports all Intellon-specific management and control frames.

.SH "MENU COMMANDS"
\-i	specify network interface to use
.br
\-m	show the menu asking for known MM types
.br
\-a	destination MAC address to send frames to
.br
\-k	network key to set
.br
\-v	be verbose (default: no)
.br
\-e	set error stream (default: stderr)
.br
\-o	set output stream (default: stdout)
.br
\-s	set input stream (default: stdin)
.br
\-h	show the usage

.TP
.B "HomePlug AV protocol"

The HomePlug AV protocol was developed by Intellon and specifies how the powerline PHY layer and HPAV MAC layer can converge to allow Ethernet frames to be sent on the medium. It handles all the low-level modulation and constellation building plus the Medium Access Control handling between devices.
The HomePlug AV network topology consists of one coordinator (called CCo) for a given logical HPAV network (i.e: with the same Network Encryption Key) and none or several stations (called STAs). Other devices can have a specific role which is a bridge, between several logical networks.


------------------------------------
.br
| HomePlug PHY					|
.br
------------------------------------
.br
| HomePlug MAC convergence layer	|
.br
------------------------------------
.br
| Ethernet MAC layer			|
.br
------------------------------------
.br

It is possible to configure the HPAV MAC convergence layer by using specific Ethernet frames with the 0x88e1 Ethertype. Such frames will be interpreted by the Intellon controller present in the devices and are known as control or management frames.

Such frames can be either protocol specific (i.e: common to all HPAV implementations) or vendor specific. There is no convention to specify whether an HPAV configuration and management frame is vendor specific or not. Most implementations will share a common format for basic network operations like setting the Network Management Key or the Encryption Key.

A HomePlug AV management frame is described below :

	8 bits		16 bits
.br
---------------------------------------------------
.br
| MM version | 		MM type				|
.br
---------------------------------------------------
.br
| 		OUI (24 bits)						|
.br
---------------------------------------------------
.br
|		Payload	(var)					|
.br
---------------------------------------------------

The payload is highly dependent on the implementation though most vendors will try to define a common template for it. Such management frame should be encapsulated in standard ethernet frames with the 0x88e1 ethertype.


.B
Faifa operations

Faifa basically performs 3 main operations :

\- send all vendor and protocol specific frames with the corresponding parameters
.br
\- dump all vendor and HomePlug 1.0/AV frames with the appropriate frame parsing
.br
\- discover the HPAV network topology

The available vendor specific operations are stored in an array of struct hpav_frame_ops. For each entry the mmtype and the description is specified, with possible callbacks to handle frame initialization and dump function.

.B
Using the faifa library

Faifa is also provided as shared library (so file) and static library so that you can link programs with to send HomePlug AV frames. The library allows you, specifying a given mmtype to send the corresponding HPAV frame to a given device.

.B
Linking with faifa

You should include faifa.h into your C source file and then you can directly call functions that are provided by the faifa library. When linking with the faifa library, make sure your linker flags include "\-lfaifa" or the absolute path of the shared object to make sure your program will successfully link.

.B
Sending frames using do_frame

The main function you want to call is do_frame and pass it the MMtype and destination MAC address you want to send the frame to. This function will :

\- lookup the mmtype by reading the array containing available frame operations
.br
\- initialize the frame header (MM version, type, source and destination MAC addresses)
.br
\- call the initialisation function (if needed) to let the user input the parameters (or any other input method)
.br
\- calculate the appropriate frame size
.br
\- send it to the device
.br
\- close the network socket descriptor

This function propagates the return code from the write command on the socket descriptor.

.B
Receiving frames using do_receive_frame

This function will listen for received frames on the specified interface and will :

\- check that the ethertype is set to 0x88e1 otherwise it will discard the frame
.br
\- cast the received packet to an HPAV management frame structure
.br
\- lookup for the received MM type into the arrays of known response/indications
.br
\- call the frame parsing function (based on the mmtype) accordingly

You will probably want to set the network descriptor in reading mode non-blocking. Faifa uses this function with a call to a pcap_loop method inside a dedicated thread to receive all frames.

.SH SEE ALSO
.BR ifconfig(8)
.SH AUTHORS
Florian Fainelli <florian@openwrt.org>, Xavier Carcelle <xavier.carcelle@gmail.com>, Nicolas Thill <nico@openwrt.org>