Ejemplo n.º 1
0
 /// <summary>
 /// Metoda do ustawienia statusu interfejsu na nie-oferowany
 /// </summary>
 /// <param name="wNet"></param>
 public void StopOfferingInterface(WNetInterface wNet)
 {
     wNet.isOffered = false;
     wNet.offeredTo = null;
     wNet.ZeroOfferTime();
     wNet.ZeroPing();
     this.form.DisplayOnLog("WATCHDOG>#\tInterface " + wNet.eth.GetInterfaceNumber() + " is no longer offered");
 }
Ejemplo n.º 2
0
        //Oferowanie interfejsów=======================================================================================

        /// <summary>
        /// Metoda do oferowania wybranego interfejsu docelowemu adresowi
        /// </summary>
        /// <param name="wNet">Oferowany interfejs</param>
        /// <param name="targetEndpoint">Adres docelowy</param>
        public void OfferInterface(WNetInterface wNet, IPEndPoint targetEndpoint)
        {
            wNet.isOffered = true;
            wNet.offeredTo = targetEndpoint;
            wNet.SetOfferTimeout();
            wNet.ZeroPing();
            AddAwaitingToSendPacket(MakeOfferPacket(wNet, targetEndpoint));
            form.DisplayOnLog("WATCHDOG>#\tInterface " + wNet.eth.GetInterfaceNumber() + " offered. Awaiting ACK...");
        }
Ejemplo n.º 3
0
        //================================================================================================================

        //Metody do tworzenia gotowych pakietów ==========================================================================

        /// <summary>
        /// Tworzy pakiet z Pingiem dla podanego interfejsu
        /// </summary>
        /// <param name="wNetInterface"></param>
        /// <returns></returns>
        private NetPacket MakePingPacket(WNetInterface wNetInterface)
        {
            return(new NetPacket(
                       wNetInterface.GetLocalEndpoint().Address,
                       wNetInterface.GetTargetEndpoint().Address,
                       wNetInterface.GetLocalEndpoint().Port,
                       8080,
                       0,
                       Operations.PING,
                       ""));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Tworzy pakiet z ofertą wskazanego netInterface'u, adresowany na podany endpoint
 /// </summary>
 /// <param name="wNetInterface"></param>
 /// <param name="iPEndPoint"></param>
 /// <returns></returns>
 private NetPacket MakeOfferPacket(WNetInterface wNetInterface, IPEndPoint iPEndPoint)
 {
     return(new NetPacket(
                wNetInterface.GetLocalEndpoint().Address,
                iPEndPoint.Address,
                wNetInterface.GetLocalEndpoint().Port,
                iPEndPoint.Port,
                0,
                Operations.OFFER,
                ""
                ));
 }