コード例 #1
0
 public new object Clone()
 {
     PEQMessageSearch msg =
         new PEQMessageSearch(_DestinationID, _SenderID, _SequenceNumber,
         _SinkID);
     msg._nextHopCheat = _nextHopCheat;
     return msg;
 }
コード例 #2
0
        private void sendResponse(PEQTableEntrySubscription Subscription,
            PEQMessageSearch msg)
        {
            PEQMessageResponse newMsg = new PEQMessageResponse(msg._SenderID,
                _id, msg._SequenceNumber, Subscription._HopCount,
                msg._SinkID);
            newMsg._nextHopCheat = _location;

            PEQTimerMessage timerEvent = new PEQTimerMessage(newMsg,
                _eventManager.CurrentClock + _TIMER_RANDOM_WAIT_SEND
                * RandomValue.NextDouble(), this);
            _eventManager.AddEvent(timerEvent);
        }
コード例 #3
0
        private void sendSearch(VarID SinkID, int searchCount)
        {
            PEQMessageSearch msg = new PEQMessageSearch(new VarID(SinkID.SizeOf()), _id,
                _sequenceNumber++, SinkID);

            msg._nextHopCheat = _location;

            PEQTimerMessage timerEvent = new PEQTimerMessage(msg,
                _eventManager.CurrentClock + _TIMER_RANDOM_WAIT_SEND * _randomValue.NextDouble(), this);
            _eventManager.AddEvent(timerEvent);

            PEQTimerSearch searchTimer
                = new PEQTimerSearch(_eventManager.CurrentClock +
                    _physicalProcessor.MaximumRange * _TIMER_SEARCH /
                    _physicalProcessor.PropagationSpeed, this);
            searchTimer._SinkID = SinkID;
            searchTimer._Count = ++searchCount;

            _eventManager.AddEvent(searchTimer);
        }
コード例 #4
0
        private void processSearch(PEQMessageSearch msg)
        {
            PEQTableEntrySubscription subscriptionEntry = null;

            foreach (PEQTableEntrySubscription entry in _tableSubscription)
            {
                if ((entry._SinkID == msg._SinkID) && entry._Valid)
                {
                    if (subscriptionEntry == null)
                        subscriptionEntry = entry;
                    else if (subscriptionEntry._HopCount > entry._HopCount)
                        subscriptionEntry = entry;
                }
            }

            if (subscriptionEntry == null)
            {
                subscriptionEntry = new PEQTableEntrySubscription();
                subscriptionEntry._HopCount = 0xff;
                subscriptionEntry._Valid = false;
                subscriptionEntry._nextHopCheat = null;
                subscriptionEntry._CriteriaType = 0x0000;
            }

            sendResponse(subscriptionEntry, msg);
        }