4.8 Retrieving Device Configuration Information

This example illustrates the use of the Rasrpc Interface method RasRpcSubmitRequest with ReqTypes REQTYPE_GETDEVICECONFIGINFO as defined in this specification. The method is used to query all the devices configured on the RRAS server when there are 7 devices on the RRAS - 2 Modem devices, 4 tunnel devices (one each for PPTP, L2TP, SSTP and IKEv2) and 1 PPPoE device.

The client calls the RPC method RasRpcSubmitRequest (section 3.3.4.5) with the following parameters:

  • The handle to the Rasrpc Server where the call is to be executed that the client obtains during initialization (section 3.3.3).

  • pReqBuffer parameter is updated as follows:

    • The pReqBuffer buffer is allocated the size of the sum of the size of RequestBuffer and 5000.

    • pReqBuffer.RB_PCBIndex is set to zero (0).

    • pReqBuffer.RB_Reqtype is set to 95 (REQTYPE_GETDEVICECONFIGINFO)

    • pReqBuffer.RB_Dummy is set to the size of ULONG.

    • pReqBuffer.Done is set to zero (0).

    • pReqBuffer.Alignment is set to zero (0).

    • pReqBuffer.RB_Buffer is interpreted as a DeviceConfigInfo structure and following value for DeviceConfigInfo are set:

      • DeviceConfigInfo.dwVersion is set to the version of Rasrpc Server. The version information can be retrieved using RasRpcGetVersion method (section 3.3.4.7)

      • DeviceConfigInfo.cbBuffer is set to zero (0).

  • The dwcbBufSize is set to the size of pReqBuffer.

When the client calls the RPC method as previously described, server returns ERROR_SUCCESS. Additionally, the DeviceConfigInfo structure as pointed by pReqBuffer.RB_Buffer is updated as follows:

  • DeviceConfigInfo.cEntries will contain 7 as the number of device entries present on the Rasrpc server.

  • DeviceConfigInfo.cbBuffer will contain 3304 as the size of DeviceConfigInfo.abdata buffer needed to contain all the device information.

  • DeviceConfigInfo.dwVersion will contain 6 as the version of the Rasrpc server.

If DeviceConfigInfo.cbBuffer returned size is greater than the passed-in DeviceConfigInfo.cbBuffer size, it implies that the passed-in size was not large enough to hold all of the devices information. In that case, the client calls the RasRpcSubmitRequest method again with DeviceConfigInfo.cbBuffer set to the returned value of DeviceConfigInfo.cbBuffer in the first call.

If DeviceConfigInfo.cbBuffer returned size is less than or equal to the passed in DeviceConfigInfo.cbBuffer size, DeviceConfigInfo.abdata contains an array of RAS_DEVICE_INFO structure that contains information for each device on the server.

The client will call the RasRpcSubmitRequest method again with DeviceConfigInfo.cbBuffer set to 3304 and all other parameters being same.

When the client calls the RPC method as described, the server returns ERROR_SUCCESS. Additionally, the DeviceConfigInfo structure as pointed by pReqBuffer.RB_Buffer is updated as follows by the server:

  • DeviceConfigInfo.cEntries will contain 7 as the number of device entries present on the Rasrpc server.

  • DeviceConfigInfo.cbBuffer will contain 3304 as the size of DeviceConfigInfo.abdata buffer needed to contain all the device information.

  • DeviceConfigInfo.dwVersion will contain 6 as the version of the Rasrpc server.

  • DeviceConfigInfo.abdata points to the array of RAS_DEVICE_INFO structures that contains the device information.

The client frees the memory allocated to the pReqBuffer structure.