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.

81 lines
2.1 KiB

  1. /*****************************************************************************
  2. *
  3. * $Workfile: SnmpMgr.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_SNMPMGR_H
  14. #define INC_SNMPMGR_H
  15. #define DEFAULT_IP_GET_COMMUNITY_ALT "internal" // HP devices only
  16. #define MAX_JDPORTS 3 // # of JetDirect Ex ports
  17. #define MAX_COMMUNITY_LEN 32 // maximum community length
  18. #define DEFAULT_SNMP_REQUEST ASN_RFC1157_GETREQUEST // get request is the default
  19. #define DEFAULT_TIMEOUT 6000 // milliseconds
  20. #define DEFAULT_RETRIES 3
  21. typedef enum {
  22. DEV_UNKNOWN = 0,
  23. DEV_OTHER = 1,
  24. DEV_HP_JETDIRECT= 2,
  25. DEV_TEK_PRINTER = 3,
  26. DEV_LEX_PRINTER = 4,
  27. DEV_IBM_PRINTER = 5,
  28. DEV_KYO_PRINTER = 6,
  29. DEV_XER_PRINTER = 7
  30. } DeviceType;
  31. class CMemoryDebug;
  32. class CSnmpMgr
  33. #if defined _DEBUG || defined DEBUG
  34. : public CMemoryDebug
  35. #endif
  36. {
  37. public:
  38. CSnmpMgr();
  39. CSnmpMgr( const char *pHost,
  40. const char *pCommunity,
  41. DWORD dwDevIndex);
  42. CSnmpMgr( const char *pHost,
  43. const char *pCommunity,
  44. DWORD dwDevIndex,
  45. AsnObjectIdentifier *pMibObjId,
  46. RFC1157VarBindList *pVarBindList);
  47. ~CSnmpMgr();
  48. INT GetLastError(void) { return m_iLastError; };
  49. INT Get( RFC1157VarBindList *pVariableBindings);
  50. INT Walk(RFC1157VarBindList *pVariableBindings);
  51. INT WalkNext(RFC1157VarBindList *pVariableBindings);
  52. INT GetNext(RFC1157VarBindList *pVariableBindings);
  53. DWORD BldVarBindList( AsnObjectIdentifier *pMibObjId, // builds the varBindList
  54. RFC1157VarBindList *pVarBindList);
  55. private: // methods
  56. BOOL Open(); // establish a session
  57. void Close(); // close the previously established session
  58. private: // attributes
  59. LPSTR m_pCommunity;
  60. LPSTR m_pAgent;
  61. LPSNMP_MGR_SESSION m_pSession;
  62. INT m_iLastError;
  63. INT m_iTimeout;
  64. INT m_iRetries;
  65. BYTE m_bRequestType;
  66. };
  67. #endif // INC_SNMPMGR_H