System for translating native data structures and specific message structures by using template represented data structures on communication media and host machines
First Claim
1. A system compiler template structures for enabling byte order and word alignment on a native machine to be translated as needed into the byte order and word alignment required in a communication media, comprising:
- an unpacked source buffer;
a packed target buffer;
a template buffer;
a first swap structure for exchanging high and low bytes of word values;
a second swap structure for reversing byte order of long values;
a host order structure for returning a value TRUE if and only if the byte order of said communication media is different than the byte order on said native system;
a pack swap structure for processing a packed structure ‘
data’
by performing byte order adjustments as specified by an associated unpacked ‘
template’
value;
a pack send structure for structure packing followed by byte-order manipulation before a send operation and for copying said unpacked source buffer to said packed target buffer according to said template buffer, which is of a specified length;
a pack receive buffer for unpacking after byte-order manipulation after a receive operation by copying said packed source buffer to said unpacked target buffer according to said template buffer, which is of a specified length; and
a pack size structure for return the packed buffer size represented by the given template, of the specified length, which is equivalent to the number of non-zero bytes in the template.
2 Assignments
0 Petitions
Accused Products
Abstract
A system and method implemented, for example, by a C language compiler at either a source or target system, for translating between native data structures on arbitrary machines and specific message structures on communication media such that the byte order and word alignment on the native machine is translated as needed into the byte order and word alignment required in the communication media. In so doing, templates which represent data structures on the communication media and data structures in the host machine that represent the communication structures are defined. Then, translations adjusting for byte alignment (structure packing) and adjusting for byte order between these two representations are performed in either direction.
37 Citations
2 Claims
-
1. A system compiler template structures for enabling byte order and word alignment on a native machine to be translated as needed into the byte order and word alignment required in a communication media, comprising:
-
an unpacked source buffer;
a packed target buffer;
a template buffer;
a first swap structure for exchanging high and low bytes of word values;
a second swap structure for reversing byte order of long values;
a host order structure for returning a value TRUE if and only if the byte order of said communication media is different than the byte order on said native system;
a pack swap structure for processing a packed structure ‘
data’
by performing byte order adjustments as specified by an associated unpacked ‘
template’
value;
a pack send structure for structure packing followed by byte-order manipulation before a send operation and for copying said unpacked source buffer to said packed target buffer according to said template buffer, which is of a specified length;
a pack receive buffer for unpacking after byte-order manipulation after a receive operation by copying said packed source buffer to said unpacked target buffer according to said template buffer, which is of a specified length; and
a pack size structure for return the packed buffer size represented by the given template, of the specified length, which is equivalent to the number of non-zero bytes in the template.
-
-
2. A method for translating application data on a native machine into the byte order and word alignment required in a communication media, comprising the steps of:
-
initializing a data structure MessageTemplate of type MessageStructure to a known state;
resolving a size of said MessageTemplate;
allocating a data structure MessageBuffer with a size equal to MessageStructure;
filling said MessageBuffer with said application data;
allocating a data structure WorkingBuffer with a size equal to the size of said MessageStructure;
copying the contents of said MessageBuffer into said WorkingBuffer;
selectively byte aligning and byte order adjusting the contents of said WorkingBuffer and copying the resulting packed data back to said MessageBuffer;
determining the length n of packed data in said MessageTemplate; and
sending packed data of length n from said MessageBuffer to said communication media.
-
Specification