* @revision 03 * @license http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons Attribution-Share Alike 3.0 Germany * @homepage http://oss.tiggerswelt.net/oscar/ * @copyright Copyright © 2009 tiggersWelt.net */ class Oscar_TLV_ICQSrv_Data extends Oscar_TLV { /* Type / Identifier of this record */ const TYPE = 0x0001; public $UIN = 0; public $Command = 0x000; public $Sequence = 0x0000; public $Payload = ""; // {{{ parse /** * Parse incoming data * * @access public * @return void **/ public function parse () { $Length = Oscar_Common::str2int16 ($this->Data, 0, true, true); $this->UID = Oscar_Common::str2int32 ($this->Data, 0, true, true); $this->Command = Oscar_Common::str2int16 ($this->Data, 0, true, true); $this->Sequence = Oscar_Common::str2int16 ($this->Data, 0, true, true); $this->Payload = substr ($this->Data, 0, $Length - 8); print " UID: " . $this->UID . "\n"; print " CMD: " . $this->Command . "\n"; print " SEQ: " . $this->Sequence . "\n"; print " DTA: " . bin2hex ($this->Payload) ."\n"; } // }}} // {{{ generate /** * Create a binary string from this TLV * * @accss public * @return string **/ public function generate () { $this->Data = Oscar_Common::int16toStr (strlen ($this->Payload) + 8, true) . Oscar_Common::int32toStr (intval ($this->UIN), true) . Oscar_Common::int16toStr ($this->Command, true) . Oscar_Common::int16toStr ($this->Sequence, true) . $this->Payload; return parent::generate (); } // }}} } ?>