tpalloc

Name

tpalloc — Allocate XATMI buffer

Synopsis

#include <atmi.h>

char *tpalloc(char *type, char *subtype, long size);

For XATMI client link with -latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm

For XATMI server link with -latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm

DESCRIPTION

Function allocates XATMI buffer by given type and subtype. The buffer size is indicated by size argument, if it set to 0 and buffer type is UBF, then system allocates 1024 for new buffer. Currently subtype is not used, and it can be leaved NULL or empty string. If function succeeds, then Enduro/X registers buffer in internal registry. If user allocates the buffer, it is up to user to free it with tpfree(), only exception is with auto buffers which are allocated at point when when service receives request, and Enduro/X will free the buffer after doing tpreturn() or tpforward().

Valid type

UBF Unified Buffer Format. Which is type key-value storage with extensive API. See ubf.h for list of functions.

UBF32 The same as UBF.

FML Compatibility mode with Tuxedo. Same as UBF.

FML32 Compatibility mode with Tuxedo. Same as UBF.

STRING String buffer. It can store any ASCII character except 0x00, which will indicate the end of the data i.e. zero terminated string.

JSON This is also string format, can hold ASCII chars, 0x00 is used for string termination. The difference between this format and STRING, is that JSON buffer can be used for converting it automatically to UBF and vice versa, either by service request or by issuing tpjsontoubf(), tpubftojson().

CARRAY Byte array buffer. Can hold 0x00 byte.

VIEW This is view buffer, see viewfile(5) for view descriptor format. Basically with view the C structure is being defined (generated) which included in the code by header file. For VIEW buffer subtype must be specified. The views must be configured by setting up