home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / geninc32.pak / MGMTAPI.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  3KB  |  116 lines

  1. /*++
  2.  
  3. Module Name:
  4.  
  5.     mgmtapi.h
  6.  
  7. Abstract:
  8.  
  9.     Definitions for SNMP Management API Development.
  10.  
  11. --*/
  12.  
  13. /*
  14.  *      C/C++ Run Time Library - Version 6.5
  15.  *
  16.  *      Copyright (c) 1994 by Borland International
  17.  *      All Rights Reserved.
  18.  *
  19.  */
  20.  
  21. #ifndef mgmtapi_h
  22. #define mgmtapi_h
  23. #define __MGMTAPI_H
  24.  
  25. // Necessary includes.
  26.  
  27. #include <winsock.h>
  28. #include <snmp.h>
  29.  
  30.  
  31. // Errors... (unique from those in snmp.h)
  32.  
  33. #define SNMP_MGMTAPI_TIMEOUT         40
  34. #define SNMP_MGMTAPI_SELECT_FDERRORS 41
  35. #define SNMP_MGMTAPI_TRAP_ERRORS     42
  36. #define SNMP_MGMTAPI_TRAP_DUPINIT    43
  37. #define SNMP_MGMTAPI_NOTRAPS         44
  38. #define SNMP_MGMTAPI_AGAIN           45
  39.  
  40. #define SNMP_MAX_OID_LEN     0x7f00 // Max number of elements in obj id
  41.  
  42. // Types...
  43.  
  44.  
  45. typedef SOCKET SockDesc;
  46.  
  47. #define RECVBUFSIZE 4096
  48.  
  49. typedef struct _SNMP_MGR_SESSION {
  50.     SockDesc        fd;                   // socket
  51.     struct sockaddr destAddr;             // destination agent address
  52.     LPSTR           community;            // community name
  53.     INT             timeout;              // comm time-out (milliseconds)
  54.     INT             retries;              // comm retry count
  55.     AsnInteger      requestId;            // RFC1157 requestId
  56.     char            recvBuf[RECVBUFSIZE]; // receive buffer
  57. } SNMP_MGR_SESSION, *LPSNMP_MGR_SESSION;
  58.  
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62.  
  63.  
  64. // Prototypes...
  65.  
  66. extern LPSNMP_MGR_SESSION
  67. SNMP_FUNC_TYPE SnmpMgrOpen(
  68.     IN LPSTR lpAgentAddress,    // Name/address of target SNMP agent
  69.     IN LPSTR lpAgentCommunity,  // Community for target SNMP agent
  70.     IN INT   nTimeOut,          // Communication time-out in milliseconds
  71.     IN INT   nRetries);         // Communication time-out/retry count
  72.  
  73. extern BOOL
  74. SNMP_FUNC_TYPE SnmpMgrClose(
  75.     IN LPSNMP_MGR_SESSION session);   // SNMP session pointer
  76.  
  77. extern SNMPAPI
  78. SNMP_FUNC_TYPE SnmpMgrRequest(
  79.     IN     LPSNMP_MGR_SESSION session,           // SNMP session pointer
  80.     IN     BYTE               requestType,       // Get, GetNext, or Set
  81.     IN OUT RFC1157VarBindList *variableBindings, // Varible bindings
  82.     OUT    AsnInteger         *errorStatus,      // Result error status
  83.     OUT    AsnInteger         *errorIndex);      // Result error index
  84.  
  85.  
  86. extern BOOL
  87. SNMP_FUNC_TYPE SnmpMgrStrToOid(
  88.     IN  LPSTR               string,   // OID string to be converted
  89.     OUT AsnObjectIdentifier *oid);    // OID internal representation
  90.  
  91. extern BOOL
  92. SNMP_FUNC_TYPE SnmpMgrOidToStr(
  93.     IN  AsnObjectIdentifier *oid,     // OID internal rep to be converted
  94.     OUT LPSTR               *string); // OID string representation
  95.  
  96.  
  97. extern BOOL
  98. SNMP_FUNC_TYPE SnmpMgrTrapListen(
  99.     OUT HANDLE *phTrapAvailable); // Event handle indicating trap(s) available
  100.  
  101. extern BOOL
  102. SNMP_FUNC_TYPE SnmpMgrGetTrap(
  103.     OUT AsnObjectIdentifier *enterprise,       // Generating enterprise
  104.     OUT AsnNetworkAddress   *IPAddress,        // Generating IP address
  105.     OUT AsnInteger          *genericTrap,      // Generic trap type
  106.     OUT AsnInteger          *specificTrap,     // Enterprise specific type
  107.     OUT AsnTimeticks        *timeStamp,        // Time stamp
  108.     OUT RFC1157VarBindList  *variableBindings);// Variable bindings
  109.  
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113.  
  114. #endif /* mgmtapi_h */
  115.  
  116.