0001 TPCONVERT(3)
0002 ============
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 tpconvert - Convert Enduro/X identifier to or from string representation
0009
0010
0011 SYNOPSIS
0012 --------
0013 #include <atmi.h>
0014
0015 int tpconvert (char *'str', char *'bin', long 'flags');
0016
0017 For XATMI client link with '-latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm'
0018
0019 For XATMI server link with '-latmisrv|-latmisrvnomain|-latmisrvinteg -latmi
0020 -lubf -lnstd -lpthread -lrt -lm'
0021
0022 DESCRIPTION
0023 -----------
0024 Function is used to convert Enduro/X identifiers like client id, transaction id
0025 and XA two-phase commit xid to string representation. Function also offers to
0026 convert value from string back to binary (Enduro/X) identifier. If converting
0027 to string, then 'bin' is pointer to binary identifier, casted to char pointer.
0028 It is assumed that 'str' is at least *TPCONVMAXSTR* bytes long (currently 512).
0029 If converting to binary representation, then destination size must match the
0030 target structure, i.e. *CLIENTID*, *TPTRANID* or *XID* from *xa.h*.
0031
0032 *Valid flags*
0033
0034 *TPCONVCLTID* Convert *CLIENTID* type from *atmi.h* to/from string.
0035
0036 *TPCONVTRANID* Convert *TPTRANID* type from *atmi.h* to/from string. Note that
0037 string version converted is platform specific. And not will not be valid
0038 (restorable) on different platform type (i.e. little-endian, big-endian, 32bit or 64bit).
0039
0040 *TPCONVXID* Convert *XID* type from *xa.h* to/from string.
0041
0042 *TPTOSTRING* In this mode the value from 'bin' parameter is converted to 'str'
0043 parameter. If flag is not present then value from 'str' is converted to 'bin'.
0044
0045 If multiple TPCONV flags are present, then execution will pick up the first flag
0046 for processing in following order: *TPCONVCLTID*, *TPCONVTRANID*, *TPCONVXID*.
0047
0048 RETURN VALUE
0049 ------------
0050 On success, *tpconvert()* return zero; on error, -1 is returned, with *tperrno* set
0051 to indicate the error.
0052
0053
0054 ERRORS
0055 ------
0056 Note that *tpstrerror()* returns generic error message plus custom message with
0057 debug info from last function call.
0058
0059 *TPEINVAL* 'str' or 'bin' params are NULL. Error is returned also in cases if
0060 'TPTOSTRING' is present, but 'str' parameter is zero length (first byte 0x00).
0061 Also in cases if none of *TPCONVCLTID*, *TPCONVTRANID* or *TPCONVXID* are present
0062 this error will be returned too.
0063
0064 *TPEINVAL* Enduro/X tpinit failed - environment variables not configured,
0065 see ex_env(5) page.
0066
0067 *TPESYSTEM* During Enduro/X init - system failure occurred during serving.
0068 See logs i.e. user log, or debugs for more info.
0069
0070 *TPEOS* During Enduor/X init operating system failure occurred during serving.
0071 See logs i.e. user log, or debugs for more info.
0072
0073 EXAMPLE
0074 -------
0075 See *atmitest/test021_xafull/atmiclt21-tpconvert.c* for sample code.
0076
0077 BUGS
0078 ----
0079 Report bugs to support@mavimax.com
0080
0081 SEE ALSO
0082 --------
0083 *tpinit(3)* *tpsuspend(3)* *tpresume(3)* *tpservice(3)*
0084
0085 COPYING
0086 -------
0087 (C) Mavimax, Ltd