4.3 Creating a Demand Dial Interface on RRAS with Filters
This example illustrates the use of the RPC methods defined in this specification to create a one-way demand-dial interface named "dd1" on the RRAS on Windows Server 2008 operating system. Then, IPv4 filtering is enabled on the demand-dial interface so that the demand-dial is triggered whenever packets with the source address 1.1.1.1 reach the RRAS server.
The client updates the phone book file router.pbk under the file path C:\Windows\System32 to comprise the phonebook entry for dd1, see section 4.10 for details.
The client calls the RPC method RRouterInterfaceCreate (section 3.1.4.13) 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. In this example, the client specifies level 0.
The pointer to DIM_INFORMATION_CONTAINER (section 2.2.1.2.1) (pInfoStruct) that the RRAS server uses to pass the information.
The dwBufferSize in the pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) will contain the size of information being passed; in this case, it will be the size of MPRI_INTERFACE_0 (section 2.2.1.2.81).
The pBuffer in the pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) will contain a pointer to MPRI_INTERFACE_0.
The wszInterfaceName in the pointer to MPRI_INTERFACE_0 is set to L"dd1".
The dwIfType in the pointer to MPRI_INTERFACE_0 is set to ROUTER_IF_TYPE_HOME_ROUTER.
When the client calls the RPC method as previously described, it returns ERROR_SUCCESS. Additionally, the following parameter value is updated:
The hInterface specifies a unique identifier of the newly created interface.
The client stores the hInterface returned in MPRI_INTERFACE_0 into a local variable hInterface.
The client frees the buffer pointed to by pBuffer.
The client then calls the RPC method RRouterInterfaceTransportAdd (section 3.1.4.18) to add with the following parameters:
The DIM_HANDLE that the client obtains during initialization (section 3.1.3).
The pointer to DIM_INTERFACE_CONTAINER (pInfoStruct) that the RRAS server uses to pass the information.
The hInterface is the handle to the interface stored locally.
The dwTransportId will be set to 0x00000021 since IPv4 filters are being added.
The pointer to DIM_INTERFACE_CONTAINER (pInfoStruct) that the RRAS server uses to pass the information.
The fGetInterfaceInfo in the pointer to DIM_INTERFACE_CONTAINER (pInfoStruct) is set to 0 because the client is setting information.
The dwInterfaceInfoSize in the pointer to DIM_INTERFACE_CONTAINER (pInfoStruct) is set to the size of RTR_INFO_BLOCK_HEADER (section 2.2.1.2.3) with one RTR_TOC_ENTRY (section 2.2.1.2.4) and have the quad memory aligned data for MPR_FILTER_0 0x34.
The pInterfaceInfo in the pointer to DIM_INTERFACE_CONTAINER (pInfoStruct) is set to RTR_INFO_BLOCK_HEADER.
The Version in RTR_INFO_BLOCK_HEADER is set to 1.
The Size is set to 32.
The TocEntriesCount is set to 1.
The InfoType of RTR_TOC_ENTRY is set to IP_FILTER_ENABLE_INFO (0xFFFF0015).
The InfoSize in RTR_TOC_ENTRY is set to 20 (TOC entry 16 byte + 4 bytes mprfilter).
The Count in RTR_TOC_ENTRY is set to 1.
The Offset is 16 and points to MPR_FILTER_0 (section 2.2.1.2.89).
The fEnable in MPR_FILTER_0 is set to 0x00000001 to enable filtering on the RRAS server.
Having enabled filtering on the interface, the client then adds filters on the demand-dial interface. In this example, filtering is enabled on all packets with the source address 1.1.1.1.
The client then calls the RPC method RRouterInterfaceTransportAdd with the following parameters:
The DIM_HANDLE that the client obtains during initialization (section 3.1.3).
The pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) that the RRAS server uses to pass.
The hInterface is the handle to the interface stored locally.
The dwTransportId will be set to 0x00000021 for IPv4.
The pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) that the RRAS server uses to pass.
The fGetInterfaceInfo in the pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) is set to 0 because the client is setting information.
The dwInterfaceInfoSize in the pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) is set to 68 (filter descriptor 40 bytes + TOC entry 16 bytes + RTR_INFO_BLOCK_HEADER -Toc 12 bytes).
The pInterfaceInfo in the pointer to DIM_INFORMATION_CONTAINER (pInfoStruct) is set to RTR_INFO_BLOCK_HEADER.
The Version in RTR_INFO_BLOCK_HEADER is set to 1.
The Size is set to 72 (filter descriptor 40 bytes + TOC entry 32 bytes).
The TocEntriesCount is set to 1.
The InfoType of RTR_TOC_ENTRY is set to 0xFFFF0009.
The InfoSize in RTR_TOC_ENTRY is set to 40 (the size of the filter descriptor).
The Count in RTR_TOC_ENTRY is set to 1.
The Offset is 32 and points to FILTER_DESCRIPTOR (section 2.2.1.2.5).
The dwVersion in FILTER_DESCRIPTOR is set to 0x00000001.
The dwNumFilters in FILTER_DESCRIPTOR is set to 0x00000001.
The faDefaultAction in FILTER_DESCRIPTOR is set to 0x00000000.
The fiFilter contains FILTER_INFO (section 2.2.1.2.6).
The dwSrcAddr in FILTER_INFO is set to 0x01010101 and the rest of the fields in FILTER_INFO are set to 0.