home *** CD-ROM | disk | FTP | other *** search
/ ftp.umcs.maine.edu / 2015-02-07.ftp.umcs.maine.edu.tar / ftp.umcs.maine.edu / pub / thesis / zhongy / snmp / snmp.h < prev    next >
C/C++ Source or Header  |  1994-05-10  |  3KB  |  66 lines

  1. #define snmp_port 161
  2. #define SMAXOBJID 32
  3. #define SNMPMAXSZ 600
  4. #define MAXMIBITEM 600
  5. #define MAXSNMPNAME 100
  6.  
  7. struct  oid {                          /* object identifier*/
  8.         int len;                       /*length of this object id*/
  9.         unsigned short id[SMAXOBJID];  /*array of sub-identifiers*/
  10.         };
  11.  
  12.  
  13. /*structure that contains the value of an SNMP variable*/
  14. struct snval {
  15.          int sv_type;                  /*variable type*/
  16.          union {                       /*value of var is one of these*/
  17.            int sv_int;                 /*variable is one of :integer */
  18.                                        /*counter,gauge,timeticks     */
  19.            struct {                    /*value is a (oct) string     */
  20.              char *sv_str;             /*string's contents           */
  21.              int sv_len;               /*string's length             */
  22.              } sv_str;
  23.            struct oid sv_oid;          /*variable is an object id    */
  24.         /*   IPaddr sv_ipaddr;           /*variable is an IP address   */
  25.            } sv_val;
  26.          };
  27.  
  28.  
  29.  
  30. /*
  31.   Each snbentry node contains an SNMP binding in one of 2 forms:
  32.   ASN.1 encoded form or internal form.(The bindings list is doubly-linked)
  33. */
  34. struct snbentry {
  35.          struct oid sb_oid;            /*object id in internal form  */
  36.          struct snval sb_val;          /*value of the object         */
  37.          unsigned char   *sb_alstr;    /*ASN.1 string containing the */
  38.                                        /*object id and its value     */
  39.          int    sb_alslen;             /*length of the ASN.1 string  */
  40.          char   name[MAXSNMPNAME];     /*whole instance name         */
  41.       /* struct snbentry *sb_next;     /*next node in the bind list  */
  42.       /* struct snbentry *sb_prev;     /*previous node in the list   */
  43.          };
  44.  
  45. /*
  46.   struct that holds a complete description of an snmp request
  47. */
  48. struct req_desc {
  49.         char reqtype;                  /*request type               */
  50.         char reqid[10];                /*request identifier         */
  51.         int  reqidlen;                 /*length of the identifier   */
  52.         char err_stat;                 /*error status               */
  53.         char err_idx;                  /*error index                */
  54.         int  err_stat_pos;             /*position of error status in*/
  55.                                        /*the ASN.1 encoding         */
  56.         int err_idx_pos;               /*position of error index    */
  57.         int pdutype_pos;               /*position of pdu type       */
  58.         struct snbentry bind;         /*single bind list           */
  59.      /* struct snbentry *bindlf;       /*front of bindings list     */
  60.      /* struct snbentry *bindle;       /*end of bindings list       */
  61.         };
  62.  
  63. struct snbentry mib[MAXMIBITEM];
  64. int NUM_MIBITEM;
  65.  
  66.