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.

71 lines
1.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000.
  5. //
  6. // File: R E C E I V E D A T A . H
  7. //
  8. // Contents: Queue of received data from network
  9. //
  10. // Notes:
  11. //
  12. // Author: mbend 17 Dec 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "upsync.h"
  17. #include "winsock2.h"
  18. class CReceiveDataManager;
  19. class CReceiveData
  20. {
  21. private:
  22. friend class CReceiveDataManager;
  23. CReceiveData(char * szData, SOCKET sock, BOOL fIsTcpSocket, BOOL fMCast, SOCKADDR_IN * psockAddrInRemote);
  24. ~CReceiveData();
  25. CReceiveData(const CReceiveData &);
  26. CReceiveData & operator=(const CReceiveData &);
  27. CReceiveData * m_pNext;
  28. char * m_szData;
  29. SOCKET m_sock;
  30. SOCKADDR_IN m_sockAddrInRemote;
  31. BOOL m_fIsTcpSocket;
  32. BOOL m_fMCast;
  33. };
  34. class CReceiveDataManager
  35. {
  36. public:
  37. ~CReceiveDataManager();
  38. static CReceiveDataManager & Instance();
  39. HRESULT HrAddData(char * szData, SOCKET sock, BOOL fMCast, SOCKADDR_IN * psockAddrInRemote);
  40. HRESULT HrInitialize();
  41. HRESULT HrShutdown();
  42. private:
  43. CReceiveDataManager();
  44. CReceiveDataManager(const CReceiveDataManager &);
  45. CReceiveDataManager & operator=(const CReceiveDataManager &);
  46. static CReceiveDataManager s_instance;
  47. static DWORD WINAPI ThreadFunc(void *);
  48. DWORD ThreadMember();
  49. void ProcessReceiveBuffer(CReceiveData * pData);
  50. CUCriticalSection m_critSec;
  51. CReceiveData * m_pHead;
  52. CReceiveData * m_pTail;
  53. HANDLE m_hEventShutdown;
  54. HANDLE m_hEventWork;
  55. HANDLE m_hThread;
  56. };