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.

215 lines
4.7 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  2. /*--------------------------------------------------
  3. Filename: transp.hpp (transport.hpp)
  4. Author: B.Rajeev
  5. Purpose: Provides declarations for the SnmpTransport class
  6. and its derivatives
  7. --------------------------------------------------*/
  8. #ifndef __TRANSPORT__
  9. #define __TRANSPORT__
  10. #include "forward.h"
  11. #include "address.h"
  12. #pragma warning (disable:4355)
  13. class DllImportExport SnmpTransport
  14. {
  15. private:
  16. SnmpTransportAddress *transport_address;
  17. // the "=" operator and the copy constructor have been
  18. // made private to prevent any copies from being made
  19. SnmpTransport &operator=(IN const SnmpTransport &transport)
  20. {
  21. return *this;
  22. }
  23. SnmpTransport(IN const SnmpTransport &snmp_transport) {}
  24. protected:
  25. SnmpTransport(IN SnmpSession &session,
  26. IN const SnmpTransportAddress &transportAddress);
  27. virtual void TransportFlowControlOn() = 0;
  28. virtual void TransportFlowControlOff() = 0;
  29. public:
  30. virtual ~SnmpTransport();
  31. virtual void TransportSendFrame(
  32. OUT TransportFrameId &transport_frame_id,
  33. IN SnmpPdu &snmpPdu
  34. ) = 0 ;
  35. virtual void TransportReceiveFrame (
  36. IN SnmpPdu &snmpPdu,
  37. IN SnmpErrorReport &errorReport
  38. ) = 0 ;
  39. virtual void TransportSentFrame (
  40. IN TransportFrameId transport_frame_id,
  41. IN SnmpErrorReport &errorReport
  42. ) = 0;
  43. virtual SnmpTransportAddress &GetTransportAddress() ;
  44. virtual void * operator()(void) const = 0;
  45. };
  46. // forward declaration
  47. class TransportSession;
  48. class DllImportExport SnmpImpTransport: public SnmpTransport
  49. {
  50. friend TransportWindow;
  51. private:
  52. BOOL transport_created;
  53. SnmpSession &session;
  54. TransportWindow *transport;
  55. // References to the following instances are used instead of
  56. // embedded instances themselves. This is done to avoid including
  57. // the header files providing their declaration
  58. TransportSentStateStore store;
  59. static TransportFrameId next_transport_frame_id;
  60. protected:
  61. BOOL is_valid;
  62. virtual void HandleSentFrame(IN const TransportFrameId transport_frame_id);
  63. void TransportFlowControlOn() {}
  64. void TransportFlowControlOff() {}
  65. public:
  66. SnmpImpTransport(IN SnmpSession &session,
  67. IN const SnmpTransportAddress &address);
  68. ~SnmpImpTransport();
  69. void TransportSendFrame (
  70. OUT TransportFrameId &transport_frame_id,
  71. IN SnmpPdu &snmpPdu
  72. ) ;
  73. void TransportReceiveFrame (
  74. IN SnmpPdu &snmpPdu ,
  75. IN SnmpErrorReport &errorReport
  76. ) ;
  77. void TransportSentFrame (
  78. IN TransportFrameId transport_frame_id,
  79. IN SnmpErrorReport &errorReport
  80. );
  81. void * operator()(void) const
  82. {
  83. return ( is_valid?(void *)this:NULL );
  84. }
  85. };
  86. class DllImportExport SnmpUdpIpTransport: public SnmpImpTransport
  87. {
  88. private:
  89. protected:
  90. public:
  91. SnmpUdpIpTransport(IN SnmpSession &session,
  92. IN const SnmpTransportIpAddress &ipAddress);
  93. };
  94. class DllImportExport SnmpUdpIpImp : public SnmpTransportIpAddress ,
  95. public SnmpUdpIpTransport
  96. {
  97. public:
  98. SnmpUdpIpImp(IN SnmpSession &session,
  99. IN const char *address,
  100. IN const ULONG addressResolution = SNMP_ADDRESS_RESOLVE_VALUE )
  101. : SnmpTransportIpAddress(address,addressResolution),
  102. SnmpUdpIpTransport(session, *this)
  103. {}
  104. SnmpUdpIpImp(IN SnmpSession &session,
  105. IN const UCHAR *address)
  106. : SnmpTransportIpAddress(address, SNMP_IP_ADDR_LEN),
  107. SnmpUdpIpTransport(session, *this)
  108. {}
  109. SnmpUdpIpImp(IN SnmpSession &session,
  110. IN const SnmpTransportIpAddress &address)
  111. : SnmpTransportIpAddress(address),
  112. SnmpUdpIpTransport(session, *this)
  113. {}
  114. void * operator()(void) const;
  115. ~SnmpUdpIpImp() {}
  116. } ;
  117. class DllImportExport SnmpIpxTransport: public SnmpImpTransport
  118. {
  119. private:
  120. protected:
  121. public:
  122. SnmpIpxTransport(IN SnmpSession &session,
  123. IN const SnmpTransportIpxAddress &ipxAddress);
  124. };
  125. class DllImportExport SnmpIpxImp : public SnmpTransportIpxAddress ,
  126. public SnmpIpxTransport
  127. {
  128. public:
  129. SnmpIpxImp(IN SnmpSession &session,
  130. IN const char *address
  131. )
  132. : SnmpTransportIpxAddress(address),
  133. SnmpIpxTransport(session, *this)
  134. {}
  135. SnmpIpxImp(IN SnmpSession &session,
  136. IN const UCHAR *address)
  137. : SnmpTransportIpxAddress(address, SNMP_IPX_ADDR_LEN),
  138. SnmpIpxTransport(session, *this)
  139. {}
  140. SnmpIpxImp(IN SnmpSession &session,
  141. IN const SnmpTransportIpxAddress &address)
  142. : SnmpTransportIpxAddress(address),
  143. SnmpIpxTransport(session, *this)
  144. {}
  145. void * operator()(void) const;
  146. ~SnmpIpxImp() {}
  147. } ;
  148. #pragma warning (default:4355)
  149. #endif // __TRANSPORT__