18NETSIM_ID fnFindGateway(NETSIM_ID nDeviceId)
21 for(i=0;i<NETWORK->ppstruDeviceList[nDeviceId-1]->nNumOfInterface;i++)
23 if(NETWORK->ppstruDeviceList[nDeviceId-1]->ppstruInterfaceList[i]->szDefaultGateWay)
25 return fn_NetSim_Stack_GetDeviceId_asIP(NETWORK->ppstruDeviceList[nDeviceId-1]->ppstruInterfaceList[i]->szDefaultGateWay,&j);
42_declspec(dllexport) NETSIM_IPAddress dns_query(NETSIM_ID nDeviceId,NETSIM_ID
id)
46 NETSIM_ID ngatewayId=fnFindGateway(nDeviceId);
49 fnNetSimError(
"Gateway is not configured for device %d",nDeviceId);
52 if(!DEVICE_NWLAYER(ngatewayId))
53 fnNetSimError(
"DNS-- Netwok layer is not configured for device %d",ngatewayId);
54 devVar=DEVICE_NWLAYER(ngatewayId)->ipVar;
64 dns->ip=fn_NetSim_Stack_GetFirstIPAddressAsId(
id,0);
65 LIST_ADD_LAST(&(devVar->dnsList),dns);