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

namespace Gst.Sdp {

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

#region Autogenerated code
	public partial class MIKEYMessage : Gst.MiniObject {

		public byte Version {
			get {
				unsafe {
					byte* raw_ptr = (byte*)(((byte*)Handle) + abi_info.GetFieldOffset("version"));
					return (*raw_ptr);
				}
			}
			set {
				unsafe {
					byte* raw_ptr = (byte*)(((byte*)Handle) + abi_info.GetFieldOffset("version"));
					*raw_ptr = value;
				}
			}
		}

		public Gst.Sdp.MIKEYType Type {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("type"));
					return (Gst.Sdp.MIKEYType) (*raw_ptr);
				}
			}
			set {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("type"));
					*raw_ptr = (int) value;
				}
			}
		}

		public bool V {
			get {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("V"));
					return (*raw_ptr);
				}
			}
			set {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("V"));
					*raw_ptr = value;
				}
			}
		}

		public Gst.Sdp.MIKEYPRFFunc PrfFunc {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("prf_func"));
					return (Gst.Sdp.MIKEYPRFFunc) (*raw_ptr);
				}
			}
			set {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("prf_func"));
					*raw_ptr = (int) value;
				}
			}
		}

		public uint CSBId {
			get {
				unsafe {
					uint* raw_ptr = (uint*)(((byte*)Handle) + abi_info.GetFieldOffset("CSB_id"));
					return (*raw_ptr);
				}
			}
			set {
				unsafe {
					uint* raw_ptr = (uint*)(((byte*)Handle) + abi_info.GetFieldOffset("CSB_id"));
					*raw_ptr = value;
				}
			}
		}

		public Gst.Sdp.MIKEYMapType MapType {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("map_type"));
					return (Gst.Sdp.MIKEYMapType) (*raw_ptr);
				}
			}
			set {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("map_type"));
					*raw_ptr = (int) value;
				}
			}
		}

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

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

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_add_cs_srtp(IntPtr raw, byte policy, uint ssrc, uint roc);

		public bool AddCsSrtp(byte policy, uint ssrc, uint roc) {
			bool raw_ret = gst_mikey_message_add_cs_srtp(Handle, policy, ssrc, roc);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool AddPayload(Gst.Sdp.MIKEYPayload payload) {
			payload.Owned = false;
			bool raw_ret = gst_mikey_message_add_payload(Handle, payload == null ? IntPtr.Zero : payload.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_add_pke(IntPtr raw, int C, ushort data_len, byte[] data);

		public bool AddPke(Gst.Sdp.MIKEYCacheType C, ushort data_len, byte[] data) {
			bool raw_ret = gst_mikey_message_add_pke(Handle, (int) C, data_len, data);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_add_rand(IntPtr raw, byte len, byte[] rand);

		public bool AddRand(byte len, byte[] rand) {
			bool raw_ret = gst_mikey_message_add_rand(Handle, len, rand);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_add_rand_len(IntPtr raw, byte len);

		public bool AddRandLen(byte len) {
			bool raw_ret = gst_mikey_message_add_rand_len(Handle, len);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_add_t(IntPtr raw, int type, byte[] ts_value);

		public bool AddT(Gst.Sdp.MIKEYTSType type, byte[] ts_value) {
			bool raw_ret = gst_mikey_message_add_t(Handle, (int) type, ts_value);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool AddTNowNtpUtc() {
			bool raw_ret = gst_mikey_message_add_t_now_ntp_utc(Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public string Base64Encode() {
			IntPtr raw_ret = gst_mikey_message_base64_encode(Handle);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_mikey_message_find_payload(IntPtr raw, int type, uint nth);

		public Gst.Sdp.MIKEYPayload FindPayload(Gst.Sdp.MIKEYPayloadType type, uint nth) {
			IntPtr raw_ret = gst_mikey_message_find_payload(Handle, (int) type, nth);
			Gst.Sdp.MIKEYPayload ret = raw_ret == IntPtr.Zero ? null : (Gst.Sdp.MIKEYPayload) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Sdp.MIKEYPayload), false);
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_mikey_message_get_cs_srtp(IntPtr raw, uint idx);

		public Gst.Sdp.MIKEYMapSRTP GetCsSrtp(uint idx) {
			IntPtr raw_ret = gst_mikey_message_get_cs_srtp(Handle, idx);
			Gst.Sdp.MIKEYMapSRTP ret = Gst.Sdp.MIKEYMapSRTP.New (raw_ret);
			return ret;
		}

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

		public uint NCs { 
			get {
				uint raw_ret = gst_mikey_message_get_n_cs(Handle);
				uint ret = raw_ret;
				return ret;
			}
		}

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

		public uint NPayloads { 
			get {
				uint raw_ret = gst_mikey_message_get_n_payloads(Handle);
				uint ret = raw_ret;
				return ret;
			}
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_mikey_message_get_payload(IntPtr raw, uint idx);

		public Gst.Sdp.MIKEYPayload GetPayload(uint idx) {
			IntPtr raw_ret = gst_mikey_message_get_payload(Handle, idx);
			Gst.Sdp.MIKEYPayload ret = raw_ret == IntPtr.Zero ? null : (Gst.Sdp.MIKEYPayload) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Sdp.MIKEYPayload), false);
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_insert_cs_srtp(IntPtr raw, int idx, IntPtr map);

		public bool InsertCsSrtp(int idx, Gst.Sdp.MIKEYMapSRTP map) {
			IntPtr native_map = GLib.Marshaller.StructureToPtrAlloc (map);
			bool raw_ret = gst_mikey_message_insert_cs_srtp(Handle, idx, native_map);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_map);
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_insert_payload(IntPtr raw, uint idx, IntPtr payload);

		public bool InsertPayload(uint idx, Gst.Sdp.MIKEYPayload payload) {
			payload.Owned = false;
			bool raw_ret = gst_mikey_message_insert_payload(Handle, idx, payload == null ? IntPtr.Zero : payload.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_remove_cs_srtp(IntPtr raw, int idx);

		public bool RemoveCsSrtp(int idx) {
			bool raw_ret = gst_mikey_message_remove_cs_srtp(Handle, idx);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_remove_payload(IntPtr raw, uint idx);

		public bool RemovePayload(uint idx) {
			bool raw_ret = gst_mikey_message_remove_payload(Handle, idx);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_replace_cs_srtp(IntPtr raw, int idx, IntPtr map);

		public bool ReplaceCsSrtp(int idx, Gst.Sdp.MIKEYMapSRTP map) {
			IntPtr native_map = GLib.Marshaller.StructureToPtrAlloc (map);
			bool raw_ret = gst_mikey_message_replace_cs_srtp(Handle, idx, native_map);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_map);
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_replace_payload(IntPtr raw, uint idx, IntPtr payload);

		public bool ReplacePayload(uint idx, Gst.Sdp.MIKEYPayload payload) {
			payload.Owned = false;
			bool raw_ret = gst_mikey_message_replace_payload(Handle, idx, payload == null ? IntPtr.Zero : payload.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_mikey_message_set_info(IntPtr raw, byte version, int type, bool V, int prf_func, uint CSB_id, int map_type);

		public bool SetInfo(byte version, Gst.Sdp.MIKEYType type, bool V, Gst.Sdp.MIKEYPRFFunc prf_func, uint CSB_id, Gst.Sdp.MIKEYMapType map_type) {
			bool raw_ret = gst_mikey_message_set_info(Handle, version, (int) type, V, (int) prf_func, CSB_id, (int) map_type);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern unsafe IntPtr gst_mikey_message_to_bytes(IntPtr raw, IntPtr info, out IntPtr error);

		public unsafe GLib.Bytes ToBytes(Gst.Sdp.MIKEYEncryptInfo info) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = gst_mikey_message_to_bytes(Handle, info == null ? IntPtr.Zero : info.Handle, out error);
			GLib.Bytes ret = new GLib.Bytes(raw_ret);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

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

		public bool ToCaps(Gst.Caps caps) {
			bool raw_ret = gst_mikey_message_to_caps(Handle, caps == null ? IntPtr.Zero : caps.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

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

		public MIKEYMessage () 
		{
			Raw = gst_mikey_message_new();
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_mikey_message_new_from_bytes(IntPtr bytes, IntPtr info);

		public MIKEYMessage (GLib.Bytes bytes, Gst.Sdp.MIKEYDecryptInfo info) 
		{
			Raw = gst_mikey_message_new_from_bytes(bytes == null ? IntPtr.Zero : bytes.Handle, info == null ? IntPtr.Zero : info.Handle);
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_mikey_message_new_from_caps(IntPtr caps);

		public MIKEYMessage (Gst.Caps caps) 
		{
			Raw = gst_mikey_message_new_from_caps(caps == null ? IntPtr.Zero : caps.Handle);
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_mikey_message_new_from_data(byte[] data, UIntPtr n_length, IntPtr info);

		public MIKEYMessage (byte[] data, Gst.Sdp.MIKEYDecryptInfo info) 
		{
			Raw = gst_mikey_message_new_from_data(data, new UIntPtr ((ulong) (data == null ? 0 : data.Length)), info == null ? IntPtr.Zero : info.Handle);
		}


		// 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("version"
							, Gst.MiniObject.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(byte)) // version
							, null
							, "type"
							, (long) Marshal.OffsetOf(typeof(GstMIKEYMessage_versionAlign), "version")
							, 0
							),
						new GLib.AbiField("type"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.Sdp.MIKEYType))) // type
							, "version"
							, "V"
							, (long) Marshal.OffsetOf(typeof(GstMIKEYMessage_typeAlign), "type")
							, 0
							),
						new GLib.AbiField("V"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // V
							, "type"
							, "prf_func"
							, (long) Marshal.OffsetOf(typeof(GstMIKEYMessage_VAlign), "V")
							, 0
							),
						new GLib.AbiField("prf_func"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.Sdp.MIKEYPRFFunc))) // prf_func
							, "V"
							, "CSB_id"
							, (long) Marshal.OffsetOf(typeof(GstMIKEYMessage_prf_funcAlign), "prf_func")
							, 0
							),
						new GLib.AbiField("CSB_id"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // CSB_id
							, "prf_func"
							, "map_type"
							, (long) Marshal.OffsetOf(typeof(GstMIKEYMessage_CSB_idAlign), "CSB_id")
							, 0
							),
						new GLib.AbiField("map_type"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.Sdp.MIKEYMapType))) // map_type
							, "CSB_id"
							, "map_info"
							, (long) Marshal.OffsetOf(typeof(GstMIKEYMessage_map_typeAlign), "map_type")
							, 0
							),
						new GLib.AbiField("map_info"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // map_info
							, "map_type"
							, "payloads"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("payloads"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // payloads
							, "map_info"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstMIKEYMessage_versionAlign
		{
			sbyte f1;
			private byte version;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstMIKEYMessage_typeAlign
		{
			sbyte f1;
			private Gst.Sdp.MIKEYType type;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstMIKEYMessage_VAlign
		{
			sbyte f1;
			private bool V;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstMIKEYMessage_prf_funcAlign
		{
			sbyte f1;
			private Gst.Sdp.MIKEYPRFFunc prf_func;
		}

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

		[StructLayout(LayoutKind.Sequential)]
		public struct GstMIKEYMessage_map_typeAlign
		{
			sbyte f1;
			private Gst.Sdp.MIKEYMapType map_type;
		}


		// End of the ABI representation.

#endregion
	}
}
