/// <summary> /// Initializes a new instance of the <see cref="VendorSpecificAttribute"/> class. /// </summary> /// <param name="vendorId">Vendor id for the attribute data</param> /// <param name="vendorType">Vendor type for the attribute data.</param> /// <param name="data">Data for the attribute data.</param> public VendorSpecificAttribute(uint vendorId, byte vendorType, byte[] data) { if (data == null || data.Length == 0) { throw new ArgumentNullException("data"); } if (data.Length > byte.MaxValue - 2) { throw new ArgumentException("data cannot be longer than (Byte.MaxValue - 2)", "data"); } this.vsa = new RADIUS_VSA_FORMAT { VendorId = BitConverter.GetBytes(vendorId).Reverse().ToArray(), VendorType = vendorType, VendorLength = (byte)(data.Length + 2) }; this.data = new byte[data.Length]; Array.Copy(data, this.data, data.Length); }
/// <summary> /// Initializes a new instance of the <see cref="VendorSpecificAttribute"/> class. /// </summary> /// <param name="vsaPtr">Pointer to the native attribute data.</param> internal VendorSpecificAttribute(IntPtr vsaPtr) { this.vsaPtr = vsaPtr; this.vsa = (RADIUS_VSA_FORMAT)Marshal.PtrToStructure(vsaPtr, typeof(RADIUS_VSA_FORMAT)); }