public byte[] EncodeChain(CallerChain chain) { try { CallerChainImpl chainImpl = (CallerChainImpl)chain; int i = 0; VersionedData? actualVersion = null; VersionedData? legacyVersion = null; if (!chainImpl.Legacy) { // se não é legacy, tem a versão atual. Pode ter a versão legacy ou não. TypeCode signedChainTC = _orb.create_tc_for_type(typeof(SignedData)); Any any = new Any(chainImpl.Signed.Chain, signedChainTC); byte[] encoded = _codec.encode_value(any); actualVersion = new VersionedData(ExportVersion.ConstVal, encoded); i++; } if (chainImpl.Signed.LegacyChain.encoded != null) { ExportedCallChain exported = new ExportedCallChain(chainImpl.BusId, chainImpl.Signed.LegacyChain); TypeCode exportedChainTC = _orb.create_tc_for_type(typeof(ExportedCallChain)); Any any = new Any(exported, exportedChainTC); byte[] legacyEncoded = _codec.encode_value(any); legacyVersion = new VersionedData(CurrentVersion.ConstVal, legacyEncoded); i++; } VersionedData[] versions = new VersionedData[i]; // A ordem das versões exportadas IMPORTA. A 2.1 deve vir antes da 2.0. if (legacyVersion != null) { versions[--i] = legacyVersion.Value; } if (actualVersion != null) { versions[--i] = actualVersion.Value; } return(EncodeExportedVersions(versions, _magicTagCallChain)); } catch (InvalidTypeForEncoding e) { const string message = "Falha inesperada ao codificar uma cadeia para exportação."; Logger.Error(message, e); throw new OpenBusInternalException(message, e); } }
private static CredentialData UnmarshalCredential(ServiceContext serviceContext) { OrbServices orb = OrbServices.GetSingleton(); TypeCode credentialTypeCode = orb.create_tc_for_type(typeof(CredentialData)); byte[] data = serviceContext.context_data; return((CredentialData)InterceptorsInitializer.Codec.decode_value(data, credentialTypeCode)); }
public void TestNilReferenceAsAny() { OrbServices orb = OrbServices.GetSingleton(); omg.org.CORBA.TypeCode nilRefTC = orb.create_tc_for_type(typeof(System.MarshalByRefObject)); Any nilRefAny = new Any(null, nilRefTC); object result = m_testService.EchoAny(nilRefAny); Assert.IsNull(result, "result not null"); Any nilRefAny2 = new Any(null, orb.create_interface_tc(String.Empty, String.Empty)); object result2 = m_testService.EchoAny(nilRefAny2); Assert.IsNull(result2, "result not null"); }
public BiDirIiopServerInterceptor(OrbServices orb) { m_codec = orb.CodecFactory.create_codec( new Encoding(ENCODING_CDR_ENCAPS.ConstVal, 1, 2)); m_svcContextTypeCode = orb.create_tc_for_type(typeof(BiDirIIOPServiceContext)); }