mib.c

函数 sprint_realloc_by_type  (E:\code\net-snmp-5.4.2.1\snmplib\mib.c)的主要作用是:

解析传入的mib中的节点,根据mib节点类型,将其转换为可以识别的数字存入buffer中。

int
sprint_realloc_by_type(u_char ** buf, size_t * buf_len, size_t * out_len,
                       int allow_realloc,
                       const netsnmp_variable_list * var,
                       const struct enum_list *enums,
                       const char *hint, const char *units)

{     DEBUGMSGTL(("output", "sprint_by_type, type %d\n", var->type));

    switch (var->type) {    

    case ASN_INTEGER:        

       return sprint_realloc_integer(buf, buf_len, out_len, allow_realloc, var, enums, hint, units);    

            case ASN_OCTET_STR:        

      return sprint_realloc_octet_string(buf, buf_len, out_len, allow_realloc, var, enums, hint,  units);

             .................    

      /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */    

     default:        

       DEBUGMSGTL(("sprint_by_type", "bad type: %d\n", var->type));        

      return sprint_realloc_badtype(buf, buf_len, out_len, allow_realloc, var, enums, hint, units);    

    }

}

 

posted @ 2015-08-21 14:46  hbg-rohens  阅读(352)  评论(0编辑  收藏  举报