/**
  * Dump human readable frame information for debugging
  *
  * @param int $frame_type
  * @param int $channel_id
  * @param string $payload
  */
 protected function frameInfo(int $frame_type, int $channel_id, string $payload)
 {
     if ($frame_type == FrameTypes::METHOD) {
         if (strlen($payload) >= 4) {
             $method_sig_array = unpack('n2', substr($payload, 0, 4));
             $method_sig = $method_sig_array[1] . ',' . $method_sig_array[2];
             return Constants091::$FRAME_TYPES[$frame_type] . " " . sprintf('> %s: %s', $method_sig, Constants091::$GLOBAL_METHOD_NAMES[MiscHelper::methodSig($method_sig)]);
         }
     } else {
         return Constants091::$FRAME_TYPES[$frame_type];
     }
 }
Example #2
0
 public function __construct($reply_code, $reply_text, $method_sig)
 {
     parent::__construct($reply_text, $reply_code);
     $this->amqp_reply_code = $reply_code;
     // redundant, but kept for BC
     $this->amqp_reply_text = $reply_text;
     // redundant, but kept for BC
     $this->amqp_method_sig = $method_sig;
     $ms = MiscHelper::methodSig($method_sig);
     $mn = isset(AbstractChannel::$GLOBAL_METHOD_NAMES[$ms]) ? AbstractChannel::$GLOBAL_METHOD_NAMES[$ms] : ($mn = "");
     $this->args = array($reply_code, $reply_text, $method_sig, $mn);
 }
Example #3
0
 /**
  * @param int $version_major
  * @param int $version_minor
  * @param array $server_properties
  * @param array $mechanisms
  * @param array $locales
  */
 public function debug_connection_start($version_major, $version_minor, $server_properties, $mechanisms, $locales)
 {
     if ($this->debug) {
         $this->debug_msg(sprintf('Start from server, version: %d.%d, properties: %s, mechanisms: %s, locales: %s', $version_major, $version_minor, MiscHelper::dump_table($server_properties), implode(', ', $mechanisms), implode(', ', $locales)));
     }
 }
Example #4
0
        </div>

        <div class="row inlinerow">
            <?php 
echo CHtml::submitButton('Generate', array('id' => 'generateButton', 'style' => 'margin-top: 24px; min-width: 0;'));
?>
        </div>

    </div>

    <?php 
echo CHtml::endForm();
?>
    <br clear="all"/>
    <?php 
echo MiscHelper::outputInfoBar('infoBar', 'Please click the generate button to refresh the chart!');
?>
</div><!-- form -->

<div id="UrlsChart" style="margin:auto;width:850px;min-height:400px;">
</div>

<div style="color: #888888;font-size: 0.8em;margin: 0;padding-top: 10px;">Charts powered by <a href="http://www.fusioncharts.com/free" target="_blank">Fusion Charts Free</a></div>

<script type="text/javascript">

    // do something on document ready
    $(function() {
        var btnBg = function(){ $('#infoBar').animate({'opacity':1},500); }

        $('#infoBar').css('opacity',0);
Example #5
0
 /**
  * start connection negotiation
  */
 protected function start($args)
 {
     $this->version_major = $args->read_octet();
     $this->version_minor = $args->read_octet();
     $this->server_properties = $args->read_table();
     $this->mechanisms = explode(" ", $args->read_longstr());
     $this->locales = explode(" ", $args->read_longstr());
     if ($this->debug) {
         MiscHelper::debug_msg(sprintf("Start from server, version: %d.%d, properties: %s, mechanisms: %s, locales: %s", $this->version_major, $this->version_minor, self::dump_table($this->server_properties), implode(', ', $this->mechanisms), implode(', ', $this->locales)));
     }
 }
Example #6
0
<div class="view">

	<b><?php 
echo MiscHelper::niceDate($data->time_euh);
?>
:</b>
	<?php 
echo $data->action_euh;
?>

</div>
Example #7
0
 /**
  * Wait for some expected AMQP methods and dispatch to them.
  * Unexpected methods are queued up for later calls to this Python
  * method.
  */
 public function wait($allowed_methods = NULL, $non_blocking = false)
 {
     if ($allowed_methods) {
         if ($this->debug) {
             MiscHelper::debug_msg("waiting for " . implode(", ", $allowed_methods));
         }
     } else {
         if ($this->debug) {
             MiscHelper::debug_msg("waiting for any method");
         }
     }
     //Process deferred methods
     foreach ($this->method_queue as $qk => $queued_method) {
         if ($this->debug) {
             MiscHelper::debug_msg("checking queue method " . $qk);
         }
         $method_sig = $queued_method[0];
         if ($allowed_methods == NULL || in_array($method_sig, $allowed_methods)) {
             unset($this->method_queue[$qk]);
             if ($this->debug) {
                 MiscHelper::debug_msg("Executing queued method: {$method_sig}: " . self::$GLOBAL_METHOD_NAMES[MiscHelper::methodSig($method_sig)]);
             }
             return $this->dispatch($queued_method[0], $queued_method[1], $queued_method[2]);
         }
     }
     // No deferred methods?  wait for new ones
     while (true) {
         $frm = $this->next_frame();
         $frame_type = $frm[0];
         $payload = $frm[1];
         if ($frame_type != 1) {
             throw new Exception("Expecting AMQP method, received frame type: {$frame_type}");
         }
         if (strlen($payload) < 4) {
             throw new Exception("Method frame too short");
         }
         $method_sig_array = unpack("n2", substr($payload, 0, 4));
         $method_sig = "" . $method_sig_array[1] . "," . $method_sig_array[2];
         $args = new AMQPReader(substr($payload, 4));
         if ($this->debug) {
             MiscHelper::debug_msg("> {$method_sig}: " . self::$GLOBAL_METHOD_NAMES[MiscHelper::methodSig($method_sig)]);
         }
         if (in_array($method_sig, self::$CONTENT_METHODS)) {
             $content = $this->wait_content();
         } else {
             $content = NULL;
         }
         if ($allowed_methods == NULL || in_array($method_sig, $allowed_methods) || in_array($method_sig, self::$CLOSE_METHODS)) {
             return $this->dispatch($method_sig, $args, $content);
         }
         // Wasn't what we were looking for? save it for later
         if ($this->debug) {
             MiscHelper::debug_msg("Queueing for later: {$method_sig}: " . self::$GLOBAL_METHOD_NAMES[MiscHelper::methodSig($method_sig)]);
         }
         $this->method_queue[] = array($method_sig, $args, $content);
         if ($non_blocking) {
             break;
         }
     }
 }
Example #8
0
 protected function open_ok($args)
 {
     $this->is_open = true;
     if ($this->debug) {
         MiscHelper::debug_msg("Channel open");
     }
 }