home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / snmp.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  23.5 KB  |  670 lines

  1. /*++
  2.  
  3. Copyright (C) 1992-1999 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     snmp.h
  8.  
  9. Abstract:
  10.  
  11.     Definitions for SNMP development.
  12.  
  13. --*/
  14.  
  15. #ifndef _INC_SNMP
  16. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  17. #define _INC_SNMP
  18.  
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif
  22.  
  23. ///////////////////////////////////////////////////////////////////////////////
  24. //                                                                           //
  25. // Additional Header Files                                                   //
  26. //                                                                           //
  27. ///////////////////////////////////////////////////////////////////////////////
  28.  
  29. #include <windows.h>
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. ///////////////////////////////////////////////////////////////////////////////
  36. //                                                                           //
  37. // SNMP Type Definitions                                                     //
  38. //                                                                           //
  39. ///////////////////////////////////////////////////////////////////////////////
  40.  
  41. #include <pshpack4.h>
  42.  
  43. typedef struct {
  44.     BYTE * stream;
  45.     UINT   length;
  46.     BOOL   dynamic;
  47. } AsnOctetString;
  48.  
  49. typedef struct {
  50.     UINT   idLength;
  51.     UINT * ids;
  52. } AsnObjectIdentifier;
  53.  
  54. typedef LONG                    AsnInteger32;
  55. typedef ULONG                   AsnUnsigned32;
  56. typedef ULARGE_INTEGER          AsnCounter64;
  57. typedef AsnUnsigned32           AsnCounter32;
  58. typedef AsnUnsigned32           AsnGauge32;
  59. typedef AsnUnsigned32           AsnTimeticks;
  60. typedef AsnOctetString          AsnBits;
  61. typedef AsnOctetString          AsnSequence;
  62. typedef AsnOctetString          AsnImplicitSequence;
  63. typedef AsnOctetString          AsnIPAddress;
  64. typedef AsnOctetString          AsnNetworkAddress;
  65. typedef AsnOctetString          AsnDisplayString;
  66. typedef AsnOctetString          AsnOpaque;
  67.  
  68. typedef struct {
  69.     BYTE asnType;
  70.     union {
  71.         AsnInteger32            number;     // ASN_INTEGER
  72.                                             // ASN_INTEGER32
  73.         AsnUnsigned32           unsigned32; // ASN_UNSIGNED32
  74.         AsnCounter64            counter64;  // ASN_COUNTER64
  75.         AsnOctetString          string;     // ASN_OCTETSTRING
  76.         AsnBits                 bits;       // ASN_BITS
  77.         AsnObjectIdentifier     object;     // ASN_OBJECTIDENTIFIER
  78.         AsnSequence             sequence;   // ASN_SEQUENCE
  79.         AsnIPAddress            address;    // ASN_IPADDRESS
  80.         AsnCounter32            counter;    // ASN_COUNTER32
  81.         AsnGauge32              gauge;      // ASN_GAUGE32
  82.         AsnTimeticks            ticks;      // ASN_TIMETICKS
  83.         AsnOpaque               arbitrary;  // ASN_OPAQUE
  84.     } asnValue;
  85. } AsnAny;
  86.  
  87. typedef AsnObjectIdentifier     AsnObjectName;
  88. typedef AsnAny                  AsnObjectSyntax;
  89.  
  90. typedef struct {
  91.     AsnObjectName    name;
  92.     AsnObjectSyntax  value;
  93. } SnmpVarBind;
  94.  
  95. typedef struct {
  96.     SnmpVarBind * list;
  97.     UINT          len;
  98. } SnmpVarBindList;
  99.  
  100. #include <poppack.h>
  101.  
  102. #ifndef _INC_WINSNMP
  103.  
  104. ///////////////////////////////////////////////////////////////////////////////
  105. //                                                                           //
  106. // ASN/BER Base Types                                                        //
  107. //                                                                           //
  108. ///////////////////////////////////////////////////////////////////////////////
  109.  
  110. #define ASN_UNIVERSAL                   0x00
  111. #define ASN_APPLICATION                 0x40
  112. #define ASN_CONTEXT                     0x80
  113. #define ASN_PRIVATE                     0xC0
  114.  
  115. #define ASN_PRIMITIVE                   0x00
  116. #define ASN_CONSTRUCTOR                 0x20
  117.  
  118. ///////////////////////////////////////////////////////////////////////////////
  119. //                                                                           //
  120. // PDU Type Values                                                           //
  121. //                                                                           //
  122. ///////////////////////////////////////////////////////////////////////////////
  123.  
  124. #define SNMP_PDU_GET                (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
  125. #define SNMP_PDU_GETNEXT            (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
  126. #define SNMP_PDU_RESPONSE           (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)
  127. #define SNMP_PDU_SET                (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3)
  128. #define SNMP_PDU_V1TRAP             (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4)
  129. #define SNMP_PDU_GETBULK            (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)
  130. #define SNMP_PDU_INFORM             (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)
  131. #define SNMP_PDU_TRAP               (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)
  132.  
  133. #endif // _INC_WINSNMP
  134.  
  135. ///////////////////////////////////////////////////////////////////////////////
  136. //                                                                           //
  137. // SNMP Simple Syntax Values                                                 //
  138. //                                                                           //
  139. ///////////////////////////////////////////////////////////////////////////////
  140.  
  141. #define ASN_INTEGER                 (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x02)
  142. #define ASN_BITS                    (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
  143. #define ASN_OCTETSTRING             (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x04)
  144. #define ASN_NULL                    (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x05)
  145. #define ASN_OBJECTIDENTIFIER        (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x06)
  146. #define ASN_INTEGER32               ASN_INTEGER
  147.  
  148. ///////////////////////////////////////////////////////////////////////////////
  149. //                                                                           //
  150. // SNMP Constructor Syntax Values                                            //
  151. //                                                                           //
  152. ///////////////////////////////////////////////////////////////////////////////
  153.  
  154. #define ASN_SEQUENCE                (ASN_UNIVERSAL | ASN_CONSTRUCTOR | 0x10)
  155. #define ASN_SEQUENCEOF              ASN_SEQUENCE
  156.  
  157. ///////////////////////////////////////////////////////////////////////////////
  158. //                                                                           //
  159. // SNMP Application Syntax Values                                            //
  160. //                                                                           //
  161. ///////////////////////////////////////////////////////////////////////////////
  162.  
  163. #define ASN_IPADDRESS               (ASN_APPLICATION | ASN_PRIMITIVE | 0x00)
  164. #define ASN_COUNTER32               (ASN_APPLICATION | ASN_PRIMITIVE | 0x01)
  165. #define ASN_GAUGE32                 (ASN_APPLICATION | ASN_PRIMITIVE | 0x02)
  166. #define ASN_TIMETICKS               (ASN_APPLICATION | ASN_PRIMITIVE | 0x03)
  167. #define ASN_OPAQUE                  (ASN_APPLICATION | ASN_PRIMITIVE | 0x04)
  168. #define ASN_COUNTER64               (ASN_APPLICATION | ASN_PRIMITIVE | 0x06)
  169. #define ASN_UNSIGNED32              (ASN_APPLICATION | ASN_PRIMITIVE | 0x07)
  170.  
  171. ///////////////////////////////////////////////////////////////////////////////
  172. //                                                                           //
  173. // SNMP Exception Conditions                                                 //
  174. //                                                                           //
  175. ///////////////////////////////////////////////////////////////////////////////
  176.  
  177. #define SNMP_EXCEPTION_NOSUCHOBJECT     (ASN_CONTEXT | ASN_PRIMITIVE | 0x00)
  178. #define SNMP_EXCEPTION_NOSUCHINSTANCE   (ASN_CONTEXT | ASN_PRIMITIVE | 0x01)
  179. #define SNMP_EXCEPTION_ENDOFMIBVIEW     (ASN_CONTEXT | ASN_PRIMITIVE | 0x02)
  180.  
  181. ///////////////////////////////////////////////////////////////////////////////
  182. //                                                                           //
  183. // SNMP Request Types (used in SnmpExtensionQueryEx)                         //
  184. //                                                                           //
  185. ///////////////////////////////////////////////////////////////////////////////
  186.  
  187. #define SNMP_EXTENSION_GET          SNMP_PDU_GET
  188. #define SNMP_EXTENSION_GET_NEXT     SNMP_PDU_GETNEXT
  189. #define SNMP_EXTENSION_GET_BULK     SNMP_PDU_GETBULK
  190. #define SNMP_EXTENSION_SET_TEST     (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x0)
  191. #define SNMP_EXTENSION_SET_COMMIT   SNMP_PDU_SET
  192. #define SNMP_EXTENSION_SET_UNDO     (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x1)
  193. #define SNMP_EXTENSION_SET_CLEANUP  (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x2)
  194.  
  195. ///////////////////////////////////////////////////////////////////////////////
  196. //                                                                           //
  197. // SNMP Error Codes                                                          //
  198. //                                                                           //
  199. ///////////////////////////////////////////////////////////////////////////////
  200.  
  201. #define SNMP_ERRORSTATUS_NOERROR                0
  202. #define SNMP_ERRORSTATUS_TOOBIG                 1
  203. #define SNMP_ERRORSTATUS_NOSUCHNAME             2
  204. #define SNMP_ERRORSTATUS_BADVALUE               3
  205. #define SNMP_ERRORSTATUS_READONLY               4
  206. #define SNMP_ERRORSTATUS_GENERR                 5
  207. #define SNMP_ERRORSTATUS_NOACCESS               6
  208. #define SNMP_ERRORSTATUS_WRONGTYPE              7
  209. #define SNMP_ERRORSTATUS_WRONGLENGTH            8
  210. #define SNMP_ERRORSTATUS_WRONGENCODING          9
  211. #define SNMP_ERRORSTATUS_WRONGVALUE             10
  212. #define SNMP_ERRORSTATUS_NOCREATION             11
  213. #define SNMP_ERRORSTATUS_INCONSISTENTVALUE      12
  214. #define SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE    13
  215. #define SNMP_ERRORSTATUS_COMMITFAILED           14
  216. #define SNMP_ERRORSTATUS_UNDOFAILED             15
  217. #define SNMP_ERRORSTATUS_AUTHORIZATIONERROR     16
  218. #define SNMP_ERRORSTATUS_NOTWRITABLE            17
  219. #define SNMP_ERRORSTATUS_INCONSISTENTNAME       18
  220.  
  221. ///////////////////////////////////////////////////////////////////////////////
  222. //                                                                           //
  223. // SNMPv1 Trap Types                                                         //
  224. //                                                                           //
  225. ///////////////////////////////////////////////////////////////////////////////
  226.  
  227. #define SNMP_GENERICTRAP_COLDSTART              0
  228. #define SNMP_GENERICTRAP_WARMSTART              1
  229. #define SNMP_GENERICTRAP_LINKDOWN               2
  230. #define SNMP_GENERICTRAP_LINKUP                 3
  231. #define SNMP_GENERICTRAP_AUTHFAILURE            4
  232. #define SNMP_GENERICTRAP_EGPNEIGHLOSS           5
  233. #define SNMP_GENERICTRAP_ENTERSPECIFIC          6
  234.  
  235. ///////////////////////////////////////////////////////////////////////////////
  236. //                                                                           //
  237. // SNMP Access Types                                                         //
  238. //                                                                           //
  239. ///////////////////////////////////////////////////////////////////////////////
  240.  
  241. #define SNMP_ACCESS_NONE                        0
  242. #define SNMP_ACCESS_NOTIFY                      1
  243. #define SNMP_ACCESS_READ_ONLY                   2
  244. #define SNMP_ACCESS_READ_WRITE                  3
  245. #define SNMP_ACCESS_READ_CREATE                 4
  246.  
  247. ///////////////////////////////////////////////////////////////////////////////
  248. //                                                                           //
  249. // SNMP API Return Code Definitions                                          //
  250. //                                                                           //
  251. ///////////////////////////////////////////////////////////////////////////////
  252.  
  253. #define SNMPAPI                                 INT
  254. #define SNMP_FUNC_TYPE                          WINAPI
  255.  
  256. #define SNMPAPI_NOERROR                         TRUE
  257. #define SNMPAPI_ERROR                           FALSE
  258.  
  259. ///////////////////////////////////////////////////////////////////////////////
  260. //                                                                           //
  261. // SNMP Extension API Prototypes                                             //
  262. //                                                                           //
  263. ///////////////////////////////////////////////////////////////////////////////
  264.  
  265. BOOL
  266. SNMP_FUNC_TYPE
  267. SnmpExtensionInit(
  268.     DWORD                 dwUptimeReference,
  269.     HANDLE *              phSubagentTrapEvent,
  270.     AsnObjectIdentifier * pFirstSupportedRegion
  271.     );
  272.  
  273. BOOL
  274. SNMP_FUNC_TYPE
  275. SnmpExtensionInitEx(
  276.     AsnObjectIdentifier * pNextSupportedRegion
  277.     );
  278.  
  279. BOOL
  280. SNMP_FUNC_TYPE
  281. SnmpExtensionMonitor(
  282.     LPVOID            pAgentMgmtData
  283.     );
  284.  
  285. BOOL
  286. SNMP_FUNC_TYPE
  287. SnmpExtensionQuery(
  288.     BYTE              bPduType,
  289.     SnmpVarBindList * pVarBindList,
  290.     AsnInteger32 *    pErrorStatus,
  291.     AsnInteger32 *    pErrorIndex
  292.     );
  293.  
  294. BOOL
  295. SNMP_FUNC_TYPE
  296. SnmpExtensionQueryEx(
  297.     UINT              nRequestType,
  298.     UINT              nTransactionId,
  299.     SnmpVarBindList * pVarBindList,
  300.     AsnOctetString *  pContextInfo,
  301.     AsnInteger32 *    pErrorStatus,
  302.     AsnInteger32 *    pErrorIndex
  303.     );
  304.  
  305. BOOL
  306. SNMP_FUNC_TYPE
  307. SnmpExtensionTrap(
  308.     AsnObjectIdentifier * pEnterpriseOid,
  309.     AsnInteger32 *        pGenericTrapId,
  310.     AsnInteger32 *        pSpecificTrapId,
  311.     AsnTimeticks *        pTimeStamp,
  312.     SnmpVarBindList *     pVarBindList
  313.     );
  314.  
  315. VOID
  316. SNMP_FUNC_TYPE
  317. SnmpExtensionClose(
  318.     );
  319.  
  320. ///////////////////////////////////////////////////////////////////////////////
  321. //                                                                           //
  322. // SNMP Extension API Type Definitions                                       //
  323. //                                                                           //
  324. ///////////////////////////////////////////////////////////////////////////////
  325.  
  326. typedef BOOL (SNMP_FUNC_TYPE * PFNSNMPEXTENSIONINIT)(
  327.     DWORD                 dwUpTimeReference,
  328.     HANDLE *              phSubagentTrapEvent,
  329.     AsnObjectIdentifier * pFirstSupportedRegion
  330.     );
  331.  
  332. typedef BOOL (SNMP_FUNC_TYPE * PFNSNMPEXTENSIONINITEX)(
  333.     AsnObjectIdentifier * pNextSupportedRegion
  334.     );
  335.  
  336. typedef BOOL (SNMP_FUNC_TYPE * PFNSNMPEXTENSIONMONITOR)(
  337.     LPVOID            pAgentMgmtData
  338.     );
  339.  
  340. typedef BOOL (SNMP_FUNC_TYPE * PFNSNMPEXTENSIONQUERY)(
  341.     BYTE              bPduType,
  342.     SnmpVarBindList * pVarBindList,
  343.     AsnInteger32 *    pErrorStatus,
  344.     AsnInteger32 *    pErrorIndex
  345.     );
  346.  
  347. typedef BOOL (SNMP_FUNC_TYPE * PFNSNMPEXTENSIONQUERYEX)(
  348.     UINT              nRequestType,
  349.     UINT              nTransactionId,
  350.     SnmpVarBindList * pVarBindList,
  351.     AsnOctetString *  pContextInfo,
  352.     AsnInteger32 *    pErrorStatus,
  353.     AsnInteger32 *    pErrorIndex
  354.     );
  355.  
  356. typedef BOOL (SNMP_FUNC_TYPE * PFNSNMPEXTENSIONTRAP)(
  357.     AsnObjectIdentifier * pEnterpriseOid,
  358.     AsnInteger32 *        pGenericTrapId,
  359.     AsnInteger32 *        pSpecificTrapId,
  360.     AsnTimeticks *        pTimeStamp,
  361.     SnmpVarBindList *     pVarBindList
  362.     );
  363.  
  364. typedef VOID (SNMP_FUNC_TYPE * PFNSNMPEXTENSIONCLOSE)(
  365.     );
  366.  
  367. ///////////////////////////////////////////////////////////////////////////////
  368. //                                                                           //
  369. // SNMP API Prototypes                                                       //
  370. //                                                                           //
  371. ///////////////////////////////////////////////////////////////////////////////
  372.  
  373. SNMPAPI
  374. SNMP_FUNC_TYPE
  375. SnmpUtilOidCpy(
  376.     AsnObjectIdentifier * pOidDst,
  377.     AsnObjectIdentifier * pOidSrc
  378.     );
  379.  
  380. SNMPAPI
  381. SNMP_FUNC_TYPE
  382. SnmpUtilOidAppend(
  383.     AsnObjectIdentifier * pOidDst,
  384.     AsnObjectIdentifier * pOidSrc
  385.     );
  386.  
  387. SNMPAPI
  388. SNMP_FUNC_TYPE
  389. SnmpUtilOidNCmp(
  390.     AsnObjectIdentifier * pOid1,
  391.     AsnObjectIdentifier * pOid2,
  392.     UINT                  nSubIds
  393.     );
  394.  
  395. SNMPAPI
  396. SNMP_FUNC_TYPE
  397. SnmpUtilOidCmp(
  398.     AsnObjectIdentifier * pOid1,
  399.     AsnObjectIdentifier * pOid2
  400.     );
  401.  
  402. VOID
  403. SNMP_FUNC_TYPE
  404. SnmpUtilOidFree(
  405.     AsnObjectIdentifier * pOid
  406.     );
  407.  
  408. SNMPAPI
  409. SNMP_FUNC_TYPE
  410. SnmpUtilOctetsCmp(
  411.     AsnOctetString * pOctets1,
  412.     AsnOctetString * pOctets2
  413.     );
  414.  
  415. SNMPAPI
  416. SNMP_FUNC_TYPE
  417. SnmpUtilOctetsNCmp(
  418.     AsnOctetString * pOctets1,
  419.     AsnOctetString * pOctets2,
  420.     UINT             nChars
  421.     );
  422.  
  423. SNMPAPI
  424. SNMP_FUNC_TYPE
  425. SnmpUtilOctetsCpy(
  426.     AsnOctetString * pOctetsDst,
  427.     AsnOctetString * pOctetsSrc
  428.     );
  429.  
  430. VOID
  431. SNMP_FUNC_TYPE
  432. SnmpUtilOctetsFree(
  433.     AsnOctetString * pOctets
  434.     );
  435.  
  436. SNMPAPI
  437. SNMP_FUNC_TYPE
  438. SnmpUtilAsnAnyCpy(
  439.     AsnAny * pAnyDst,
  440.     AsnAny * pAnySrc
  441.     );
  442.  
  443. VOID
  444. SNMP_FUNC_TYPE
  445. SnmpUtilAsnAnyFree(
  446.     AsnAny * pAny
  447.     );
  448.  
  449. SNMPAPI
  450. SNMP_FUNC_TYPE
  451. SnmpUtilVarBindCpy(
  452.     SnmpVarBind * pVbDst,
  453.     SnmpVarBind * pVbSrc
  454.     );
  455.  
  456. VOID
  457. SNMP_FUNC_TYPE
  458. SnmpUtilVarBindFree(
  459.     SnmpVarBind * pVb
  460.     );
  461.  
  462. SNMPAPI
  463. SNMP_FUNC_TYPE
  464. SnmpUtilVarBindListCpy(
  465.     SnmpVarBindList * pVblDst,
  466.     SnmpVarBindList * pVblSrc
  467.     );
  468.  
  469. VOID
  470. SNMP_FUNC_TYPE
  471. SnmpUtilVarBindListFree(
  472.     SnmpVarBindList * pVbl
  473.     );
  474.  
  475. VOID
  476. SNMP_FUNC_TYPE
  477. SnmpUtilMemFree(
  478.     LPVOID pMem
  479.     );
  480.  
  481. LPVOID
  482. SNMP_FUNC_TYPE
  483. SnmpUtilMemAlloc(
  484.     UINT nBytes
  485.     );
  486.  
  487. LPVOID
  488. SNMP_FUNC_TYPE
  489. SnmpUtilMemReAlloc(
  490.     LPVOID pMem,
  491.     UINT   nBytes
  492.     );
  493.  
  494. LPSTR
  495. SNMP_FUNC_TYPE
  496. SnmpUtilOidToA(
  497.     IN AsnObjectIdentifier *Oid
  498.     );
  499.  
  500. LPSTR
  501. SNMP_FUNC_TYPE
  502. SnmpUtilIdsToA(
  503.     IN UINT *Ids,
  504.     IN UINT IdLength
  505.     );
  506.  
  507. VOID
  508. SNMP_FUNC_TYPE
  509. SnmpUtilPrintOid(
  510.     IN AsnObjectIdentifier *Oid
  511.     );
  512.  
  513. VOID
  514. SNMP_FUNC_TYPE
  515. SnmpUtilPrintAsnAny(
  516.     AsnAny * pAny
  517.     );
  518.  
  519. DWORD
  520. SNMP_FUNC_TYPE
  521. SnmpSvcGetUptime(
  522.     );
  523.  
  524. VOID
  525. SNMP_FUNC_TYPE
  526. SnmpSvcSetLogLevel(
  527.     INT nLogLevel
  528.     );
  529.  
  530. VOID
  531. SNMP_FUNC_TYPE
  532. SnmpSvcSetLogType(
  533.     INT nLogType
  534.     );
  535.  
  536. ///////////////////////////////////////////////////////////////////////////////
  537. //                                                                           //
  538. // SNMP Debugging Definitions                                                //
  539. //                                                                           //
  540. ///////////////////////////////////////////////////////////////////////////////
  541.  
  542. #define SNMP_LOG_SILENT                 0x0
  543. #define SNMP_LOG_FATAL                  0x1
  544. #define SNMP_LOG_ERROR                  0x2
  545. #define SNMP_LOG_WARNING                0x3
  546. #define SNMP_LOG_TRACE                  0x4
  547. #define SNMP_LOG_VERBOSE                0x5
  548.  
  549. #define SNMP_OUTPUT_TO_CONSOLE          0x1
  550. #define SNMP_OUTPUT_TO_LOGFILE          0x2
  551. #define SNMP_OUTPUT_TO_EVENTLOG         0x4  // no longer supported
  552. #define SNMP_OUTPUT_TO_DEBUGGER         0x8
  553.  
  554. ///////////////////////////////////////////////////////////////////////////////
  555. //                                                                           //
  556. // SNMP Debugging Prototypes                                                 //
  557. //                                                                           //
  558. ///////////////////////////////////////////////////////////////////////////////
  559.  
  560. VOID
  561. SNMP_FUNC_TYPE
  562. SnmpUtilDbgPrint(
  563.     IN INT nLogLevel,   // see log levels above...
  564.     IN LPSTR szFormat,
  565.     IN ...
  566.     );
  567.  
  568. #if DBG
  569. #define SNMPDBG(_x_)                    SnmpUtilDbgPrint _x_
  570. #else
  571. #define SNMPDBG(_x_)
  572. #endif
  573.  
  574. ///////////////////////////////////////////////////////////////////////////////
  575. //                                                                           //
  576. // Miscellaneous definitions                                                 //
  577. //                                                                           //
  578. ///////////////////////////////////////////////////////////////////////////////
  579.  
  580. #define DEFINE_SIZEOF(Array)        (sizeof(Array)/sizeof((Array)[0]))
  581. #define DEFINE_OID(SubIdArray)      {DEFINE_SIZEOF(SubIdArray),(SubIdArray)}
  582. #define DEFINE_NULLOID()            {0,NULL}
  583. #define DEFINE_NULLOCTETS()         {NULL,0,FALSE}
  584.  
  585. #define DEFAULT_SNMP_PORT_UDP       161
  586. #define DEFAULT_SNMP_PORT_IPX       36879
  587. #define DEFAULT_SNMPTRAP_PORT_UDP   162
  588. #define DEFAULT_SNMPTRAP_PORT_IPX   36880
  589.  
  590. #define SNMP_MAX_OID_LEN            128
  591.  
  592. ///////////////////////////////////////////////////////////////////////////////
  593. //                                                                           //
  594. // API Error Code Definitions                                                //
  595. //                                                                           //
  596. ///////////////////////////////////////////////////////////////////////////////
  597.  
  598. #define SNMP_MEM_ALLOC_ERROR            1
  599. #define SNMP_BERAPI_INVALID_LENGTH      10
  600. #define SNMP_BERAPI_INVALID_TAG         11
  601. #define SNMP_BERAPI_OVERFLOW            12
  602. #define SNMP_BERAPI_SHORT_BUFFER        13
  603. #define SNMP_BERAPI_INVALID_OBJELEM     14
  604. #define SNMP_PDUAPI_UNRECOGNIZED_PDU    20
  605. #define SNMP_PDUAPI_INVALID_ES          21
  606. #define SNMP_PDUAPI_INVALID_GT          22
  607. #define SNMP_AUTHAPI_INVALID_VERSION    30
  608. #define SNMP_AUTHAPI_INVALID_MSG_TYPE   31
  609. #define SNMP_AUTHAPI_TRIV_AUTH_FAILED   32
  610.  
  611. ///////////////////////////////////////////////////////////////////////////////
  612. //                                                                           //
  613. // Support for old definitions (support disabled via SNMPSTRICT)             //
  614. //                                                                           //
  615. ///////////////////////////////////////////////////////////////////////////////
  616.  
  617. #ifndef SNMPSTRICT
  618.  
  619. #define SNMP_oidcpy                     SnmpUtilOidCpy
  620. #define SNMP_oidappend                  SnmpUtilOidAppend
  621. #define SNMP_oidncmp                    SnmpUtilOidNCmp
  622. #define SNMP_oidcmp                     SnmpUtilOidCmp
  623. #define SNMP_oidfree                    SnmpUtilOidFree
  624.  
  625. #define SNMP_CopyVarBindList            SnmpUtilVarBindListCpy
  626. #define SNMP_FreeVarBindList            SnmpUtilVarBindListFree
  627. #define SNMP_CopyVarBind                SnmpUtilVarBindCpy
  628. #define SNMP_FreeVarBind                SnmpUtilVarBindFree
  629.  
  630. #define SNMP_printany                   SnmpUtilPrintAsnAny
  631.  
  632. #define SNMP_free                       SnmpUtilMemFree
  633. #define SNMP_malloc                     SnmpUtilMemAlloc
  634. #define SNMP_realloc                    SnmpUtilMemReAlloc
  635.  
  636. #define SNMP_DBG_free                   SnmpUtilMemFree
  637. #define SNMP_DBG_malloc                 SnmpUtilMemAlloc
  638. #define SNMP_DBG_realloc                SnmpUtilMemReAlloc
  639.  
  640. #define ASN_RFC1155_IPADDRESS           ASN_IPADDRESS
  641. #define ASN_RFC1155_COUNTER             ASN_COUNTER32
  642. #define ASN_RFC1155_GAUGE               ASN_GAUGE32
  643. #define ASN_RFC1155_TIMETICKS           ASN_TIMETICKS
  644. #define ASN_RFC1155_OPAQUE              ASN_OPAQUE
  645. #define ASN_RFC1213_DISPSTRING          ASN_OCTETSTRING
  646.  
  647. #define ASN_RFC1157_GETREQUEST          SNMP_PDU_GET
  648. #define ASN_RFC1157_GETNEXTREQUEST      SNMP_PDU_GETNEXT
  649. #define ASN_RFC1157_GETRESPONSE         SNMP_PDU_RESPONSE
  650. #define ASN_RFC1157_SETREQUEST          SNMP_PDU_SET
  651. #define ASN_RFC1157_TRAP                SNMP_PDU_V1TRAP
  652.  
  653. #define ASN_CONTEXTSPECIFIC             ASN_CONTEXT
  654. #define ASN_PRIMATIVE                   ASN_PRIMITIVE
  655.  
  656. #define RFC1157VarBindList              SnmpVarBindList
  657. #define RFC1157VarBind                  SnmpVarBind
  658. #define AsnInteger                      AsnInteger32
  659. #define AsnCounter                      AsnCounter32
  660. #define AsnGauge                        AsnGauge32
  661.  
  662. #endif // SNMPSTRICT
  663.  
  664. #ifdef __cplusplus
  665. }
  666. #endif
  667.  
  668. #pragma option pop /*P_O_Pop*/
  669. #endif // _INC_SNMP
  670.