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.

148 lines
6.5 KiB

  1. /*****************************************************************************
  2. *
  3. * $Workfile: TcpMib.h $
  4. *
  5. * Copyright (C) 1997 Hewlett-Packard Company.
  6. * Copyright (C) 1997 Microsoft Corporation.
  7. * All rights reserved.
  8. *
  9. * 11311 Chinden Blvd.
  10. * Boise, Idaho 83714
  11. *
  12. *****************************************************************************/
  13. #ifndef INC_TCPMIB_H
  14. #define INC_TCPMIB_H
  15. #include "mibABC.h"
  16. #include "winspool.h"
  17. #define ERROR_SNMPAPI_ERROR 15000
  18. #ifndef DllExport
  19. #define DllExport __declspec(dllexport)
  20. #endif
  21. class CTcpMibABC;
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. // return the pointer to the interface
  26. CTcpMibABC* GetTcpMibPtr( void );
  27. ///////////////////////////////////////////////////////////////////////////////
  28. // Ping return codes:
  29. // NO_ERROR if ping is successfull
  30. // DEVICE_NOT_FOUND if device is not found
  31. DllExport DWORD Ping( LPCSTR pHost );
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. ///////////////////////////////////////////////////////////////////////////////
  36. // Global definitions/declerations/macros
  37. // externs
  38. extern int g_cntGlobalAlloc;
  39. extern int g_csGlobalCount;
  40. // macros to manupulate the RFC1157 variable bindings
  41. #define RFC1157_VARBINDLIST_LEN(varBindList) ( varBindList.len ) // returns the length of the varBind list
  42. #define PRFC1157_VARBINDLIST_LEN(pVarBindList) ( pVarBindList->len ) // returns the length of the varBind list
  43. #define IS_ASN_INTEGER(varBindList, i) ( ( varBindList.list[i].value.asnType == ASN_INTEGER ) ? TRUE : FALSE )
  44. #define IS_ASN_OBJECTIDENTIFIER(varBindList, i) ( ( varBindList.list[i].value.asnType == ASN_OBJECTIDENTIFIER ) ? TRUE : FALSE )
  45. #define IS_ASN_OCTETSTRING(varBindList, i) ( ( varBindList.list[i].value.asnType == ASN_OCTETSTRING ) ? TRUE : FALSE )
  46. #define GET_ASN_NUMBER(varBindList, i) ( varBindList.list[i].value.asnValue.number )
  47. #define GET_ASN_STRING_LEN(varBindList, i) ( (varBindList).list[i].value.asnValue.string.length )
  48. #define GET_ASN_OBJECT(varBindList, i) ( varBindList.list[i].value.asnValue.object )
  49. #define GET_ASN_OCTETSTRING(pDest, count, varBindList, i) ( GetAsnOctetString(pDest, count, &varBindList, i) )
  50. #define GET_ASN_OCTETSTRING_CHAR( varBindList, i, x) ( varBindList.list[i].value.asnValue.string.stream[x] )
  51. #define GET_ASN_OID_NAME(varBindList, i) ( varBindList.list[i].name )
  52. #define PGET_ASN_OID_NAME(pVarBindList, i) ( pVarBindList->list[i].name )
  53. #define PGET_ASN_TYPE(pVarBindList, i) ( pVarBindList->list[i].value.asnType )
  54. // export the interface for CRawTcpInterface class
  55. class DllExport CTcpMib : public CTcpMibABC
  56. #if defined _DEBUG || defined DEBUG
  57. // , public CMemoryDebug
  58. #endif
  59. {
  60. public:
  61. CTcpMib();
  62. ~CTcpMib();
  63. BOOL SupportsPrinterMib(LPCSTR pHost,
  64. LPCSTR pCommunity,
  65. DWORD dwDevIndex,
  66. PBOOL pbSupported);
  67. DWORD GetDeviceDescription(LPCSTR pHost,
  68. LPCSTR pCommunity,
  69. DWORD dwDevIndex,
  70. LPTSTR pszPortDescription,
  71. DWORD dwDescLen);
  72. DWORD GetDeviceStatus ( LPCSTR pHost,
  73. LPCSTR pCommunity,
  74. DWORD dwDevIndex);
  75. DWORD GetJobStatus ( LPCSTR pHost,
  76. LPCSTR pCommunity,
  77. DWORD dwDevIndex);
  78. DWORD GetDeviceHWAddress( LPCSTR pHost,
  79. LPCSTR pCommunity,
  80. DWORD dwDevIndex,
  81. DWORD dwSize, // Size in characters of the dest HWAddress buffer
  82. LPTSTR psztHWAddress);
  83. DWORD GetDeviceName ( LPCSTR pHost,
  84. LPCSTR pCommunity,
  85. DWORD dwDevIndex,
  86. DWORD dwSize, // Size in characters of the dest Description buffer
  87. LPTSTR psztDescription);
  88. DWORD SnmpGet( LPCSTR pHost,
  89. LPCSTR pCommunity,
  90. DWORD dwDevIndex,
  91. AsnObjectIdentifier *pMibObjId,
  92. RFC1157VarBindList *pVarBindList);
  93. DWORD SnmpGet( LPCSTR pHost,
  94. LPCSTR pCommunity,
  95. DWORD dwDevIndex,
  96. RFC1157VarBindList *pVarBindList);
  97. DWORD SnmpWalk( LPCSTR pHost,
  98. LPCSTR pCommunity,
  99. DWORD dwDevIndex,
  100. AsnObjectIdentifier *pMibObjId,
  101. RFC1157VarBindList *pVarBindList);
  102. DWORD SnmpWalk( LPCSTR pHost,
  103. LPCSTR pCommunity,
  104. DWORD dwDevIndex,
  105. RFC1157VarBindList *pVarBindList);
  106. DWORD SnmpGetNext( LPCSTR pHost,
  107. LPCSTR pCommunity,
  108. DWORD dwDevIndex,
  109. AsnObjectIdentifier *pMibObjId,
  110. RFC1157VarBindList *pVarBindList);
  111. DWORD SnmpGetNext( LPCSTR pHost,
  112. LPCSTR pCommunity,
  113. DWORD dwDevIndex,
  114. RFC1157VarBindList *pVarBindList);
  115. BOOL SNMPToPortStatus( const DWORD in dwStatus,
  116. PPORT_INFO_3 pPortInfo );
  117. DWORD SNMPToPrinterStatus( const DWORD in dwStatus);
  118. private: // methods
  119. void EnterCSection();
  120. void ExitCSection();
  121. private: // attributes
  122. CRITICAL_SECTION m_critSect;
  123. }; // class CTcpMib
  124. #endif // INC_DLLINTERFACE_H