First it is necessary to find the IP address, gateway address and interface index of the adapter that you wish to route over. This information can easily be obtained by calling GetAdapterAddresses() a number of times to enumerate all network device data.
Once the IP information has been obtained for the selected adapter then CreateIpForwardEntry() can be called to setup the route. The CreateIpForwardEntry() API takes a PMIB_IPFORWARDROW parameter essentially a route definition. This needs to be setup as follows:
- dwForwardDest - Set to the IP address of server you will be connecting too.
- dwForwardMask - Mapping IP address mask. This will need to be 255.255.255.255 for specified traffic.
- dwForwardPolicy - Set to zero.
- dwForwardNextHop - This needs to be set to the discovered IP adapters gateway address.
- dwForwardIfIndex - This needs to be set to the discovered IP adapters index.
- dwForwardType - This is set to MIB_IPROUTE_TYPE_INDIRECT.
- dwForwardProto - This is set to MIB_IPPROTO_NETMGMT.
- dwForwardAge - Set to zero.
- dwForwardNextHopAS - Set to zero.
- dwForwardMetric1 - Set to 1.
- dwForwardMetric2-5 - Set to 0xFFFFFFFF.
At the end of the session the DeleteIpForwardEntry() API should be called to tear down the route.
3 comments:
Hi
Sorry for cross posting.. as i didnt have your mail id. saw your message in the below link.
http://www.eggheadcafe.com/software/aspnet/29797750/re-gsm-data-prepost-pro.aspx
Actually i wanted to execute the GSM algorithms using RIL or any other API's like RIL_SendSimCmd ( AT + CSIM). Is it possible ? does i have to be part of OEM. Hope you could help me out.
It is possible to use the RIL commands. Unfortunately the RIL.H and RIL.LIB files are not included in the SDK. This means that unless you own the BSP (you are the OEM) that you cannot do the link. There are several rough copies of the RIL files on the internet but I would not endorse using them.
Tried this on some other units and could not get the CreateIpForwardEntry() to work. I tracked down the problem and needed to use MIB_IPROUTE_TYPE_DIRECT instead.
Post a Comment