PreviousNext

DCE RPC Evaluation Routines

DCE RPC provides two character and code sets compatibility evaluation routines: rpc_cs_eval_with_universal( ) and rpc_cs_eval_without_universal( ). To use either one of these routines, specify their names in the evaluation function argument to the rpc_ns_import_ctx_add_eval( ) routine. (The code shown in Sample Client Code specifies a DCE RPC character and code sets evaluation routine.)

The rpc_cs_eval_with_universal( ) routine first compares the client's local code set with the server's local code set. If they are the same, client-server character and code set compatibility exists. The routine returns to the NSI import routine, which returns the server binding to the client.

If the routine finds that the client and server local code sets differ, it calls the routine rpc_cs_char_set_compat_check( ) to determine client-server character set compatibility. If the client and server are using the same character set, it will be safe for them to exchange character data despite their use of different encodings for the character data. Clients and servers using different character sets are considered to be incompatible, since the process of converting the character data from one character set to the other will result in significant data loss.

Using the client and server's local code set identifiers as indexes into the code set registry, the rpc_cs_char_set_compat_check( ) routine obtains the registered values that represent the character set(s) that the specified code sets support. If the client and server support just one character set, the routine compares the values for compatibility. If the values do not match, then the client-server character sets are not compatible; for example, the client is using the German character set and the server is using the Korean character set. In this case, the routine returns the status code rpc_s_ss_no_compat_charsets to the evaluation routine so that binding to that server will be rejected.

If the client and server support multiple character sets, the rpc_cs_char_set_compat_check( ) routine determines whether at least two of the sets are compatible. If two or more sets match, the routine considers the character sets compatible, and returns a success status code to the evaluation routine.

In the case where the client and server are character set compatible, the rpc_cs_eval_with_universal( ) routine uses the following model to determine a conversion method:

· RMIR (receiver makes it right)

· SMIR (client uses its local, server converts to and from it)

· CMIR (server uses its local, client converts to and from it)

· Use an intermediate code set

· Use the universal (ISO 10646) code set

This conversion model translates into the following steps:

1. The rpc_cs_eval_with_universal( ) routine takes the client's local code set and searches through the server's code sets array to determine whether it has a converter for the client's local set. Then it takes the server's local code set and searches through the client's code sets array to see if it has a converter for the server's local code set.

2. If both client and server support converters for each others' local code sets, that is, they can convert to and from each other's local code set, the routine sets the conversion method to RMIR.

3. If the server can convert to and from the client's local code set, but the client cannot convert from the server's local code set, the routine sets the conversion method to SMIR.

4. If the client can convert to and from the server's local code set, but the server cannot convert to and from the client's local code set, the routine sets the conversion method to CMIR.

If the conversion method is SMIR or RMIR, the rpc_cs_eval_with_universal( ) routine sets both the sending tag and the desired receiving tag to the code set value that represents the client's local code set. In the case of CMIR, the routine sets both the sending tag and the desired receiving tag to the code set value that represents the server's local code set.

5. If neither client nor server support each other's local code set, the routine next determines if they both support a code set into which they both can convert to/from their local code sets. If it finds an intermediate set into which they both can convert, it sets the conversion method to INTERMEDIATE and sets the sending tag and desired receiving tag to the code set value that represents the intermediate code set to use.

6. If the routine does not find any intermediate code set into which client and server can convert, it sets the sending tag and desired receiving tag to the code set value that represents the ISO 10646 universal code set, which is the default intermediate code set that all DCE clients and servers support.

The rpc_cs_eval_without_universal( ) routine uses the following conversion model to determine a conversion method:

· RMIR

· SMIR (client uses its local, server converts to and from it)

· CMIR (server uses its local, client converts to and from it)

· Intermediate

· Reject for code set incompatibility

Consequently, the rpc_cs_eval_without_universal( ) uses the same evaluation logic as rpc_cs_eval_with_universal( ) except that it rejects the server binding if the client and server do not support a common code set to use as an intermediate code set.