/// <summary> /// Creates a new instance of this class. /// </summary> public RIPFrame() { lRipUpdates = new List <RIPUpdate>(); bReservedField = new byte[2]; iVersion = 2; ripCommand = RipCommand.RIPRequest; }
public RipPacket(byte[] payload) { Command = (RipCommand)Convert.ToChar(payload[0]); Version = Convert.ToChar(payload[1]); var current = 4; while (current < payload.Length) { Records.Add(new RipRecord( payload.Skip(current).Take(20).ToArray() )); current += 20; } }
/// <summary> /// Creates a new RIP frame by parsing the given data. /// </summary> /// <param name="bData">The data to parse</param> public RIPFrame(byte[] bData) { ripCommand = (RipCommand)(bData[0]); iVersion = bData[1]; bReservedField = new byte[2]; bReservedField[0] = bData[2]; bReservedField[1] = bData[3]; byte[] bUpdateData = new byte[20]; lRipUpdates = new List <RIPUpdate>(); for (int iC1 = 4; iC1 < bData.Length; iC1 += 20) { for (int iC2 = iC1; iC2 < iC1 + 20; iC2++) { bUpdateData[iC2 - iC1] = bData[iC2]; } lRipUpdates.Add(new RIPUpdate(bUpdateData)); } }
public RipPacket(RipCommand command) { Version = (char)2; Command = command; }