public SimulatorPacket(SimulatorPacket pack) { Type t = typeof(SimulatorPacket); PropertyInfo[] properties = t.GetProperties(); foreach (PropertyInfo pi in properties) { pi.SetValue(this, pi.GetValue(pack, null), null); } }
// TODO check if this work corectlly public KeepAlive(SimulatorPacket pack) { Type t = typeof(SimulatorPacket); PropertyInfo[] properties = t.GetProperties(); foreach (PropertyInfo pi in properties) { pi.SetValue(this, pi.GetValue(pack, null), null); } }
//===================================================================== public virtual void ParseReceivedPacket(SimulatorPacket pack) { }
public NullDataAck(SimulatorPacket pack) : base(pack) { }
public Connect(SimulatorPacket pack) : base(pack) { }
public TDLSTearDown(SimulatorPacket pack) : base(pack) { }
public ConnectionACK(SimulatorPacket pack) : base(pack) { }
// TODO check if this work corectlly public KeepAlive(SimulatorPacket pack) : base(pack) { }
public TDLSSetupConfirm(SimulatorPacket pack) : base(pack) { }
public Beacon(SimulatorPacket pack) : base(pack) { }
public TDLSChannelSwitchRequest(SimulatorPacket pack) : base(pack) { }
public TDLSSetupRequest(SimulatorPacket pack) : base(pack) { }
//********************************************************************* public void SendData(SimulatorPacket pack) { CheckScanConditionOnSend(); int Rate = pack.getTransmitRate(); int sleep = (int)(600 / Rate); lock (RfSync) { try{ RF_STATUS = RFStatus.Tx; short OperateChannel = this.getOperateChannel(); int try_counter = 0; while (!Medium.Registration(this.Freq, OperateChannel, this.x, this.y, sleep)) { Thread.Sleep(new TimeSpan(randomWait.Next(20, 50))); if (try_counter++ > 200) return; } this.MACLastTrnsmitRate = pack.getTransmitRate(); Medium.SendData(pack); } catch(Exception ex){ AddToLog("SendData:[" + this.GetType() + "] " + ex.Message); MessageBox.Show("SendData :" + ex.Message); } RF_STATUS = RFStatus.None; } if (pack.GetType() == typeof(Data)){ _DataSent++; } }
public TDLSChannelSwitchResponse(SimulatorPacket pack) : base(pack) { }
//===================================================================== //[MethodImpl(MethodImplOptions.Synchronized)] /// <summary> /// Function for parse received packet /// </summary> /// <param name="pack">SimulatorPacket</param> public override void ParseReceivedPacket(SimulatorPacket pack) { Type pt = pack.GetType(); if (pt == typeof(Connect)) ConnectRoutine(pack.Source); else if (pt == typeof(Disconnect)) DisonnectRoutine(pack.Source); else if (pt == typeof(KeepAlive)) { var newThread = new Thread(() => UpdateSTAKeepAliveInfoOnReceive(pack.Source)); newThread.Start(); } else if (pt == typeof(Data)) DataRoutine((Data) pack); else if (pt == typeof(DataAck)) DataAckRoutine((DataAck)pack); else OtherPacketsRoutine(pack); }
//===================================================================== /// <summary> /// This function work with all others packets which don't have special Routines /// </summary> /// <param name="pack">Simulator Packet </param> private void OtherPacketsRoutine(SimulatorPacket pack) { // Generic Packet retransmitter // This code will create new packet by him type var instance = (SimulatorPacket)Activator.CreateInstance(pack.GetType(), pack); instance.X = this.x; instance.Y = this.y; instance.Destination = pack.Reciver; SendData(instance); }
public Disconnect(SimulatorPacket pack) : base(pack) { }
public NullData(SimulatorPacket pack) : base(pack) { }
public TDLSSetupResponse(SimulatorPacket pack) : base(pack) { }
public Data(SimulatorPacket pack) : base(pack) { }
public SimulatorPacket CreatePacket(bool inTDLS) { SimulatorPacket pack = new SimulatorPacket(this.getOperateChannel()) { SSID = this.SSID, Source = getMACAddress(), X = this.x, Y = this.y, PacketFrequency = this.Freq, PacketStandart = this.Stand80211, PacketBandWith = this.BandWidth, }; return (pack); }
public DataAck(SimulatorPacket pack) : base(pack) { }