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

namespace Gst.Net {

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

#region Autogenerated code
	public partial class Global {

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_buffer_add_net_address_meta(IntPtr buffer, IntPtr addr);

		public static Gst.Net.NetAddressMeta BufferAddNetAddressMeta(Gst.Buffer buffer, GLib.SocketAddress addr) {
			IntPtr raw_ret = gst_buffer_add_net_address_meta(buffer == null ? IntPtr.Zero : buffer.Handle, addr == null ? IntPtr.Zero : addr.Handle);
			Gst.Net.NetAddressMeta ret = Gst.Net.NetAddressMeta.New (raw_ret);
			return ret;
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_buffer_add_net_control_message_meta(IntPtr buffer, IntPtr message);

		public static Gst.Net.NetControlMessageMeta BufferAddNetControlMessageMeta(Gst.Buffer buffer, GLib.SocketControlMessage message) {
			IntPtr raw_ret = gst_buffer_add_net_control_message_meta(buffer == null ? IntPtr.Zero : buffer.Handle, message == null ? IntPtr.Zero : message.Handle);
			Gst.Net.NetControlMessageMeta ret = Gst.Net.NetControlMessageMeta.New (raw_ret);
			return ret;
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_buffer_get_net_address_meta(IntPtr buffer);

		public static Gst.Net.NetAddressMeta BufferGetNetAddressMeta(Gst.Buffer buffer) {
			IntPtr raw_ret = gst_buffer_get_net_address_meta(buffer == null ? IntPtr.Zero : buffer.Handle);
			Gst.Net.NetAddressMeta ret = Gst.Net.NetAddressMeta.New (raw_ret);
			return ret;
		}

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

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

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

		public static Gst.MetaInfo NetAddressMetaGetInfo() {
			IntPtr raw_ret = gst_net_address_meta_get_info();
			Gst.MetaInfo ret = Gst.MetaInfo.New (raw_ret);
			return ret;
		}

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

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

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

		public static Gst.MetaInfo NetControlMessageMetaGetInfo() {
			IntPtr raw_ret = gst_net_control_message_meta_get_info();
			Gst.MetaInfo ret = Gst.MetaInfo.New (raw_ret);
			return ret;
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern unsafe IntPtr gst_net_time_packet_receive(IntPtr socket, out IntPtr src_address, out IntPtr error);

		public static unsafe Gst.Net.NetTimePacket NetTimePacketReceive(GLib.Socket socket, out GLib.SocketAddress src_address) {
			IntPtr native_src_address;
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = gst_net_time_packet_receive(socket == null ? IntPtr.Zero : socket.Handle, out native_src_address, out error);
			Gst.Net.NetTimePacket ret = Gst.Net.NetTimePacket.New (raw_ret);
			src_address = GLib.Object.GetObject(native_src_address, true) as GLib.SocketAddress;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_net_utils_set_socket_tos(IntPtr socket, int qos_dscp);

		public static bool NetUtilsSetSocketTos(GLib.Socket socket, int qos_dscp) {
			bool raw_ret = gst_net_utils_set_socket_tos(socket == null ? IntPtr.Zero : socket.Handle, qos_dscp);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_ptp_deinit();

		public static void PtpDeinit() {
			gst_ptp_deinit();
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_ptp_init(ulong clock_id, IntPtr interfaces);

		public static bool PtpInit(ulong clock_id, string[] interfaces) {
			IntPtr native_interfaces = GLib.Marshaller.StringArrayToStrvPtr(interfaces, true);
			bool raw_ret = gst_ptp_init(clock_id, native_interfaces);
			bool ret = raw_ret;
			GLib.Marshaller.StrFreeV (native_interfaces);
			return ret;
		}

		public static bool PtpInit(ulong clock_id) {
			return PtpInit (clock_id, null);
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_ptp_is_initialized();

		public static bool PtpIsInitialized() {
			bool raw_ret = gst_ptp_is_initialized();
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_ptp_is_supported();

		public static bool PtpIsSupported() {
			bool raw_ret = gst_ptp_is_supported();
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern UIntPtr gst_ptp_statistics_callback_add(Gst.NetSharp.PtpStatisticsCallbackNative cb, IntPtr user_data, GLib.DestroyNotify destroy_data);

		public static ulong PtpStatisticsCallbackAdd(Gst.Net.PtpStatisticsCallback cb) {
			Gst.NetSharp.PtpStatisticsCallbackWrapper cb_wrapper = new Gst.NetSharp.PtpStatisticsCallbackWrapper (cb);
			IntPtr user_data;
			GLib.DestroyNotify destroy_data;
			if (cb == null) {
				user_data = IntPtr.Zero;
				destroy_data = null;
			} else {
				user_data = (IntPtr) GCHandle.Alloc (cb_wrapper);
				destroy_data = GLib.DestroyHelper.NotifyHandler;
			}
			UIntPtr raw_ret = gst_ptp_statistics_callback_add(cb_wrapper.NativeDelegate, user_data, destroy_data);
			ulong ret = (ulong) raw_ret;
			return ret;
		}

		[DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_ptp_statistics_callback_remove(UIntPtr id);

		public static void PtpStatisticsCallbackRemove(ulong id) {
			gst_ptp_statistics_callback_remove(new UIntPtr (id));
		}

#endregion
	}
}
