Chapter 5. Buffer Type

Table of Contents

5.1. Overview
5.2. Buffer Type
5.3. Managing a Buffer
5.3.1. Structure Buffer
5.3.2. Field Buffer

This chapter describes the buffer types supported in Tmax.

5.1. Overview

If data must be exchanged between different hardware and OSs in a system with multiple servers, a complex data conversion process and intimate knowledge of platforms and memory allocation are required.

Tmax overcomes this obstacle by providing various types of buffers. The various buffers reduce unnecessary network load, give developers more choices, and shorten development time. The following are the advantages of using the buffers provided by Tmax.

  • More flexibility when developing application programs.

  • A data conversion program is not needed.

  • Reduced network load associated with data conversion is reduced. A data type that is initially set can be sent and received, which reduces network overhead from converting character type data.

5.2. Buffer Type

Tmax supports seven buffer types to reduce network load and facilitate easier development: STRING, CARRAY, X_OCTET , STRUCT, X_C_TYPE, X_COMMON, and FIELD.

  • STRING buffer

    Used for strings that end with NULL. The buffer length is not required, and the platform(s) used have no effect.

  • CARRAY and X_OCTET buffers

    Used for strings with a specified data transmission length (usually binary data). The platform(s) used have no effect.

  • STRUCT and X_C_TYPE buffers

    Used for structure data in C (language). All primitive types, the structure itself, and arrays of structs can be used as members of the struct.

  • X_COMMON buffer

    A C program structure with only char, int, and long member types.

  • FIELD buffer

    Used for data with a field key. All primitive data types can be saved in this buffer. Various methods for accessing data and conversion APIs are provided in case the data type exchanged between servers changes.

The following figure shows the buffer types available for Tmax communication.

[Figure 5.1] Tmax Communication Buffer Types

Tmax Communication Buffer Types


5.3. Managing a Buffer

The standard communication buffer is used to guarantee the integrity of a buffer. The standard communication buffer sets the standards for the data type and memory allocation. Data in the buffer is converted into a standard communication type before it is sent and reverted to the original type before it is received. Through data conversion/reversion, Tmax allows the use of the structure and string buffers for communication between heterogeneous machines.

Tmax uses sdlc to convert data to the standard format. sdlc creates an information table for client-side conversion and a conversion/reversion program for standard communication on the server side. The client encrypts data to a standard recognized by the server. A program on the server decrypts the data and then encrypts the result to the client in the standard type. Throughout this process, structure buffers or field buffers that have string or primitive data types can be used without any constraints.

The STRUCT, X_C_TYPE, and X_COMMON structure buffers must be converted to standard communication types and added during compilation. STRING, CARRAY, and X_OCTET buffers do not need to be converted to standard buffer types because they allow string type communication between heterogeneous machines.

Note

For more information on buffers and related functions, refer to "9.8. Buffer Management" or "Tmax Reference Guide".

5.3.1. Structure Buffer

Developers write the structures used in a structure file (xxx.s), which becomes the base for the conversion table and conversion program. For this structure file, commands such as typdef and include cannot be used. All primitive and structure types can be members of a structure.

To use a structure buffer as a standard communication type, the information table and the conversion/reversion program must be created using the sdlc program provided by Tmax. The information table is automatically used when the structure is used, and the conversion/reversion program is compiled and used together with the service routine.

The following is the process of compiling a server/client program when developing an application that uses a structure buffer (STRUCT, X_C_TYPE, and X_COMMON). demo.s is the structure buffer.

[Figure 5.2] Compiling an Application Program that Uses a Structure Buffer

Compiling an Application Program that Uses a Structure Buffer


5.3.2. Field Buffer

Developers write the field buffers used in a field buffer file (xxx.f), which becomes the base for the conversion table. To use a field buffer as a standard communication type, an information table must be created using the fdlc program provided by Tmax. The information table is automatically used when the field buffer is used.

The following is the process of compiling a server/client program when developing an application that uses a field buffer. demo.f is the field buffer.

[Figure 5.3] Compiling an Application Program that Uses a Field Buffer

Compiling an Application Program that Uses a Field Buffer