xref: /plan9/sys/src/cmd/cec/Protocol (revision 68de9c9388a1b0174f2979e40f3c4361793bf05a)
1eba00c11SDavid du ColombierCoraid Ethernet Console (cec)
2eba00c11SDavid du Colombier
3eba00c11SDavid du ColombierAbstract
4eba00c11SDavid du Colombier
5eba00c11SDavid du ColombierThe Coraid Ethernet Console (cec) implements a bidirectional conversation
6eba00c11SDavid du Colombierover raw ethernet frames with provisions for retransmission and discovery.
7eba00c11SDavid du ColombierLike serial consoles, each machine has a single shared interface per service
8eba00c11SDavid du Colombiertype,  but any number connections can be made from any machine connected to
9eba00c11SDavid du Colombierthe same physical network.  The communications from the various connections
10eba00c11SDavid du Colombierwill be interleaved.  The first implementation of cec is for console communications
11eba00c11SDavid du Colombierto Coraid appliances.
12eba00c11SDavid du Colombier
13eba00c11SDavid du ColombierOutline
14eba00c11SDavid du Colombier
15eba00c11SDavid du Colombier1. Packet format
16eba00c11SDavid du Colombier2. The Tdiscover packet and Toffer reply.
17eba00c11SDavid du Colombier3.  Initializing a connection. Tinit[abc]
18eba00c11SDavid du Colombier4.  The connection.  Tdata and Tack
19eba00c11SDavid du Colombier5.  Closing the connection.  Treset
20eba00c11SDavid du Colombier
21eba00c11SDavid du Colombier1. Packet Format
22eba00c11SDavid du Colombier
23eba00c11SDavid du ColombierAll cec packets are follow the layout implied by the following structure
24eba00c11SDavid du Colombier
25eba00c11SDavid du Colombier	struct Pkt {
26eba00c11SDavid du Colombier		uchar	dst[6];		// destination ethernet address
27eba00c11SDavid du Colombier		uchar	src[6];		// source ethernet address
28eba00c11SDavid du Colombier		uchar	etype[2];		// service type
29eba00c11SDavid du Colombier		uchar	type;		// type of packet.
30eba00c11SDavid du Colombier		uchar	conn;		// unique connection id.
31eba00c11SDavid du Colombier		uchar	seq;		// packet sequence number
32eba00c11SDavid du Colombier		uchar	len;		// data length.
33eba00c11SDavid du Colombier		uchar	data[1500];
34eba00c11SDavid du Colombier	};
35eba00c11SDavid du Colombier
36eba00c11SDavid du ColombierThe packet types are as follows:
37eba00c11SDavid du Colombier
38eba00c11SDavid du Colombier	enum {
39eba00c11SDavid du Colombier		Tinita,
40eba00c11SDavid du Colombier		Tinitb,
41eba00c11SDavid du Colombier		Tinitc,
42eba00c11SDavid du Colombier		Tdata,
43eba00c11SDavid du Colombier		Tack,
44eba00c11SDavid du Colombier		Tdiscover,
45eba00c11SDavid du Colombier		Toffer,
46eba00c11SDavid du Colombier		Treset,
47eba00c11SDavid du Colombier	};
48eba00c11SDavid du Colombier
49eba00c11SDavid du Colombier2. The Tdiscover packet and Toffer reply.
50eba00c11SDavid du Colombier
51eba00c11SDavid du ColombierThe Tdiscover packet is used to discover the avaliable cec devices on the local
52eba00c11SDavid du Colombiernetwork.  The packet sent is of the form
53eba00c11SDavid du Colombier
54eba00c11SDavid du Colombier	Tdiscover = {
55eba00c11SDavid du Colombier	[dest]	0xffffffff,
56eba00c11SDavid du Colombier	[src]	mac of local interface,
57eba00c11SDavid du Colombier	[etype]	service type,
58eba00c11SDavid du Colombier	[type]	Tdiscover,
59eba00c11SDavid du Colombier	[seq]	0,
60eba00c11SDavid du Colombier	[len]	0,
61eba00c11SDavid du Colombier	[data]	0,
62eba00c11SDavid du Colombier	}
63eba00c11SDavid du Colombier
64eba00c11SDavid du ColombierThe reply to the Tdiscover packet is of type Toffer which differes from
65eba00c11SDavid du ColombierTdiscover in that data and len may be set.  The contents of data is application
66eba00c11SDavid du Colombierspecific.
67eba00c11SDavid du Colombier
68eba00c11SDavid du Colombier3.  Initializing a connection. Tinit[abc]
69eba00c11SDavid du Colombier
70eba00c11SDavid du ColombierA connection is initialized by the following conversation: In addition
71*68de9c93SDavid du Colombierto the fields set for the Tdiscover packet, the client sends a packet
72eba00c11SDavid du Colombierof type Tinita with the conntag of its choice.  The server responds to
73eba00c11SDavid du ColombierTinita with a packet of type Tinitb.  And finally the client sents a
74eba00c11SDavid du ColombierTinitc packet back to the server, completing the connection.
75eba00c11SDavid du Colombier
76eba00c11SDavid du Colombier4.  The connection.  Tdata and Tack
77eba00c11SDavid du Colombier
78eba00c11SDavid du ColombierData is sent from the client to the console server with the Tdata packet.
79eba00c11SDavid du ColombierThe seq field is incremented for each data packet sent.  Thus data packets
80eba00c11SDavid du Colombiermay be transmitted if lost.  The data is whatever data the client has to
81*68de9c93SDavid du Colombiersend to the server, up to 255 bytes.  Typically, however, each keystroke
82eba00c11SDavid du Colombieris sent in a seperate packet.  The len field is the length of the
83eba00c11SDavid du Colombierdata.
84eba00c11SDavid du Colombier
85eba00c11SDavid du ColombierThe server responds to a Tdata message with a Tack message with the
86eba00c11SDavid du Colombiersame seq sequence number.
87eba00c11SDavid du Colombier
88eba00c11SDavid du Colombier5.  Closing the connection.  Treset
89eba00c11SDavid du Colombier
90eba00c11SDavid du ColombierEither the server of the client may send a Treset message to close the
91eba00c11SDavid du Colombierconnection.  There is no response to a Treset message, however any
92eba00c11SDavid du Colombierinformation associated with that connection (conntag) is discarded
93eba00c11SDavid du Colombierwhen the Treset message is recieved.
94