// 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 Resolver : GLib.Object {

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

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

		[GLib.Signal("reload")]
		public event System.EventHandler Reload {
			add {
				this.AddSignalHandler ("reload", value);
			}
			remove {
				this.RemoveSignalHandler ("reload", value);
			}
		}

		static ReloadNativeDelegate Reload_cb_delegate;
		static ReloadNativeDelegate ReloadVMCallback {
			get {
				if (Reload_cb_delegate == null)
					Reload_cb_delegate = new ReloadNativeDelegate (Reload_cb);
				return Reload_cb_delegate;
			}
		}

		static void OverrideReload (GLib.GType gtype)
		{
			OverrideReload (gtype, ReloadVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void ReloadNativeDelegate (IntPtr inst);

		static void Reload_cb (IntPtr inst)
		{
			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				__obj.OnReload ();
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideReload")]
		protected virtual void OnReload ()
		{
			InternalReload ();
		}

		private void InternalReload ()
		{
			ReloadNativeDelegate unmanaged = class_abi.BaseOverride<ReloadNativeDelegate>(this.LookupGType(), "reload");
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}

		static LookupByNameNativeDelegate LookupByName_cb_delegate;
		static LookupByNameNativeDelegate LookupByNameVMCallback {
			get {
				if (LookupByName_cb_delegate == null)
					LookupByName_cb_delegate = new LookupByNameNativeDelegate (LookupByName_cb);
				return LookupByName_cb_delegate;
			}
		}

		static void OverrideLookupByName (GLib.GType gtype)
		{
			OverrideLookupByName (gtype, LookupByNameVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupByNameNativeDelegate (IntPtr inst, IntPtr hostname, IntPtr cancellable, out IntPtr error);

		static IntPtr LookupByName_cb (IntPtr inst, IntPtr hostname, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				GLib.InetAddress[] __result;
				__result = __obj.OnLookupByName (GLib.Marshaller.Utf8PtrToString (hostname), GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				return new GLib.List(__result, typeof (GLib.InetAddress), true, true) == null ? IntPtr.Zero : new GLib.List(__result, typeof (GLib.InetAddress), true, true).Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideLookupByName")]
		protected virtual GLib.InetAddress[] OnLookupByName (string hostname, GLib.Cancellable cancellable)
		{
			return InternalLookupByName (hostname, cancellable);
		}

		private GLib.InetAddress[] InternalLookupByName (string hostname, GLib.Cancellable cancellable)
		{
			LookupByNameNativeDelegate unmanaged = class_abi.BaseOverride<LookupByNameNativeDelegate>(this.LookupGType(), "lookup_by_name");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr native_hostname = GLib.Marshaller.StringToPtrGStrdup (hostname);
			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, native_hostname, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.Marshaller.Free (native_hostname);
			return GLib.Marshaller.ListPtrToArray<GLib.InetAddress, GLib.InetAddress> (__result, true, true);
		}

		static LookupByNameAsyncNativeDelegate LookupByNameAsync_cb_delegate;
		static LookupByNameAsyncNativeDelegate LookupByNameAsyncVMCallback {
			get {
				if (LookupByNameAsync_cb_delegate == null)
					LookupByNameAsync_cb_delegate = new LookupByNameAsyncNativeDelegate (LookupByNameAsync_cb);
				return LookupByNameAsync_cb_delegate;
			}
		}

		static void OverrideLookupByNameAsync (GLib.GType gtype)
		{
			OverrideLookupByNameAsync (gtype, LookupByNameAsyncVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void LookupByNameAsyncNativeDelegate (IntPtr inst, IntPtr hostname, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void LookupByNameAsync_cb (IntPtr inst, IntPtr hostname, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnLookupByNameAsync (GLib.Marshaller.Utf8PtrToString (hostname), GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideLookupByNameAsync")]
		protected virtual void OnLookupByNameAsync (string hostname, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalLookupByNameAsync (hostname, cancellable, cb);
		}

		private void InternalLookupByNameAsync (string hostname, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			LookupByNameAsyncNativeDelegate unmanaged = class_abi.BaseOverride<LookupByNameAsyncNativeDelegate>(this.LookupGType(), "lookup_by_name_async");
			if (unmanaged == null) return;

			IntPtr native_hostname = GLib.Marshaller.StringToPtrGStrdup (hostname);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			unmanaged (this.Handle, native_hostname, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_hostname);
		}

		static LookupByNameFinishNativeDelegate LookupByNameFinish_cb_delegate;
		static LookupByNameFinishNativeDelegate LookupByNameFinishVMCallback {
			get {
				if (LookupByNameFinish_cb_delegate == null)
					LookupByNameFinish_cb_delegate = new LookupByNameFinishNativeDelegate (LookupByNameFinish_cb);
				return LookupByNameFinish_cb_delegate;
			}
		}

		static void OverrideLookupByNameFinish (GLib.GType gtype)
		{
			OverrideLookupByNameFinish (gtype, LookupByNameFinishVMCallback);
		}

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

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideLookupByNameFinish")]
		protected virtual GLib.InetAddress[] OnLookupByNameFinish (GLib.IAsyncResult result)
		{
			return InternalLookupByNameFinish (result);
		}

		private GLib.InetAddress[] InternalLookupByNameFinish (GLib.IAsyncResult result)
		{
			LookupByNameFinishNativeDelegate unmanaged = class_abi.BaseOverride<LookupByNameFinishNativeDelegate>(this.LookupGType(), "lookup_by_name_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.Marshaller.ListPtrToArray<GLib.InetAddress, GLib.InetAddress> (__result, true, true);
		}

		static LookupByAddressNativeDelegate LookupByAddress_cb_delegate;
		static LookupByAddressNativeDelegate LookupByAddressVMCallback {
			get {
				if (LookupByAddress_cb_delegate == null)
					LookupByAddress_cb_delegate = new LookupByAddressNativeDelegate (LookupByAddress_cb);
				return LookupByAddress_cb_delegate;
			}
		}

		static void OverrideLookupByAddress (GLib.GType gtype)
		{
			OverrideLookupByAddress (gtype, LookupByAddressVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupByAddressNativeDelegate (IntPtr inst, IntPtr address, IntPtr cancellable, out IntPtr error);

		static IntPtr LookupByAddress_cb (IntPtr inst, IntPtr address, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				string __result;
				__result = __obj.OnLookupByAddress (GLib.Object.GetObject(address) as GLib.InetAddress, GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				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.Resolver), ConnectionMethod="OverrideLookupByAddress")]
		protected virtual string OnLookupByAddress (GLib.InetAddress address, GLib.Cancellable cancellable)
		{
			return InternalLookupByAddress (address, cancellable);
		}

		private string InternalLookupByAddress (GLib.InetAddress address, GLib.Cancellable cancellable)
		{
			LookupByAddressNativeDelegate unmanaged = class_abi.BaseOverride<LookupByAddressNativeDelegate>(this.LookupGType(), "lookup_by_address");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

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

		static LookupByAddressAsyncNativeDelegate LookupByAddressAsync_cb_delegate;
		static LookupByAddressAsyncNativeDelegate LookupByAddressAsyncVMCallback {
			get {
				if (LookupByAddressAsync_cb_delegate == null)
					LookupByAddressAsync_cb_delegate = new LookupByAddressAsyncNativeDelegate (LookupByAddressAsync_cb);
				return LookupByAddressAsync_cb_delegate;
			}
		}

		static void OverrideLookupByAddressAsync (GLib.GType gtype)
		{
			OverrideLookupByAddressAsync (gtype, LookupByAddressAsyncVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void LookupByAddressAsyncNativeDelegate (IntPtr inst, IntPtr address, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void LookupByAddressAsync_cb (IntPtr inst, IntPtr address, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnLookupByAddressAsync (GLib.Object.GetObject(address) as GLib.InetAddress, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideLookupByAddressAsync")]
		protected virtual void OnLookupByAddressAsync (GLib.InetAddress address, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalLookupByAddressAsync (address, cancellable, cb);
		}

		private void InternalLookupByAddressAsync (GLib.InetAddress address, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			LookupByAddressAsyncNativeDelegate unmanaged = class_abi.BaseOverride<LookupByAddressAsyncNativeDelegate>(this.LookupGType(), "lookup_by_address_async");
			if (unmanaged == null) return;

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

		static LookupByAddressFinishNativeDelegate LookupByAddressFinish_cb_delegate;
		static LookupByAddressFinishNativeDelegate LookupByAddressFinishVMCallback {
			get {
				if (LookupByAddressFinish_cb_delegate == null)
					LookupByAddressFinish_cb_delegate = new LookupByAddressFinishNativeDelegate (LookupByAddressFinish_cb);
				return LookupByAddressFinish_cb_delegate;
			}
		}

		static void OverrideLookupByAddressFinish (GLib.GType gtype)
		{
			OverrideLookupByAddressFinish (gtype, LookupByAddressFinishVMCallback);
		}

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

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

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

			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				string __result;
				__result = __obj.OnLookupByAddressFinish (GLib.AsyncResultAdapter.GetObject (result, false));
				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.Resolver), ConnectionMethod="OverrideLookupByAddressFinish")]
		protected virtual string OnLookupByAddressFinish (GLib.IAsyncResult result)
		{
			return InternalLookupByAddressFinish (result);
		}

		private string InternalLookupByAddressFinish (GLib.IAsyncResult result)
		{
			LookupByAddressFinishNativeDelegate unmanaged = class_abi.BaseOverride<LookupByAddressFinishNativeDelegate>(this.LookupGType(), "lookup_by_address_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.Marshaller.PtrToStringGFree(__result);
		}

		static LookupServiceNativeDelegate LookupService_cb_delegate;
		static LookupServiceNativeDelegate LookupServiceVMCallback {
			get {
				if (LookupService_cb_delegate == null)
					LookupService_cb_delegate = new LookupServiceNativeDelegate (LookupService_cb);
				return LookupService_cb_delegate;
			}
		}

		static void OverrideLookupService (GLib.GType gtype)
		{
			OverrideLookupService (gtype, LookupServiceVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupServiceNativeDelegate (IntPtr inst, IntPtr rrname, IntPtr cancellable, out IntPtr error);

		static IntPtr LookupService_cb (IntPtr inst, IntPtr rrname, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				GLib.SrvTarget[] __result;
				__result = __obj.OnLookupService (GLib.Marshaller.Utf8PtrToString (rrname), GLib.Object.GetObject(cancellable) as GLib.Cancellable);
				return new GLib.List(__result, typeof (GLib.SrvTarget), true, true) == null ? IntPtr.Zero : new GLib.List(__result, typeof (GLib.SrvTarget), true, true).Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideLookupService")]
		protected virtual GLib.SrvTarget[] OnLookupService (string rrname, GLib.Cancellable cancellable)
		{
			return InternalLookupService (rrname, cancellable);
		}

		private GLib.SrvTarget[] InternalLookupService (string rrname, GLib.Cancellable cancellable)
		{
			LookupServiceNativeDelegate unmanaged = class_abi.BaseOverride<LookupServiceNativeDelegate>(this.LookupGType(), "lookup_service");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr native_rrname = GLib.Marshaller.StringToPtrGStrdup (rrname);
			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, native_rrname, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.Marshaller.Free (native_rrname);
			return GLib.Marshaller.ListPtrToArray<GLib.SrvTarget, GLib.SrvTarget> (__result, true, true);
		}

		static LookupServiceAsyncNativeDelegate LookupServiceAsync_cb_delegate;
		static LookupServiceAsyncNativeDelegate LookupServiceAsyncVMCallback {
			get {
				if (LookupServiceAsync_cb_delegate == null)
					LookupServiceAsync_cb_delegate = new LookupServiceAsyncNativeDelegate (LookupServiceAsync_cb);
				return LookupServiceAsync_cb_delegate;
			}
		}

		static void OverrideLookupServiceAsync (GLib.GType gtype)
		{
			OverrideLookupServiceAsync (gtype, LookupServiceAsyncVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void LookupServiceAsyncNativeDelegate (IntPtr inst, IntPtr rrname, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void LookupServiceAsync_cb (IntPtr inst, IntPtr rrname, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnLookupServiceAsync (GLib.Marshaller.Utf8PtrToString (rrname), GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideLookupServiceAsync")]
		protected virtual void OnLookupServiceAsync (string rrname, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalLookupServiceAsync (rrname, cancellable, cb);
		}

		private void InternalLookupServiceAsync (string rrname, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			LookupServiceAsyncNativeDelegate unmanaged = class_abi.BaseOverride<LookupServiceAsyncNativeDelegate>(this.LookupGType(), "lookup_service_async");
			if (unmanaged == null) return;

			IntPtr native_rrname = GLib.Marshaller.StringToPtrGStrdup (rrname);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			unmanaged (this.Handle, native_rrname, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_rrname);
		}

		static LookupServiceFinishNativeDelegate LookupServiceFinish_cb_delegate;
		static LookupServiceFinishNativeDelegate LookupServiceFinishVMCallback {
			get {
				if (LookupServiceFinish_cb_delegate == null)
					LookupServiceFinish_cb_delegate = new LookupServiceFinishNativeDelegate (LookupServiceFinish_cb);
				return LookupServiceFinish_cb_delegate;
			}
		}

		static void OverrideLookupServiceFinish (GLib.GType gtype)
		{
			OverrideLookupServiceFinish (gtype, LookupServiceFinishVMCallback);
		}

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

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideLookupServiceFinish")]
		protected virtual GLib.SrvTarget[] OnLookupServiceFinish (GLib.IAsyncResult result)
		{
			return InternalLookupServiceFinish (result);
		}

		private GLib.SrvTarget[] InternalLookupServiceFinish (GLib.IAsyncResult result)
		{
			LookupServiceFinishNativeDelegate unmanaged = class_abi.BaseOverride<LookupServiceFinishNativeDelegate>(this.LookupGType(), "lookup_service_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.Marshaller.ListPtrToArray<GLib.SrvTarget, GLib.SrvTarget> (__result, true, true);
		}

		static LookupRecordsNativeDelegate LookupRecords_cb_delegate;
		static LookupRecordsNativeDelegate LookupRecordsVMCallback {
			get {
				if (LookupRecords_cb_delegate == null)
					LookupRecords_cb_delegate = new LookupRecordsNativeDelegate (LookupRecords_cb);
				return LookupRecords_cb_delegate;
			}
		}

		static void OverrideLookupRecords (GLib.GType gtype)
		{
			OverrideLookupRecords (gtype, LookupRecordsVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr LookupRecordsNativeDelegate (IntPtr inst, IntPtr rrname, int record_type, IntPtr cancellable, out IntPtr error);

		static IntPtr LookupRecords_cb (IntPtr inst, IntPtr rrname, int record_type, IntPtr cancellable, out IntPtr error)
		{
			error = IntPtr.Zero;

			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				GLib.List __result;
				__result = __obj.OnLookupRecords (GLib.Marshaller.Utf8PtrToString (rrname), (GLib.ResolverRecordType) record_type, 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.Resolver), ConnectionMethod="OverrideLookupRecords")]
		protected virtual GLib.List OnLookupRecords (string rrname, GLib.ResolverRecordType record_type, GLib.Cancellable cancellable)
		{
			return InternalLookupRecords (rrname, record_type, cancellable);
		}

		private GLib.List InternalLookupRecords (string rrname, GLib.ResolverRecordType record_type, GLib.Cancellable cancellable)
		{
			LookupRecordsNativeDelegate unmanaged = class_abi.BaseOverride<LookupRecordsNativeDelegate>(this.LookupGType(), "lookup_records");
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr native_rrname = GLib.Marshaller.StringToPtrGStrdup (rrname);
			IntPtr error = IntPtr.Zero;
			IntPtr __result = unmanaged (this.Handle, native_rrname, (int) record_type, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.Marshaller.Free (native_rrname);
			return new GLib.List(__result);
		}

		static LookupRecordsAsyncNativeDelegate LookupRecordsAsync_cb_delegate;
		static LookupRecordsAsyncNativeDelegate LookupRecordsAsyncVMCallback {
			get {
				if (LookupRecordsAsync_cb_delegate == null)
					LookupRecordsAsync_cb_delegate = new LookupRecordsAsyncNativeDelegate (LookupRecordsAsync_cb);
				return LookupRecordsAsync_cb_delegate;
			}
		}

		static void OverrideLookupRecordsAsync (GLib.GType gtype)
		{
			OverrideLookupRecordsAsync (gtype, LookupRecordsAsyncVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void LookupRecordsAsyncNativeDelegate (IntPtr inst, IntPtr rrname, int record_type, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);

		static void LookupRecordsAsync_cb (IntPtr inst, IntPtr rrname, int record_type, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
		{
			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
				__obj.OnLookupRecordsAsync (GLib.Marshaller.Utf8PtrToString (rrname), (GLib.ResolverRecordType) record_type, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.Resolver), ConnectionMethod="OverrideLookupRecordsAsync")]
		protected virtual void OnLookupRecordsAsync (string rrname, GLib.ResolverRecordType record_type, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			InternalLookupRecordsAsync (rrname, record_type, cancellable, cb);
		}

		private void InternalLookupRecordsAsync (string rrname, GLib.ResolverRecordType record_type, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
		{
			LookupRecordsAsyncNativeDelegate unmanaged = class_abi.BaseOverride<LookupRecordsAsyncNativeDelegate>(this.LookupGType(), "lookup_records_async");
			if (unmanaged == null) return;

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

		static LookupRecordsFinishNativeDelegate LookupRecordsFinish_cb_delegate;
		static LookupRecordsFinishNativeDelegate LookupRecordsFinishVMCallback {
			get {
				if (LookupRecordsFinish_cb_delegate == null)
					LookupRecordsFinish_cb_delegate = new LookupRecordsFinishNativeDelegate (LookupRecordsFinish_cb);
				return LookupRecordsFinish_cb_delegate;
			}
		}

		static void OverrideLookupRecordsFinish (GLib.GType gtype)
		{
			OverrideLookupRecordsFinish (gtype, LookupRecordsFinishVMCallback);
		}

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

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

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

			try {
				Resolver __obj = GLib.Object.GetObject (inst, false) as Resolver;
				GLib.List __result;
				__result = __obj.OnLookupRecordsFinish (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.Resolver), ConnectionMethod="OverrideLookupRecordsFinish")]
		protected virtual GLib.List OnLookupRecordsFinish (GLib.IAsyncResult result)
		{
			return InternalLookupRecordsFinish (result);
		}

		private GLib.List InternalLookupRecordsFinish (GLib.IAsyncResult result)
		{
			LookupRecordsFinishNativeDelegate unmanaged = class_abi.BaseOverride<LookupRecordsFinishNativeDelegate>(this.LookupGType(), "lookup_records_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("reload"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) // reload
							, null
							, "lookup_by_name"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_by_name"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_by_name
							, "reload"
							, "lookup_by_name_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_by_name_async"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_by_name_async
							, "lookup_by_name"
							, "lookup_by_name_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_by_name_finish"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_by_name_finish
							, "lookup_by_name_async"
							, "lookup_by_address"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_by_address"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_by_address
							, "lookup_by_name_finish"
							, "lookup_by_address_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_by_address_async"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_by_address_async
							, "lookup_by_address"
							, "lookup_by_address_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_by_address_finish"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_by_address_finish
							, "lookup_by_address_async"
							, "lookup_service"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_service"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_service
							, "lookup_by_address_finish"
							, "lookup_service_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_service_async"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_service_async
							, "lookup_service"
							, "lookup_service_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_service_finish"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_service_finish
							, "lookup_service_async"
							, "lookup_records"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_records"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_records
							, "lookup_service_finish"
							, "lookup_records_async"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_records_async"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_records_async
							, "lookup_records"
							, "lookup_records_finish"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("lookup_records_finish"
							, -1
							, (uint) sizeof( IntPtr ) // lookup_records_finish
							, "lookup_records_async"
							, "_g_reserved4"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved4"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved4
							, "lookup_records_finish"
							, "_g_reserved5"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved5"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved5
							, "_g_reserved4"
							, "_g_reserved6"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved6"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved6
							, "_g_reserved5"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_g_resolver_error_quark();
		static d_g_resolver_error_quark g_resolver_error_quark = FuncLoader.LoadFunction<d_g_resolver_error_quark>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_error_quark"));

		public static int ErrorQuark() {
			int raw_ret = g_resolver_error_quark();
			int ret = raw_ret;
			return ret;
		}

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

		public static void FreeAddresses(GLib.List addresses) {
			g_resolver_free_addresses(addresses == null ? IntPtr.Zero : addresses.Handle);
		}

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

		public static void FreeTargets(GLib.List targets) {
			g_resolver_free_targets(targets == null ? IntPtr.Zero : targets.Handle);
		}

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

		public static GLib.Resolver Default { 
			get {
				IntPtr raw_ret = g_resolver_get_default();
				GLib.Resolver ret = GLib.Object.GetObject(raw_ret) as GLib.Resolver;
				return ret;
			}
		}

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_resolver_lookup_by_address(IntPtr raw, IntPtr address, IntPtr cancellable, out IntPtr error);
		static d_g_resolver_lookup_by_address g_resolver_lookup_by_address = FuncLoader.LoadFunction<d_g_resolver_lookup_by_address>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_lookup_by_address"));

		public unsafe string LookupByAddress(GLib.InetAddress address, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resolver_lookup_by_address(Handle, address == null ? IntPtr.Zero : address.Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_resolver_lookup_by_address_async(IntPtr raw, IntPtr address, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_resolver_lookup_by_address_async g_resolver_lookup_by_address_async = FuncLoader.LoadFunction<d_g_resolver_lookup_by_address_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_lookup_by_address_async"));

		public void LookupByAddressAsync(GLib.InetAddress address, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_resolver_lookup_by_address_async(Handle, address == null ? IntPtr.Zero : address.Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_resolver_lookup_by_name(IntPtr raw, IntPtr hostname, IntPtr cancellable, out IntPtr error);
		static d_g_resolver_lookup_by_name g_resolver_lookup_by_name = FuncLoader.LoadFunction<d_g_resolver_lookup_by_name>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_lookup_by_name"));

		public unsafe GLib.InetAddress[] LookupByName(string hostname, GLib.Cancellable cancellable) {
			IntPtr native_hostname = GLib.Marshaller.StringToPtrGStrdup (hostname);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resolver_lookup_by_name(Handle, native_hostname, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.InetAddress[] ret = GLib.Marshaller.ListPtrToArray<GLib.InetAddress, GLib.InetAddress> (raw_ret, true, true);
			GLib.Marshaller.Free (native_hostname);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_resolver_lookup_by_name_async(IntPtr raw, IntPtr hostname, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_resolver_lookup_by_name_async g_resolver_lookup_by_name_async = FuncLoader.LoadFunction<d_g_resolver_lookup_by_name_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_lookup_by_name_async"));

		public void LookupByNameAsync(string hostname, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			IntPtr native_hostname = GLib.Marshaller.StringToPtrGStrdup (hostname);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_resolver_lookup_by_name_async(Handle, native_hostname, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_hostname);
		}

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

		public unsafe GLib.InetAddress[] LookupByNameFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resolver_lookup_by_name_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			GLib.InetAddress[] ret = GLib.Marshaller.ListPtrToArray<GLib.InetAddress, GLib.InetAddress> (raw_ret, true, true);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_resolver_lookup_records(IntPtr raw, IntPtr rrname, int record_type, IntPtr cancellable, out IntPtr error);
		static d_g_resolver_lookup_records g_resolver_lookup_records = FuncLoader.LoadFunction<d_g_resolver_lookup_records>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_lookup_records"));

		public unsafe GLib.List LookupRecords(string rrname, GLib.ResolverRecordType record_type, GLib.Cancellable cancellable) {
			IntPtr native_rrname = GLib.Marshaller.StringToPtrGStrdup (rrname);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resolver_lookup_records(Handle, native_rrname, (int) record_type, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.List ret = new GLib.List(raw_ret);
			GLib.Marshaller.Free (native_rrname);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_resolver_lookup_records_async(IntPtr raw, IntPtr rrname, int record_type, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_resolver_lookup_records_async g_resolver_lookup_records_async = FuncLoader.LoadFunction<d_g_resolver_lookup_records_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_lookup_records_async"));

		public void LookupRecordsAsync(string rrname, GLib.ResolverRecordType record_type, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			IntPtr native_rrname = GLib.Marshaller.StringToPtrGStrdup (rrname);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_resolver_lookup_records_async(Handle, native_rrname, (int) record_type, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_rrname);
		}

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

		public unsafe GLib.List LookupRecordsFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resolver_lookup_records_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 IntPtr d_g_resolver_lookup_service(IntPtr raw, IntPtr service, IntPtr protocol, IntPtr domain, IntPtr cancellable, out IntPtr error);
		static d_g_resolver_lookup_service g_resolver_lookup_service = FuncLoader.LoadFunction<d_g_resolver_lookup_service>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_lookup_service"));

		public unsafe GLib.SrvTarget[] LookupService(string service, string protocol, string domain, GLib.Cancellable cancellable) {
			IntPtr native_service = GLib.Marshaller.StringToPtrGStrdup (service);
			IntPtr native_protocol = GLib.Marshaller.StringToPtrGStrdup (protocol);
			IntPtr native_domain = GLib.Marshaller.StringToPtrGStrdup (domain);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resolver_lookup_service(Handle, native_service, native_protocol, native_domain, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.SrvTarget[] ret = GLib.Marshaller.ListPtrToArray<GLib.SrvTarget, GLib.SrvTarget> (raw_ret, true, true);
			GLib.Marshaller.Free (native_service);
			GLib.Marshaller.Free (native_protocol);
			GLib.Marshaller.Free (native_domain);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_resolver_lookup_service_async(IntPtr raw, IntPtr service, IntPtr protocol, IntPtr domain, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_resolver_lookup_service_async g_resolver_lookup_service_async = FuncLoader.LoadFunction<d_g_resolver_lookup_service_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resolver_lookup_service_async"));

		public void LookupServiceAsync(string service, string protocol, string domain, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			IntPtr native_service = GLib.Marshaller.StringToPtrGStrdup (service);
			IntPtr native_protocol = GLib.Marshaller.StringToPtrGStrdup (protocol);
			IntPtr native_domain = GLib.Marshaller.StringToPtrGStrdup (domain);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_resolver_lookup_service_async(Handle, native_service, native_protocol, native_domain, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_service);
			GLib.Marshaller.Free (native_protocol);
			GLib.Marshaller.Free (native_domain);
		}

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

		public unsafe GLib.SrvTarget[] LookupServiceFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resolver_lookup_service_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			GLib.SrvTarget[] ret = GLib.Marshaller.ListPtrToArray<GLib.SrvTarget, GLib.SrvTarget> (raw_ret, true, true);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

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

		public void SetDefault() {
			g_resolver_set_default(Handle);
		}


		// 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
	}
}
