/// <summary> /// <see cref="AGDnsApi.AGDnsProxyServerCallbacks.ag_dns_request_processed_cb"/> adapter /// </summary> /// <param name="pInfo">The pointer to an instance of /// <see cref="AGDnsApi.ag_dns_request_processed_event"/></param> private void AGCOnDnsRequestProcessed(IntPtr pInfo) { try { AGDnsApi.ag_dns_request_processed_event coreArgs = MarshalUtils.PtrToStructure <AGDnsApi.ag_dns_request_processed_event>(pInfo); DnsRequestProcessedEventArgs args = DnsApiConverter.FromNativeObject(coreArgs); m_DnsServerCallbackConfiguration.OnDnsRequestProcessed(m_ProxyServer, args); } catch (Exception ex) { DnsExceptionHandler.HandleManagedException(ex); } }
private static Dns64Settings FromNativeObject(IntPtr pDns64C) { AGDnsApi.ag_dns64_settings dns64C = MarshalUtils.PtrToStructure <AGDnsApi.ag_dns64_settings>(pDns64C); List <UpstreamOptions> dns64Upstreams = MarshalUtils.AgListToList <AGDnsApi.ag_upstream_options, UpstreamOptions>( dns64C.upstreams, FromNativeObject); Dns64Settings dns64 = new Dns64Settings { Upstreams = dns64Upstreams }; MarshalUtils.CopyFieldsToProperties(dns64C, dns64); return(dns64); }
/// <summary> /// <see cref="AGDnsApi.cbd_onCertificateVerification"/> adapter /// </summary> /// <param name="pInfo">The pointer to an instance of /// <see cref="AGDnsApi.ag_certificate_verification_event"/></param> /// <returns>Certificate verification result /// (<seealso cref="AGDnsApi.ag_certificate_verification_result"/>)</returns> private AGDnsApi.ag_certificate_verification_result AGCOnCertificateVerification(IntPtr pInfo) { try { AGDnsApi.ag_certificate_verification_event coreArgs = MarshalUtils.PtrToStructure <AGDnsApi.ag_certificate_verification_event>(pInfo); CertificateVerificationEventArgs args = DnsApiConverter.FromNativeObject(coreArgs); AGDnsApi.ag_certificate_verification_result certificateVerificationResult = m_CertificateVerificationCallback.OnCertificateVerification(this, args); return(certificateVerificationResult); } catch (Exception ex) { DnsExceptionHandler.HandleManagedException(ex); return(AGDnsApi.ag_certificate_verification_result.AGCVR_ERROR_CERT_VERIFICATION); } }
private static OutboundProxySettings FromNativeObject( AGDnsApi.ag_outbound_proxy_settings outboundProxySettingsC) { AGDnsApi.ag_outbound_proxy_auth_info outboundProxyAuthInfoC = MarshalUtils.PtrToStructure <AGDnsApi.ag_outbound_proxy_auth_info>( outboundProxySettingsC.auth_info); OutboundProxyAuthInfo authInfo = FromNativeObject(outboundProxyAuthInfoC); OutboundProxySettings outboundProxySettings = new OutboundProxySettings { AuthInfo = authInfo }; MarshalUtils.CopyFieldsToProperties(outboundProxySettingsC, outboundProxySettings); MarshalUtils.AllPtrsToStrings(outboundProxySettingsC, outboundProxySettings); return(outboundProxySettings); }
internal static DnsProxySettings FromNativeObject( AGDnsApi.ag_dnsproxy_settings dnsProxySettingsC) { List <UpstreamOptions> upstreams = MarshalUtils.AgListToList <AGDnsApi.ag_upstream_options, UpstreamOptions>( dnsProxySettingsC.upstreams, FromNativeObject); List <UpstreamOptions> fallbacks = MarshalUtils.AgListToList <AGDnsApi.ag_upstream_options, UpstreamOptions>( dnsProxySettingsC.fallbacks, FromNativeObject); List <string> fallbackDomains = MarshalUtils.AgListToList <IntPtr, string>( dnsProxySettingsC.fallbackDomains, MarshalUtils.PtrToString); AGDnsApi.ag_dns64_settings dns64C = MarshalUtils.PtrToStructure <AGDnsApi.ag_dns64_settings>(dnsProxySettingsC.pDns64); Dns64Settings dns64 = FromNativeObject(dns64C); EngineParams engineParams = FromNativeObject(dnsProxySettingsC.FilterParams); List <ListenerSettings> listeners = MarshalUtils.AgListToList <AGDnsApi.ag_listener_settings, ListenerSettings>( dnsProxySettingsC.listeners, FromNativeObject); AGDnsApi.ag_outbound_proxy_settings outboundProxySettingsC = MarshalUtils.PtrToStructure <AGDnsApi.ag_outbound_proxy_settings>(dnsProxySettingsC.outbound_proxy); OutboundProxySettings outboundProxySettings = FromNativeObject(outboundProxySettingsC); DnsProxySettings dnsProxySettings = new DnsProxySettings { Upstreams = upstreams, Fallbacks = fallbacks, FallbackDomains = fallbackDomains, Dns64 = dns64, EngineParams = engineParams, Listeners = listeners, OutboundProxySettings = outboundProxySettings }; MarshalUtils.CopyFieldsToProperties(dnsProxySettingsC, dnsProxySettings); MarshalUtils.AllPtrsToStrings(dnsProxySettingsC, dnsProxySettings); return(dnsProxySettings); }