Negotiating using a capability bitmask

To negotiate request capabilities using a capability bitmask, an application must:

  1. Read in the entire bitmask by calling srv_capability_info with the cmd argument set to CS_GET, the type argument set to CS_CAP_REQUEST, the capability argument set to CS_ALL_CAPS, and valp pointing to the CS_CAP_TYPE structure that will contain the bitmask.

  2. Test, set, or clear particular bits in the bitmask using the CS_TST_CAPMASK, CS_SET_CAPMASK and CS_CLR_CAPMASK macros.

An application negotiates response capabilities in a similar fashion, except that it must set the type argument to CS_CAP_RESPONSE.

Gateway applications should use the mask method to negotiate capabilities. As the following diagram illustrates, the gateway calls srv_capability_info to retrieve the remote client’s capability mask and sends those capabilities to the remote server by calling ct_capability prior to calling ct_connect. Once the remote connection has been established, the gateway can retrieve the capability masks that the remote server has sent using ct_capability and then define them on the remote client connection, using srv_capability_info.