Protocol version ve code atamasını yapar
423754
private function setProtocolAndCode()
    {
        $code = intval($this->getStatusCode());
        $statusText = $this->getStatusTexts();
        if (isset($statusText[$code])) {
            $text = $statusText[$code];
        } else {
            $text = '';
        }
        header(sprintf("%s %d %s ", $this->getProtocolVersion(), $code, $text));
        http_response_code($code);
    }
362792
function f_teklifleri(tahta_id, ihale_id) {
        var defer = result.dbQ.Q.defer();

        //ihaleye bağlı teklifleri bul
        result.rc.multi()
            .sinterstore("temp_ihale_teklif", result.kp.ihale.ssetTeklifleri(ihale_id), result.kp.tahta.ssetTeklifleri(tahta_id, true))
            .smembers("temp_ihale_teklif")
            .expire("temp_ihale_teklif", 10)
            .exec(function (err, replies) {
                l.info("MULTI REPLY" + JSON.stringify(replies));

                if (replies[1] && replies[1].length > 0) {
                    defer.resolve(replies[1]);

                } else {
                    defer.resolve(null);
                }
            });

        return defer.promise;
    }
486603
protected function getCurrentPort()
    {
        // Сначала проверьте наличие прокси-сервера
        $port = $this->getHeader('X_FORWARDED_PORT');
        if ($port) {
            return (string)$port;
        }

        $protocol = (string)$this->getHeader('X_FORWARDED_PROTO');
        if ($protocol === 'https') {
            return '443';
        }

        return (string)$this->getServerVar('SERVER_PORT');
    }
441014
def get(version: str) -> 'Protocol':
        

        return Protocol.V_13 if version == Protocol.V_13.value.name else Protocol.DEFAULT
375943
private void validateRSV(byte opcodeByte) throws ProtocolDecoderException {
        if ((opcodeByte & 0x70) != 0) {
            // We don't support negotiated extensions that deal with RSV bits
            if ((opcodeByte & 0x40) != 0) {
                throw new ProtocolDecoderException("RSV1 is set");
            }
            if ((opcodeByte & 0x20) != 0) {
                throw new ProtocolDecoderException("RSV2 is set");
            }
            if ((opcodeByte & 0x10) != 0) {
                throw new ProtocolDecoderException("RSV3 is set");
            }
        }
    }
976473
public function Rfc2822()
    {
        $formatter = $this->getInternalFormatter();
        $formatter->setPattern('y-MM-dd HH:mm:ss');
        return $formatter->format($this->getTimestamp());
    }
450794
def resolve_ssl_version(candidate):
    
    if candidate is None:
        return PROTOCOL_SSLv23

    if isinstance(candidate, str):
        res = getattr(ssl, candidate, None)
        if res is None:
            res = getattr(ssl, 'PROTOCOL_' + candidate)
        return res

    return candidate
45681
public function getProtocolVersion()
    {
        if ($this->protocol === null) {
            if ($this->protocolProvider !== null) {
                $this->protocol = ($this->protocolProvider)();
            } else {
                $this->protocol = '1.1';
            }
        }
        return $this->protocol;
    }
976562
def handle_get_version_command(self):
        
        protocol = Element('protocol')
        for name, value in [('name', 'OSP'), ('version', self.get_protocol_version())]:
            elem = SubElement(protocol, name)
            elem.text = value

        daemon = Element('daemon')
        for name, value in [('name', self.get_daemon_name()), ('version', self.get_daemon_version())]:
            elem = SubElement(daemon, name)
            elem.text = value

        scanner = Element('scanner')
        for name, value in [('name', self.get_scanner_name()), ('version', self.get_scanner_version())]:
            elem = SubElement(scanner, name)
            elem.text = value

        content = [protocol, daemon, scanner]

        if self.get_vts_version():
            vts = Element('vts')
            elem = SubElement(vts, 'version')
            elem.text = self.get_vts_version()
            content.append(vts)

        return simple_response_str('get_version', 200, 'OK', content)
437235
def get_version_id(protocol_version):
    
    ver = registry.version_info.get(protocol_version)
    if ver:
        return ver.version_id
538221
ProtocolVersion selectProtocolVersion(ProtocolVersion protocolVersion) {
        if (activeProtocols == null) {
            activeProtocols = getActiveProtocols();
        }

        return activeProtocols.selectProtocolVersion(protocolVersion);
    }
524876
def sanitize(self):
        '''
        
        '''
        # Let the parent do its stuff
        super(IPv4Packet, self).sanitize()

        # Check the version
        if self.version != 4:
            raise ValueError("Protocol version must be 4")

        # Treat type-of-service as an 8-bit unsigned integer. Future versions
        # of this code may implement methods to treat it as DSCP+ECN
        if not isinstance(self.tos, numbers.Integral) \
        or self.tos < 0 \
        or self.tos >= 2 ** 8:
            raise ValueError('Invalid type of service')

        # Identification: An identifying value assigned by the sender to aid in
        # assembling the fragments of a datagram.
        if not isinstance(self.identification, numbers.Integral) \
        or self.identification < 0 \
        or self.identification >= 2 ** 16:
            raise ValueError('Invalid fragment identification')

        # An internet datagram can be marked "don't fragment."  Any internet
        # datagram so marked is not to be internet fragmented under any
        # circumstances.  If internet datagram marked don't fragment cannot be
        # delivered to its destination without fragmenting it, it is to be
        # discarded instead.
        if not isinstance(self.dont_fragment, bool):
            raise ValueError("Don't fragment flag must be a boolean")

        # The More Fragments flag bit (MF) is set if the datagram is not the
        # last fragment.  The Fragment Offset field identifies the fragment
        # location, relative to the beginning of the original unfragmented
        # datagram.  Fragments are counted in units of 8 octets.  The
        # fragmentation strategy is designed so than an unfragmented datagram
        # has all zero fragmentation information (MF = 0, fragment offset =
        # 0).  If an internet datagram is fragmented, its data portion must be
        # broken on 8 octet boundaries.
        if not isinstance(self.more_fragments, bool):
            raise ValueError('More fragments flag must be a boolean')

        # Fragment offset: This field indicates where in the datagram this
        # fragment belongs. The fragment offset is measured in units of 8
        # octets (64 bits).  The first fragment has offset zero.
        if not isinstance(self.fragment_offset, numbers.Integral) \
        or self.fragment_offset < 0 \
        or self.fragment_offset >= 2 ** 13:
            raise ValueError('Invalid fragment offset')

        # Check for don't-fragment combined with a fragment offset
        if self.dont_fragment and self.fragment_offset > 0:
            raise ValueError("A packet marked don't fragment can't have "
                             "a fragment-offset")

        # Check that the TTL is correct
        if not isinstance(self.ttl, numbers.Integral) \
        or self.ttl < 0 \
        or self.ttl >= 2 ** 8:
            raise ValueError('Invalid TTL')

        # Check the source and destination addresses
        if not isinstance(self.source, IPv4Address):
            raise ValueError('Source address must be IPv4')

        if not isinstance(self.destination, IPv4Address):
            raise ValueError('Destination address must be IPv4')
84404
def to_payload
      version.htb << [depth].pack('C') <<
          parent_fingerprint.htb << [number].pack('N') << chain_code << pub.htb
    end
1146234
private static function uuid4()
    {
        $bytes =
            function_exists('openssl_random_pseudo_bytes')
                ? openssl_random_pseudo_bytes(16)
                : self::generateBytes(16);


        $hash = bin2hex($bytes);

        // Set the version number
        $timeHi = hexdec(substr($hash, 12, 4)) & 0x0fff;
        $timeHi &= ~(0xf000);
        $timeHi |= 4 << 12;

        // Set the variant to RFC 4122
        $clockSeqHi = hexdec(substr($hash, 16, 2)) & 0x3f;
        $clockSeqHi &= ~(0xc0);
        $clockSeqHi |= 0x80;

        $fields = [
            'time_low' => substr($hash, 0, 8),
            'time_mid' => substr($hash, 8, 4),
            'time_hi_and_version' => sprintf('%04x', $timeHi),
            'clock_seq_hi_and_reserved' => sprintf('%02x', $clockSeqHi),
            'clock_seq_low' => substr($hash, 18, 2),
            'node' => substr($hash, 20, 12),
        ];

        return vsprintf(
            '%08s-%04s-%04s-%02s%02s-%012s',
            $fields
        );
    }
1307693
public function code(): string
    {
        $version = config('doorman.uuid.version', 4);

        $method = 'createVersion' . $version . 'Uuid';

        if (method_exists($this, $method)) {
            return $this->$method();
        }

        throw new InvalidArgumentException("Version [$version] not supported.");
    }
1137379
def version():
    '''
    
    '''
    amajor = FT_Int()
    aminor = FT_Int()
    apatch = FT_Int()
    library = get_handle()
    FT_Library_Version(library, byref(amajor), byref(aminor), byref(apatch))
    return (amajor.value, aminor.value, apatch.value)
113437
def checkProto(proto)
            if proto != Protocol::UDP && proto != Protocol::TCP then
                raise ArgumentError, "Unknown protocol #{proto}, only Protocol::TCP and Protocol::UDP are valid."
            end
        end