Tuxedo function description
- Collection
1 ATMI 2 related to the buffer
1.1tpalloc. 2
1.2tpRealloc. 2
1.3tpfree. 2
1.4TPTYPES. 2
2 commonly used FML (FML32) operation function ... 3
2.1falloc. 3
2.2finit 3
2.3FADD. 3
2.4fchg. 3
2.5fget 4
2.5fprint 4
2.6ferror 4
3 Connection establishment and disconnection ATMI 5
3.1tpchkauth. 5
3.2tpinit 5
3.3tpterm .. 6
4 with ATMI 6 related to Tuxedo Server
4.1tpcall 6
4.2tpacall 7
4.3TpGetrPly. 7
4.4TpCancel 7
4.5TpgPrio. 8
4.6TPSPRIO. 8
5 ATMI 8 related to request error handling
5.1tpstrerror 8
5.2TPERRORDETAIL 9
5.3tpstrerrorDetail 9
1 ATMI related to the buffer
1.1tpalloc
Char * TPalloc (Char * Type, Char * Subtype, Long Size)
Description: Distribution buffer
Parameters: TYPE: Type of Buffer
Subtype: Subtype of buffer, only VIEW has a child type, other buffer This parameter is set to NULL
Long: Size of the buffer
Return Value: Successfully returned a char *-shaped pointer to the first address of the assigned space, and failed to return NULL.
1.2tpRealloc
Char * TPREAlloc (Char * PTR, long size)
Description: Reassign the buffer
Parameters: PTR: Pointing to the first address of the original buffer
Size: Size of the new buffer
Return Value: Successfully returns a char *-shaped pointer pointing to the first address of the new allocation space, failed to return NULL.
1.3tpfree
Void Tpfree (Char * BUFPTR)
Description: Release the buffer allocated by tpalloc () or tpRealloc ()
Parameters: BUFPTR: Pointer to the first address of the buffer to be released
Return value: no
Note: The memory allocated with tpalloc () and tpRealloc () can only be released, and free () cannot be used.
1.4TPTYPES
Long tptypes (char * ptr, char * type, char * subtype)
Description: Returns the type and subtype of the buffer pointed to by the PTR
Parameters: PTR: Pointer to the first address of the buffer to be identified
TYPE: Type name
Subtype: Sub Type Name (only valid for View types)
Return value: 0 Success, -1 failed, the error number saved in the global variable tperrno.
2 commonly used FML (FML32) operation function
2.1falloc
FBFR * Falloc (Fldocc F, FLDLEN V)
Description: Assign a FML buffer
parameter:
FLDOCC: The field of the FML buffer,
FLDLEN: The length of the FML buffer
Return Value: Successfully returns a pointer to the first address of the FML buffer, failed to return NULL, error number is saved in the whole
Variable Ferror
Note: This FML buffer cannot be used in tpCall (), TPacAll (), TPRETURN (), etc. to be used in these functions.
The FML buffer can only be assigned with TPalloc ().
2.2finit
Int Finit (FBFR * FBFR, FLDLEN BUFLEN)
Description: Initializing this FML buffer
parameter:
FBFR: a pointer to the first address of the FML buffer
BUFLEN: The length of the FML buffer
Return Value: Failure is -1, the error number is saved in the global variable Ferror
2.3FADD
INT FADD (FBFR * FBFR, FLDID Fieldid, Char * Value, Fldlen Len)
Description: Add a value value value parameter to the field of the FELDID in the FML buffer FBFR:
FBFR: Pointer to the first address of the FML buffer
FieldID: ID to be added to the field
Value: To increase the value, if other types of other types are converted to Char *
LEN: The length of this field, if the carrary type is available from time to time, can be set to 0
Return Value: Failure is -1, the error number is saved in the global variable Ferror
2.4fchg
INT FCHG (FBFR * FBFR, FLDID Fieldid, Int Occ, Char * Value, FLDLEN LEN)
Description: Change the value of the ID in the FBFR as the fieldID field.
parameter:
FBFR: Pointer to the first address of the FML buffer
FieldID: ID to be added to the field
Value: The new value of this field, if other types of other types are converted to Char *
LEN: The length of this field, if the carrary type is available from time to time, can be set to 0
Return Value: Failure is -1, the error number is saved in the global variable Ferror
2.5fget
int FGET (FBFR * FBFR, FLDID FIELDID, INT OCC, CHAR * VALUE, FLDLEN * MAXLEN)
Description: Take the ID from the FBFR buffer to the value of the field to value to Value.
parameter:
FBFR: Pointer to the first address of the FML buffer
FIELDID: Id of field
Value: The removed value is saved to the address pointing to the pointer.
Maxlen: You can copy the length of the string in the buffer Value, the return value is the word true COPY to the buffer.
String length
Return Value: Failure is -1, the error number is saved in the global variable Ferror
2.5fprint
FPRINT (FBFR * FBFR)
Description: Print the contents of the FBFR buffer in format. Generally used in program debugging.
parameter:
FBFR: Pointer to the first address of the FML buffer
Return Value: Failure is -1, the error number is saved in the global variable Ferror
2.6frror
Ferror:
Similar to Errno in the C language, when the FML (FML32) function is wrong, save the error number in the global variable Ferror.
Char * fstrerror (int ERR)
Description: Returns error description of error number ERR
Parameters: Err: Ferror value
Return Value: Successful returns an error description, failed to return NULL
3 Connection establishment with disconnected ATMI
3.1tpchkauth
Int TPCHKAUTH ()
Description: Check the security mode used by this Tuxedo Server
Parameters: no
return value:
TPNOAUTH: No certification
TpsysAuth: Need a password certification
TPAPPSUTH: Need a password certification and also needs to be applied for authentication or authorization.
-1: The call failed, the error number is saved in the global variable tperrno.
3.2tpinit
Int Tpinit (TPinit * Tpinfo)
Description: Establish a connection with Tuxedo Server
Parameters: TPInfo
Return Value: Failure Returns -1, the error number is saved in the global variable tperrno.
The definition of the TPinit structure in atmi.h is as follows
Struct tpinfo_t {
CHAR USRNAME [MAXTIDENT 2]; / * Client User Name * /
CHAR CLTNAME [MAXTIDENT 2]; / * Application Client Name * /
Char passwd [maxTident 2]; / * Application Password * /
Char Grpname [MaxTident 2]; / * Client Group name * / long flag; / * Initialization Flags * /
Long Datalen; / * Length of App Specific Data * /
Long Data; / * PlaceHolder for app data * /
}
Typedef struct tpinfo_t tpinit;
Description: Username, CLTNAME, Passwd, Grpname, Data, Datalen is used in secure authentication
Flags: User to notify the client a unsolicted message in the client. Its value can be:
TPU-SIG
TPU-DIP
TPU-IGN
TPSA-FASTPATH
TPSA-Protected
3.3tpterm
Int tpterm ()
Description: Disconnects to establish a connection with Tuxedo Server
Parameters: no
Return Value: Failure Returns -1, the error number is saved in the global variable tperrno.
4 ATMI related to request Tuxedo Server
4.1tpcall
Int TpCall (Char * SVC, Char * Idata, Long ilen, char ** ODATA, Long * Olen, Long Flags
Description: The client synchronously calls the server's name SVC,
parameter:
* SVC: SERVICE name
CHAR * IDATA: Enter the address of the buffer, the client is transmitted to the server's parameter in the buffer
Long Ilen: Input buffer length
CHAR ** ODATA Output The address of the buffer, the result of the server is transmitted to the client in the buffer
Long * Olen: The length of the output buffer
Long flags: Call the logo, by the following:
TPNOTRAN
If the client calling the SVC is currently in the Transaction mode, SVC does not participate in the current transaction.
TPNOCHANGE
If the buffer type returned by the server is inconsistent with the client-defined buffer (ODATA) type, ODATA is converted into a type consistent with the buffer type returned by the server, if the Flag is set, then when it appears In this case, the buffer type conversion is not performed, and it will be absorbed.
TPNOBLOCK
By default, if the client has blocking conditions (such as the buffer full of Client's TCP / IP, disk I / O busy, etc.), then the client will block there, until the blocking elimination or timeout error. If TPNOBLOCK is set, TPCall () will return and report it immediately when the client has blocking conditions. Note that the TPNOBLOCK only works when sending the request, if there is a blocking condition, the client is present, the client will Wait there, until the blocking elimination or timeout error
TPNotime
If the client has blocking conditions, the client will blocked there, even if it is time time, it does not return, but if the client is in Transaction mode, it is
The timeout time of the transaction is still reported for timeout errors and returns.
Tpsigrstrt
If the system is interrupted, the system call is reopened.
The call successfully returns 0, the failure returns -1, the error number is saved in the global variable tperrno.
4.2tpacall
Int TpacAll (Char * SVC, Char * Data, Long Len, Long Flags)
Description: Client asynchronous calls the server named SVC's service, the server returns the result, the program can continue
Return, call the returning parameters of the server to TPGETRPLY () in some place:
Char * SVC, Char * DATA, LONG LEN Parameters The meaning of TPCall ()
Flags can be set to: TPNOTRAN, TPNOREPLY, TPNOBLOCKTPNOTIME, TPSIGRSTRT.
The meaning of TPNOTRAN, TPNOBLOCKTPNOTIME, TPSIGRSTRT is the same as in tpCall ()
TPNOREPLY: Call TPACALL () client does not want to receive a SEVER-side response. If set
TPNOREPLY: The server does not send a response to the client.
Return Value: Failback Returns -1, successfully returns a handler, can be used as a TPGETRPLY parameter for adherent
4.3TpGetrPly
INT TPGETRPLY (INT * CD, Char ** DATA, Long * LEN, Long Flags)
Description: Remove the server's response to TPACALL ().
Parameters: cd tpacall () returned Handler
CHAR ** DATA Returns the address of the buffer, and the result of the server is transmitted to the client.
Long * LEN: Returns the length of the buffer
Flags: Yes: TPNOBLOCK, TPNOTIME, TPSIGRSTRT, TPGETANY (regardless of the value of the CD, from the service
Take the first available message in the response queue of the device), TPNOCHANGE
Return Value: Failure Returns -1, the error number is saved in the global variable tperrno.
4.4TpCancel
Int tpcancel (int Handle)
Description: If the current program is not in transaction mode, cancel a response to TPACALL (), if it is in transaction mode
In, the response to TPACALL () cannot be canceled, which will fail.
Parameters: tpacall () Returned Handler
Return Value: Failure Returns -1, the error number is saved in the global variable tperrno.
4.5TPGPRIO
Int tpgprio ()
Description: Returns the priority of a message (TPCall (), TPACALL () or reception (TPGETRPLY ())
Parameters: no
Return value: 1-100 Message priority, the higher the value, the higher the priority
Failure returns -1, the error number is saved in the global variable tperrno.
Struct {
Int hdl; / * handle * /
INT Pr; / * priority * /
} pa [size];
For (i = 0; i / * DETERMINE Service and Data for Request * / PA [I] .hdl = TPACALL (SVC, BUF, LEN, FLAGS); / * Save priority use to send request * / PA [i] .pr = tpgPrio (); } / * Use Qsort (3) Routine to Sort Handles in Priority Order * / Qsort ((char *) Pa, Requests, SizeOf (Pa [0]), CMPFCN); For (i = 0; i TpGetrPly (& PA [I]. HDL, & RBUFP, & RLEN, RFLAGS); } 4.6TPSPRIO Int Tpsprio (int Prio, Long Flags) Description: Set the priority of the next message to send Parameters: 0- PRIO is the relative value, set the priority of the next message to send to the current priority plus priotpabsolute: PRIO is an absolute value, set the priority of the next message to send to PRIO Return Value: Failure Returns -1, the error number is saved in the global variable tperrno. 5 ATMI related to request error handling 5.1tpstrerror Char * TPSTRERROR (int TPERRNO) Description: Returns error description of the error number TperrNO Parameters: tperrno: Global variables defined in Atmi.h, used to identify error numbers, similar to Errno in C Return Value: Failure Returns NULL, successfully returns an error number for TPERRNO. 5.2TPERRORDETAIL INT TPERRORDETAIL (Long Flags) Description: Returns a more detailed description of the current process or thread recently call ATMI error Parameter: Set to 0 Return Value: If there is no error to return 0, there is an error returns an error description number 5.3tpstrerRORDetail Char * TPSTRRORDETAIL (int Err, long flags) Description: Returns the detailed description of the error description number ERR parameter: Err: TPERRORDETAIL () return value, Flags: Set to 0 Return Value: Failure Returns NULL, successfully returned Detailed description