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

namespace Gst.WebRTC {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class WebRTCICE : Gst.Object {

		protected WebRTCICE (IntPtr raw) : base(raw) {}

		protected WebRTCICE() : base(IntPtr.Zero)
		{
			CreateNativeObject (new string [0], new GLib.Value [0]);
		}

		[GLib.Property ("max-rtp-port")]
		public uint MaxRtpPort {
			get {
				GLib.Value val = GetProperty ("max-rtp-port");
				uint ret = (uint) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("max-rtp-port", val);
				val.Dispose ();
			}
		}

		[GLib.Property ("min-rtp-port")]
		public uint MinRtpPort {
			get {
				GLib.Value val = GetProperty ("min-rtp-port");
				uint ret = (uint) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("min-rtp-port", val);
				val.Dispose ();
			}
		}

		public Gst.WebRTC.WebRTCICEGatheringState IceGatheringState {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("ice_gathering_state"));
					return (Gst.WebRTC.WebRTCICEGatheringState) (*raw_ptr);
				}
			}
		}

		public Gst.WebRTC.WebRTCICEConnectionState IceConnectionState {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("ice_connection_state"));
					return (Gst.WebRTC.WebRTCICEConnectionState) (*raw_ptr);
				}
			}
		}

		public uint MinRtpPortField {
			get {
				unsafe {
					uint* raw_ptr = (uint*)(((byte*)Handle) + abi_info.GetFieldOffset("min_rtp_port"));
					return (*raw_ptr);
				}
			}
		}

		public uint MaxRtpPortField {
			get {
				unsafe {
					uint* raw_ptr = (uint*)(((byte*)Handle) + abi_info.GetFieldOffset("max_rtp_port"));
					return (*raw_ptr);
				}
			}
		}

		[GLib.Signal("add-local-ip-address")]
		public event Gst.WebRTC.AddLocalIpAddressHandler AddLocalIpAddress {
			add {
				this.AddSignalHandler ("add-local-ip-address", value, typeof (Gst.WebRTC.AddLocalIpAddressArgs));
			}
			remove {
				this.RemoveSignalHandler ("add-local-ip-address", value);
			}
		}

		static AddLocalIpAddressNativeDelegate AddLocalIpAddress_cb_delegate;
		static AddLocalIpAddressNativeDelegate AddLocalIpAddressVMCallback {
			get {
				if (AddLocalIpAddress_cb_delegate == null)
					AddLocalIpAddress_cb_delegate = new AddLocalIpAddressNativeDelegate (AddLocalIpAddress_cb);
				return AddLocalIpAddress_cb_delegate;
			}
		}

		static void OverrideAddLocalIpAddress (GLib.GType gtype)
		{
			OverrideAddLocalIpAddress (gtype, AddLocalIpAddressVMCallback);
		}

		static void OverrideAddLocalIpAddress (GLib.GType gtype, AddLocalIpAddressNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "add-local-ip-address", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool AddLocalIpAddressNativeDelegate (IntPtr inst, IntPtr address);

		static bool AddLocalIpAddress_cb (IntPtr inst, IntPtr address)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				bool __result;
				__result = __obj.OnAddLocalIpAddress (GLib.Marshaller.Utf8PtrToString (address));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideAddLocalIpAddress")]
		protected virtual bool OnAddLocalIpAddress (string address)
		{
			return InternalAddLocalIpAddress (address);
		}

		private bool InternalAddLocalIpAddress (string address)
		{
			GLib.Value ret = new GLib.Value (GLib.GType.Boolean);
			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
			GLib.Value[] vals = new GLib.Value [2];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (address);
			inst_and_params.Append (vals [1]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
			bool result = (bool) ret;
			ret.Dispose ();
			return result;
		}

		static AddStreamNativeDelegate AddStream_cb_delegate;
		static AddStreamNativeDelegate AddStreamVMCallback {
			get {
				if (AddStream_cb_delegate == null)
					AddStream_cb_delegate = new AddStreamNativeDelegate (AddStream_cb);
				return AddStream_cb_delegate;
			}
		}

		static void OverrideAddStream (GLib.GType gtype)
		{
			OverrideAddStream (gtype, AddStreamVMCallback);
		}

		static void OverrideAddStream (GLib.GType gtype, AddStreamNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("add_stream"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr AddStreamNativeDelegate (IntPtr inst, uint session_id);

		static IntPtr AddStream_cb (IntPtr inst, uint session_id)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				Gst.WebRTC.WebRTCICEStream __result;
				__result = __obj.OnAddStream (session_id);
				return __result == null ? IntPtr.Zero : __result.OwnedHandle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideAddStream")]
		protected virtual Gst.WebRTC.WebRTCICEStream OnAddStream (uint session_id)
		{
			return InternalAddStream (session_id);
		}

		private Gst.WebRTC.WebRTCICEStream InternalAddStream (uint session_id)
		{
			AddStreamNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("add_stream"));
				unmanaged = (AddStreamNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AddStreamNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle, session_id);
			return GLib.Object.GetObject(__result, true) as Gst.WebRTC.WebRTCICEStream;
		}

		static FindTransportNativeDelegate FindTransport_cb_delegate;
		static FindTransportNativeDelegate FindTransportVMCallback {
			get {
				if (FindTransport_cb_delegate == null)
					FindTransport_cb_delegate = new FindTransportNativeDelegate (FindTransport_cb);
				return FindTransport_cb_delegate;
			}
		}

		static void OverrideFindTransport (GLib.GType gtype)
		{
			OverrideFindTransport (gtype, FindTransportVMCallback);
		}

		static void OverrideFindTransport (GLib.GType gtype, FindTransportNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("find_transport"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr FindTransportNativeDelegate (IntPtr inst, IntPtr stream, int component);

		static IntPtr FindTransport_cb (IntPtr inst, IntPtr stream, int component)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				Gst.WebRTC.WebRTCICETransport __result;
				__result = __obj.OnFindTransport (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream, (Gst.WebRTC.WebRTCICEComponent) component);
				return __result == null ? IntPtr.Zero : __result.OwnedHandle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideFindTransport")]
		protected virtual Gst.WebRTC.WebRTCICETransport OnFindTransport (Gst.WebRTC.WebRTCICEStream stream, Gst.WebRTC.WebRTCICEComponent component)
		{
			return InternalFindTransport (stream, component);
		}

		private Gst.WebRTC.WebRTCICETransport InternalFindTransport (Gst.WebRTC.WebRTCICEStream stream, Gst.WebRTC.WebRTCICEComponent component)
		{
			FindTransportNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("find_transport"));
				unmanaged = (FindTransportNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(FindTransportNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle, (int) component);
			return GLib.Object.GetObject(__result, true) as Gst.WebRTC.WebRTCICETransport;
		}

		static GatherCandidatesNativeDelegate GatherCandidates_cb_delegate;
		static GatherCandidatesNativeDelegate GatherCandidatesVMCallback {
			get {
				if (GatherCandidates_cb_delegate == null)
					GatherCandidates_cb_delegate = new GatherCandidatesNativeDelegate (GatherCandidates_cb);
				return GatherCandidates_cb_delegate;
			}
		}

		static void OverrideGatherCandidates (GLib.GType gtype)
		{
			OverrideGatherCandidates (gtype, GatherCandidatesVMCallback);
		}

		static void OverrideGatherCandidates (GLib.GType gtype, GatherCandidatesNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("gather_candidates"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GatherCandidatesNativeDelegate (IntPtr inst, IntPtr stream);

		static bool GatherCandidates_cb (IntPtr inst, IntPtr stream)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				bool __result;
				__result = __obj.OnGatherCandidates (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideGatherCandidates")]
		protected virtual bool OnGatherCandidates (Gst.WebRTC.WebRTCICEStream stream)
		{
			return InternalGatherCandidates (stream);
		}

		private bool InternalGatherCandidates (Gst.WebRTC.WebRTCICEStream stream)
		{
			GatherCandidatesNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("gather_candidates"));
				unmanaged = (GatherCandidatesNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GatherCandidatesNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle);
			return __result;
		}

		static AddCandidateNativeDelegate AddCandidate_cb_delegate;
		static AddCandidateNativeDelegate AddCandidateVMCallback {
			get {
				if (AddCandidate_cb_delegate == null)
					AddCandidate_cb_delegate = new AddCandidateNativeDelegate (AddCandidate_cb);
				return AddCandidate_cb_delegate;
			}
		}

		static void OverrideAddCandidate (GLib.GType gtype)
		{
			OverrideAddCandidate (gtype, AddCandidateVMCallback);
		}

		static void OverrideAddCandidate (GLib.GType gtype, AddCandidateNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("add_candidate"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void AddCandidateNativeDelegate (IntPtr inst, IntPtr stream, IntPtr candidate, IntPtr promise);

		static void AddCandidate_cb (IntPtr inst, IntPtr stream, IntPtr candidate, IntPtr promise)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				__obj.OnAddCandidate (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream, GLib.Marshaller.Utf8PtrToString (candidate), promise == IntPtr.Zero ? null : (Gst.Promise) GLib.Opaque.GetOpaque (promise, typeof (Gst.Promise), false));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideAddCandidate")]
		protected virtual void OnAddCandidate (Gst.WebRTC.WebRTCICEStream stream, string candidate, Gst.Promise promise)
		{
			InternalAddCandidate (stream, candidate, promise);
		}

		private void InternalAddCandidate (Gst.WebRTC.WebRTCICEStream stream, string candidate, Gst.Promise promise)
		{
			AddCandidateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("add_candidate"));
				unmanaged = (AddCandidateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AddCandidateNativeDelegate));
			}
			if (unmanaged == null) return;

			IntPtr native_candidate = GLib.Marshaller.StringToPtrGStrdup (candidate);
			unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle, native_candidate, promise == null ? IntPtr.Zero : promise.Handle);
			GLib.Marshaller.Free (native_candidate);
		}

		static SetLocalCredentialsNativeDelegate SetLocalCredentials_cb_delegate;
		static SetLocalCredentialsNativeDelegate SetLocalCredentialsVMCallback {
			get {
				if (SetLocalCredentials_cb_delegate == null)
					SetLocalCredentials_cb_delegate = new SetLocalCredentialsNativeDelegate (SetLocalCredentials_cb);
				return SetLocalCredentials_cb_delegate;
			}
		}

		static void OverrideSetLocalCredentials (GLib.GType gtype)
		{
			OverrideSetLocalCredentials (gtype, SetLocalCredentialsVMCallback);
		}

		static void OverrideSetLocalCredentials (GLib.GType gtype, SetLocalCredentialsNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_local_credentials"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SetLocalCredentialsNativeDelegate (IntPtr inst, IntPtr stream, IntPtr ufrag, IntPtr pwd);

		static bool SetLocalCredentials_cb (IntPtr inst, IntPtr stream, IntPtr ufrag, IntPtr pwd)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				bool __result;
				__result = __obj.OnSetLocalCredentials (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream, GLib.Marshaller.Utf8PtrToString (ufrag), GLib.Marshaller.Utf8PtrToString (pwd));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetLocalCredentials")]
		protected virtual bool OnSetLocalCredentials (Gst.WebRTC.WebRTCICEStream stream, string ufrag, string pwd)
		{
			return InternalSetLocalCredentials (stream, ufrag, pwd);
		}

		private bool InternalSetLocalCredentials (Gst.WebRTC.WebRTCICEStream stream, string ufrag, string pwd)
		{
			SetLocalCredentialsNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_local_credentials"));
				unmanaged = (SetLocalCredentialsNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetLocalCredentialsNativeDelegate));
			}
			if (unmanaged == null) return false;

			IntPtr native_ufrag = GLib.Marshaller.StringToPtrGStrdup (ufrag);
			IntPtr native_pwd = GLib.Marshaller.StringToPtrGStrdup (pwd);
			bool __result = unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle, native_ufrag, native_pwd);
			GLib.Marshaller.Free (native_ufrag);
			GLib.Marshaller.Free (native_pwd);
			return __result;
		}

		static SetRemoteCredentialsNativeDelegate SetRemoteCredentials_cb_delegate;
		static SetRemoteCredentialsNativeDelegate SetRemoteCredentialsVMCallback {
			get {
				if (SetRemoteCredentials_cb_delegate == null)
					SetRemoteCredentials_cb_delegate = new SetRemoteCredentialsNativeDelegate (SetRemoteCredentials_cb);
				return SetRemoteCredentials_cb_delegate;
			}
		}

		static void OverrideSetRemoteCredentials (GLib.GType gtype)
		{
			OverrideSetRemoteCredentials (gtype, SetRemoteCredentialsVMCallback);
		}

		static void OverrideSetRemoteCredentials (GLib.GType gtype, SetRemoteCredentialsNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_remote_credentials"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SetRemoteCredentialsNativeDelegate (IntPtr inst, IntPtr stream, IntPtr ufrag, IntPtr pwd);

		static bool SetRemoteCredentials_cb (IntPtr inst, IntPtr stream, IntPtr ufrag, IntPtr pwd)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				bool __result;
				__result = __obj.OnSetRemoteCredentials (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream, GLib.Marshaller.Utf8PtrToString (ufrag), GLib.Marshaller.Utf8PtrToString (pwd));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetRemoteCredentials")]
		protected virtual bool OnSetRemoteCredentials (Gst.WebRTC.WebRTCICEStream stream, string ufrag, string pwd)
		{
			return InternalSetRemoteCredentials (stream, ufrag, pwd);
		}

		private bool InternalSetRemoteCredentials (Gst.WebRTC.WebRTCICEStream stream, string ufrag, string pwd)
		{
			SetRemoteCredentialsNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_remote_credentials"));
				unmanaged = (SetRemoteCredentialsNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetRemoteCredentialsNativeDelegate));
			}
			if (unmanaged == null) return false;

			IntPtr native_ufrag = GLib.Marshaller.StringToPtrGStrdup (ufrag);
			IntPtr native_pwd = GLib.Marshaller.StringToPtrGStrdup (pwd);
			bool __result = unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle, native_ufrag, native_pwd);
			GLib.Marshaller.Free (native_ufrag);
			GLib.Marshaller.Free (native_pwd);
			return __result;
		}

		static AddTurnServerNativeDelegate AddTurnServer_cb_delegate;
		static AddTurnServerNativeDelegate AddTurnServerVMCallback {
			get {
				if (AddTurnServer_cb_delegate == null)
					AddTurnServer_cb_delegate = new AddTurnServerNativeDelegate (AddTurnServer_cb);
				return AddTurnServer_cb_delegate;
			}
		}

		static void OverrideAddTurnServer (GLib.GType gtype)
		{
			OverrideAddTurnServer (gtype, AddTurnServerVMCallback);
		}

		static void OverrideAddTurnServer (GLib.GType gtype, AddTurnServerNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("add_turn_server"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool AddTurnServerNativeDelegate (IntPtr inst, IntPtr uri);

		static bool AddTurnServer_cb (IntPtr inst, IntPtr uri)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				bool __result;
				__result = __obj.OnAddTurnServer (GLib.Marshaller.Utf8PtrToString (uri));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideAddTurnServer")]
		protected virtual bool OnAddTurnServer (string uri)
		{
			return InternalAddTurnServer (uri);
		}

		private bool InternalAddTurnServer (string uri)
		{
			AddTurnServerNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("add_turn_server"));
				unmanaged = (AddTurnServerNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AddTurnServerNativeDelegate));
			}
			if (unmanaged == null) return false;

			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			bool __result = unmanaged (this.Handle, native_uri);
			GLib.Marshaller.Free (native_uri);
			return __result;
		}

		static SetIsControllerNativeDelegate SetIsController_cb_delegate;
		static SetIsControllerNativeDelegate SetIsControllerVMCallback {
			get {
				if (SetIsController_cb_delegate == null)
					SetIsController_cb_delegate = new SetIsControllerNativeDelegate (SetIsController_cb);
				return SetIsController_cb_delegate;
			}
		}

		static void OverrideSetIsController (GLib.GType gtype)
		{
			OverrideSetIsController (gtype, SetIsControllerVMCallback);
		}

		static void OverrideSetIsController (GLib.GType gtype, SetIsControllerNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_is_controller"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetIsControllerNativeDelegate (IntPtr inst, bool controller);

		static void SetIsController_cb (IntPtr inst, bool controller)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				__obj.OnSetIsController (controller);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetIsController")]
		protected virtual void OnSetIsController (bool controller)
		{
			InternalSetIsController (controller);
		}

		private void InternalSetIsController (bool controller)
		{
			SetIsControllerNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_is_controller"));
				unmanaged = (SetIsControllerNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetIsControllerNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, controller);
		}

		static GetIsControllerNativeDelegate GetIsController_cb_delegate;
		static GetIsControllerNativeDelegate GetIsControllerVMCallback {
			get {
				if (GetIsController_cb_delegate == null)
					GetIsController_cb_delegate = new GetIsControllerNativeDelegate (GetIsController_cb);
				return GetIsController_cb_delegate;
			}
		}

		static void OverrideGetIsController (GLib.GType gtype)
		{
			OverrideGetIsController (gtype, GetIsControllerVMCallback);
		}

		static void OverrideGetIsController (GLib.GType gtype, GetIsControllerNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_is_controller"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GetIsControllerNativeDelegate (IntPtr inst);

		static bool GetIsController_cb (IntPtr inst)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				bool __result;
				__result = __obj.OnGetIsController ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideGetIsController")]
		protected virtual bool OnGetIsController ()
		{
			return InternalGetIsController ();
		}

		private bool InternalGetIsController ()
		{
			GetIsControllerNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_is_controller"));
				unmanaged = (GetIsControllerNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetIsControllerNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle);
			return __result;
		}

		static SetForceRelayNativeDelegate SetForceRelay_cb_delegate;
		static SetForceRelayNativeDelegate SetForceRelayVMCallback {
			get {
				if (SetForceRelay_cb_delegate == null)
					SetForceRelay_cb_delegate = new SetForceRelayNativeDelegate (SetForceRelay_cb);
				return SetForceRelay_cb_delegate;
			}
		}

		static void OverrideSetForceRelay (GLib.GType gtype)
		{
			OverrideSetForceRelay (gtype, SetForceRelayVMCallback);
		}

		static void OverrideSetForceRelay (GLib.GType gtype, SetForceRelayNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_force_relay"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetForceRelayNativeDelegate (IntPtr inst, bool force_relay);

		static void SetForceRelay_cb (IntPtr inst, bool force_relay)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				__obj.OnSetForceRelay (force_relay);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetForceRelay")]
		protected virtual void OnSetForceRelay (bool force_relay)
		{
			InternalSetForceRelay (force_relay);
		}

		private void InternalSetForceRelay (bool force_relay)
		{
			SetForceRelayNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_force_relay"));
				unmanaged = (SetForceRelayNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetForceRelayNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, force_relay);
		}

		static SetStunServerNativeDelegate SetStunServer_cb_delegate;
		static SetStunServerNativeDelegate SetStunServerVMCallback {
			get {
				if (SetStunServer_cb_delegate == null)
					SetStunServer_cb_delegate = new SetStunServerNativeDelegate (SetStunServer_cb);
				return SetStunServer_cb_delegate;
			}
		}

		static void OverrideSetStunServer (GLib.GType gtype)
		{
			OverrideSetStunServer (gtype, SetStunServerVMCallback);
		}

		static void OverrideSetStunServer (GLib.GType gtype, SetStunServerNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_stun_server"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetStunServerNativeDelegate (IntPtr inst, IntPtr uri);

		static void SetStunServer_cb (IntPtr inst, IntPtr uri)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				__obj.OnSetStunServer (GLib.Marshaller.Utf8PtrToString (uri));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetStunServer")]
		protected virtual void OnSetStunServer (string uri)
		{
			InternalSetStunServer (uri);
		}

		private void InternalSetStunServer (string uri)
		{
			SetStunServerNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_stun_server"));
				unmanaged = (SetStunServerNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetStunServerNativeDelegate));
			}
			if (unmanaged == null) return;

			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			unmanaged (this.Handle, native_uri);
			GLib.Marshaller.Free (native_uri);
		}

		static GetStunServerNativeDelegate GetStunServer_cb_delegate;
		static GetStunServerNativeDelegate GetStunServerVMCallback {
			get {
				if (GetStunServer_cb_delegate == null)
					GetStunServer_cb_delegate = new GetStunServerNativeDelegate (GetStunServer_cb);
				return GetStunServer_cb_delegate;
			}
		}

		static void OverrideGetStunServer (GLib.GType gtype)
		{
			OverrideGetStunServer (gtype, GetStunServerVMCallback);
		}

		static void OverrideGetStunServer (GLib.GType gtype, GetStunServerNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_stun_server"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideGetStunServer")]
		protected virtual string OnGetStunServer ()
		{
			return InternalGetStunServer ();
		}

		private string InternalGetStunServer ()
		{
			GetStunServerNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_stun_server"));
				unmanaged = (GetStunServerNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetStunServerNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle);
			return GLib.Marshaller.PtrToStringGFree(__result);
		}

		static SetTurnServerNativeDelegate SetTurnServer_cb_delegate;
		static SetTurnServerNativeDelegate SetTurnServerVMCallback {
			get {
				if (SetTurnServer_cb_delegate == null)
					SetTurnServer_cb_delegate = new SetTurnServerNativeDelegate (SetTurnServer_cb);
				return SetTurnServer_cb_delegate;
			}
		}

		static void OverrideSetTurnServer (GLib.GType gtype)
		{
			OverrideSetTurnServer (gtype, SetTurnServerVMCallback);
		}

		static void OverrideSetTurnServer (GLib.GType gtype, SetTurnServerNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_turn_server"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetTurnServerNativeDelegate (IntPtr inst, IntPtr uri);

		static void SetTurnServer_cb (IntPtr inst, IntPtr uri)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				__obj.OnSetTurnServer (GLib.Marshaller.Utf8PtrToString (uri));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetTurnServer")]
		protected virtual void OnSetTurnServer (string uri)
		{
			InternalSetTurnServer (uri);
		}

		private void InternalSetTurnServer (string uri)
		{
			SetTurnServerNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_turn_server"));
				unmanaged = (SetTurnServerNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetTurnServerNativeDelegate));
			}
			if (unmanaged == null) return;

			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			unmanaged (this.Handle, native_uri);
			GLib.Marshaller.Free (native_uri);
		}

		static GetTurnServerNativeDelegate GetTurnServer_cb_delegate;
		static GetTurnServerNativeDelegate GetTurnServerVMCallback {
			get {
				if (GetTurnServer_cb_delegate == null)
					GetTurnServer_cb_delegate = new GetTurnServerNativeDelegate (GetTurnServer_cb);
				return GetTurnServer_cb_delegate;
			}
		}

		static void OverrideGetTurnServer (GLib.GType gtype)
		{
			OverrideGetTurnServer (gtype, GetTurnServerVMCallback);
		}

		static void OverrideGetTurnServer (GLib.GType gtype, GetTurnServerNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_turn_server"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideGetTurnServer")]
		protected virtual string OnGetTurnServer ()
		{
			return InternalGetTurnServer ();
		}

		private string InternalGetTurnServer ()
		{
			GetTurnServerNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_turn_server"));
				unmanaged = (GetTurnServerNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetTurnServerNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle);
			return GLib.Marshaller.PtrToStringGFree(__result);
		}

		static SetHttpProxyNativeDelegate SetHttpProxy_cb_delegate;
		static SetHttpProxyNativeDelegate SetHttpProxyVMCallback {
			get {
				if (SetHttpProxy_cb_delegate == null)
					SetHttpProxy_cb_delegate = new SetHttpProxyNativeDelegate (SetHttpProxy_cb);
				return SetHttpProxy_cb_delegate;
			}
		}

		static void OverrideSetHttpProxy (GLib.GType gtype)
		{
			OverrideSetHttpProxy (gtype, SetHttpProxyVMCallback);
		}

		static void OverrideSetHttpProxy (GLib.GType gtype, SetHttpProxyNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_http_proxy"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetHttpProxyNativeDelegate (IntPtr inst, IntPtr uri);

		static void SetHttpProxy_cb (IntPtr inst, IntPtr uri)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				__obj.OnSetHttpProxy (GLib.Marshaller.Utf8PtrToString (uri));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetHttpProxy")]
		protected virtual void OnSetHttpProxy (string uri)
		{
			InternalSetHttpProxy (uri);
		}

		private void InternalSetHttpProxy (string uri)
		{
			SetHttpProxyNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_http_proxy"));
				unmanaged = (SetHttpProxyNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetHttpProxyNativeDelegate));
			}
			if (unmanaged == null) return;

			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			unmanaged (this.Handle, native_uri);
			GLib.Marshaller.Free (native_uri);
		}

		static GetHttpProxyNativeDelegate GetHttpProxy_cb_delegate;
		static GetHttpProxyNativeDelegate GetHttpProxyVMCallback {
			get {
				if (GetHttpProxy_cb_delegate == null)
					GetHttpProxy_cb_delegate = new GetHttpProxyNativeDelegate (GetHttpProxy_cb);
				return GetHttpProxy_cb_delegate;
			}
		}

		static void OverrideGetHttpProxy (GLib.GType gtype)
		{
			OverrideGetHttpProxy (gtype, GetHttpProxyVMCallback);
		}

		static void OverrideGetHttpProxy (GLib.GType gtype, GetHttpProxyNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_http_proxy"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideGetHttpProxy")]
		protected virtual string OnGetHttpProxy ()
		{
			return InternalGetHttpProxy ();
		}

		private string InternalGetHttpProxy ()
		{
			GetHttpProxyNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_http_proxy"));
				unmanaged = (GetHttpProxyNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetHttpProxyNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle);
			return GLib.Marshaller.PtrToStringGFree(__result);
		}

		static SetTosNativeDelegate SetTos_cb_delegate;
		static SetTosNativeDelegate SetTosVMCallback {
			get {
				if (SetTos_cb_delegate == null)
					SetTos_cb_delegate = new SetTosNativeDelegate (SetTos_cb);
				return SetTos_cb_delegate;
			}
		}

		static void OverrideSetTos (GLib.GType gtype)
		{
			OverrideSetTos (gtype, SetTosVMCallback);
		}

		static void OverrideSetTos (GLib.GType gtype, SetTosNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_tos"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetTosNativeDelegate (IntPtr inst, IntPtr stream, uint tos);

		static void SetTos_cb (IntPtr inst, IntPtr stream, uint tos)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				__obj.OnSetTos (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream, tos);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetTos")]
		protected virtual void OnSetTos (Gst.WebRTC.WebRTCICEStream stream, uint tos)
		{
			InternalSetTos (stream, tos);
		}

		private void InternalSetTos (Gst.WebRTC.WebRTCICEStream stream, uint tos)
		{
			SetTosNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_tos"));
				unmanaged = (SetTosNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetTosNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle, tos);
		}

		static SetOnIceCandidateNativeDelegate SetOnIceCandidate_cb_delegate;
		static SetOnIceCandidateNativeDelegate SetOnIceCandidateVMCallback {
			get {
				if (SetOnIceCandidate_cb_delegate == null)
					SetOnIceCandidate_cb_delegate = new SetOnIceCandidateNativeDelegate (SetOnIceCandidate_cb);
				return SetOnIceCandidate_cb_delegate;
			}
		}

		static void OverrideSetOnIceCandidate (GLib.GType gtype)
		{
			OverrideSetOnIceCandidate (gtype, SetOnIceCandidateVMCallback);
		}

		static void OverrideSetOnIceCandidate (GLib.GType gtype, SetOnIceCandidateNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_on_ice_candidate"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetOnIceCandidateNativeDelegate (IntPtr inst, Gst.WebRTCSharp.WebRTCICEOnCandidateFuncNative func, IntPtr user_data, GLib.DestroyNotify notify);

		static void SetOnIceCandidate_cb (IntPtr inst, Gst.WebRTCSharp.WebRTCICEOnCandidateFuncNative func, IntPtr user_data, GLib.DestroyNotify notify)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				Gst.WebRTCSharp.WebRTCICEOnCandidateFuncInvoker func_invoker = new Gst.WebRTCSharp.WebRTCICEOnCandidateFuncInvoker (func, user_data, notify);
				__obj.OnSetOnIceCandidate (func_invoker.Handler);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideSetOnIceCandidate")]
		protected virtual void OnSetOnIceCandidate (Gst.WebRTC.WebRTCICEOnCandidateFunc func)
		{
			InternalSetOnIceCandidate (func);
		}

		private void InternalSetOnIceCandidate (Gst.WebRTC.WebRTCICEOnCandidateFunc func)
		{
			SetOnIceCandidateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_on_ice_candidate"));
				unmanaged = (SetOnIceCandidateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetOnIceCandidateNativeDelegate));
			}
			if (unmanaged == null) return;

			Gst.WebRTCSharp.WebRTCICEOnCandidateFuncWrapper func_wrapper = new Gst.WebRTCSharp.WebRTCICEOnCandidateFuncWrapper (func);
			IntPtr user_data;
			GLib.DestroyNotify notify;
			if (func == null) {
				user_data = IntPtr.Zero;
				notify = null;
			} else {
				user_data = (IntPtr) GCHandle.Alloc (func_wrapper);
				notify = GLib.DestroyHelper.NotifyHandler;
			}
			unmanaged (this.Handle, func_wrapper.NativeDelegate, user_data, notify);
		}

		static GetLocalCandidatesNativeDelegate GetLocalCandidates_cb_delegate;
		static GetLocalCandidatesNativeDelegate GetLocalCandidatesVMCallback {
			get {
				if (GetLocalCandidates_cb_delegate == null)
					GetLocalCandidates_cb_delegate = new GetLocalCandidatesNativeDelegate (GetLocalCandidates_cb);
				return GetLocalCandidates_cb_delegate;
			}
		}

		static void OverrideGetLocalCandidates (GLib.GType gtype)
		{
			OverrideGetLocalCandidates (gtype, GetLocalCandidatesVMCallback);
		}

		static void OverrideGetLocalCandidates (GLib.GType gtype, GetLocalCandidatesNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_local_candidates"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetLocalCandidatesNativeDelegate (IntPtr inst, IntPtr stream);

		static IntPtr GetLocalCandidates_cb (IntPtr inst, IntPtr stream)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				Gst.WebRTC.WebRTCICECandidateStats __result;
				__result = __obj.OnGetLocalCandidates (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream);
				return GLib.Marshaller.StructureToPtrAlloc (__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideGetLocalCandidates")]
		protected virtual Gst.WebRTC.WebRTCICECandidateStats OnGetLocalCandidates (Gst.WebRTC.WebRTCICEStream stream)
		{
			return InternalGetLocalCandidates (stream);
		}

		private Gst.WebRTC.WebRTCICECandidateStats InternalGetLocalCandidates (Gst.WebRTC.WebRTCICEStream stream)
		{
			GetLocalCandidatesNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_local_candidates"));
				unmanaged = (GetLocalCandidatesNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetLocalCandidatesNativeDelegate));
			}
			if (unmanaged == null) return Gst.WebRTC.WebRTCICECandidateStats.Zero;

			IntPtr __result = unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle);
			return Gst.WebRTC.WebRTCICECandidateStats.New (__result);
		}

		static GetRemoteCandidatesNativeDelegate GetRemoteCandidates_cb_delegate;
		static GetRemoteCandidatesNativeDelegate GetRemoteCandidatesVMCallback {
			get {
				if (GetRemoteCandidates_cb_delegate == null)
					GetRemoteCandidates_cb_delegate = new GetRemoteCandidatesNativeDelegate (GetRemoteCandidates_cb);
				return GetRemoteCandidates_cb_delegate;
			}
		}

		static void OverrideGetRemoteCandidates (GLib.GType gtype)
		{
			OverrideGetRemoteCandidates (gtype, GetRemoteCandidatesVMCallback);
		}

		static void OverrideGetRemoteCandidates (GLib.GType gtype, GetRemoteCandidatesNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_remote_candidates"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetRemoteCandidatesNativeDelegate (IntPtr inst, IntPtr stream);

		static IntPtr GetRemoteCandidates_cb (IntPtr inst, IntPtr stream)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				Gst.WebRTC.WebRTCICECandidateStats __result;
				__result = __obj.OnGetRemoteCandidates (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream);
				return GLib.Marshaller.StructureToPtrAlloc (__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideGetRemoteCandidates")]
		protected virtual Gst.WebRTC.WebRTCICECandidateStats OnGetRemoteCandidates (Gst.WebRTC.WebRTCICEStream stream)
		{
			return InternalGetRemoteCandidates (stream);
		}

		private Gst.WebRTC.WebRTCICECandidateStats InternalGetRemoteCandidates (Gst.WebRTC.WebRTCICEStream stream)
		{
			GetRemoteCandidatesNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_remote_candidates"));
				unmanaged = (GetRemoteCandidatesNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetRemoteCandidatesNativeDelegate));
			}
			if (unmanaged == null) return Gst.WebRTC.WebRTCICECandidateStats.Zero;

			IntPtr __result = unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle);
			return Gst.WebRTC.WebRTCICECandidateStats.New (__result);
		}

		static GetSelectedPairNativeDelegate GetSelectedPair_cb_delegate;
		static GetSelectedPairNativeDelegate GetSelectedPairVMCallback {
			get {
				if (GetSelectedPair_cb_delegate == null)
					GetSelectedPair_cb_delegate = new GetSelectedPairNativeDelegate (GetSelectedPair_cb);
				return GetSelectedPair_cb_delegate;
			}
		}

		static void OverrideGetSelectedPair (GLib.GType gtype)
		{
			OverrideGetSelectedPair (gtype, GetSelectedPairVMCallback);
		}

		static void OverrideGetSelectedPair (GLib.GType gtype, GetSelectedPairNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_selected_pair"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GetSelectedPairNativeDelegate (IntPtr inst, IntPtr stream, IntPtr local_stats, IntPtr remote_stats);

		static bool GetSelectedPair_cb (IntPtr inst, IntPtr stream, IntPtr local_stats, IntPtr remote_stats)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				bool __result;
				Gst.WebRTC.WebRTCICECandidateStats mylocal_stats;
				Gst.WebRTC.WebRTCICECandidateStats myremote_stats;
				__result = __obj.OnGetSelectedPair (GLib.Object.GetObject(stream) as Gst.WebRTC.WebRTCICEStream, out mylocal_stats, out myremote_stats);
				if (local_stats != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (mylocal_stats, local_stats, false);
				if (remote_stats != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (myremote_stats, remote_stats, false);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideGetSelectedPair")]
		protected virtual bool OnGetSelectedPair (Gst.WebRTC.WebRTCICEStream stream, out Gst.WebRTC.WebRTCICECandidateStats local_stats, out Gst.WebRTC.WebRTCICECandidateStats remote_stats)
		{
			return InternalGetSelectedPair (stream, out local_stats, out remote_stats);
		}

		private bool InternalGetSelectedPair (Gst.WebRTC.WebRTCICEStream stream, out Gst.WebRTC.WebRTCICECandidateStats local_stats, out Gst.WebRTC.WebRTCICECandidateStats remote_stats)
		{
			GetSelectedPairNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_selected_pair"));
				unmanaged = (GetSelectedPairNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetSelectedPairNativeDelegate));
			}
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr native_local_stats = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.WebRTC.WebRTCICECandidateStats)));
			IntPtr native_remote_stats = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.WebRTC.WebRTCICECandidateStats)));
			bool __result = unmanaged (this.Handle, stream == null ? IntPtr.Zero : stream.Handle, native_local_stats, native_remote_stats);
			local_stats = Gst.WebRTC.WebRTCICECandidateStats.New (native_local_stats);
			Marshal.FreeHGlobal (native_local_stats);
			remote_stats = Gst.WebRTC.WebRTCICECandidateStats.New (native_remote_stats);
			Marshal.FreeHGlobal (native_remote_stats);
			return __result;
		}

		static CloseNativeDelegate Close_cb_delegate;
		static CloseNativeDelegate CloseVMCallback {
			get {
				if (Close_cb_delegate == null)
					Close_cb_delegate = new CloseNativeDelegate (Close_cb);
				return Close_cb_delegate;
			}
		}

		static void OverrideClose (GLib.GType gtype)
		{
			OverrideClose (gtype, CloseVMCallback);
		}

		static void OverrideClose (GLib.GType gtype, CloseNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("close"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void CloseNativeDelegate (IntPtr inst, IntPtr promise);

		static void Close_cb (IntPtr inst, IntPtr promise)
		{
			try {
				WebRTCICE __obj = GLib.Object.GetObject (inst, false) as WebRTCICE;
				__obj.OnClose (promise == IntPtr.Zero ? null : (Gst.Promise) GLib.Opaque.GetOpaque (promise, typeof (Gst.Promise), false));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.WebRTC.WebRTCICE), ConnectionMethod="OverrideClose")]
		protected virtual void OnClose (Gst.Promise promise)
		{
			InternalClose (promise);
		}

		private void InternalClose (Gst.Promise promise)
		{
			CloseNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("close"));
				unmanaged = (CloseNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(CloseNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, promise == null ? IntPtr.Zero : promise.Handle);
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("add_stream"
							, Gst.Object.class_abi.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // add_stream
							, null
							, "find_transport"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("find_transport"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // find_transport
							, "add_stream"
							, "gather_candidates"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("gather_candidates"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // gather_candidates
							, "find_transport"
							, "add_candidate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("add_candidate"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // add_candidate
							, "gather_candidates"
							, "set_local_credentials"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_local_credentials"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_local_credentials
							, "add_candidate"
							, "set_remote_credentials"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_remote_credentials"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_remote_credentials
							, "set_local_credentials"
							, "add_turn_server"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("add_turn_server"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // add_turn_server
							, "set_remote_credentials"
							, "set_is_controller"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_is_controller"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_is_controller
							, "add_turn_server"
							, "get_is_controller"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_is_controller"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_is_controller
							, "set_is_controller"
							, "set_force_relay"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_force_relay"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_force_relay
							, "get_is_controller"
							, "set_stun_server"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_stun_server"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_stun_server
							, "set_force_relay"
							, "get_stun_server"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_stun_server"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_stun_server
							, "set_stun_server"
							, "set_turn_server"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_turn_server"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_turn_server
							, "get_stun_server"
							, "get_turn_server"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_turn_server"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_turn_server
							, "set_turn_server"
							, "set_http_proxy"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_http_proxy"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_http_proxy
							, "get_turn_server"
							, "get_http_proxy"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_http_proxy"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_http_proxy
							, "set_http_proxy"
							, "set_tos"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_tos"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_tos
							, "get_http_proxy"
							, "set_on_ice_candidate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_on_ice_candidate"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_on_ice_candidate
							, "set_tos"
							, "get_local_candidates"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_local_candidates"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_local_candidates
							, "set_on_ice_candidate"
							, "get_remote_candidates"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_remote_candidates"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_remote_candidates
							, "get_local_candidates"
							, "get_selected_pair"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_selected_pair"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_selected_pair
							, "get_remote_candidates"
							, "close"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("close"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // close
							, "get_selected_pair"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 3 // _gst_reserved
							, "close"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_webrtc_ice_get_type();

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

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_add_candidate(IntPtr raw, IntPtr stream, IntPtr candidate, IntPtr promise);

		public void AddCandidate(Gst.WebRTC.WebRTCICEStream stream, string candidate, Gst.Promise promise) {
			IntPtr native_candidate = GLib.Marshaller.StringToPtrGStrdup (candidate);
			gst_webrtc_ice_add_candidate(Handle, stream == null ? IntPtr.Zero : stream.Handle, native_candidate, promise == null ? IntPtr.Zero : promise.Handle);
			GLib.Marshaller.Free (native_candidate);
		}

		public void AddCandidate(Gst.WebRTC.WebRTCICEStream stream, string candidate) {
			AddCandidate (stream, candidate, null);
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_webrtc_ice_add_stream(IntPtr raw, uint session_id);

		public Gst.WebRTC.WebRTCICEStream AddStream(uint session_id) {
			IntPtr raw_ret = gst_webrtc_ice_add_stream(Handle, session_id);
			Gst.WebRTC.WebRTCICEStream ret = GLib.Object.GetObject(raw_ret, true) as Gst.WebRTC.WebRTCICEStream;
			return ret;
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_webrtc_ice_add_turn_server(IntPtr raw, IntPtr uri);

		public bool AddTurnServer(string uri) {
			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			bool raw_ret = gst_webrtc_ice_add_turn_server(Handle, native_uri);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_uri);
			return ret;
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_close(IntPtr raw, IntPtr promise);

		public void Close(Gst.Promise promise) {
			gst_webrtc_ice_close(Handle, promise == null ? IntPtr.Zero : promise.Handle);
		}

		public void Close() {
			Close (null);
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_webrtc_ice_find_transport(IntPtr raw, IntPtr stream, int component);

		public Gst.WebRTC.WebRTCICETransport FindTransport(Gst.WebRTC.WebRTCICEStream stream, Gst.WebRTC.WebRTCICEComponent component) {
			IntPtr raw_ret = gst_webrtc_ice_find_transport(Handle, stream == null ? IntPtr.Zero : stream.Handle, (int) component);
			Gst.WebRTC.WebRTCICETransport ret = GLib.Object.GetObject(raw_ret, true) as Gst.WebRTC.WebRTCICETransport;
			return ret;
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_webrtc_ice_gather_candidates(IntPtr raw, IntPtr stream);

		public bool GatherCandidates(Gst.WebRTC.WebRTCICEStream stream) {
			bool raw_ret = gst_webrtc_ice_gather_candidates(Handle, stream == null ? IntPtr.Zero : stream.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_webrtc_ice_get_http_proxy(IntPtr raw);

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_set_http_proxy(IntPtr raw, IntPtr uri);

		public string HttpProxy { 
			get {
				IntPtr raw_ret = gst_webrtc_ice_get_http_proxy(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
			set {
				IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
				gst_webrtc_ice_set_http_proxy(Handle, native_value);
				GLib.Marshaller.Free (native_value);
			}
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_webrtc_ice_get_is_controller(IntPtr raw);

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_set_is_controller(IntPtr raw, bool controller);

		public bool IsController { 
			get {
				bool raw_ret = gst_webrtc_ice_get_is_controller(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set {
				gst_webrtc_ice_set_is_controller(Handle, value);
			}
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_webrtc_ice_get_selected_pair(IntPtr raw, IntPtr stream, IntPtr local_stats, IntPtr remote_stats);

		[Obsolete]
		public bool GetSelectedPair(Gst.WebRTC.WebRTCICEStream stream, out Gst.WebRTC.WebRTCICECandidateStats local_stats, out Gst.WebRTC.WebRTCICECandidateStats remote_stats) {
			IntPtr native_local_stats = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.WebRTC.WebRTCICECandidateStats)));
			IntPtr native_remote_stats = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.WebRTC.WebRTCICECandidateStats)));
			bool raw_ret = gst_webrtc_ice_get_selected_pair(Handle, stream == null ? IntPtr.Zero : stream.Handle, native_local_stats, native_remote_stats);
			bool ret = raw_ret;
			local_stats = Gst.WebRTC.WebRTCICECandidateStats.New (native_local_stats);
			Marshal.FreeHGlobal (native_local_stats);
			remote_stats = Gst.WebRTC.WebRTCICECandidateStats.New (native_remote_stats);
			Marshal.FreeHGlobal (native_remote_stats);
			return ret;
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_webrtc_ice_get_stun_server(IntPtr raw);

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_set_stun_server(IntPtr raw, IntPtr uri);

		public string StunServer { 
			get {
				IntPtr raw_ret = gst_webrtc_ice_get_stun_server(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
			set {
				IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
				gst_webrtc_ice_set_stun_server(Handle, native_value);
				GLib.Marshaller.Free (native_value);
			}
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_webrtc_ice_get_turn_server(IntPtr raw);

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_set_turn_server(IntPtr raw, IntPtr uri);

		public string TurnServer { 
			get {
				IntPtr raw_ret = gst_webrtc_ice_get_turn_server(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
			set {
				IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
				gst_webrtc_ice_set_turn_server(Handle, native_value);
				GLib.Marshaller.Free (native_value);
			}
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_set_force_relay(IntPtr raw, bool force_relay);

		public bool ForceRelay { 
			set {
				gst_webrtc_ice_set_force_relay(Handle, value);
			}
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_webrtc_ice_set_local_credentials(IntPtr raw, IntPtr stream, IntPtr ufrag, IntPtr pwd);

		public bool SetLocalCredentials(Gst.WebRTC.WebRTCICEStream stream, string ufrag, string pwd) {
			IntPtr native_ufrag = GLib.Marshaller.StringToPtrGStrdup (ufrag);
			IntPtr native_pwd = GLib.Marshaller.StringToPtrGStrdup (pwd);
			bool raw_ret = gst_webrtc_ice_set_local_credentials(Handle, stream == null ? IntPtr.Zero : stream.Handle, native_ufrag, native_pwd);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_ufrag);
			GLib.Marshaller.Free (native_pwd);
			return ret;
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_set_on_ice_candidate(IntPtr raw, Gst.WebRTCSharp.WebRTCICEOnCandidateFuncNative func, IntPtr user_data, GLib.DestroyNotify notify);

		public Gst.WebRTC.WebRTCICEOnCandidateFunc OnIceCandidate { 
			set {
				Gst.WebRTCSharp.WebRTCICEOnCandidateFuncWrapper value_wrapper = new Gst.WebRTCSharp.WebRTCICEOnCandidateFuncWrapper (value);
				IntPtr user_data;
				GLib.DestroyNotify notify;
				if (value == null) {
					user_data = IntPtr.Zero;
					notify = null;
				} else {
					user_data = (IntPtr) GCHandle.Alloc (value_wrapper);
					notify = GLib.DestroyHelper.NotifyHandler;
				}
				gst_webrtc_ice_set_on_ice_candidate(Handle, value_wrapper.NativeDelegate, user_data, notify);
			}
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_webrtc_ice_set_remote_credentials(IntPtr raw, IntPtr stream, IntPtr ufrag, IntPtr pwd);

		public bool SetRemoteCredentials(Gst.WebRTC.WebRTCICEStream stream, string ufrag, string pwd) {
			IntPtr native_ufrag = GLib.Marshaller.StringToPtrGStrdup (ufrag);
			IntPtr native_pwd = GLib.Marshaller.StringToPtrGStrdup (pwd);
			bool raw_ret = gst_webrtc_ice_set_remote_credentials(Handle, stream == null ? IntPtr.Zero : stream.Handle, native_ufrag, native_pwd);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_ufrag);
			GLib.Marshaller.Free (native_pwd);
			return ret;
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_webrtc_ice_set_tos(IntPtr raw, IntPtr stream, uint tos);

		public void SetTos(Gst.WebRTC.WebRTCICEStream stream, uint tos) {
			gst_webrtc_ice_set_tos(Handle, stream == null ? IntPtr.Zero : stream.Handle, tos);
		}


		static WebRTCICE ()
		{
			GtkSharp.GstreamerSharp.ObjectManager.Initialize ();
		}

		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("ice_gathering_state"
							, Gst.Object.abi_info.Fields
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.WebRTC.WebRTCICEGatheringState))) // ice_gathering_state
							, null
							, "ice_connection_state"
							, (long) Marshal.OffsetOf(typeof(GstWebRTCICE_ice_gathering_stateAlign), "ice_gathering_state")
							, 0
							),
						new GLib.AbiField("ice_connection_state"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.WebRTC.WebRTCICEConnectionState))) // ice_connection_state
							, "ice_gathering_state"
							, "min_rtp_port"
							, (long) Marshal.OffsetOf(typeof(GstWebRTCICE_ice_connection_stateAlign), "ice_connection_state")
							, 0
							),
						new GLib.AbiField("min_rtp_port"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // min_rtp_port
							, "ice_connection_state"
							, "max_rtp_port"
							, (long) Marshal.OffsetOf(typeof(GstWebRTCICE_min_rtp_portAlign), "min_rtp_port")
							, 0
							),
						new GLib.AbiField("max_rtp_port"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // max_rtp_port
							, "min_rtp_port"
							, "_gst_reserved"
							, (long) Marshal.OffsetOf(typeof(GstWebRTCICE_max_rtp_portAlign), "max_rtp_port")
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 4 // _gst_reserved
							, "max_rtp_port"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstWebRTCICE_ice_gathering_stateAlign
		{
			sbyte f1;
			private Gst.WebRTC.WebRTCICEGatheringState ice_gathering_state;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstWebRTCICE_ice_connection_stateAlign
		{
			sbyte f1;
			private Gst.WebRTC.WebRTCICEConnectionState ice_connection_state;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstWebRTCICE_min_rtp_portAlign
		{
			sbyte f1;
			private uint min_rtp_port;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstWebRTCICE_max_rtp_portAlign
		{
			sbyte f1;
			private uint max_rtp_port;
		}


		// End of the ABI representation.

#endregion
	}
}
