ANSC_STATUS BbhmDiagipStartDiag ( ANSC_HANDLE hThisObject ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PBBHM_DIAG_IP_PING_OBJECT pMyObject = (PBBHM_DIAG_IP_PING_OBJECT )hThisObject; PDSLH_PING_INFO pDiagInfo = (PDSLH_PING_INFO)pMyObject->hDslhDiagInfo; if ( pMyObject->CheckCanStart((ANSC_HANDLE)pMyObject) ) { AnscTraceFlow(("BbhmDiagipStartDiag -- enter...\n")); pMyObject->SetEnv(pMyObject); pMyObject->ResetProperty((ANSC_HANDLE)pMyObject); /* TODO set source interface name here */ pMyObject->SetSrcIp((ANSC_HANDLE)pMyObject, pDiagInfo->IfAddrName); if ( pMyObject->SetDstIp((ANSC_HANDLE)pMyObject, pDiagInfo->Host) == ANSC_STATUS_SUCCESS) { pMyObject->SetNumPkts((ANSC_HANDLE)pMyObject, pDiagInfo->NumberOfRepetitions); pMyObject->SetPktSize((ANSC_HANDLE)pMyObject, pDiagInfo->DataBlockSize); pMyObject->SetTimeOut((ANSC_HANDLE)pMyObject, pDiagInfo->Timeout); pMyObject->Open(pMyObject); if ( pMyObject->hSendBuffer ) { AnscFreeMemory(pMyObject->hSendBuffer); pMyObject->hSendBuffer = NULL; } pMyObject->hSendBuffer = (PCHAR)AnscAllocateMemory(pDiagInfo->DataBlockSize + sizeof(ICMPV4_HEADER)); if ( !pMyObject->hSendBuffer ) { return ANSC_STATUS_RESOURCES; } returnStatus = pMyObject->SetControl ( (ANSC_HANDLE)pMyObject, BBHM_IP_PING_CONTROL_START ); if ( returnStatus == ANSC_STATUS_SUCCESS ) { BbhmDiageoStartDiag((ANSC_HANDLE)pMyObject); } else { return returnStatus; } } else { pDiagInfo->DiagnosticState = DSLH_DIAG_STATE_TYPE_PING_Error_HostName; } return ANSC_STATUS_SUCCESS; } else { AnscTraceFlow(("BbhmDiagipStartDiag -- query task is running...\n")); return ANSC_STATUS_PENDING; } }