3.1.5.2.1 Receive CONNECT

This message is sent by the connection initiator after authentication completes. It is also sent when the initiator begins listening, if the initiator was not listening at the time that it first sends the CONNECT message.

If the message fails to conform to any of the following conditions, then the message MUST be discarded unprocessed and the connection MUST be terminated.

  • The Message Size MUST be at least 0x18.

  • Address Count * 20 + Address Offset MUST be at most Message Size.

  • Friendly Name Offset MUST be at least Address Count * 20 + Address Offset.

  • Friendly Name Offset MUST be at most Message Size.

If the CONNECT message's Update bit is set, and this message was received from a Link that is not yet in the LINK_STATE_CONNECTED state, the Update bit MUST be ignored. Otherwise, the addresses in the message MUST be used to update this connection's entry in the Neighbor List, and then processing of the message MUST be halted.

If the CONNECT message's Direct bit is set, this message is intended to establish a direct connection. If the application has not caused the Direct Connection flag to be set (see section 3.1.4.7), the node MUST send (see section 3.1.7.1) a REFUSE message containing the following data:

  • Error Code MUST be set to the value REFUSE_CODE_DIRECT_CONNECTION_DISALLOWED.

  • Address Count MUST be set to 0.

  • Address Offset MUST be set to 0.

  • The Ipv6 Address Array field MUST NOT be present.

The node MUST then halt processing the message and terminate the connection.

Otherwise, the node MUST send (see section 3.1.7.1) a WELCOME message with the following data:

  • Node ID MUST be set to the value of the local node ID.

  • Peer Time MUST be set to the local peer time.

  • Address Count MUST be set to 0.

  • Address Offset MUST be set to 0.

  • Ipv6 Address Array MUST NOT be present.

The node MUST then set the connection state to LINK_STATE_CONNECTED.

If there is another existing neighbor connection for the node that sent the CONNECT message (that is, if the node ID in the message is identical to the node ID of one of the entries in the Neighbor List), the node MUST send (see section 3.1.7.1) a REFUSE message with the following information:

  • Error Code MUST be set to REFUSE_CODE_DUPLICATE_CONNECTION.

  • Address Count MUST be set to 0.

  • Address Offset MUST be set to 0.

  • IPv6 Address Array MUST NOT be present.

The node MUST then halt processing of the message and terminate the connection.

If the local node already has a count of Neighbors greater than or equal to Maximum neighbors, the node MUST respond by sending (see section 3.1.7.1) a REFUSE message, and then halt processing of the message and terminate the connection. The REFUSE message MUST contain the following information:

  • Error Code MUST be set to REFUSE_CODE_BUSY.

  • Address Count MUST be set to the number of neighbor referrals returned (default is 10).

  • Address Offset MUST specify the starting point of the Ipv6 Address Array inside the message.

  • Ipv6 Address Array MUST contain a list of Address Count PEER_IN6_ADDRESS objects.

If the CONNECT message was sent on a Link that was already in the CONNECTED state, a REFUSE message MUST be sent (see section 3.1.7.1) containing the following information:

  • Error Code MUST be set to REFUSE_CODE_ALREADY_CONNECTED.

  • Address Count MUST be set to 0.

  • Address Offset MUST be set to 0.

  • IPv6 Address Array MUST NOT be present.

The node MUST then halt processing of the message and terminate the connection.

If none of the above cases hold, the remote node information from the CONNECT message MUST be stored in the Neighbor List and a WELCOME message MUST be sent (see section 3.1.7.1) with the following information:

  • Node ID MUST be set to the local node ID.

  • Peer Time MUST be set to the local node's peer time.

  • Address Count MUST be set to the number of returned referrals (the default value is 10) if the Neighbor List bit in the Connect message is set; otherwise it MUST be set to 0.

  • Address Offset MUST be set to the starting point of the Ipv6 Address Array if the Address Count is greater than 0.

  • Ipv6 Address Array MUST contain a list of Address Count PEER_IN6_ADDRESS objects if Address Count is greater than 0; it MUST NOT be present if Address Count is 0.

The connection state MUST then be set to LINK_STATE_AUTHENTICATED.

If the Defer Expiration flag is set to true, the Record Expiration Timer MUST be set to expire in 0 seconds.