* @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 */ require_once ("oscar/common.php"); class Oscar_SNAC_Rate_Parameter { public $classID = 0x0000; public $windowSize = 0x000000; public $clearThreshold = 0x000000; public $alertThreshold = 0x000000; public $limitThreshold = 0x000000; public $disconnectThreshold = 0x000000; public $currentAverage = 0x000000; public $maxAverage = 0x000000; public $lastArrivalDelta = 0x000000; public $droppingSNACs = 0x00; // {{{ getParameters /** * @access public * @return void */ public static function getParameters (&$Data, $Count = null, $Trim = true) { $Params = array (); $myData = $Data; $num = 0; if ($Count == null) $Count = intval (strlen ($myData) / 35); while ((strlen ($Data) > 34) && ($num < $Count)) { // Create a new parameter item $Item = new Oscar_SNAC_Rate_Parameter; // Fill the item with data $Item->classID = Oscar_Common::str2int16 ($myData, 0, true); $Item->windowSize = Oscar_Common::str2int32 ($myData, 0, true); $Item->clearThreshold = Oscar_Common::str2int32 ($myData, 0, true); $Item->alertThreshold = Oscar_Common::str2int32 ($myData, 0, true); $Item->limitThreshold = Oscar_Common::str2int32 ($myData, 0, true); $Item->disconnectThreshold = Oscar_Common::str2int32 ($myData, 0, true); $Item->currentAverage = Oscar_Common::str2int32 ($myData, 0, true); $Item->maxAverage = Oscar_Common::str2int32 ($myData, 0, true); $Item->lastArrivalDelta = Oscar_Common::str2int32 ($myData, 0, true); $Item->droppingSNACs = Oscar_Common::str2int8 ($myData, 0, true); // Append to output $Params [] = $Item; $num++; } if ($Trim) $Data = $myData; return $Params; } // }}} // {{{ setParameters /** * @param array $Items * * @access public * @return string **/ public static function setParameters ($Items) { $buf = ""; if (is_array ($Items)) foreach ($Items as $Item) if ($Item instanceof Oscar_SNAC_Rate_Parameter) $buf .= Oscar_Common::int16tostr ($Item->classID) . Oscar_Common::int32tostr ($Item->windowSize) . Oscar_Common::int32tostr ($Item->clearThreshold) . Oscar_Common::int32tostr ($Item->alertThreshold) . Oscar_Common::int32tostr ($Item->limitThreshold) . Oscar_Common::int32tostr ($Item->disconnectThreshold) . Oscar_Common::int32tostr ($Item->currentAverage) . Oscar_Common::int32tostr ($Item->maxAverage) . Oscar_Common::int32tostr ($Item->lastArrivalDelta) . Oscar_Common::int8tostr ($Item->droppingSNACs); return $buf; } // }}} } ?>