home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / snmp / testdll / testmib.h < prev   
C/C++ Source or Header  |  1996-08-09  |  3KB  |  127 lines

  1. /*++ BUILD Version: 0001    // Increment this if a change has global effects
  2.  
  3. Copyright (c) 1992-1996  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     testmib.h
  8.  
  9. Abstract:
  10.  
  11.     Sample SNMP Extension Agent for Windows NT.
  12.  
  13.     These files (testdll.c, testmib.c, and testmib.h) provide an example of 
  14.     how to structure an Extension Agent DLL which works in conjunction with 
  15.     the SNMP Extendible Agent for Windows NT.
  16.  
  17.     Extensive comments have been included to describe its structure and
  18.     operation.  See also "Microsoft Windows NT SNMP Programmer's Reference".
  19.  
  20. --*/
  21.  
  22. #ifndef testmib_h
  23. #define testmib_h
  24.  
  25. // Necessary includes.
  26.  
  27. #include <snmp.h>
  28.  
  29.  
  30. // MIB Specifics.
  31.  
  32. #define MIB_PREFIX_LEN            MIB_OidPrefix.idLength
  33. #define MAX_STRING_LEN            255
  34.  
  35.  
  36. // Ranges and limits for specific MIB variables.
  37.  
  38. #define MIB_TOASTER_UP            1
  39. #define MIB_TOASTER_DOWN          2
  40.  
  41. #define MIB_TOASTER_LIGHTLYWARM   1
  42. #define MIB_TOASTER_BURNT         10
  43.  
  44. #define MIB_TOASTER_WHITEBREAD    1
  45. #define MIB_TOASTER_OTHERBREAD    7
  46.  
  47.  
  48. // MIB function actions.
  49.  
  50. #define MIB_ACTION_GET         ASN_RFC1157_GETREQUEST
  51. #define MIB_ACTION_SET         ASN_RFC1157_SETREQUEST
  52. #define MIB_ACTION_GETNEXT     ASN_RFC1157_GETNEXTREQUEST
  53.  
  54.  
  55. // MIB Variable access privileges.
  56.  
  57. #define MIB_ACCESS_READ        0
  58. #define MIB_ACCESS_WRITE       1
  59. #define MIB_ACCESS_READWRITE   2
  60.  
  61.  
  62. // Macro to determine number of sub-oid's in array.
  63.  
  64. #define OID_SIZEOF( Oid )      ( sizeof Oid / sizeof(UINT) )
  65.  
  66.  
  67. // MIB variable ENTRY definition.  This structure defines the format for
  68. // each entry in the MIB.
  69.  
  70. typedef struct mib_entry
  71.            {
  72.        AsnObjectIdentifier Oid;
  73.        void *              Storage;
  74.        BYTE                Type;
  75.        UINT                Access;
  76.        UINT                (*MibFunc)( UINT, struct mib_entry *,
  77.                                        RFC1157VarBind * );
  78.        struct mib_entry *  MibNext;
  79.        } MIB_ENTRY;
  80.  
  81.  
  82. // Internal MIB structure.
  83.  
  84. extern MIB_ENTRY Mib[];
  85. extern UINT      MIB_num_variables;
  86.  
  87.  
  88. // Prefix to every variable in the MIB.
  89.  
  90. extern AsnObjectIdentifier MIB_OidPrefix;
  91.  
  92.  
  93. // Function Prototypes.
  94.  
  95. UINT ResolveVarBind(
  96.         IN OUT RFC1157VarBind *VarBind, // Variable Binding to resolve
  97.     IN UINT PduAction               // Action specified in PDU
  98.     );
  99.  
  100. UINT MIB_leaf_func(
  101.         IN UINT Action,
  102.     IN MIB_ENTRY *MibPtr,
  103.     IN RFC1157VarBind *VarBind
  104.     );
  105.  
  106. UINT MIB_control_func(
  107.         IN UINT Action,
  108.     IN MIB_ENTRY *MibPtr,
  109.     IN RFC1157VarBind *VarBind
  110.     );
  111.  
  112. UINT MIB_doneness_func(
  113.         IN UINT Action,
  114.     IN MIB_ENTRY *MibPtr,
  115.     IN RFC1157VarBind *VarBind
  116.     );
  117.  
  118. UINT MIB_toasttype_func(
  119.         IN UINT Action,
  120.     IN MIB_ENTRY *MibPtr,
  121.     IN RFC1157VarBind *VarBind
  122.     );
  123.  
  124.  
  125. #endif /* testmib_h */
  126.  
  127.