3.3.4.7 Xa_open
The Xa_open event MUST be signaled with the following arguments:
xa_info - String using an implementation-specific format that contains the following fields:
TM - Transaction Manager description.
RM Recovery GUID - Resource Manager Recovery GUID.
Transaction Timeout (optional).<18>
Branch Isolation (optional).<19>
RMID - Resource Manager ID.
Flags - Flags defined in [XOPEN-DTP] Chapter 4.4.
The Xa_open event MUST return the following value:
XA Result - Return code defined in [XOPEN-DTP] Chapter 4.5 or an Error Code as defined in [MS-ERREF] section 2.1.1.
If the Xa_open event is signaled, the XA Superior Transaction Manager MUST perform the following actions:
If the provided Flags field has TMASYNC set:
Return XAER_ASYNC.
If the provided Flags field is not set to TMNOFLAGS or the xa_info argument is not set:
Return E_INVALIDARG.
If the Branch Isolation argument is set and the value is not equal to Tight:
Return XAER_INVAL.
Attempt to find an XA Superior Proxy object in the XA Superior Proxy Table keyed by the provided RMID.
If an object is found:
If the provided Branch Isolation is not set and the value of the Branch Isolation field of the XA Superior Proxy object is not set to Loose:
Return XAER_INVAL.
Otherwise, if the value of the provided Branch Isolation is not equal to the value of the Branch Isolation field of the XA Superior Proxy object:
Return XAER_INVAL.
Otherwise:
Increment the Open Count field of the XA Superior Proxy object.
The implementation SHOULD check whether Transaction Timeout is provided:
If Transaction Timeout is provided, the implementation SHOULD set the Transaction Timeout field of the XA Superior Proxy object to the provided Transaction Timeout converted to a 32-bit unsigned integer.
Return XA_OK.
Otherwise:
Attempt to create a new XA Superior Proxy object with the following values:
The TM field is set to the TM field of the provided xa_info.
The Resource Manager Recovery GUID field is set to the provided RM Recovery GUID field.
The Resource Manager ID field is set to the provided RMID.
Transaction Timeout is set if provided.
The Branch Isolation field is set to the Branch Isolation field if provided; otherwise set the Branch Isolation field to Loose.
The Recovery Complete field is set to FALSE.
If failed:
Return XAER_RMERR.
Otherwise:
Attempt to create a new XA Superior Proxy CMP Connection object with the following values:
The Connection type field is set to CONNTYPE_XAUSER_CONTROL.
The XA Superior Proxy object is set to created XA Superior Proxy object.
The State is set to Awaiting Creation Response.
If failed:
Return XAER_RMERR.
Otherwise:
Set the Transaction Manager Connection field of XA Superior Proxy object to the newly created XA Superior Proxy CMP Connection object.
Send an XAUSER_CONTROL_MTAG_CREATE message with the following argument:
The guidXaRm field of the message is set to the provided RM Recovery GUID.
Wait for a response and continue with the processing rules defined in CONNTYPE_XAUSER_CONTROL Initiator (section 3.3.5.1).