Example #1
0
 public softGetawayHost()
 {
     watchDog = new Timer(new TimerCallback(watchTimer), this, Timeout.Infinite, Timeout.Infinite);
     ServiceController[] services = ServiceController.GetServices();
     stopService("Realtek11nCU", services);
     stopService("RealtekCU", services);
     System.Diagnostics.Trace.Listeners.Add(new GetawayTraceListener());
     events            = new softEventQueue <SOFTEVENT>();
     events.processor += new EventHandler <softEventQueue <SOFTEVENT> .EventType>(events_processor);
     events.put(SOFTEVENT.LOAD, 0);
     events.start();
     disposed = false;
     notifier.notify("load");
 }
Example #2
0
        void events_processor(object sender, softEventQueue <SOFTEVENT> .EventType e)
        {
            switch (e.ev)
            {
            case SOFTEVENT.LOAD:
                this.icsManager = new IcsManager();
                state_          = getawayState.Idle;
                shouldStart_    = false;
                privateManager  = new privateNetManager();
                events.put(SOFTEVENT.LOADINIT, 0);
                break;

            case SOFTEVENT.LOADINIT:
                try {
                    privateManager.init();
                } catch {
                    startTimer();
                    break;
                }
                events.put(SOFTEVENT.LOAD_SAVED_STATE, 0);
                NetworkChange.NetworkAddressChanged      += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
                NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
                privateManager.networkAvailable          += new EventHandler(privateManager_networkAvailable);
                privateManager.networkUnavailable        += new EventHandler(privateManager_networkUnavailable);
                break;

            case SOFTEVENT.LOAD_SAVED_STATE:
                LoadConfig();
                if (shouldStart_)
                {
                    Start();
                }
                break;

            case SOFTEVENT.NETWORKADDRESSCHANGED:
                networkAddressChanged();
                break;

            case SOFTEVENT.STARTINIT:
                privateManager.enable();
                startTimer();
                break;

            case SOFTEVENT.RENEWIP:
                reNewIp();
                startTimer();
                break;

            case SOFTEVENT.UPDATECONNECTIONS:
                icsManager.updateConnections();
                break;

            case SOFTEVENT.RESTARTPRIVATE:
                intStop();
                if (shouldStart_)
                {
                    privateManager.enable();
                }
                break;

            case SOFTEVENT.TESTPRIVATE:
                testPrivateConnected();
                break;

            case SOFTEVENT.FIREROUTESTART:
                watchDog.Change(Timeout.Infinite, Timeout.Infinite);
                if (OnRouterStart != null)
                {
                    OnRouterStart(this, null);
                }
                break;

            case SOFTEVENT.INTSTOP:
                intStop();
                break;
            }
        }