Exemplo n.º 1
0
        public RadiusPacket DisconnectRequest(string sessionId, string username, string framedIpAddress)
        {
            var packet = new RadiusPacket(RadiusCode.DISCONNECT_REQUEST);

            packet.SetAttribute(RadiusAttribute.CreateString(RadiusAttributeType.ACCT_SESSION_ID, sessionId));
            packet.SetAttribute(RadiusAttribute.CreateString(RadiusAttributeType.USER_NAME, username));
            packet.SetAttribute(RadiusAttribute.CreateAddress(RadiusAttributeType.FRAMED_IP_ADDRESS, framedIpAddress));
            packet.SetAuthenticator(_SharedSecret);

            return(packet);
        }
Exemplo n.º 2
0
        public void SetAttribute(RadiusAttribute attribute)
        {
            _Attributes.Add(attribute);

            //Make an array with a size of the current RawData plus the new attribute
            byte[] newRawData = new byte[RawData.Length + attribute.Length];

            //Copy the current RawData into the temp array
            Array.Copy(RawData, 0, newRawData, 0, RawData.Length);

            //Copy the new attribute into the temp array
            Array.Copy(attribute.RawData, 0, newRawData, RawData.Length, attribute.Length);

            RawData = newRawData;

            //Update the length of the RadiusPacket
            _Length = (ushort)RawData.Length;
            Array.Copy(BitConverter.GetBytes(_Length), 0, RawData, RADIUS_LENGTH_INDEX, sizeof(ushort));
            Array.Reverse(RawData, RADIUS_LENGTH_INDEX, sizeof(ushort));
        }
Exemplo n.º 3
0
		public void SetAttribute(RadiusAttribute attribute)
		{			
			_Attributes.Add(attribute);

			//Make an array with a size of the current RawData plus the new attribute
			byte[] newRawData = new byte[RawData.Length + attribute.Length];

			//Copy the current RawData into the temp array
			Array.Copy(RawData, 0, newRawData, 0, RawData.Length);

			//Copy the new attribute into the temp array
			Array.Copy(attribute.RawData, 0, newRawData, RawData.Length, attribute.Length);

			RawData = newRawData;

			//Update the length of the RadiusPacket
			_Length = (ushort)RawData.Length;
			Array.Copy(BitConverter.GetBytes(_Length), 0, RawData, RADIUS_LENGTH_INDEX, sizeof(ushort));
			Array.Reverse(RawData, RADIUS_LENGTH_INDEX, sizeof(ushort));
		}