/*
********** Initiating a cluster link ***************************************************

Node A					Node B
1. Makes connection

					2. Sends PC18 protocol, including in the
					cluster information field the clulink 
					support identifier :
					PC18^CluLink 0.1^5449^~

3. After identifying the protocol
support identifier, sends the sends
the protocol connection init string,
switches to binary link mode, sends
node and user table, finishes with
message 0.
		
					4. As soon as the protocol connection
					init string has been received, switches to
					binary link mode, sends node and user table,
					finishes with message 0.

********** Description of the binary messages ******************************************

Protocol messages are binary, to save valuable network bandwidth. No CRC checking
or message acking is normally done, since this should be done at lower layers.

First byte of a message is an unsigned char (BYTE) which indicate the length of the
protocol message, in bytes. A protocol message can be up to 255 byte long. 

String are stored as pascal-type strings. The first byte indicates the actual length 
of the string, then follows the string itself.

User and node callsigns are maximum 9 bytes longs (6 characters for the callsign, and
2 or 3 characters for the SSID if any).

Date and time are strored in two bytes, in format used by the rotten FAT file system.
It's accurate to two seconds.

	Bits	Description
	31-27	hours (0-23)
	26-21	minutes
	20-16	seconds divided by 2
	15-9	year - 1980
	8-5	month
	4-0	day

The second byte of a message indicates the message type.

0  -  Remote initialization completed.
 
1  -  Add node(s)
	Hop count:      byte
	NodeCall:       pascal-type string
	Software ID &
	Node status:	byte
				bit 0 to 5 :
					1 - unknown
					2 - PacketCluster - type
					3 - Clusse
					4 - DxNet
				bit 6 - nohere ON
				bit 7 - conference mode ON
	Version:	unsigned int
				version number is multiplied by 1000

	If there are more than one node to add, they'll be added following.


2  -  Delete node
	Hop count:	byte
	NodeCall:	pascal-type string
	Reason:		byte
				0   - Shutdown
				1   - Disconnected by operateur
				2   - Hard disconnect
				255 - Special reason, the reason string follows ...
	Reason String:	pascal-type string (maxlength 30)
				only send if Reason is 255.

3  -  Add user(s)
	Hop count:	byte
	FromNode:	pascal-type string
	UserCall:	pascal-type string
	UserFlag:	byte
				Bit	Meaning		1	0
				bit 0 - Here status	here	not here
				bit 1 - Conf status	in	not in
				others are reserved

	If there are more than one user to add, they'll be added following.

4  -  Delete user
	Hop count:	byte
	FromNode:	pascal-type string
	UserCall:	pascal-type string

10 -  Change user flag
	Hop count:	byte
	FromNode:	pascal-type string
	UserCall:	pascal-type string
	UserFlag:	byte (see message #3)

11 -  Change user data
	Hop count:	byte
	FromNode:	pascal-type string
	UserCall:	pascal-type string
	DataType:	byte
				1 - Name (max length 22)
				2 - Qth  (max length 80)
				3 - Coordinates (not yet implemented in DxNet)
				4 - Home node (max length 9)
				5 - Locator (max length 6)
	Info:		pascal-type string

12 -  Ping message
	Hop count:	byte
	FromNode:	pascal-type string
	ToNode:		pascal-type string
	pingFlag:	byte
				0 - Answer for a ping
				1 - Ping

64 - DX info
	Hop count:	byte
	FromNode:	pascal-type string (max 9 bytes)
	FromUser:	pascal-type string (max 6 bytes, without SSID)
	DxFreq:		unsigned long (4 bytes)
				Frequency of the DX station in KHz, multiplied by 10
				An integer is used to prevent rouding errors.
	DxCall:		pascal-type string (max 14 bytes)
	DateTime:	unsigned long
	Comments:	unsigned string (max 30 bytes)

66 - Announcement
	Hop count:	byte
	FromNode:	pascal-type string
	FromUser:	pascal-type string
	ToNode or
        Distribution:	pascal-type string (max 20 bytes)				
	DateTime:	unsigned long
	Message flags:	byte
				Bit	Meaning
				bit 0 - Cluster-wide announcement
				bit 1 - To users connected to the specified cluster only
				bit 2 - To a distribution list of users		
	Message:	pascal-type string (max 80 bytes)

67 - Talk
	FromNode:	pascal-type string (max 9 bytes)
	FromUser:	pascal-type string (max 9 bytes)
	ToNode:		pascal-type string (max 9 bytes)
	ToUser:		pascal-type string (max 9 bytes)
	DateTime:	unsigned long
	Message flags:	byte
				Bit	Meaning		ON	OFF
				bit 0 - Bell flag	1	0
	Message:	pascal-type string (max 80 bytes)
