Set the object used to uncompress incoming packets.

\param fpoirotte::Pssht::CompressionInterface $uncompressor
Incoming packets' uncompressor.

\retval Transport
Return this transport layer.
557989
public function setUncompressor(\fpoirotte\Pssht\CompressionInterface $uncompressor)
    {
        if ($uncompressor->getMode() !== \fpoirotte\Pssht\CompressionInterface::MODE_UNCOMPRESS) {
            throw new \InvalidArgumentException();
        }

        $this->uncompressor = $uncompressor;
        return $this;
    }
600575
public function unsetHandler($type, \fpoirotte\Pssht\HandlerInterface $handler)
    {
        if (!is_int($type) || $type < 0 || $type > 255) {
            throw new \InvalidArgumentException();
        }

        if (isset($this->handlers[$type]) && $this->handlers[$type] === $handler) {
            unset($this->handlers[$type]);
        }
        return $this;
    }
953949
public function setSocket()
    {
        if (empty($this->uri['scheme'])) {
            throw new OutOfBoundsException('Unknown URL scheme');
        }

        if ($this->uri['scheme'] === 'http') {
            $port = 80;
            $protocol = 'tcp';
        } else if ($this->uri['scheme'] === 'https') {
            $port = 443;
            $protocol = 'ssl';
        } else {
            throw new UnexpectedValueException("Unsupported URL scheme: {$this->uri['scheme']}");
        }

        if (isset($this->uri['port'])) {
            $port = $this->uri['port'];
        }

        $this->socket = "$protocol://{$this->uri['host']}:$port";

        if (!isset($this->headers['Host'])) {
            $this->headers['Host'] = "{$this->uri['host']}:$port";
        }

        return $this;
    }
86774
public function setHeader($aHeader = null)
    {
        if (is_null($aHeader) && $this->getMethod() == "POST") {
            $sHost = $this->getHost();

            $aHeader = array();
            $aHeader[] = 'POST /cgi-bin/webscr HTTP/1.1';
            $aHeader[] = 'Content-Type: multipart/form-data';
            if (isset($sHost)) {
                $aHeader[] = 'Host: ' . $sHost;
            }
            $aHeader[] = 'Connection: close';
        }
        $this->_aHeader = $aHeader;
    }
1118279
public function setOperator($operator)
    {
        if ($this->allowedOperators && !in_array($operator, $this->allowedOperators)) {
            throw new UnsupportedParameterException('This constraint only accepts operators: ' . implode(',', $this->allowedOperators));
        }

        $this->operator = $operator;
        return $this;
    }
1364440
def _flush_decompressor(self):
        ''''''
        if self._decompressor:
            try:
                return self._decompressor.flush()
            except zlib.error as error:
                raise ProtocolError(
                    'zlib flush error: {0}.'.format(error)
                ) from error
        else:
            return b''
993671
public function unPack($data, $isUncrypted = false)
    {
        //====================================================================//
        // Debug Log
        Splash::log()->deb('MsgWsunPack');

        //====================================================================//
        // Decrypt response
        //====================================================================//
        if (!empty($data) && !$isUncrypted) {
            $decode = $this->crypt('decrypt', $data, $this->key, $this->id);
        //====================================================================//
        // Else, switch from base64
        } else {
            $decode = base64_decode($data, true);
        }

        //====================================================================//
        // Decode Data Response
        //====================================================================//
        // Convert Data Buffer To XML
        if ('XML' == Splash::configuration()->WsEncode) {
            if ($decode && false !== strpos($decode, '<SPLASH>')) {
                $out = Splash::xml()->XmlToArrayObject($decode);
            }
            //====================================================================//
        // Unserialize Data buffer
        } else {
            if (!empty($decode)) {
                $out = unserialize($decode);
            }
        }

        //====================================================================//
        // Trow Exception if fails
        if (empty($out)) {
            Splash::log()->err('ErrWsunPack');
        }

        //====================================================================//
        //  Messages Debug Informations
        //====================================================================//
//        //  Data Decoded (PHP Serialized Objects or XML)
//        if ((!SPLASH_SERVER_MODE) && (Splash::configuration()->TraceIn)) {
//            Splash::log()->war("Splash unPack - Data Decode : " . print_r($Decode, true));
//        }
//        //====================================================================//
//        //  Final Decoded Data (ArrayObject Structure)
//        Splash::log()->deb("Splash unPack - Data unSerialized : " . print_r($Out,true) );

        //====================================================================//
        // Return Result or False
        return empty($out) ? false : $out;
    }
1202215
public static function setLoader($loader) {
    if (!$loader) {
      self::$_loader = NULL;
      return;
    }
    if ($loader instanceof FluentDOM\Loadable) {
      self::$_loader = $loader;
      return;
    }
    throw new FluentDOM\Exceptions\InvalidArgument(
      'loader', [Loadable::class]
    );
  }
1333842
public function updateWithTransport($transport)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        /** @noinspection PhpUndefinedMethodInspection */
        $this
            ->setSubject($transport->getMessage()->getSubject())
            ->setMessage($transport->getMessage())
            ->setRecipients($transport->getMessage()->getRecipients())
            ->setId(null);

        return $this;
    }
555702
def set_ntp(use_ntp)
      new_action = { 'Oem' => { 'Hp' => { 'DHCPv4' => { 'UseNTPServers' => use_ntp } } } }
      response = rest_patch('/redfish/v1/Managers/1/EthernetInterfaces/1/', body: new_action)
      response_handler(response)
      true
    end
785095
protected function setTransport(TransportInterface $transport = null)
    {
        if (is_null($transport)) {
            $this->transport = $this->createTransport();
        } else {
            $this->transport = $transport;
        }
    }
1046820
public function writeMessage(\fpoirotte\Pssht\MessageInterface $message)
    {
        $logging = \Plop\Plop::getInstance();

        // Serialize the message.
        $encoder    = new \fpoirotte\Pssht\Wire\Encoder();
        $encoder->encodeBytes(chr($message::getMessageId()));
        $message->serialize($encoder);
        $payload    = $encoder->getBuffer()->get(0);
        $logging->debug('Sending payload: %s', array(\escape($payload)));

        // Compress the payload if necessary.
        $payload    = $this->compressor->update($payload);
        $size       = strlen($payload);
        $blockSize  = max(8, $this->encryptor->getBlockSize());

        // Compute padding requirements.
        // See http://api.libssh.org/rfc/PROTOCOL
        // for more information on EtM (Encrypt-then-MAC)
        // and RFCs 5116 & 5647 for AEAD & AES-GCM.
        if ($this->outMAC instanceof \fpoirotte\Pssht\MAC\OpensshCom\EtM\EtMInterface) {
            $padSize    = $blockSize - ((1 + $size) % $blockSize);
        } elseif ($this->encryptor instanceof \fpoirotte\Pssht\AEADInterface) {
            $padSize    = $blockSize - ((1 + $size) % $blockSize);
        } else {
            $padSize    = $blockSize - ((1 + 4 + $size) % $blockSize);
        }
        if ($padSize < 4) {
            $padSize = ($padSize + $blockSize) % 256;
        }
        $padding = openssl_random_pseudo_bytes($padSize);

        // Create the packet. Every content passed to $encoder
        // will be encrypted, except possibly for the packet
        // length (see below).
        $encoder->encodeUint32(1 + $size + $padSize);
        if ($this->outMAC instanceof \fpoirotte\Pssht\MAC\OpensshCom\EtM\EtMInterface) {
            // Send the packet length in plaintext.
            $encSize = $encoder->getBuffer()->get(0);
            $this->encoder->encodeBytes($encSize);
        }
        $encoder->encodeBytes(chr($padSize));
        $encoder->encodeBytes($payload);
        $encoder->encodeBytes($padding);
        $packet     = $encoder->getBuffer()->get(0);
        $encrypted  = $this->encryptor->encrypt($this->outSeqNo, $packet);

        // Compute the MAC.
        if ($this->outMAC instanceof \fpoirotte\Pssht\MAC\OpensshCom\EtM\EtMInterface) {
            $mac = $this->outMAC->compute($this->outSeqNo, $encSize . $encrypted);
        } else {
            $mac = $this->outMAC->compute($this->outSeqNo, $packet);
        }

        // Send the packet on the wire.
        $this->encoder->encodeBytes($encrypted);
        $this->encoder->encodeBytes($mac);
        $this->outSeqNo = ++$this->outSeqNo & 0xFFFFFFFF;

        $logging->debug(
            'Sending %(type)s packet ' .
            '(size: %(size)d, payload: %(payload)d, ' .
            'block: %(block)d, padding: %(padding)d)',
            array(
                'type' => get_class($message),
                'size' => strlen($encrypted),
                'payload' => $size,
                'block' => $blockSize,
                'padding' => $padSize,
            )
        );
        return $this;
    }
441923
function setEncoding($enc = 'gzip, deflate')
    {
        if (function_exists('gzdeflate')) {
            $this->protocol_version = '1.1';
            $this->setHeader('Accept-Encoding', $enc);
            if (!isset($this->outgoing_headers['Connection'])) {
                $this->setHeader('Connection', 'close');
                $this->persistentConnection = FALSE;
            }
            // deprecated as of PHP 5.3.0
            //set_magic_quotes_runtime(0);
            $this->encoding = $enc;
        }
    }
12089
public function unsealResponse(
        ResponseInterface $response,
        SealingSecretKey $secretKey
    ): ResponseInterface {
        $body = Base64UrlSafe::decode((string) $response->getBody());
        $unsealed = Simple::unseal(
            $body,
            $secretKey
        );
        return $response->withBody($this->adapter->stringToStream($unsealed));
    }
58779
public function handle(
        $msgType,
        \fpoirotte\Pssht\Wire\Decoder $decoder,
        \fpoirotte\Pssht\Transport $transport,
        array &$context
    ) {
        $algos      = \fpoirotte\Pssht\Algorithms::factory();
        $kex        = \fpoirotte\Pssht\Messages\KEXINIT::unserialize($decoder);
        $context['kex']['client'] = $kex;

        if (!isset($context['rekeying'])) {
            $context['rekeying'] = 'client';
        }

        // KEX method
        $context['kexAlgo'] = null;
        foreach ($kex->getKEXAlgos() as $algo) {
            if ($algos->getClass('KEX', $algo) !== null) {
                $kexCls = $context['kexAlgo'] = $algos->getClass('KEX', $algo);
                break;
            }
        }
        // No suitable KEX algorithm found.
        if (!isset($context['kexAlgo'])) {
            throw new \RuntimeException();
        }
        $kexCls::addHandlers($transport);

        // C2S encryption
        $context['C2S']['Encryption'] = null;
        foreach ($kex->getC2SEncryptionAlgos() as $algo) {
            if ($algos->getClass('Encryption', $algo) !== null) {
                $context['C2S']['Encryption'] = $algos->getClass('Encryption', $algo);
                break;
            }
        }
        // No suitable C2S encryption cipher found.
        if (!isset($context['C2S']['Encryption'])) {
            throw new \RuntimeException();
        }

        // C2S compression
        $context['C2S']['Compression'] = null;
        foreach ($kex->getC2SCompressionAlgos() as $algo) {
            if ($algos->getClass('Compression', $algo) !== null) {
                $context['C2S']['Compression'] = $algos->getClass('Compression', $algo);
                break;
            }
        }
        // No suitable C2S compression found.
        if (!isset($context['C2S']['Compression'])) {
            throw new \RuntimeException();
        }

        // C2S MAC
        $context['C2S']['MAC'] = null;
        $reflector = new \ReflectionClass($context['C2S']['Encryption']);
        // Skip MAC algorithm selection for AEAD.
        if ($reflector->implementsInterface('\\fpoirotte\\Pssht\\AEADInterface')) {
            $context['C2S']['MAC'] = '\\fpoirotte\\Pssht\\MAC\\None';
        } else {
            foreach ($kex->getC2SMACAlgos() as $algo) {
                if ($algos->getClass('MAC', $algo) !== null) {
                    $context['C2S']['MAC'] = $algos->getClass('MAC', $algo);
                    break;
                }
            }
        }
        // No suitable C2S MAC found.
        if (!isset($context['C2S']['MAC'])) {
            throw new \RuntimeException();
        }

        // S2C encryption
        $context['S2C']['Encryption'] = null;
        foreach ($kex->getS2CEncryptionAlgos() as $algo) {
            if ($algos->getClass('Encryption', $algo) !== null) {
                $context['S2C']['Encryption'] = $algos->getClass('Encryption', $algo);
                break;
            }
        }
        // No suitable S2C encryption cipher found.
        if (!isset($context['S2C']['Encryption'])) {
            throw new \RuntimeException();
        }

        // S2C compression
        $context['S2C']['Compression'] = null;
        foreach ($kex->getS2CCompressionAlgos() as $algo) {
            if ($algos->getClass('Compression', $algo) !== null) {
                $context['S2C']['Compression'] = $algos->getClass('Compression', $algo);
                break;
            }
        }
        // No suitable S2C compression found.
        if (!isset($context['S2C']['Compression'])) {
            throw new \RuntimeException();
        }

        // S2C MAC
        $context['S2C']['MAC'] = null;
        $reflector = new \ReflectionClass($context['S2C']['Encryption']);
        // Skip MAC algorithm selection for AEAD.
        if ($reflector->implementsInterface('\\fpoirotte\\Pssht\\AEADInterface')) {
            $context['S2C']['MAC'] = '\\fpoirotte\\Pssht\\MAC\\None';
        } else {
            foreach ($kex->getS2CMACAlgos() as $algo) {
                if ($algos->getClass('MAC', $algo) !== null) {
                    $context['S2C']['MAC'] = $algos->getClass('MAC', $algo);
                    break;
                }
            }
        }
        // No suitable S2C MAC found.
        if (!isset($context['S2C']['MAC'])) {
            throw new \RuntimeException();
        }

        if ($context['rekeying'] === 'client') {
            $kexinit = new \fpoirotte\Pssht\Handlers\InitialState();
            return $kexinit->handleKEXINIT($transport, $context);
        }

        return true;
    }
333044
public function setSender($sender)
    {
        if (!is_null($sender) && (strlen($sender) > 11)) {
            throw new \InvalidArgumentException('invalid length for $sender when calling UpdateSmsCampaign., must be smaller than or equal to 11.');
        }

        $this->container['sender'] = $sender;

        return $this;
    }
556283
def RegisterDecompressor(cls, decompressor):
    
    compression_method = decompressor.COMPRESSION_METHOD.lower()
    if compression_method in cls._decompressors:
      raise KeyError(
          'Decompressor for compression method: {0:s} already set.'.format(
              decompressor.COMPRESSION_METHOD))

    cls._decompressors[compression_method] = decompressor