/**
  * Creates a new A2M_GET_SERVERS_BATCH2 request object, filtering by the
  * given paramters
  *
  * @param int $regionCode The region code to filter servers by region.
  * @param string $startIp This should be the last IP received from the
  *        master server or 0.0.0.0
  * @param string $filter The filters to apply in the form
  *        ("\filtername\value...")
  */
 public function __construct($regionCode = MasterServer::REGION_ALL, $startIp = '0.0.0.0', $filter = '')
 {
     parent::__construct(SteamPacket::A2M_GET_SERVERS_BATCH2_HEADER);
     $this->filter = $filter;
     $this->regionCode = $regionCode;
     $this->startIp = $startIp;
 }
示例#2
0
 /**
  * @param byte[] $contentData
  */
 public function __construct($contentData)
 {
     if ($contentData != "" && $contentData != "00000000000000") {
         throw new Exception("Wrong formatted A2A_ACK packet.");
     }
     parent::__construct(SteamPacket::A2A_ACK_HEADER, $contentData);
 }
 /**
  * @param String $contentData
  */
 public function __construct($contentData)
 {
     if (empty($contentData)) {
         throw new Exception("Wrong formatted S2A_RULES packet.");
     }
     parent::__construct(SteamPacket::S2A_RULES_HEADER);
     $contentData = unpack("vrulesNumber/a*rulesData", $contentData);
     $tmpRulesArray = explode("", $contentData["rulesData"]);
     for ($x = 0; $x < sizeof($tmpRulesArray); $x++) {
         $this->rulesArray[$tmpRulesArray[$x]] = $tmpRulesArray[++$x];
     }
 }
 /**
  * Creates a new S2M_HEARTBEAT2 packet object based on the given data
  *
  * @param array $data The data to send with the heartbeat. The data
  *        contents are merged with the values from {@link DEFAULT_DATA}.
  * @throws SteamCondenserException when the required challenge number is
  *         missing
  */
 public function __construct($data = array())
 {
     $data = array_merge(self::$DEFAULT_DATA, $data);
     if (empty($data['challenge'])) {
         throw new SteamCondenserException('You have to provide a challenge number when sending a heartbeat to a master server.');
     }
     $bytes = "\n";
     while (list($k, $v) = each($data)) {
         $bytes .= "\\{$k}\\{$v}";
     }
     $bytes .= "\n";
     parent::__construct(SteamPacket::S2M_HEARTBEAT2_HEADER, $bytes);
 }
 /**
  * @param mixed $contentData
  */
 public function __construct($contentData)
 {
     if (empty($contentData)) {
         throw new Exception("Wrong formatted S2A_PLAYER packet.");
     }
     parent::__construct(SteamPacket::S2A_PLAYER_HEADER, $contentData);
     $this->contentData->getByte();
     $this->playerHash = array();
     while ($this->contentData->remaining() > 0) {
         $playerData = array($this->contentData->getByte(), $this->contentData->getString(), $this->contentData->getLong(), $this->contentData->getFloat());
         $this->playerHash[$playerData[1]] = new SteamPlayer($playerData[0], $playerData[1], $playerData[2], $playerData[3]);
     }
 }
 public function __construct($data)
 {
     parent::__construct(SteamPacket::M2A_SERVER_BATCH_HEADER, $data);
     if ($this->contentData->getByte() != 10) {
         throw new PacketFormatException("Master query response is missing additional 0x0A byte.");
     }
     do {
         $firstOctet = $this->contentData->getByte();
         $secondOctet = $this->contentData->getByte();
         $thirdOctet = $this->contentData->getByte();
         $fourthOctet = $this->contentData->getByte();
         $portNumber = $this->contentData->getShort();
         $portNumber = (($portNumber & 0xff) << 8) + ($portNumber >> 8);
         $this->serverArray[] = "{$firstOctet}.{$secondOctet}.{$thirdOctet}.{$fourthOctet}:{$portNumber}";
     } while ($this->contentData->remaining() > 0);
 }
 /**
  * @param String $contentData
  */
 public function __construct($contentData)
 {
     if (empty($contentData)) {
         throw new Exception("Wrong formatted S2A_RULES packet.");
     }
     parent::__construct(SteamPacket::S2A_RULES_HEADER);
     $contentData = unpack("vrulesNumber/a*rulesData", $contentData);
     $tmpRulesArray = explode("", $contentData["rulesData"]);
     // This is a workaround for servers sending corrupt replies
     if (sizeof($tmpRulesArray) % 2) {
         array_pop($tmpRulesArray);
     }
     for ($x = 0; $x < sizeof($tmpRulesArray); $x++) {
         $this->rulesArray[$tmpRulesArray[$x]] = $tmpRulesArray[++$x];
     }
 }
 /**
  * Creates a new S2A_RULES response object based on the given data
  *
  * @param string $contentData The raw packet data sent by the server
  * @throws PacketFormatException if the packet data is missing
  */
 public function __construct($contentData)
 {
     if (empty($contentData)) {
         throw new PacketFormatException('Wrong formatted S2A_RULES packet.');
     }
     parent::__construct(SteamPacket::S2A_RULES_HEADER, $contentData);
     $rulesCount = $this->contentData->getShort();
     $this->rulesArray = array();
     for ($x = 0; $x < $rulesCount; $x++) {
         $rule = $this->contentData->getString();
         $value = $this->contentData->getString();
         if (empty($rule)) {
             break;
         }
         $this->rulesArray[$rule] = $value;
     }
 }
 /**
  * @param long $challengeNumber
  */
 public function __construct($challengeNumber)
 {
     parent::__construct(SteamPacket::S2C_CHALLENGE_HEADER, $challengeNumber);
 }
 public function __construct($request)
 {
     parent::__construct(0x0, $request);
 }
 /**
  * Creates a new S2A_LOGSTRING object based on the given data
  *
  * @param string $data The raw packet data sent by the server
  */
 public function __construct($data)
 {
     parent::__construct(SteamPacket::S2A_LOGSTRING_HEADER, $data);
     $this->contentData->getByte();
     $this->message = $this->contentData->getString();
 }
 /**
  * Creates a new A2S_INFO request object
  */
 public function __construct()
 {
     parent::__construct(SteamPacket::A2S_INFO_HEADER, "Source Engine Query");
 }
 /**
  * Creates a new M2S_REQUESTRESTART object based on the given data
  *
  * @param string $data The raw packet data replied from the server
  */
 public function __construct($data)
 {
     parent::__construct(SteamPacket::C2M_CHECKMD5_HEADER, $data);
     $this->challenge = $this->contentData->getUnsignedLong();
 }
 /**
  * Creates a new M2S_ISVALIDMD5 response object based on the given data
  *
  * @param string $data The raw packet data replied from the server
  */
 public function __construct($data)
 {
     parent::__construct(SteamPacket::M2C_ISVALIDMD5_HEADER, $data);
     $this->contentData->getByte();
     $this->challenge = $this->contentData->getUnsignedLong();
 }
 public function __construct($commandResponse)
 {
     parent::__construct(SteamPacket::RCON_GOLDSRC_RESPONSE_HEADER, $commandResponse);
 }
 /**
  *
  */
 public function __construct()
 {
     parent::__construct(SteamPacket::A2S_SERVERQUERY_GETCHALLENGE_HEADER);
 }
示例#17
0
 /**
  *
  */
 public function __construct()
 {
     parent::__construct(SteamPacket::A2A_PING_HEADER);
 }
示例#18
0
 public function __construct($requestId, $rconHeader, $rconData = null)
 {
     parent::__construct($rconHeader, "{$rconData}");
     $this->requestId = $requestId;
 }