4.4 Enumerating Interfaces and Connecting "dd1"

This example illustrates the use of the RPC methods defined in this specification to enumerate interfaces on the RRAS server that has three demand-dial interfaces and connect dd1.

The client calls the RPC method RRouterInterfaceEnum (section 3.1.4.21) with the following parameters: 

  • The DIM_HANDLE (section 2.2.1.1.6) that the client obtains during initialization (section 3.1.3).

  • The level of information required is set to zero (0).

  • The pointer to DIM_INFORMATION_CONTAINER (section 2.2.1.2.1) (pInfoStruct) into which the information is passed by the RRAS server.

  • The dwPreferedMaximumLength is set to -1, so that the buffer returned is large enough to hold all available information.

  • The lpdwResumeHandle parameter is zero (0) because this is the first call.

When the client calls the RPC method as previously described, the RRAS server returns ERROR_SUCCESS. Additionally, the following parameter values are updated:

  • The dwBufferSize in the pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) will contain the size of information being passed. In this case, it will be three times the size of MPRI_INTERFACE_0 (section 2.2.1.2.81).

  • The pBuffer in the pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) will contain the pointer to the three-element array of MPRI_INTERFACE_0.

  • The lpdwEntriesRead and lpdwTotalEntries will point to the DWORD whose value is 3. The client will attempt to match wszInterfaceName of each of the entries of MPRI_INTERFACE_0.

It will store the dwInterface of the matched MPRI_INTERFACE_0 in the local variable hInterface. After ensuring that the fEnabled field is 1, the client calls RRouterInterfaceConnect (section 3.1.4.22) with the following parameters:

  • The DIM_HANDLE that the client obtains during initialization (section 3.1.3).

  • The hInterface that the client has stored locally.

  • The hEvent is set to NULL and fBlocking is set to 1 so that the call is blocked until the connection attempt has completed.

When the client calls the RPC method as previously described, the RRAS server returns ERROR_SUCCESS after the connection is successful.