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.

138 lines
3.0 KiB

  1. //#--------------------------------------------------------------
  2. //
  3. // File: packetreceiver.h
  4. //
  5. // Synopsis: This file holds the declarations of the
  6. // CPacketReceiver class
  7. //
  8. //
  9. // History: 9/23/97 MKarki Created
  10. //
  11. // Copyright (C) 1997-98 Microsoft Corporation
  12. // All rights reserved.
  13. //
  14. //----------------------------------------------------------------
  15. #ifndef _PACKETRECEIVER_H_
  16. #define _PACKETRECEIVER_H_
  17. #include "mempool.h"
  18. #include "packetio.h"
  19. #include "packetradius.h"
  20. #include "prevalidator.h"
  21. #include "reportevent.h"
  22. #include "clients.h"
  23. #include "sockevt.h"
  24. #include "radcommon.h"
  25. #include "regex.h"
  26. class CHashMD5;
  27. class CHashHmacMD5;
  28. class CDictionary;
  29. class CPacketReceiver : public CPacketIo
  30. {
  31. public:
  32. //
  33. // initializes the CPacketReceiver class object
  34. //
  35. BOOL Init (
  36. /*[in]*/ CDictionary *pCDictionary,
  37. /*[in]*/ CPreValidator *pCPreValidator,
  38. /*[in]*/ CHashMD5 *pCHashMD5,
  39. /*[in]*/ CHashHmacMD5 *pCHashHmacMD5,
  40. /*[in]*/ CClients *pCClients,
  41. /*[in]*/ CReportEvent *pCReportEvent
  42. );
  43. //
  44. // start processing of the new packet received
  45. //
  46. HRESULT ReceivePacket (
  47. /*[in]*/ PBYTE pInBuffer,
  48. /*[in]*/ DWORD dwSize,
  49. /*[in]*/ DWORD dwIPaddress,
  50. /*[in]*/ WORD wPort,
  51. /*[in]*/ SOCKET sock,
  52. /*[in]*/ PORTTYPE portType
  53. );
  54. //
  55. // this is the routine in which the worker thread work
  56. //
  57. VOID WorkerRoutine (
  58. /*[in]*/ DWORD dwHandle
  59. );
  60. //
  61. // initate the processing of inbound data
  62. //
  63. BOOL StartProcessing (
  64. fd_set& AuthSet,
  65. fd_set& AcctSet
  66. );
  67. //
  68. // stop processing of inbound data
  69. //
  70. BOOL StopProcessing (
  71. VOID
  72. );
  73. //
  74. // constructor
  75. //
  76. CPacketReceiver(VOID);
  77. //
  78. // destructor
  79. //
  80. virtual ~CPacketReceiver(VOID);
  81. private:
  82. BOOL StartThreadIfNeeded (
  83. /*[in]*/ DWORD dwHandle
  84. );
  85. void ProcessInvalidPacketSize(
  86. /*in*/ DWORD dwInfo,
  87. /*in*/ const void* pBuffer,
  88. /*in*/ DWORD address
  89. );
  90. BSTR pingPattern;
  91. RegularExpression regexp;
  92. CPreValidator *m_pCPreValidator;
  93. CHashMD5 *m_pCHashMD5;
  94. CHashHmacMD5 *m_pCHashHmacMD5;
  95. CDictionary *m_pCDictionary;
  96. CClients *m_pCClients;
  97. CReportEvent *m_pCReportEvent;
  98. //
  99. // memory pool for UDP in request
  100. //
  101. memory_pool <MAX_PACKET_SIZE, task_allocator> m_InBufferPool;
  102. //
  103. // socket sets
  104. //
  105. fd_set m_AuthSet;
  106. fd_set m_AcctSet;
  107. // Used for knocking threads out of select.
  108. SocketEvent m_AuthEvent;
  109. SocketEvent m_AcctEvent;
  110. };
  111. #endif // infndef _PACKETRECEIVER_H_