bool Coder<WebCore::CertificateInfo>::decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
{
    WebCore::CertificateInfo::Type certificateInfoType;
    if (!decoder.decodeEnum(certificateInfoType))
        return false;

    switch (certificateInfoType) {
#if HAVE(SEC_TRUST_SERIALIZATION)
    case WebCore::CertificateInfo::Type::Trust: {
        RetainPtr<SecTrustRef> trust;
        if (!decodeSecTrustRef(decoder, trust))
            return false;

        certificateInfo = WebCore::CertificateInfo(WTFMove(trust));
        return true;
    }
#endif
    case WebCore::CertificateInfo::Type::CertificateChain: {
        RetainPtr<CFArrayRef> certificateChain;
        if (!decodeCertificateChain(decoder, certificateChain))
            return false;

        certificateInfo = WebCore::CertificateInfo(WTFMove(certificateChain));
        return true;
    }    
    case WebCore::CertificateInfo::Type::None:
        // Do nothing.
        break;
    }

    return true;
}
Beispiel #2
0
    static void decode(Decoder& d, resetT& v) {
		size_t index = d.decodeEnum();
		if (index < reset || index > reset)
		{
			std::ostringstream error;
			error << "enum value " << index << " is out of bound for resetT and cannot be decoded";
			throw avro::Exception(error.str());
		}
        v = static_cast<resetT>(index);
    }
Beispiel #3
0
    static void decode(Decoder& d, strategyT& v) {
		size_t index = d.decodeEnum();
		if (index < DEFAULT || index > CONCRETE2)
		{
			std::ostringstream error;
			error << "enum value " << index << " is out of bound for strategyT and cannot be decoded";
			throw avro::Exception(error.str());
		}
        v = static_cast<strategyT>(index);
    }
Beispiel #4
0
    static void decode(Decoder& d, unchangedT& v) {
		size_t index = d.decodeEnum();
		if (index < unchanged || index > unchanged)
		{
			std::ostringstream error;
			error << "enum value " << index << " is out of bound for unchangedT and cannot be decoded";
			throw avro::Exception(error.str());
		}
        v = static_cast<unchangedT>(index);
    }
Beispiel #5
0
    static void decode(Decoder& d, userRoleT& v) {
		size_t index = d.decodeEnum();
		if (index < ADMIN || index > GUEST)
		{
			std::ostringstream error;
			error << "enum value " << index << " is out of bound for userRoleT and cannot be decoded";
			throw avro::Exception(error.str());
		}
        v = static_cast<userRoleT>(index);
    }