QtNetSNMP::QMIBTree *QtNetSNMP::QSNMPManager::getMIBModule(const QString& module) throw(QSNMPException) { if(module.isEmpty()) return _core -> getMIBTree(read_all_mibs()); else if(getModulesInstalled().indexOf(module) == -1) throw QSNMPException("QSNMPManager :: Get MIB Module :: Module not found"); return _core -> getMIBTree(read_module(module.toStdString().c_str())); }
/** * Parse FS specific option string * to build the export entry option. */ fsal_status_t SNMPFSAL_BuildExportContext(snmpfsal_export_context_t * p_export_context, /* OUT */ fsal_path_t * p_export_path, /* IN */ char *fs_specific_options /* IN */ ) { struct tree *tree_head, *sub_tree; char snmp_path[FSAL_MAX_PATH_LEN]; int rc; /* sanity check */ if(!p_export_context) Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_BuildExportContext); if((fs_specific_options != NULL) && (fs_specific_options[0] != '\0')) { LogCrit(COMPONENT_FSAL, "FSAL BUILD CONTEXT: ERROR: found an EXPORT::FS_Specific item whereas it is not supported for this filesystem."); } /* retrieves the MIB tree associated to this export */ /*tree_head = get_tree_head(); */ tree_head = read_all_mibs(); if(tree_head == NULL) Return(ERR_FSAL_BAD_INIT, snmp_errno, INDEX_FSAL_BuildExportContext); /* convert the path to a SNMP path */ if(p_export_path != NULL) PosixPath2SNMP(p_export_path->path, snmp_path); else strcpy(snmp_path, "."); if(!strcmp(snmp_path, ".")) { /* the exported tree is the root tree */ p_export_context->root_mib_tree = tree_head; BuildRootHandle(&p_export_context->root_handle); } else { /* convert the SNMP path to an oid */ rc = ParseSNMPPath(snmp_path, &p_export_context->root_handle); if(rc) { LogCrit(COMPONENT_FSAL, "FSAL BUILD CONTEXT: ERROR parsing SNMP path '%s'", snmp_path); Return(rc, 0, INDEX_FSAL_BuildExportContext); } /* get the subtree */ sub_tree = FSAL_GetTree(p_export_context->root_handle.data.oid_tab, p_export_context->root_handle.data.oid_len, tree_head, FALSE); if(sub_tree == NULL) Return(ERR_FSAL_NOENT, snmp_errno, INDEX_FSAL_BuildExportContext); /* if it has some childs or the object is unknown, consider it has a node */ if((sub_tree->child_list != NULL) || (sub_tree->type == TYPE_OTHER)) { p_export_context->root_handle.data.object_type_reminder = FSAL_NODETYPE_NODE; } else { LogEvent(COMPONENT_FSAL, "FSAL BUILD CONTEXT: WARNING: '%s' seems to be a leaf !!!", snmp_path); } p_export_context->root_mib_tree = tree_head; } /* save the root path (for lookupPath checks) */ if(p_export_path != NULL) p_export_context->root_path = *p_export_path; else FSAL_str2path("/", 2, &p_export_context->root_path); LogEvent(COMPONENT_FSAL, "CREATING EXPORT CONTEXT PATH=%s\n", snmp_path); if(isFullDebug(COMPONENT_FSAL)) { int i; char oidstr[2048], *p = oidstr; oidstr[0] = '\0'; for(i = 0; i < p_export_context->root_handle.data.oid_len; i++) p += sprintf(p, ".%ld", p_export_context->root_handle.data.oid_tab[i]); LogFullDebug(COMPONENT_FSAL, "oid %s", oidstr); } Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_BuildExportContext); }