/** * @return string */ public function &udpMappingToText() { $returnText = ''; if (count($this->udpPortMap) != 0) { $mapsText = array(); foreach ($this->udpPortMap as &$map) { if ($map['start'] == $map['end']) { $mapsText[] = (string) $map['start']; } else { $mapsText[] = $map['start'] . '-' . $map['end']; } } $returnText = PH::list_to_string($mapsText); } return $returnText; }
$rulesLocation = 'shared'; } } // // Determine rule types // $supportedRuleTypes = array('all', 'any', 'security', 'nat', 'decryption', 'appoverride'); if (!isset(PH::$args['ruletype'])) { print " - No 'ruleType' specified, using 'security' by default\n"; $ruleTypes = array('security'); } else { $ruleTypes = explode(',', PH::$args['ruletype']); foreach ($ruleTypes as &$rType) { $rType = strtolower($rType); if (array_search($rType, $supportedRuleTypes) === false) { display_error_usage_exit("'ruleType' has unsupported value: '" . $rType . "'. Supported values are: " . PH::list_to_string($supportedRuleTypes)); } if ($rType == 'all') { $rType = 'any'; } } $ruleTypes = array_unique($ruleTypes); } // // Extracting actions // $explodedActions = explode('/', $doActions); /** @var CallContext[] $doActions */ $doActions = array(); foreach ($explodedActions as &$exAction) { $explodedAction = explode(':', $exAction);
print str_pad('', 100, '-') . "\n"; print str_pad('Action name', 28, ' ', STR_PAD_BOTH) . "|" . str_pad("Argument:Type", 24, ' ', STR_PAD_BOTH) . " |" . str_pad("Def. Values", 12, ' ', STR_PAD_BOTH) . "| Choices\n"; print str_pad('', 100, '-') . "\n"; foreach ($supportedActions as &$action) { $output = "* " . $action['name']; $output = str_pad($output, 28) . '|'; if (isset($action['args'])) { $first = true; $count = 1; foreach ($action['args'] as $argName => &$arg) { if (!$first) { $output .= "\n" . str_pad('', 28) . '|'; } $output .= " " . str_pad("#{$count} {$argName}:{$arg['type']}", 24) . "| " . str_pad("{$arg['default']}", 12) . "| "; if (isset($arg['choices'])) { $output .= PH::list_to_string($arg['choices']); } $count++; $first = false; } } print $output . "\n"; print str_pad('', 100, '=') . "\n"; //print "\n"; } exit(0); } if (isset(PH::$args['listfilters'])) { ksort(RQuery::$defaultFilters['service']); print "Listing of supported filters:\n\n"; foreach (RQuery::$defaultFilters['service'] as $index => &$filter) {
$supportedArguments[] = array('niceName' => 'filter', 'shortHelp' => 'filter rules that can be converted'); $tmpArray = array(); foreach ($supportedArguments as &$arg) { $tmpArray[strtolower($arg['niceName'])] =& $arg; } $supportedArguments =& $tmpArray; // // methods array preparation // $supportedMethods_tmp = array('matchFromToSrcDstApp' => 1, 'matchFromToSrcDstSvc' => 2, 'matchFromToSrcSvcApp' => 3, 'matchFromToDstSvcApp' => 4, 'matchFromSrcDstSvcApp' => 5, 'matchToSrcDstSvcApp' => 6, 'matchToDstSvcApp' => 7, 'matchFromSrcSvcApp' => 8, 'identical' => 9); $supportedMethods = array(); foreach ($supportedMethods_tmp as $methodName => $method) { $supportedMethods[strtolower($methodName)] = $method; } $methodsNameList = array_flip($supportedMethods_tmp); $supportedArguments['method']['shortHelp'] .= PH::list_to_string($methodsNameList); PH::processCliArgs(); foreach (PH::$args as $index => &$arg) { if (!isset($supportedArguments[$index])) { //var_dump($supportedArguments); display_error_usage_exit("unsupported argument provided: '{$index}'"); } } if (isset(PH::$args['help'])) { display_usage_and_exit(); } if (!isset(PH::$args['in'])) { display_error_usage_exit('"in" is missing from arguments'); } $configInput = PH::$args['in']; if (!is_string($configInput) || strlen($configInput) < 1) {
public function &toString_inline() { return PH::list_to_string($this->o); }