Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.5 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation
  2. //
  3. // File: NetworkInterface.h
  4. //
  5. // Synopsis: Declares a NetworkInterface
  6. // This object has the knowledge of an
  7. // IP enabled network connection including
  8. // IP address, DHCP information, etc.
  9. //
  10. // History: 03/01/2001 JeffJon Created
  11. #ifndef __CYS_NETWORKINTERFACE_H
  12. #define __CYS_NETWORKINTERFACE_H
  13. class NetworkInterface
  14. {
  15. public:
  16. // Constructor
  17. NetworkInterface();
  18. // Desctructor
  19. ~NetworkInterface();
  20. // Copy constructor and assignment operator
  21. NetworkInterface(const NetworkInterface& nic);
  22. NetworkInterface& operator=(const NetworkInterface& rhs);
  23. // Initializer
  24. HRESULT
  25. Initialize(SmartInterface<IWbemClassObject>& adapterObject);
  26. // Pulic accessor methods
  27. DWORD
  28. GetIPAddress(DWORD addressIndex) const;
  29. bool
  30. IsDHCPEnabled() const { return dhcpEnabled; }
  31. bool
  32. RenewDHCPLease();
  33. String
  34. GetDescription() const;
  35. String
  36. GetStringIPAddress() const;
  37. private:
  38. HRESULT
  39. GetIPAddressFromWMI();
  40. HRESULT
  41. SetIPAddresses(const StringList& ipList);
  42. HRESULT
  43. GetDHCPEnabledFromWMI();
  44. bool initialized;
  45. String ipaddressString;
  46. DWORD ipaddrCount;
  47. std::vector<DWORD> ipaddresses;
  48. bool dhcpEnabled;
  49. SmartInterface<IWbemClassObject> wmiAdapterObject;
  50. };
  51. #endif // __CYS_NETWORKINTERFACE_H