Leaked source code of windows server 2003
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.

60 lines
1.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corporation
  4. //
  5. // SYNOPSIS
  6. //
  7. // Declares the class CPorts.
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef PORTS_H
  11. #define PORTS_H
  12. #pragma once
  13. // Manages the ports that the RADIUS server accepts requests on.
  14. class CPorts
  15. {
  16. public:
  17. CPorts() throw ();
  18. ~CPorts() throw ();
  19. // Sets the ports configuration.
  20. HRESULT SetConfig(const wchar_t* config) throw ();
  21. // Open/close sockets for the configured ports.
  22. HRESULT OpenSockets() throw ();
  23. void CloseSockets() throw ();
  24. void GetSocketSet(fd_set& sockets) const throw ();
  25. // Close all sockets and reset the configuration.
  26. void Clear() throw ();
  27. private:
  28. void InsertPort(DWORD ipAddress, WORD ipPort) throw ();
  29. struct Port
  30. {
  31. DWORD ipAddress;
  32. WORD ipPort;
  33. SOCKET socket;
  34. };
  35. Port* ports;
  36. size_t numPorts;
  37. fd_set fdSet;
  38. // Not implemented.
  39. CPorts(const CPorts&);
  40. CPorts& operator=(const CPorts&);
  41. };
  42. inline void CPorts::GetSocketSet(fd_set& sockets) const throw ()
  43. {
  44. sockets = fdSet;
  45. }
  46. #endif //PORTS_H