BOOL CNetworkAdapterList::SetIpAddrEntry(LONG lIfIndex, LPCTSTR lpstrIPAddr, LPCTSTR lpstrIPNetMask, LPCTSTR lpstrNetNumber) { CNetworkAdapter cAdapter; POSITION pPosCur, pPosNext; pPosNext = GetHeadPosition(); pPosCur = GetHeadPosition(); while (pPosNext != NULL) { cAdapter = GetNext( pPosNext); if (cAdapter.GetIfIndex() == lIfIndex) { // That's the adapter to update cAdapter.SetIPAddress( lpstrIPAddr); cAdapter.SetIPNetMask( lpstrIPNetMask); cAdapter.SetNetNumber( lpstrNetNumber ); SetAt( pPosCur, cAdapter); return TRUE; } // Browse the next adapter and save the adapter position in the list pPosCur = pPosNext; } return FALSE; }
int CNetworkAdapter::operator==(CNetworkAdapter cObject) const { return ((m_csNetNumber == cObject.GetNetNumber()) && (m_lIndex == cObject.GetIfIndex()) && (m_csDescription == cObject.GetDescription()) && (m_csType == cObject.GetType()) && (m_csTypeMIB == cObject.GetTypeMIB()) && (m_csSpeed == cObject.GetSpeed()) && (m_ulSpeed == cObject.GetByteSpeed()) && (m_csHWAddr == cObject.GetMACAddress()) && (m_csOperStatus == cObject.GetOperationalStatus()) && (m_csIPAddr == cObject.GetIPAddress()) && (m_csIPNetMask == cObject.GetIPNetMask()) && (m_csGateway == cObject.GetGateway()) && (m_csDhcpServer == cObject.GetDhcpServer())); }
// Didier LIROULET 2005-10-17 BEGIN BOOL CNetworkAdapterList::SetIpRouteEntry(LONG lIfIndex, LPCTSTR lpstrGateway) { CNetworkAdapter cAdapter; POSITION pPosCur, pPosNext; pPosNext = GetHeadPosition(); pPosCur = GetHeadPosition(); while (pPosNext != NULL) { cAdapter = GetNext( pPosNext); if (cAdapter.GetIfIndex() == lIfIndex) { // That's the adapter to update cAdapter.SetGateway( lpstrGateway); SetAt( pPosCur, cAdapter); return TRUE; } // Browse the next adapter and save the adapter position in the list pPosCur = pPosNext; } return FALSE; }