// 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 InetAddressMask : GLib.Object, GLib.IInitable {

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_inet_address_mask_new(IntPtr addr, uint length, out IntPtr error);
		static d_g_inet_address_mask_new g_inet_address_mask_new = FuncLoader.LoadFunction<d_g_inet_address_mask_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_inet_address_mask_new"));

		public unsafe InetAddressMask (GLib.InetAddress addr, uint length) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (InetAddressMask)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (addr != null) {
					names.Add ("length");
					vals.Add (new GLib.Value (length));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr error = IntPtr.Zero;
			Raw = g_inet_address_mask_new(addr == null ? IntPtr.Zero : addr.Handle, length, out error);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_inet_address_mask_new_from_string(IntPtr mask_string, out IntPtr error);
		static d_g_inet_address_mask_new_from_string g_inet_address_mask_new_from_string = FuncLoader.LoadFunction<d_g_inet_address_mask_new_from_string>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_inet_address_mask_new_from_string"));

		public unsafe InetAddressMask (string mask_string) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (InetAddressMask)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_mask_string = GLib.Marshaller.StringToPtrGStrdup (mask_string);
			IntPtr error = IntPtr.Zero;
			Raw = g_inet_address_mask_new_from_string(native_mask_string, out error);
			GLib.Marshaller.Free (native_mask_string);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
		}

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

		[GLib.Property ("family")]
		public GLib.SocketFamily Family {
			get  {
				int raw_ret = g_inet_address_mask_get_family(Handle);
				GLib.SocketFamily ret = (GLib.SocketFamily) raw_ret;
				return ret;
			}
		}

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

		[GLib.Property ("address")]
		public GLib.InetAddress Address {
			get  {
				IntPtr raw_ret = g_inet_address_mask_get_address(Handle);
				GLib.InetAddress ret = GLib.Object.GetObject(raw_ret) as GLib.InetAddress;
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("address", val);
				val.Dispose ();
			}
		}

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

		[GLib.Property ("length")]
		public uint Length {
			get  {
				uint raw_ret = g_inet_address_mask_get_length(Handle);
				uint ret = raw_ret;
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("length", val);
				val.Dispose ();
			}
		}


		// 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 (GLib.Object.class_abi.Fields);

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_inet_address_mask_equal(IntPtr raw, IntPtr mask2);
		static d_g_inet_address_mask_equal g_inet_address_mask_equal = FuncLoader.LoadFunction<d_g_inet_address_mask_equal>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_inet_address_mask_equal"));

		public bool Equal(GLib.InetAddressMask mask2) {
			bool raw_ret = g_inet_address_mask_equal(Handle, mask2 == null ? IntPtr.Zero : mask2.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_inet_address_mask_matches(IntPtr raw, IntPtr address);
		static d_g_inet_address_mask_matches g_inet_address_mask_matches = FuncLoader.LoadFunction<d_g_inet_address_mask_matches>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_inet_address_mask_matches"));

		public bool Matches(GLib.InetAddress address) {
			bool raw_ret = g_inet_address_mask_matches(Handle, address == null ? IntPtr.Zero : address.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public override string ToString() {
			IntPtr raw_ret = g_inet_address_mask_to_string(Handle);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			return ret;
		}

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

		public bool Init(GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_initable_init(Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			bool ret = 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
	}
}
