home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / SNMP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  23.6 KB  |  656 lines

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