A world of warcraft networking library https://www.leonetienne.de/projects/azernet.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

44 lines
2.3 KiB

THE AZERNET FRAME SPECIFICATION
========================= STRUCTURE =========================
Each azernet frame is built up like this:
[AZERNET SIGNATURE 2 OCTETs] [FRAME-ID 2 OCTETs] [APP-ADDRESS 2 OCTETs] [BODY-SIZE 2 OCTETs] [BODY CHECKSUM 2 OCTETs] [HEADER CHECKSUM 1 OCTET]
[FRAME BODY 1-65535 OCTETs]
Let's break down the header
[AZERNET SIGNATURE 2 OCTETs] => 0xA455 | Always 0xA455
[FRAME-ID 2 OCTETs] => => 0-65535 | The ID of this frame. If the frame gets sent multiple times (for redundancy), the receiver knows that it already received it.
The receiver should forget the ID after a few minutes.
The sender should NOT choose them at random, but iteratively. First frame gets 0, seconds gets 1 and the 65537's frame get's ID=2 again. It will wrap back around.
If a frame gets sent multiple times, they HAVE to have the same frame id!
[APP-ADDRESS 2 OCTETs] => 0-65535 | An idially unique identifier for your external program receiving the azernet frames. This allows for multiple external programs to be used at the same time with one in-WoW socket. Think of it like a mac address and ethernet frames.
| Use address FFFF (=> 65535) as the broadcast address
[BODY-SIZE 2 BYTES] => 0-65535 | The length of the frame body in octets. This describes the size BEFORE HAMMING(8,4) encoding!
[BODY CHECKSUM 2 OCTETs] | A 2-byte checksum over the body. The nth bit of this double-octet is the checksum for every nth bit in the header.
[HEADER CHECKSUM 1 OCTET] | Additional checksum for the header. The nth bit of this octet is the checksum for every nth bit in the header.
[FRAME BODY 1 - 65535 Octets]
The frame body, containing the payload data.
========================= ENCODING =========================
The entire azernet frame is HAMMING(8,4) encoded.
All HAMMING(8,4) octets are concatenated in order, to form the frame body.
=> Therefore, transmitting a single byte of data takes up two octets of frame body.
=> Why waste so much bandwidth?
=> The channel this information gets transmitted over (the Azernet.Socket) is rather noisy...
Better make sure we know when it did not transmit correctly. Which HAMMING(8,4) does rather reliably.
The frame body can be followed by as many 0-bits as necessary. They will be discarded.