xref: /plan9/sys/src/cmd/cec/Protocol (revision 68de9c9388a1b0174f2979e40f3c4361793bf05a)
1Coraid Ethernet Console (cec)
2
3Abstract
4
5The Coraid Ethernet Console (cec) implements a bidirectional conversation
6over raw ethernet frames with provisions for retransmission and discovery.
7Like serial consoles, each machine has a single shared interface per service
8type,  but any number connections can be made from any machine connected to
9the same physical network.  The communications from the various connections
10will be interleaved.  The first implementation of cec is for console communications
11to Coraid appliances.
12
13Outline
14
151. Packet format
162. The Tdiscover packet and Toffer reply.
173.  Initializing a connection. Tinit[abc]
184.  The connection.  Tdata and Tack
195.  Closing the connection.  Treset
20
211. Packet Format
22
23All cec packets are follow the layout implied by the following structure
24
25	struct Pkt {
26		uchar	dst[6];		// destination ethernet address
27		uchar	src[6];		// source ethernet address
28		uchar	etype[2];		// service type
29		uchar	type;		// type of packet.
30		uchar	conn;		// unique connection id.
31		uchar	seq;		// packet sequence number
32		uchar	len;		// data length.
33		uchar	data[1500];
34	};
35
36The packet types are as follows:
37
38	enum {
39		Tinita,
40		Tinitb,
41		Tinitc,
42		Tdata,
43		Tack,
44		Tdiscover,
45		Toffer,
46		Treset,
47	};
48
492. The Tdiscover packet and Toffer reply.
50
51The Tdiscover packet is used to discover the avaliable cec devices on the local
52network.  The packet sent is of the form
53
54	Tdiscover = {
55	[dest]	0xffffffff,
56	[src]	mac of local interface,
57	[etype]	service type,
58	[type]	Tdiscover,
59	[seq]	0,
60	[len]	0,
61	[data]	0,
62	}
63
64The reply to the Tdiscover packet is of type Toffer which differes from
65Tdiscover in that data and len may be set.  The contents of data is application
66specific.
67
683.  Initializing a connection. Tinit[abc]
69
70A connection is initialized by the following conversation: In addition
71to the fields set for the Tdiscover packet, the client sends a packet
72of type Tinita with the conntag of its choice.  The server responds to
73Tinita with a packet of type Tinitb.  And finally the client sents a
74Tinitc packet back to the server, completing the connection.
75
764.  The connection.  Tdata and Tack
77
78Data is sent from the client to the console server with the Tdata packet.
79The seq field is incremented for each data packet sent.  Thus data packets
80may be transmitted if lost.  The data is whatever data the client has to
81send to the server, up to 255 bytes.  Typically, however, each keystroke
82is sent in a seperate packet.  The len field is the length of the
83data.
84
85The server responds to a Tdata message with a Tack message with the
86same seq sequence number.
87
885.  Closing the connection.  Treset
89
90Either the server of the client may send a Treset message to close the
91connection.  There is no response to a Treset message, however any
92information associated with that connection (conntag) is discarded
93when the Treset message is recieved.
94