System information

Section 1. Introduction
1-4
1.4 Encoding and Decoding Packets
Reserved characters must be acknowledged and quoted by the application
before sending a packet and also recognized and decoded before the application
processes a packet. These reserved characters are the SerSyncByte, 0xbd, and
the QuoteByte, 0xbc. When these special characters are found within the
message body or signature nullifier, they must be handled appropriately.
1.4.1 Quoting the Message Body and Signature Nullifier
Use a QuoteByte, 0xbc, to mark places in the message body or signature
nullifier where the SerSyncByte, 0xbd, or the QuoteByte, 0xbc, appear before
transmitting the packet. The value of the byte following the QuoteByte is the
sum of the quoted character and 0x20. All packets sent by the application must
encode the message body and signature nullifier in this manner. An example
of packet encoding can be found in the JAVA code in Appendix D.
1.4.2 Unquoting the Message Body and Signature Nullifier
When a packet is received, the application must parse through the message and
signature nullifier to find and replace any reserved characters that have been
quoted before processing the message. An example of decoding a packet can
be found in the JAVA code in Appendix D.
1.4.3 Signature Nullifier
In addition to the PakBus header and packet framing implementation, packets
are checked for errors through the use of a two-byte signature nullifier at the
end of the data frame. The signature nullifier is a two-byte code that when
calculated with the rest of the data frame results in a signature value of zero.
Of course, the packet must be unquoted prior to the signature calculation
process.
Checking the packet integrity with a signature nullifier enables the application
to calculate a running signature as bytes are received and then simply check to
see if the signature is zero when the trailing SerSyncByte is received. If the
signature is zero, the framed data must be correct and can be confidently
processed. Otherwise, the data has become corrupt and must be discarded.
Please note that the signature nullifier field must always be checked to ensure
that reserved characters are quoted before transmitting the message and
decoded before processing a received message. Additional descriptions of the
signature and signature nullifier algorithms and example C code can be found
in Appendix B. An additional example of the signature and signature nullifier
algorithm can be found in the JAVA code in Appendix D.
1.4.4 Packet Processing Checklist
Data packets received by an application must be examined and processed. The
necessary steps to accomplish this process first require that all reserved
characters be unquoted in the message body and signature nullifier. After all
special characters are unquoted in the packet and signature nullifier but before