IPEnumeration.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // IPEnumeration.h ///////////////////////////////////////////////////////////////
  24. // Class for enumerating IP addresses
  25. // Author: Matthew D. Campbell, October 2001
  26. #pragma once
  27. #ifndef _IPENUMERATION_H_
  28. #define _IPENUMERATION_H_
  29. #include "GameNetwork/Transport.h"
  30. /**
  31. * IP wrapper class.
  32. */
  33. class EnumeratedIP : public MemoryPoolObject
  34. {
  35. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(EnumeratedIP, "EnumeratedIP")
  36. public:
  37. EnumeratedIP() { m_IPstring = ""; m_next = NULL; m_IP = 0; }
  38. // Access functions
  39. inline AsciiString getIPstring( void ) { return m_IPstring; }
  40. inline void setIPstring( AsciiString name ) { m_IPstring = name; }
  41. inline UnsignedInt getIP( void ) { return m_IP; }
  42. inline void setIP( UnsignedInt IP ) { m_IP = IP; }
  43. inline EnumeratedIP *getNext( void ) { return m_next; }
  44. inline void setNext( EnumeratedIP *next ) { m_next = next; }
  45. protected:
  46. AsciiString m_IPstring;
  47. UnsignedInt m_IP;
  48. EnumeratedIP *m_next;
  49. };
  50. EMPTY_DTOR(EnumeratedIP)
  51. /**
  52. * The IPEnumeration class is used to obtain a list of IP addresses on the
  53. * local machine.
  54. */
  55. class IPEnumeration
  56. {
  57. public:
  58. IPEnumeration();
  59. ~IPEnumeration();
  60. EnumeratedIP * getAddresses( void ); ///< Return a linked list of local IP addresses
  61. AsciiString getMachineName( void ); ///< Return the Network Neighborhood machine name
  62. protected:
  63. EnumeratedIP *m_IPlist;
  64. Bool m_isWinsockInitialized;
  65. };
  66. #endif // _IPENUMERATION_H_