// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace GLib {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class TlsDatabase : GLib.Object {

		public TlsDatabase (IntPtr raw) : base(raw) {}

		protected TlsDatabase() : base(IntPtr.Zero)
		{
			CreateNativeObject (Array.Empty<string> (), Array.Empty<GLib.Value> ());
		}

		static VerifyChainNativeDelegate VerifyChain_cb_delegate;
		static VerifyChainNativeDelegate VerifyChainVMCallback {
			get {
				if (VerifyChain_cb_delegate == null)
					VerifyChain_cb_delegate = new VerifyChainNativeDelegate (VerifyChain_cb);
				return VerifyChain_cb_delegate;
			}
		}

		static void OverrideVerifyChain (GLib.GType gtype)
		{
			OverrideVerifyChain (gtype, VerifyChainVMCallback);
		}

		static void OverrideVerifyChain (GLib.GType gtype, VerifyChainNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("verify_chain"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int VerifyChainNativeDelegate (IntPtr inst, IntPtr chain, IntPtr purpose, IntPtr identity, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error);

		static int VerifyChain_cb (IntPtr inst, IntPtr chain, IntPtr purpose, IntPtr identity, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLib.TlsCertificateFlags __result;
				__result = __obj.OnVerifyChain (GLib.Object.GetObject(chain) as GLib.TlsCertificate, GLib.Marshaller.Utf8PtrToString (purpose), GLib.SocketConnectableAdapter.GetObject (identity, false), GLib.Object.GetObject(interaction) as GLib.TlsInteraction, (GLib.TlsDatabaseVerifyFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideVerifyChain")]
		protected virtual GLib.TlsCertificateFlags OnVerifyChain (GLib.TlsCertificate chain, string purpose, GLib.ISocketConnectable identity, GLib.TlsInteraction interaction, GLib.TlsDatabaseVerifyFlags flags, GLib.Cancellable cancellable)
		{
			return InternalVerifyChain (chain, purpose, identity, interaction, flags, cancellable);
		}

		private GLib.TlsCertificateFlags InternalVerifyChain (GLib.TlsCertificate chain, string purpose, GLib.ISocketConnectable identity, GLib.TlsInteraction interaction, GLib.TlsDatabaseVerifyFlags flags, GLib.Cancellable cancellable)
		{
			VerifyChainNativeDelegate unmanaged = class_abi.BaseOverride<VerifyChainNativeDelegate>(this.LookupGType(), "verify_chain");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr native_purpose = GLib.Marshaller.StringToPtrGStrdup (purpose);
			IntPtr error = IntPtr.Zero;
			int __result = unmanaged (this.Handle, chain == null ? IntPtr.Zero : chain.Handle, native_purpose, identity == null ? IntPtr.Zero : ((identity is GLib.Object) ? (identity as GLib.Object).Handle : (identity as GLib.SocketConnectableAdapter).Handle), interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.Marshaller.Free (native_purpose);
			return (GLib.TlsCertificateFlags) __result;
		}

		static VerifyChainAsyncNativeDelegate VerifyChainAsync_cb_delegate;
		static VerifyChainAsyncNativeDelegate VerifyChainAsyncVMCallback {
			get {
				if (VerifyChainAsync_cb_delegate == null)
					VerifyChainAsync_cb_delegate = new VerifyChainAsyncNativeDelegate (VerifyChainAsync_cb);
				return VerifyChainAsync_cb_delegate;
			}
		}

		static void OverrideVerifyChainAsync (GLib.GType gtype)
		{
			OverrideVerifyChainAsync (gtype, VerifyChainAsyncVMCallback);
		}

		static void OverrideVerifyChainAsync (GLib.GType gtype, VerifyChainAsyncNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("verify_chain_async"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void VerifyChainAsyncNativeDelegate (IntPtr inst, IntPtr chain, IntPtr purpose, IntPtr identity, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void VerifyChainAsync_cb (IntPtr inst, IntPtr chain, IntPtr purpose, IntPtr identity, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnVerifyChainAsync (GLib.Object.GetObject(chain) as GLib.TlsCertificate, GLib.Marshaller.Utf8PtrToString (purpose), GLib.SocketConnectableAdapter.GetObject (identity, false), GLib.Object.GetObject(interaction) as GLib.TlsInteraction, (GLib.TlsDatabaseVerifyFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideVerifyChainAsync")]
		protected virtual void OnVerifyChainAsync (GLib.TlsCertificate chain, string purpose, GLib.ISocketConnectable identity, GLib.TlsInteraction interaction, GLib.TlsDatabaseVerifyFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalVerifyChainAsync (chain, purpose, identity, interaction, flags, cancellable, cb);
		}

		private void InternalVerifyChainAsync (GLib.TlsCertificate chain, string purpose, GLib.ISocketConnectable identity, GLib.TlsInteraction interaction, GLib.TlsDatabaseVerifyFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			VerifyChainAsyncNativeDelegate unmanaged = class_abi.BaseOverride<VerifyChainAsyncNativeDelegate>(this.LookupGType(), "verify_chain_async");
			if (unmanaged == null) return;

			IntPtr native_purpose = GLib.Marshaller.StringToPtrGStrdup (purpose);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			unmanaged (this.Handle, chain == null ? IntPtr.Zero : chain.Handle, native_purpose, identity == null ? IntPtr.Zero : ((identity is GLib.Object) ? (identity as GLib.Object).Handle : (identity as GLib.SocketConnectableAdapter).Handle), interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_purpose);
		}

		static VerifyChainFinishNativeDelegate VerifyChainFinish_cb_delegate;
		static VerifyChainFinishNativeDelegate VerifyChainFinishVMCallback {
			get {
				if (VerifyChainFinish_cb_delegate == null)
					VerifyChainFinish_cb_delegate = new VerifyChainFinishNativeDelegate (VerifyChainFinish_cb);
				return VerifyChainFinish_cb_delegate;
			}
		}

		static void OverrideVerifyChainFinish (GLib.GType gtype)
		{
			OverrideVerifyChainFinish (gtype, VerifyChainFinishVMCallback);
		}

		static void OverrideVerifyChainFinish (GLib.GType gtype, VerifyChainFinishNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("verify_chain_finish"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int VerifyChainFinishNativeDelegate (IntPtr inst, IntPtr result, out IntPtr error);

		static int VerifyChainFinish_cb (IntPtr inst, IntPtr result, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLib.TlsCertificateFlags __result;
				__result = __obj.OnVerifyChainFinish (GLib.AsyncResultAdapter.GetObject (result, false));
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideVerifyChainFinish")]
		protected virtual GLib.TlsCertificateFlags OnVerifyChainFinish (GLib.IAsyncResult result)
		{
			return InternalVerifyChainFinish (result);
		}

		private GLib.TlsCertificateFlags InternalVerifyChainFinish (GLib.IAsyncResult result)
		{
			VerifyChainFinishNativeDelegate unmanaged = class_abi.BaseOverride<VerifyChainFinishNativeDelegate>(this.LookupGType(), "verify_chain_finish");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr error = IntPtr.Zero;
			int __result = unmanaged (this.Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			return (GLib.TlsCertificateFlags) __result;
		}

		static CreateCertificateHandleNativeDelegate CreateCertificateHandle_cb_delegate;
		static CreateCertificateHandleNativeDelegate CreateCertificateHandleVMCallback {
			get {
				if (CreateCertificateHandle_cb_delegate == null)
					CreateCertificateHandle_cb_delegate = new CreateCertificateHandleNativeDelegate (CreateCertificateHandle_cb);
				return CreateCertificateHandle_cb_delegate;
			}
		}

		static void OverrideCreateCertificateHandle (GLib.GType gtype)
		{
			OverrideCreateCertificateHandle (gtype, CreateCertificateHandleVMCallback);
		}

		static void OverrideCreateCertificateHandle (GLib.GType gtype, CreateCertificateHandleNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("create_certificate_handle"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr CreateCertificateHandleNativeDelegate (IntPtr inst, IntPtr certificate);

		static IntPtr CreateCertificateHandle_cb (IntPtr inst, IntPtr certificate)
		{
			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				string __result;
				__result = __obj.OnCreateCertificateHandle (GLib.Object.GetObject(certificate) as GLib.TlsCertificate);
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideCreateCertificateHandle")]
		protected virtual string OnCreateCertificateHandle (GLib.TlsCertificate certificate)
		{
			return InternalCreateCertificateHandle (certificate);
		}

		private string InternalCreateCertificateHandle (GLib.TlsCertificate certificate)
		{
			CreateCertificateHandleNativeDelegate unmanaged = class_abi.BaseOverride<CreateCertificateHandleNativeDelegate>(this.LookupGType(), "create_certificate_handle");
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle, certificate == null ? IntPtr.Zero : certificate.Handle);
			return GLib.Marshaller.PtrToStringGFree(__result);
		}

		static LookupCertificateForHandleNativeDelegate LookupCertificateForHandle_cb_delegate;
		static LookupCertificateForHandleNativeDelegate LookupCertificateForHandleVMCallback {
			get {
				if (LookupCertificateForHandle_cb_delegate == null)
					LookupCertificateForHandle_cb_delegate = new LookupCertificateForHandleNativeDelegate (LookupCertificateForHandle_cb);
				return LookupCertificateForHandle_cb_delegate;
			}
		}

		static void OverrideLookupCertificateForHandle (GLib.GType gtype)
		{
			OverrideLookupCertificateForHandle (gtype, LookupCertificateForHandleVMCallback);
		}

		static void OverrideLookupCertificateForHandle (GLib.GType gtype, LookupCertificateForHandleNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificate_for_handle"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupCertificateForHandleNativeDelegate (IntPtr inst, IntPtr handle, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error);

		static IntPtr LookupCertificateForHandle_cb (IntPtr inst, IntPtr handle, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLib.TlsCertificate __result;
				__result = __obj.OnLookupCertificateForHandle (GLib.Marshaller.Utf8PtrToString (handle), GLib.Object.GetObject(interaction) as GLib.TlsInteraction, (GLib.TlsDatabaseLookupFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificateForHandle")]
		protected virtual GLib.TlsCertificate OnLookupCertificateForHandle (string handle, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable)
		{
			return InternalLookupCertificateForHandle (handle, interaction, flags, cancellable);
		}

		private GLib.TlsCertificate InternalLookupCertificateForHandle (string handle, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable)
		{
			LookupCertificateForHandleNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificateForHandleNativeDelegate>(this.LookupGType(), "lookup_certificate_for_handle");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr native_handle = GLib.Marshaller.StringToPtrGStrdup (handle);
			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, native_handle, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.Marshaller.Free (native_handle);
			return GLib.Object.GetObject(__result) as GLib.TlsCertificate;
		}

		static LookupCertificateForHandleAsyncNativeDelegate LookupCertificateForHandleAsync_cb_delegate;
		static LookupCertificateForHandleAsyncNativeDelegate LookupCertificateForHandleAsyncVMCallback {
			get {
				if (LookupCertificateForHandleAsync_cb_delegate == null)
					LookupCertificateForHandleAsync_cb_delegate = new LookupCertificateForHandleAsyncNativeDelegate (LookupCertificateForHandleAsync_cb);
				return LookupCertificateForHandleAsync_cb_delegate;
			}
		}

		static void OverrideLookupCertificateForHandleAsync (GLib.GType gtype)
		{
			OverrideLookupCertificateForHandleAsync (gtype, LookupCertificateForHandleAsyncVMCallback);
		}

		static void OverrideLookupCertificateForHandleAsync (GLib.GType gtype, LookupCertificateForHandleAsyncNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificate_for_handle_async"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void LookupCertificateForHandleAsyncNativeDelegate (IntPtr inst, IntPtr handle, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void LookupCertificateForHandleAsync_cb (IntPtr inst, IntPtr handle, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnLookupCertificateForHandleAsync (GLib.Marshaller.Utf8PtrToString (handle), GLib.Object.GetObject(interaction) as GLib.TlsInteraction, (GLib.TlsDatabaseLookupFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificateForHandleAsync")]
		protected virtual void OnLookupCertificateForHandleAsync (string handle, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalLookupCertificateForHandleAsync (handle, interaction, flags, cancellable, cb);
		}

		private void InternalLookupCertificateForHandleAsync (string handle, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			LookupCertificateForHandleAsyncNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificateForHandleAsyncNativeDelegate>(this.LookupGType(), "lookup_certificate_for_handle_async");
			if (unmanaged == null) return;

			IntPtr native_handle = GLib.Marshaller.StringToPtrGStrdup (handle);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			unmanaged (this.Handle, native_handle, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_handle);
		}

		static LookupCertificateForHandleFinishNativeDelegate LookupCertificateForHandleFinish_cb_delegate;
		static LookupCertificateForHandleFinishNativeDelegate LookupCertificateForHandleFinishVMCallback {
			get {
				if (LookupCertificateForHandleFinish_cb_delegate == null)
					LookupCertificateForHandleFinish_cb_delegate = new LookupCertificateForHandleFinishNativeDelegate (LookupCertificateForHandleFinish_cb);
				return LookupCertificateForHandleFinish_cb_delegate;
			}
		}

		static void OverrideLookupCertificateForHandleFinish (GLib.GType gtype)
		{
			OverrideLookupCertificateForHandleFinish (gtype, LookupCertificateForHandleFinishVMCallback);
		}

		static void OverrideLookupCertificateForHandleFinish (GLib.GType gtype, LookupCertificateForHandleFinishNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificate_for_handle_finish"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupCertificateForHandleFinishNativeDelegate (IntPtr inst, IntPtr result, out IntPtr error);

		static IntPtr LookupCertificateForHandleFinish_cb (IntPtr inst, IntPtr result, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLib.TlsCertificate __result;
				__result = __obj.OnLookupCertificateForHandleFinish (GLib.AsyncResultAdapter.GetObject (result, false));
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificateForHandleFinish")]
		protected virtual GLib.TlsCertificate OnLookupCertificateForHandleFinish (GLib.IAsyncResult result)
		{
			return InternalLookupCertificateForHandleFinish (result);
		}

		private GLib.TlsCertificate InternalLookupCertificateForHandleFinish (GLib.IAsyncResult result)
		{
			LookupCertificateForHandleFinishNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificateForHandleFinishNativeDelegate>(this.LookupGType(), "lookup_certificate_for_handle_finish");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			return GLib.Object.GetObject(__result) as GLib.TlsCertificate;
		}

		static LookupCertificateIssuerNativeDelegate LookupCertificateIssuer_cb_delegate;
		static LookupCertificateIssuerNativeDelegate LookupCertificateIssuerVMCallback {
			get {
				if (LookupCertificateIssuer_cb_delegate == null)
					LookupCertificateIssuer_cb_delegate = new LookupCertificateIssuerNativeDelegate (LookupCertificateIssuer_cb);
				return LookupCertificateIssuer_cb_delegate;
			}
		}

		static void OverrideLookupCertificateIssuer (GLib.GType gtype)
		{
			OverrideLookupCertificateIssuer (gtype, LookupCertificateIssuerVMCallback);
		}

		static void OverrideLookupCertificateIssuer (GLib.GType gtype, LookupCertificateIssuerNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificate_issuer"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupCertificateIssuerNativeDelegate (IntPtr inst, IntPtr certificate, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error);

		static IntPtr LookupCertificateIssuer_cb (IntPtr inst, IntPtr certificate, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLib.TlsCertificate __result;
				__result = __obj.OnLookupCertificateIssuer (GLib.Object.GetObject(certificate) as GLib.TlsCertificate, GLib.Object.GetObject(interaction) as GLib.TlsInteraction, (GLib.TlsDatabaseLookupFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificateIssuer")]
		protected virtual GLib.TlsCertificate OnLookupCertificateIssuer (GLib.TlsCertificate certificate, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable)
		{
			return InternalLookupCertificateIssuer (certificate, interaction, flags, cancellable);
		}

		private GLib.TlsCertificate InternalLookupCertificateIssuer (GLib.TlsCertificate certificate, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable)
		{
			LookupCertificateIssuerNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificateIssuerNativeDelegate>(this.LookupGType(), "lookup_certificate_issuer");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, certificate == null ? IntPtr.Zero : certificate.Handle, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			return GLib.Object.GetObject(__result) as GLib.TlsCertificate;
		}

		static LookupCertificateIssuerAsyncNativeDelegate LookupCertificateIssuerAsync_cb_delegate;
		static LookupCertificateIssuerAsyncNativeDelegate LookupCertificateIssuerAsyncVMCallback {
			get {
				if (LookupCertificateIssuerAsync_cb_delegate == null)
					LookupCertificateIssuerAsync_cb_delegate = new LookupCertificateIssuerAsyncNativeDelegate (LookupCertificateIssuerAsync_cb);
				return LookupCertificateIssuerAsync_cb_delegate;
			}
		}

		static void OverrideLookupCertificateIssuerAsync (GLib.GType gtype)
		{
			OverrideLookupCertificateIssuerAsync (gtype, LookupCertificateIssuerAsyncVMCallback);
		}

		static void OverrideLookupCertificateIssuerAsync (GLib.GType gtype, LookupCertificateIssuerAsyncNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificate_issuer_async"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void LookupCertificateIssuerAsyncNativeDelegate (IntPtr inst, IntPtr certificate, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void LookupCertificateIssuerAsync_cb (IntPtr inst, IntPtr certificate, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnLookupCertificateIssuerAsync (GLib.Object.GetObject(certificate) as GLib.TlsCertificate, GLib.Object.GetObject(interaction) as GLib.TlsInteraction, (GLib.TlsDatabaseLookupFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificateIssuerAsync")]
		protected virtual void OnLookupCertificateIssuerAsync (GLib.TlsCertificate certificate, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalLookupCertificateIssuerAsync (certificate, interaction, flags, cancellable, cb);
		}

		private void InternalLookupCertificateIssuerAsync (GLib.TlsCertificate certificate, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			LookupCertificateIssuerAsyncNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificateIssuerAsyncNativeDelegate>(this.LookupGType(), "lookup_certificate_issuer_async");
			if (unmanaged == null) return;

			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			unmanaged (this.Handle, certificate == null ? IntPtr.Zero : certificate.Handle, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

		static LookupCertificateIssuerFinishNativeDelegate LookupCertificateIssuerFinish_cb_delegate;
		static LookupCertificateIssuerFinishNativeDelegate LookupCertificateIssuerFinishVMCallback {
			get {
				if (LookupCertificateIssuerFinish_cb_delegate == null)
					LookupCertificateIssuerFinish_cb_delegate = new LookupCertificateIssuerFinishNativeDelegate (LookupCertificateIssuerFinish_cb);
				return LookupCertificateIssuerFinish_cb_delegate;
			}
		}

		static void OverrideLookupCertificateIssuerFinish (GLib.GType gtype)
		{
			OverrideLookupCertificateIssuerFinish (gtype, LookupCertificateIssuerFinishVMCallback);
		}

		static void OverrideLookupCertificateIssuerFinish (GLib.GType gtype, LookupCertificateIssuerFinishNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificate_issuer_finish"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupCertificateIssuerFinishNativeDelegate (IntPtr inst, IntPtr result, out IntPtr error);

		static IntPtr LookupCertificateIssuerFinish_cb (IntPtr inst, IntPtr result, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLib.TlsCertificate __result;
				__result = __obj.OnLookupCertificateIssuerFinish (GLib.AsyncResultAdapter.GetObject (result, false));
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificateIssuerFinish")]
		protected virtual GLib.TlsCertificate OnLookupCertificateIssuerFinish (GLib.IAsyncResult result)
		{
			return InternalLookupCertificateIssuerFinish (result);
		}

		private GLib.TlsCertificate InternalLookupCertificateIssuerFinish (GLib.IAsyncResult result)
		{
			LookupCertificateIssuerFinishNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificateIssuerFinishNativeDelegate>(this.LookupGType(), "lookup_certificate_issuer_finish");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			return GLib.Object.GetObject(__result) as GLib.TlsCertificate;
		}

		static LookupCertificatesIssuedByNativeDelegate LookupCertificatesIssuedBy_cb_delegate;
		static LookupCertificatesIssuedByNativeDelegate LookupCertificatesIssuedByVMCallback {
			get {
				if (LookupCertificatesIssuedBy_cb_delegate == null)
					LookupCertificatesIssuedBy_cb_delegate = new LookupCertificatesIssuedByNativeDelegate (LookupCertificatesIssuedBy_cb);
				return LookupCertificatesIssuedBy_cb_delegate;
			}
		}

		static void OverrideLookupCertificatesIssuedBy (GLib.GType gtype)
		{
			OverrideLookupCertificatesIssuedBy (gtype, LookupCertificatesIssuedByVMCallback);
		}

		static void OverrideLookupCertificatesIssuedBy (GLib.GType gtype, LookupCertificatesIssuedByNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificates_issued_by"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupCertificatesIssuedByNativeDelegate (IntPtr inst, IntPtr issuer_raw_dn, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error);

		static IntPtr LookupCertificatesIssuedBy_cb (IntPtr inst, IntPtr issuer_raw_dn, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLib.List __result;
				__result = __obj.OnLookupCertificatesIssuedBy (issuer_raw_dn, GLib.Object.GetObject(interaction) as GLib.TlsInteraction, (GLib.TlsDatabaseLookupFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificatesIssuedBy")]
		protected virtual GLib.List OnLookupCertificatesIssuedBy (IntPtr issuer_raw_dn, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable)
		{
			return InternalLookupCertificatesIssuedBy (issuer_raw_dn, interaction, flags, cancellable);
		}

		private GLib.List InternalLookupCertificatesIssuedBy (IntPtr issuer_raw_dn, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable)
		{
			LookupCertificatesIssuedByNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificatesIssuedByNativeDelegate>(this.LookupGType(), "lookup_certificates_issued_by");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, issuer_raw_dn, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			return new GLib.List(__result);
		}

		static LookupCertificatesIssuedByAsyncNativeDelegate LookupCertificatesIssuedByAsync_cb_delegate;
		static LookupCertificatesIssuedByAsyncNativeDelegate LookupCertificatesIssuedByAsyncVMCallback {
			get {
				if (LookupCertificatesIssuedByAsync_cb_delegate == null)
					LookupCertificatesIssuedByAsync_cb_delegate = new LookupCertificatesIssuedByAsyncNativeDelegate (LookupCertificatesIssuedByAsync_cb);
				return LookupCertificatesIssuedByAsync_cb_delegate;
			}
		}

		static void OverrideLookupCertificatesIssuedByAsync (GLib.GType gtype)
		{
			OverrideLookupCertificatesIssuedByAsync (gtype, LookupCertificatesIssuedByAsyncVMCallback);
		}

		static void OverrideLookupCertificatesIssuedByAsync (GLib.GType gtype, LookupCertificatesIssuedByAsyncNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificates_issued_by_async"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void LookupCertificatesIssuedByAsyncNativeDelegate (IntPtr inst, IntPtr issuer_raw_dn, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void LookupCertificatesIssuedByAsync_cb (IntPtr inst, IntPtr issuer_raw_dn, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnLookupCertificatesIssuedByAsync (issuer_raw_dn, GLib.Object.GetObject(interaction) as GLib.TlsInteraction, (GLib.TlsDatabaseLookupFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificatesIssuedByAsync")]
		protected virtual void OnLookupCertificatesIssuedByAsync (IntPtr issuer_raw_dn, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalLookupCertificatesIssuedByAsync (issuer_raw_dn, interaction, flags, cancellable, cb);
		}

		private void InternalLookupCertificatesIssuedByAsync (IntPtr issuer_raw_dn, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			LookupCertificatesIssuedByAsyncNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificatesIssuedByAsyncNativeDelegate>(this.LookupGType(), "lookup_certificates_issued_by_async");
			if (unmanaged == null) return;

			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			unmanaged (this.Handle, issuer_raw_dn, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

		static LookupCertificatesIssuedByFinishNativeDelegate LookupCertificatesIssuedByFinish_cb_delegate;
		static LookupCertificatesIssuedByFinishNativeDelegate LookupCertificatesIssuedByFinishVMCallback {
			get {
				if (LookupCertificatesIssuedByFinish_cb_delegate == null)
					LookupCertificatesIssuedByFinish_cb_delegate = new LookupCertificatesIssuedByFinishNativeDelegate (LookupCertificatesIssuedByFinish_cb);
				return LookupCertificatesIssuedByFinish_cb_delegate;
			}
		}

		static void OverrideLookupCertificatesIssuedByFinish (GLib.GType gtype)
		{
			OverrideLookupCertificatesIssuedByFinish (gtype, LookupCertificatesIssuedByFinishVMCallback);
		}

		static void OverrideLookupCertificatesIssuedByFinish (GLib.GType gtype, LookupCertificatesIssuedByFinishNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("lookup_certificates_issued_by_finish"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupCertificatesIssuedByFinishNativeDelegate (IntPtr inst, IntPtr result, out IntPtr error);

		static IntPtr LookupCertificatesIssuedByFinish_cb (IntPtr inst, IntPtr result, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				TlsDatabase __obj = GLib.Object.GetObject (inst, false) as TlsDatabase;
				GLib.List __result;
				__result = __obj.OnLookupCertificatesIssuedByFinish (GLib.AsyncResultAdapter.GetObject (result, false));
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.TlsDatabase), ConnectionMethod="OverrideLookupCertificatesIssuedByFinish")]
		protected virtual GLib.List OnLookupCertificatesIssuedByFinish (GLib.IAsyncResult result)
		{
			return InternalLookupCertificatesIssuedByFinish (result);
		}

		private GLib.List InternalLookupCertificatesIssuedByFinish (GLib.IAsyncResult result)
		{
			LookupCertificatesIssuedByFinishNativeDelegate unmanaged = class_abi.BaseOverride<LookupCertificatesIssuedByFinishNativeDelegate>(this.LookupGType(), "lookup_certificates_issued_by_finish");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			return new GLib.List(__result);
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public unsafe new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("verify_chain"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) // verify_chain
							, null
							, "verify_chain_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("verify_chain_async"
							, -1
							, (uint) sizeof( IntPtr ) // verify_chain_async
							, "verify_chain"
							, "verify_chain_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("verify_chain_finish"
							, -1
							, (uint) sizeof( IntPtr ) // verify_chain_finish
							, "verify_chain_async"
							, "create_certificate_handle"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("create_certificate_handle"
							, -1
							, (uint) sizeof( IntPtr ) // create_certificate_handle
							, "verify_chain_finish"
							, "lookup_certificate_for_handle"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificate_for_handle"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificate_for_handle
							, "create_certificate_handle"
							, "lookup_certificate_for_handle_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificate_for_handle_async"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificate_for_handle_async
							, "lookup_certificate_for_handle"
							, "lookup_certificate_for_handle_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificate_for_handle_finish"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificate_for_handle_finish
							, "lookup_certificate_for_handle_async"
							, "lookup_certificate_issuer"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificate_issuer"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificate_issuer
							, "lookup_certificate_for_handle_finish"
							, "lookup_certificate_issuer_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificate_issuer_async"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificate_issuer_async
							, "lookup_certificate_issuer"
							, "lookup_certificate_issuer_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificate_issuer_finish"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificate_issuer_finish
							, "lookup_certificate_issuer_async"
							, "lookup_certificates_issued_by"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificates_issued_by"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificates_issued_by
							, "lookup_certificate_issuer_finish"
							, "lookup_certificates_issued_by_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificates_issued_by_async"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificates_issued_by_async
							, "lookup_certificates_issued_by"
							, "lookup_certificates_issued_by_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_certificates_issued_by_finish"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_certificates_issued_by_finish
							, "lookup_certificates_issued_by_async"
							, "padding"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("padding"
							, -1
							, (uint) sizeof( IntPtr ) * 16 // padding
							, "lookup_certificates_issued_by_finish"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_tls_database_create_certificate_handle(IntPtr raw, IntPtr certificate);
		static d_g_tls_database_create_certificate_handle g_tls_database_create_certificate_handle = FuncLoader.LoadFunction<d_g_tls_database_create_certificate_handle>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_create_certificate_handle"));

		public string CreateCertificateHandle(GLib.TlsCertificate certificate) {
			IntPtr raw_ret = g_tls_database_create_certificate_handle(Handle, certificate == null ? IntPtr.Zero : certificate.Handle);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_tls_database_get_type();
		static d_g_tls_database_get_type g_tls_database_get_type = FuncLoader.LoadFunction<d_g_tls_database_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_get_type"));

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = g_tls_database_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_tls_database_lookup_certificate_for_handle(IntPtr raw, IntPtr handle, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error);
		static d_g_tls_database_lookup_certificate_for_handle g_tls_database_lookup_certificate_for_handle = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificate_for_handle>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificate_for_handle"));

		public unsafe GLib.TlsCertificate LookupCertificateForHandle(string handle, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable) {
			IntPtr native_handle = GLib.Marshaller.StringToPtrGStrdup (handle);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_tls_database_lookup_certificate_for_handle(Handle, native_handle, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.TlsCertificate ret = GLib.Object.GetObject(raw_ret) as GLib.TlsCertificate;
			GLib.Marshaller.Free (native_handle);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_tls_database_lookup_certificate_for_handle_async(IntPtr raw, IntPtr handle, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_tls_database_lookup_certificate_for_handle_async g_tls_database_lookup_certificate_for_handle_async = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificate_for_handle_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificate_for_handle_async"));

		public void LookupCertificateForHandleAsync(string handle, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			IntPtr native_handle = GLib.Marshaller.StringToPtrGStrdup (handle);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_tls_database_lookup_certificate_for_handle_async(Handle, native_handle, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_tls_database_lookup_certificate_for_handle_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_tls_database_lookup_certificate_for_handle_finish g_tls_database_lookup_certificate_for_handle_finish = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificate_for_handle_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificate_for_handle_finish"));

		public unsafe GLib.TlsCertificate LookupCertificateForHandleFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_tls_database_lookup_certificate_for_handle_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			GLib.TlsCertificate ret = GLib.Object.GetObject(raw_ret) as GLib.TlsCertificate;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_tls_database_lookup_certificate_issuer(IntPtr raw, IntPtr certificate, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error);
		static d_g_tls_database_lookup_certificate_issuer g_tls_database_lookup_certificate_issuer = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificate_issuer>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificate_issuer"));

		public unsafe GLib.TlsCertificate LookupCertificateIssuer(GLib.TlsCertificate certificate, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_tls_database_lookup_certificate_issuer(Handle, certificate == null ? IntPtr.Zero : certificate.Handle, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.TlsCertificate ret = GLib.Object.GetObject(raw_ret) as GLib.TlsCertificate;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_tls_database_lookup_certificate_issuer_async(IntPtr raw, IntPtr certificate, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_tls_database_lookup_certificate_issuer_async g_tls_database_lookup_certificate_issuer_async = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificate_issuer_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificate_issuer_async"));

		public void LookupCertificateIssuerAsync(GLib.TlsCertificate certificate, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_tls_database_lookup_certificate_issuer_async(Handle, certificate == null ? IntPtr.Zero : certificate.Handle, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_tls_database_lookup_certificate_issuer_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_tls_database_lookup_certificate_issuer_finish g_tls_database_lookup_certificate_issuer_finish = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificate_issuer_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificate_issuer_finish"));

		public unsafe GLib.TlsCertificate LookupCertificateIssuerFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_tls_database_lookup_certificate_issuer_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			GLib.TlsCertificate ret = GLib.Object.GetObject(raw_ret) as GLib.TlsCertificate;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_tls_database_lookup_certificates_issued_by(IntPtr raw, IntPtr issuer_raw_dn, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error);
		static d_g_tls_database_lookup_certificates_issued_by g_tls_database_lookup_certificates_issued_by = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificates_issued_by>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificates_issued_by"));

		public unsafe GLib.List LookupCertificatesIssuedBy(IntPtr issuer_raw_dn, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_tls_database_lookup_certificates_issued_by(Handle, issuer_raw_dn, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.List ret = new GLib.List(raw_ret);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_tls_database_lookup_certificates_issued_by_async(IntPtr raw, IntPtr issuer_raw_dn, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_tls_database_lookup_certificates_issued_by_async g_tls_database_lookup_certificates_issued_by_async = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificates_issued_by_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificates_issued_by_async"));

		public void LookupCertificatesIssuedByAsync(IntPtr issuer_raw_dn, GLib.TlsInteraction interaction, GLib.TlsDatabaseLookupFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_tls_database_lookup_certificates_issued_by_async(Handle, issuer_raw_dn, interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_tls_database_lookup_certificates_issued_by_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_tls_database_lookup_certificates_issued_by_finish g_tls_database_lookup_certificates_issued_by_finish = FuncLoader.LoadFunction<d_g_tls_database_lookup_certificates_issued_by_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_lookup_certificates_issued_by_finish"));

		public unsafe GLib.List LookupCertificatesIssuedByFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_tls_database_lookup_certificates_issued_by_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			GLib.List ret = new GLib.List(raw_ret);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_g_tls_database_verify_chain(IntPtr raw, IntPtr chain, IntPtr purpose, IntPtr identity, IntPtr interaction, int flags, IntPtr cancellable, out IntPtr error);
		static d_g_tls_database_verify_chain g_tls_database_verify_chain = FuncLoader.LoadFunction<d_g_tls_database_verify_chain>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_verify_chain"));

		public unsafe GLib.TlsCertificateFlags VerifyChain(GLib.TlsCertificate chain, string purpose, GLib.ISocketConnectable identity, GLib.TlsInteraction interaction, GLib.TlsDatabaseVerifyFlags flags, GLib.Cancellable cancellable) {
			IntPtr native_purpose = GLib.Marshaller.StringToPtrGStrdup (purpose);
			IntPtr error = IntPtr.Zero;
			int raw_ret = g_tls_database_verify_chain(Handle, chain == null ? IntPtr.Zero : chain.Handle, native_purpose, identity == null ? IntPtr.Zero : ((identity is GLib.Object) ? (identity as GLib.Object).Handle : (identity as GLib.SocketConnectableAdapter).Handle), interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.TlsCertificateFlags ret = (GLib.TlsCertificateFlags) raw_ret;
			GLib.Marshaller.Free (native_purpose);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_tls_database_verify_chain_async(IntPtr raw, IntPtr chain, IntPtr purpose, IntPtr identity, IntPtr interaction, int flags, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_tls_database_verify_chain_async g_tls_database_verify_chain_async = FuncLoader.LoadFunction<d_g_tls_database_verify_chain_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_verify_chain_async"));

		public void VerifyChainAsync(GLib.TlsCertificate chain, string purpose, GLib.ISocketConnectable identity, GLib.TlsInteraction interaction, GLib.TlsDatabaseVerifyFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			IntPtr native_purpose = GLib.Marshaller.StringToPtrGStrdup (purpose);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_tls_database_verify_chain_async(Handle, chain == null ? IntPtr.Zero : chain.Handle, native_purpose, identity == null ? IntPtr.Zero : ((identity is GLib.Object) ? (identity as GLib.Object).Handle : (identity as GLib.SocketConnectableAdapter).Handle), interaction == null ? IntPtr.Zero : interaction.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_purpose);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_g_tls_database_verify_chain_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_tls_database_verify_chain_finish g_tls_database_verify_chain_finish = FuncLoader.LoadFunction<d_g_tls_database_verify_chain_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_tls_database_verify_chain_finish"));

		public unsafe GLib.TlsCertificateFlags VerifyChainFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			int raw_ret = g_tls_database_verify_chain_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			GLib.TlsCertificateFlags ret = (GLib.TlsCertificateFlags) raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("priv"
							, GLib.Object.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
