High level function to fetch the net speed

@access private
@param int $pointer  Position to read from, if false, return self::INVALID_IP_ADDRESS
@return string
188552
private function readNetSpeed($pointer) {
    if (false === $pointer) {
      // Deal with invalid IPs
      $netSpeed = self::INVALID_IP_ADDRESS;
    } elseif (0 === self::$columns[self::NET_SPEED][$this->type]) {
      // If the field is not suported, return accordingly
      $netSpeed = self::FIELD_NOT_SUPPORTED;
    } else {
      // Read the net speed
      $netSpeed = $this->readString($pointer + self::$columns[self::NET_SPEED][$this->type]);
    }
    return $netSpeed;
  }
1121007
public function getCpuData($snmpConnection) {
        
        $return = Array();
        $return['oneMinute'] = $snmpConnection->useLinux_Cpu()->loadOneMinute();
        $return['fiveMinute'] = $snmpConnection->useLinux_Cpu()->loadFiveMinutes();
        $return['fifteenMinute'] = $snmpConnection->useLinux_Cpu()->loadFifteenMinutes();
        $return['loadPercentage'] = 0;
        return $return;
    }
984332
public function getDsn($p)
    {
        $this->engine = isset($p['engine']) ? $p['engine'] : $this->engine;
        return $this->engine . ':dbname=' . $p['database'] . ';host=' . $p['host'] . ';charset=' . (isset($p['charset']) ? $p['charset'] : 'utf8');
    }
1275117
private function readCityName($pointer) {
    if (false === $pointer) {
      // Deal with invalid IPs
      $cityName = self::INVALID_IP_ADDRESS;
    } elseif (0 === self::$columns[self::CITY_NAME][$this->type]) {
      // If the field is not suported, return accordingly
      $cityName = self::FIELD_NOT_SUPPORTED;
    } else {
      // Read the city name
      $cityName = $this->readString($pointer + self::$columns[self::CITY_NAME][$this->type]);
    }
    return $cityName;
  }
172021
public static function getPort() :? int
  {
      // Check for proxy first
      if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) {
          return (int) $_SERVER['HTTP_X_FORWARDED_PORT'];
      }
      if ('https' === ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '')) {
          return 443;
      }

      return isset($_SERVER['SERVER_PORT']) ?
        (int) $_SERVER['SERVER_PORT'] : null;
  }
1164245
public function getIpv4Attribute() : ?string
    {
        $ip = $this->getAttributeFromArray('user_ipv4');

        return $ip !== null ? long2ip($ip) : null;
    }
722672
function getCache($address) {
        if(!isset($this->dsn))
            return false;
        
        $_ret = array();
        
        // PEAR DB
        require_once('DB.php');          
        $_db =& DB::connect($this->dsn);
        if (PEAR::isError($_db)) {
            die($_db->getMessage());
        }
        $_res =& $_db->query("SELECT lon,lat FROM {$this->_db_cache_table} where address = ?", $address);
        if (PEAR::isError($_res)) {
            die($_res->getMessage());
        }
        if($_row = $_res->fetchRow()) {            
            $_ret['lon'] = $_row[0];
            $_ret['lat'] = $_row[1];
        }
        
        $_db->disconnect();
        
        return !empty($_ret) ? $_ret : false;
    }
93651
public static function getLocalIP() {
        $s = &$_SERVER;

        $ipAddress = $s['REMOTE_ADDR'];

        if (array_key_exists('HTTP_X_FORWARDED_FOR', $s)) {
            $temp = explode(',', $s['HTTP_X_FORWARDED_FOR']);
            $ipAddress = array_pop($temp);
        }

        $result = $ipAddress == '::1' ? "127.0.0.1" : $ipAddress;

        return $result;
    }
7601
public static function lookUpHostIp($address)
    {

        $ipAddress = null;
        if (function_exists('dns_get_record')) {
            $records = dns_get_record(trim($address));
            foreach ($records as $record) {
                if ($record['type'] == 'A') {
                    $ipAddress = $record['ip'];
                }
            }
        }
        return $ipAddress;
    }
69214
public function ntoa($nip)
	{
		$ip = [];
		for ($i = 3; $i > 0; $i --) {
			$ip_seg = intval($nip / pow(256, $i));
			$ip[] = $ip_seg;
			$nip -= $ip_seg * pow(256, $i);
		}
		$ip[] = $nip;
		return join('.', $ip);
	}
637517
public static function find($ip)
    {
        if (empty($ip) === true) {
            return 'N/A';
        }

        if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6) === FALSE) {
            throw new \InvalidArgumentException("The value \"$ip\" is not a valid IP address.");
        }

        $nip = gethostbyname($ip);
        if (isset(self::$cached[$nip]) === true) {
            return self::$cached[$nip];
        }

        try {
            $reader = self::init();
            $node   = $reader->findNode($ip);

            if ($node > 0) {
                $data               = $reader->resolve($node);
                $values             = explode("\t", $data);
                $location           = array_slice($values, $reader->meta['languages']['CN'], count($reader->meta['fields']));
                $location[]         = '';
                $locationCode       = self::getLocationCode($location);
                $location[]         = $locationCode;
                self::$cached[$nip] = $location;

                return self::$cached[$nip];
            }
        } catch (\Exception $e) {
            return $e->getMessage();
        }

        return 'N/A';
    }
692575
def GetHostProcessorSpeed(self):
        ''''''
        counter = c_uint()
        ret = vmGuestLib.VMGuestLib_GetHostProcessorSpeed(self.handle.value, byref(counter))
        if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret)
        return counter.value
137570
public function getIpAddress($convertToInteger = FALSE)
    {
        if ($this->haProxyStatus === TRUE) {
            $ip = $this->getIpByHaProxy($convertToInteger);
        } else {
            $ip = $this->getRawIpAddress($convertToInteger);
        }
        $this->debug->info(__FUNCTION__, 'haProxyStatus: ' . $this->haProxyStatus);
        $this->debug->info(__FUNCTION__, 'getIpAddress: ' . $ip);

        return $ip;
    }
798669
protected function getIpThrottles($ipAddress)
    {
        if (! $this->ipThrottles->has($ipAddress))
        {
            $this->ipThrottles[$ipAddress] = $this->loadIpThrottles($ipAddress);
        }

        return $this->ipThrottles[$ipAddress];
    }
514444
public function getServiceData($snmpConnection) {
        
        /*
        $objPing = new \Cityware\Utility\Ping($snmpConnection->getHost());
        $objPing->setTypeCon('udp');
        $objPing->setPort(160);
        
        echo '<pre>';
        var_dump($objPing->ping());
        exit;
         * 
         */

        $nginxData = $snmpConnection->realWalkToArray('NET-SNMP-EXTEND-MIB::nsExtendOutLine."Nginx"', true);
        
        $return = Array();

        $return['num_active_connections'] = (isset($nginxData[1])) ? $nginxData[1] : 0;
        $return['num_accepted_connections'] = (isset($nginxData[2])) ? $nginxData[2] : 0;
        $return['num_handled_connections'] = (isset($nginxData[3])) ? $nginxData[3] : 0;
        $return['num_handled_requests'] = (isset($nginxData[4])) ? $nginxData[4] : 0;
        $return['num_reading'] = (isset($nginxData[5])) ? $nginxData[5] : 0;
        $return['num_writing'] = (isset($nginxData[6])) ? $nginxData[6] : 0;
        $return['num_waiting'] = (isset($nginxData[7])) ? $nginxData[7] : 0;
        $return['num_requests_connections'] = ($return['num_handled_connections'] > 0) ? $return['num_handled_requests'] / $return['num_handled_connections'] : 0;
        $return['num_keep_alive_connections'] = $return['num_active_connections'] - ($return['num_reading'] + $return['num_writing']);

        return $return;
    }
1353648
private int getIntAt(int pointer) {
		int out = 0;
		byte[] temp = new byte[4];
		getSubArray(temp, pointer);
		try {
			DataInputStream dis = new DataInputStream(new ByteArrayInputStream(temp));
			out = dis.readInt();
		} catch (IOException e) //This shouldn't happen. If it does something must be seriously wrong.
		{
			throw new IllegalStateException("Unexpected IOException encountered while manipulating internal streams.");
		}
		return out;
	}
20814
private function readDomainName($pointer) {
    if (false === $pointer) {
      // Deal with invalid IPs
      $domainName = self::INVALID_IP_ADDRESS;
    } elseif (0 === self::$columns[self::DOMAIN_NAME][$this->type]) {
      // If the field is not suported, return accordingly
      $domainName = self::FIELD_NOT_SUPPORTED;
    } else {
      // Read the domain name
      $domainName = $this->readString($pointer + self::$columns[self::DOMAIN_NAME][$this->type]);
    }
    return $domainName;
  }