3.1.5.7 Handling Session Activation

The following sequence defines the required actions of the NfpService if a Session Activation message (section 2.2.11) is received on the transport link on the ReplyChannelID of a specific Session Factory object (section 3.1.1.3):

  1. If a Session object (section 3.1.1.4) can be found in the Session Factory object's SessionList with a State equal to Ready and a RemoteSessionFactoryID equal to the received ActivatedSessionFactoryID field, then this sequence MUST be aborted.

  2. Create a new Session object and add it to the Session Factory object's SessionList with the following attributes:

    1. Role: Server

    2. State: WaitingForTransmit

    3. SessionID: Set to the received ReplyChannelID

    4. RemoteSessionFactoryID: Set to the ActivatedSessionFactoryID field of the received message

    5. PrivateKey/PublicKey: Generate 256-bit key pair using the Elliptic Curve Diffie-Hellman (ECDH) P256 convention [NSA].

    6. SharedSecretKey: Derive using the SHA256 key derivation algorithm with the above PrivateKey and PublicKey pair and the ECDH Public Key field of the received message.

  3. Start the SessionProtocolTimer for this Session object.

  4. Construct a Session ACK message (section 2.2.10):

    1. Set the Reserved and Extension fields.

    2. Use the Session object's PublicKey to set the ECDH Public Key field.

    3. Use the Session Factory object's TcpPort to set the TCP Port field.

    4. Use the Session Factory object's RfcommPort to set the RFCOMM Port field.

  5. Publish the Session ACK message to the received ReplyChannelID.

If the transport link indicates that this message is transmitted prior to the SessionProtocolTimer expiring for this Session object, then the Session object's State moves to Ready.

The Session object can then be used by higher-level protocols to create connections to the peer.