Example #1
0
        /**
         * Shuts down the underlying stack and prepares the object for garbage
         * collection.
         */
        public virtual void ShutDown()
        {
            StunStack.ShutDown();
            stunStack     = null;
            stunProvider  = null;
            requestSender = null;

            this.started = false;
        }
Example #2
0
        /**
         * Puts the discoverer into an operational state.
         * @throws StunException if we fail to bind or some other error occurs.
         */
        public virtual void Start()
        {
            stunStack = StunStack.Instance;
            stunStack.Start();

            stunProvider = stunStack.GetProvider();



            started = true;
        }
        /**
         * Puts the discoverer into an operational state.
         * @throws StunException if we fail to bind or some other error occurs.
         */
        virtual public void Start()
        {
            stunStack = StunStack.Instance;
            stunStack.Start();

            stunStack.InstallNetAccessPoint(apDescriptor);

            stunProvider = stunStack.GetProvider();

            requestSender = new BlockingRequestSender(stunProvider, apDescriptor);

            started = true;
        }
        /**
         * Creates a client transaction
         * @param providerCallback the provider that created us.
         * @param request the request that we are living for.
         * @param requestDestination the destination of the request.
         * @param apDescriptor the access point through which we are supposed to
         * @param responseCollector the instance that should receive this request's
         * response.
         * retransmit.
         */
        public StunClientTransaction(StunProvider providerCallback,
                                     Request request,
                                     StunAddress requestDestination,
                                     NetAccessPointDescriptor apDescriptor,
                                     ResponseCollector responseCollector)
        {
            this.providerCallback   = providerCallback;
            this.request            = request;
            this.apDescriptor       = apDescriptor;
            this.responseCollector  = responseCollector;
            this.requestDestination = requestDestination;

            this.transactionID = TransactionID.CreateTransactionID();

            request.SetTransactionID(transactionID.GetTransactionID());

            runningThread = new Thread(new ThreadStart(this.Run));
        }
Example #5
0
 public BlockingRequestSender(StunProvider stunProvider,
                              NetAccessPointDescriptor apDescriptor)
 {
     this.stunProvider = stunProvider;
     this.apDescriptor = apDescriptor;
 }
Example #6
0
        //-------------------- internal stuff --------------------------------------

        /**
         * Private constructor as we want a singleton pattern.
         */
        private StunStack()
        {
            stunProvider = new StunProvider(this);

            netAccessManager.SetEventHandler(GetProvider());
        }
        /**
         * Creates a client transaction
         * @param providerCallback the provider that created us.
         * @param request the request that we are living for.
         * @param requestDestination the destination of the request.
         * @param apDescriptor the access point through which we are supposed to
         * @param responseCollector the instance that should receive this request's
         * response.
         * retransmit.
         */
        public StunClientTransaction(StunProvider            providerCallback,
			Request                  request,
			StunAddress              requestDestination,
			NetAccessPointDescriptor apDescriptor,
			ResponseCollector        responseCollector)
        {
            this.providerCallback  = providerCallback;
            this.request           = request;
            this.apDescriptor      = apDescriptor;
            this.responseCollector = responseCollector;
            this.requestDestination = requestDestination;

            this.transactionID = TransactionID.CreateTransactionID();

            request.SetTransactionID(transactionID.GetTransactionID());

            runningThread = new Thread(new ThreadStart(this.Run));
        }
        public BlockingRequestSender(StunProvider             stunProvider,
			NetAccessPointDescriptor apDescriptor)
        {
            this.stunProvider = stunProvider;
            this.apDescriptor = apDescriptor;
        }
Example #9
0
        //-------------------- internal stuff --------------------------------------
        /**
         * Private constructor as we want a singleton pattern.
         */
        private StunStack()
        {
            stunProvider = new StunProvider(this);

            netAccessManager.SetEventHandler(GetProvider());
        }
        /**
         * Puts the discoverer into an operational state.
         * @throws StunException if we fail to bind or some other error occurs.
         */
        public virtual void Start()
        {
            stunStack = StunStack.Instance;
            stunStack.Start();

            stunStack.InstallNetAccessPoint(apDescriptor);

            stunProvider = stunStack.GetProvider();

            requestSender = new BlockingRequestSender(stunProvider, apDescriptor);

            started = true;
        }
        /**
         * Shuts down the underlying stack and prepares the object for garbage
         * collection.
         */
        public virtual void ShutDown()
        {
            StunStack.ShutDown();
            stunStack     = null;
            stunProvider  = null;
            apDescriptor  = null;
            requestSender = null;

            this.started = false;
        }