/**
  * @param ServiceDstPortMapping $other
  * @return bool
  */
 public function udpMappingIsSame(ServiceDstPortMapping $other)
 {
     return ServiceDstPortMapping::_mapsAreSame($this->udpPortMap, $other->udpPortMap);
 }
Пример #2
0
 /**
  * @return ServiceDstPortMapping
  * @throws Exception
  */
 public function dstPortMapping()
 {
     if ($this->isTmpSrv()) {
         return new ServiceDstPortMapping();
     }
     if ($this->_protocol == 'tcp') {
         $tcp = true;
     } else {
         $tcp = false;
     }
     return ServiceDstPortMapping::mappingFromText($this->_dport, $tcp);
 }
Пример #3
0
 if ($rule->actionIsNegative()) {
     print $context->padding . " - IGNORED because Action is DENY\n";
     return;
 }
 if (!$rule->apps->isAny()) {
     print $context->padding . " - IGNORED because Application is NOT EQUAL ANY\n";
     return;
 }
 $ports = '';
 if (($rule->services->isAny() || $rule->services->isApplicationDefault()) && !$context->arguments['restrictToListOfServices'] == '*sameAsInRule*') {
     $ports = '1-65535';
     $portMapping = ServiceDstPortMapping::mappingFromText($ports, true);
     $udpPortMapping = ServiceDstPortMapping::mappingFromText($ports, false);
     $portMapping->mergeWithMapping($udpPortMapping);
 } else {
     $portMapping = new ServiceDstPortMapping();
     if ($context->arguments['restrictToListOfServices'] == '*sameAsInRule*') {
         $services = $rule->services->members();
     } else {
         $listOfServicesQueryName = $context->arguments['restrictToListOfServices'];
         if (!isset($context->nestedQueries[$listOfServicesQueryName])) {
             derr("cannot find query filter called '{$listOfServicesQueryName}'");
         }
         $rQuery = new RQuery('service');
         $errorMessage = '';
         if (!$rQuery->parseFromString($context->nestedQueries[$listOfServicesQueryName], $errorMessage)) {
             derr("error while parsing query: {$context->nestedQueries[$listOfServicesQueryName]}");
         }
         $services = array();
         foreach ($rule->services->membersExpanded() as $member) {
             if ($rQuery->matchSingleObject($member)) {
 public function dstPortMapping()
 {
     $mapping = new ServiceDstPortMapping();
     foreach ($this->members as $member) {
         $localMapping = $member->dstPortMapping();
         $mapping->mergeWithMapping($localMapping);
     }
     return $mapping;
 }