3.4.6.1.1 Primary

When the local partner is the primary partner, it MUST use the provided name object to check whether or not an existing session with a matching name object already exists in the session table.

  • If an existing session is found, the session object is returned to the level-two protocol and the request completes successfully.

  • Otherwise, a new session object MUST be created and added to the session table.

After creating a new session object, the primary partner MUST set the state of the session object to Connecting, and start the Session Setup timer associated with that session object. An RPC binding handle to the secondary partner MUST be created and stored in the session object (for binding handles, see [C706]). The primary partner MUST attempt to call either the BuildContextW or BuildContext method on the secondary partner using the binding handle stored in the session object. (For making calls to a partner, see section 3.4.) The binding handle used to make the call MUST be stored in the session object. (For binding handles, see [C706].)

To determine whether the secondary partner supports BuildContextW, the primary partner calls BuildContextW on the secondary partner and waits for a return value. If the call completes with error code RPC_S_PROCNUM_OUT_OF_RANGE, then the secondary partner does not support BuildContextW.

If the secondary partner does not support the BuildContextW method, the primary partner MUST call the BuildContext method. If the secondary partner does support the BuildContextW method, the primary partner MUST NOT call the BuildContext method. During this call, the secondary partner will make a nested, synchronous callback to the primary partner to complete the session establishment.

If the call to BuildContext or BuildContextW completes unsuccessfully, the primary partner SHOULD behave according to the error code that was returned:

  • If the error code is 0x80000172 (E_CM_VERSION_SET_NOTSUPPORTED) or 0x80000173 (E_CM_S_PROTOCOL_NOT_SUPPORTED), or 0x80000124 (E_CM_S_TIMEDOUT, indicating that the Session Setup Timer expired), or the call was retried for more than the number of times specified in the Session Setup Retry Count ADM element, the primary partner MUST report an error to the level-two protocol.

  • If the error code is 0x80000123 (E_CM_SERVER_NOT_READY) or 0x000006BB (RPC_S_SERVER_TOO_BUSY), or any other implementation-specific error code, the primary partner SHOULD retry the nested call for the number of times specified in the Session Setup Retry Count ADM element.

If an error is reported to the level-two protocol, the session object MUST be removed from the session table and cleaned up. For how to clean up a session object, see section 3.2.1.3.