home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / prgcsd.exe / SNMP_DPI.H < prev    next >
C/C++ Source or Header  |  1992-12-09  |  5KB  |  140 lines

  1. /*********************************************************************/
  2. /*                                                                   */
  3. /* SNMP-DPI - SNMP Distributed Programming Interface                 */
  4. /*                                                                   */
  5. /*   May 1991 - Version 1.0  - SNMP-DPI Version 1.0 (RFC1228)        */
  6. /*                             Created by IBM Research.              */
  7. /*   Feb 1992 - Version 1.1  - Allow enterpriseID to be passed with  */
  8. /*                             a (enterprise specific) trap          */
  9. /*                           - allow multiple variables to be passed */
  10. /*                           - Use 4 octets (INTEGER from RFC1157)   */
  11. /*                             for generic and specific type.        */
  12. /*                                                                   */
  13. /* Copyright None                                                    */
  14. /*                                                                   */
  15. /* snmp_dpi.h   -  SNMP_DPI include file                             */
  16. /*                                                                   */
  17. /*********************************************************************/
  18.  
  19. /* SNMP_DPI codes from RFC 1228 */
  20. #define SNMP_DPI_GET        1
  21. #define SNMP_DPI_GET_NEXT   2
  22. #define SNMP_DPI_SET        3
  23. #define SNMP_DPI_TRAP       4
  24. #define SNMP_DPI_RESPONSE   5
  25. #define SNMP_DPI_REGISTER   6
  26.  
  27. #define SNMP_DPI_PROTOCOL   2
  28. #define SNMP_DPI_VERSION    1
  29. #define SNMP_DPI_RELEASE    1    /* enhancements to trap processing */
  30.  
  31. /* SNMP error codes from RFC 1157 (1098, 1067) */
  32. #define SNMP_NO_ERROR       0
  33. #define SNMP_TOO_BIG        1
  34. #define SNMP_NO_SUCH_NAME   2
  35. #define SNMP_BAD_VALUE      3
  36. #define SNMP_READ_ONLY      4
  37. #define SNMP_GEN_ERR        5
  38.  
  39. /* SNMP_DPI variable types from RFC 1228 */
  40. #define SNMP_TYPE_TEXT      0       /* textual representation */
  41. #define SNMP_TYPE_NUMBER    (128|1) /* number */
  42. #define SNMP_TYPE_STRING    2       /* text string */
  43. #define SNMP_TYPE_OBJECT    3       /* object identifier */
  44. #define SNMP_TYPE_EMPTY     4       /* no value */
  45. #define SNMP_TYPE_INTERNET  (128|5) /* internet address */
  46. #define SNMP_TYPE_COUNTER   (128|6) /* counter */
  47. #define SNMP_TYPE_GAUGE     (128|7) /* gauge */
  48. #define SNMP_TYPE_TICKS     (128|8) /* time ticks (1/100ths second) */
  49. #define SNMP_TYPE_MASK      0x7f    /* mask for type */
  50.  
  51. struct dpi_get_packet {
  52.   char  *object_id;
  53. };
  54.  
  55. struct dpi_next_packet {
  56.   char  *object_id;
  57.   char  *group_id;
  58. };
  59.  
  60. struct dpi_set_packet {
  61.   char                 *object_id;
  62.   unsigned char         type;
  63.   unsigned short        value_len;
  64.   char                  *value;
  65.   struct dpi_set_packet *next;
  66. };
  67.  
  68. struct dpi_resp_packet {
  69.   unsigned char            ret_code;
  70.   struct dpi_set_packet   *ret_data;
  71. };
  72.  
  73. struct dpi_trap_packet {
  74.   long int                 generic;    /* long must be 4 bytes long */
  75.   long int                 specific;
  76.   struct dpi_set_packet   *info;
  77.   char                    *enterprise;
  78. };
  79.  
  80. struct snmp_dpi_hdr {
  81.   unsigned char  proto_major;
  82.   unsigned char  proto_minor;
  83.   unsigned char  proto_release;
  84.  
  85.   unsigned char  packet_type;
  86.   union {
  87.      struct dpi_get_packet   *dpi_get;
  88.      struct dpi_next_packet  *dpi_next;
  89.      struct dpi_set_packet   *dpi_set;
  90.      struct dpi_resp_packet  *dpi_response;
  91.      struct dpi_trap_packet  *dpi_trap;
  92.   } packet_body;
  93. };
  94.  
  95. #if defined(_NO_PROTO)             /* prototypes for classic K&R C */
  96.  
  97. extern void                    DPIdebug();
  98. extern struct snmp_dpi_hdr     *pDPIpacket();
  99. extern void                     fDPIparse();
  100. extern unsigned char           *mkMIBquery();
  101. extern unsigned char           *mkDPIregister();
  102. extern unsigned char           *mkDPIresponse();
  103. extern unsigned char           *mkDPItrap();
  104. extern unsigned char           *mkDPItrape();
  105. extern struct dpi_set_packet   *mkDPIset();
  106. extern struct dpi_set_packet   *mkDPIlist();
  107.  
  108. #else /* _NO_PROTO */              /* ANSI C/C++ prototypes */
  109.  
  110. #if defined(__cplusplus)           /* allow C++ to use ANSI C Headers */
  111. extern "C" {
  112. #endif /* __cplusplus */
  113.  
  114. void                    DPIdebug(int onoff);
  115. struct snmp_dpi_hdr     *pDPIpacket(unsigned char *packet);
  116. void                     fDPIparse(struct snmp_dpi_hdr *hdr);
  117. unsigned char           *mkMIBquery(int cmd, char *oid_name,
  118.                              char *group_oid, int type, int len,
  119.                              char *value);
  120. unsigned char           *mkDPIregister(char *oid_name);
  121. unsigned char           *mkDPIresponse(int ret_code,
  122.                              struct dpi_set_packet *value_list);
  123. unsigned char           *mkDPItrap(int generic, int specific,
  124.                              struct dpi_set_packet *value_list);
  125. unsigned char           *mkDPItrape(long int generic, long int specific,
  126.                              struct dpi_set_packet *value_list,
  127.                              char *enterprise);
  128. struct dpi_set_packet   *mkDPIset(char *oid_name, int type,
  129.                              int len, void *value);
  130.  
  131. struct dpi_set_packet   *mkDPIlist(struct dpi_set_packet *packet,
  132.                              char *oid_name, int type,
  133.                              int len, void *value);
  134.  
  135. #if defined(__cplusplus)           /* close up the C++  scope */
  136. }
  137. #endif /* __cplusplus) */
  138.  
  139. #endif /* _NO_PROTO */
  140.