function get_oid_tree($mib) { $cmd = "snmptranslate -Ts -M " . MIBS_ALL_PATH . " -m {$mib}"; exec($cmd, $results, $code); if ($code) { error(_('Function') . ": get_oid_tree. " . _('Command') . ": {$cmd}. " . _('Error') . ": {$code}. " . _('Message') . ": " . join($results)); } $oid_tree = explodeTree($mib, $results); return $oid_tree; }
/** * Executes the configured subroutes if any matches. * * @author Benjamin Carl <*****@*****.**> * * @throws Doozr_Base_Presenter_Rest_Exception */ protected function run() { // First convert via subrouting defined routes to a parsable array tree $this->setRouteTree(explodeTree($this->getRoutes(), self::ROUTE_SEPARATOR)); // Retrieve route configuration via match by current request URL ;) $routeConfig = $this->getRouteByUrl($this->getStateObject()->getUrl()); // Real processed request method depends on the override header if set. Otherwise normal request type is used $headers = $this->getStateObject()->getHeaders(); // Override set? and is allowed for the resource? Sometimes clients are not able to e.g. tunnel PUT, DELETE ... if (isset($headers['X_HTTP_METHOD_OVERRIDE']) === true && $routeConfig->getOverride() === true) { $requestMethod = $headers['X_HTTP_METHOD_OVERRIDE']; // Inject into object we use as base -> update :) $this->getStateObject()->setMethod($requestMethod); } else { $requestMethod = $this->getStateObject()->getMethod(); } // Request method should not be processed. if ($routeConfig->isAllowed($requestMethod) === false) { throw new Doozr_Base_Presenter_Rest_Exception('Method "' . $this->getStateObject()->getMethod() . '" not allowed.', 405); } // Missing argument + message if ($this->validateInputArguments($routeConfig->getRequired(), $this->getStateObject()->getQueryParams()) !== true) { $missingArguments = []; foreach ($routeConfig->getRequired() as $key => $value) { if (array_key_exists($key, $this->getStateObject()->getQueryParams()->getArray()) === false) { $missingArguments[] = $key . ($value !== null ? ' => ' . $value : ''); } } throw new Doozr_Base_Presenter_Rest_Exception('Missing required argument' . (count($missingArguments) > 1 ? 's' : '') . ': ' . implode(',', $missingArguments), 406); } // Try to get data and check if authorization required and failed $data = $this->getModel()->getData($this->getStateObject(), $routeConfig); // Retrieve data from model so that VIEW and MODEL are informed (Observer and this here is the Subject) $this->setData($data); }
function get_oid_tree($mib) { exec("snmptranslate -Ts -M " . MIBS_ALL_PATH . " -m {$mib} 2>&1", $results); $oid_tree = explodeTree($mib, $results); return $oid_tree; }