public PEQMessageBuildTree(VarID DestinationID, VarID SenderID,
     Byte SequenceNumber, VarID SinkID, Byte HopCount)
     : base(DestinationID, SenderID, SequenceNumber)
 {
     _MessageType = 0x00;
     _SinkID = SinkID;
     _HopCount = HopCount;
 }
 public PEQMessageBuildTree(PEQMessage BaseMessage, VarID SinkID,
     Byte HopCount)
     : base(BaseMessage._DestinationID, BaseMessage._SenderID, 
       BaseMessage._SequenceNumber)
 {
     _MessageType = 0x00;
     _SinkID = SinkID;
     _HopCount = HopCount;
 }
 public PEQTableEntryMessageAck(Byte SequenceNumber, VarID DestinationID, PEQMessage dataMessage)
 {
     _SequenceNumber = SequenceNumber;
     _DestinationID = DestinationID;
     _DataMessage = dataMessage;
 }
 // Ack message: General acknowledgement (sent when Received Dest ID
 //              == Local Node ID)
 public PEQMessageAck(VarID DestinationID, VarID SenderID, 
     Byte SequenceNumber)
     : base(DestinationID, SenderID, SequenceNumber)
 {
     _MessageType = 0x03;
 }
 public PEQMessageResponse(PEQMessage BaseMessage, Byte HopCount, VarID SinkID)
     : base(BaseMessage._DestinationID, BaseMessage._SenderID, 
       BaseMessage._SequenceNumber)
 {
     _MessageType = 0x05;
     _HopCount = HopCount;
     _SinkID = SinkID;
 }
 public PEQMessageSearch(PEQMessage BaseMessage, VarID SinkID)
     : base(BaseMessage._DestinationID, BaseMessage._SenderID, 
       BaseMessage._SequenceNumber)
 {
     _MessageType = 0x04;
     _SinkID = SinkID;
 }
Exemplo n.º 7
0
        private void clearTableSearch(VarID SinkID)
        {
            List<PEQTableEntrySearch> killList
                = new List<PEQTableEntrySearch>();

            foreach (PEQTableEntrySearch entry in _tableSearch)
                if (entry._SinkID == SinkID)
                    killList.Add(entry);

            foreach (PEQTableEntrySearch entry in killList)
                _tableSearch.Remove(entry);
        }
 public PEQMessageNotify(PEQMessage BaseMessage, VarID SinkID, 
     PEQData Data)
     : base(BaseMessage._DestinationID, BaseMessage._SenderID, 
       BaseMessage._SequenceNumber)
 {
     _MessageType = 0x02;
     _SinkID = SinkID;
     _Data = Data;
 }
Exemplo n.º 9
0
        private void startSearch(VarID SinkID, PEQMessage dataMessage)
        {
            clearTableSearch(SinkID);

            // Set all neighbors to 0xFF hops (unreachable)
            foreach (VarID neighborID in _tableNeighbor)
            {
                PEQTableEntrySearch entry = new PEQTableEntrySearch();
                entry._SinkID = SinkID;
                entry._HopCount = 0xFF;
                entry._DestinationID = neighborID;
                entry._DataMessage = dataMessage;

                _tableSearch.Add(entry);
            }

            sendSearch(SinkID);

            _searchAggregator.IncrementSearches();

            updateRoutingTable();
        }
Exemplo n.º 10
0
 private void startSearch(VarID SinkID)
 {
     startSearch(SinkID, null);
 }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
 private void sendSearch(VarID SinkID)
 {
     sendSearch(SinkID, 0);
 }
Exemplo n.º 13
0
 public PEQTableEntryRouting(int VarIDSize)
 {
     _SenderID = new VarID(VarIDSize);
     _nextHopCheat = new XYDoubleLocation(0, 0);
 }
 public PEQMessageHello(VarID SenderID)
 {
     _DestinationID = new VarID(SenderID.SizeOf());
     _SenderID = SenderID;
     _MessageType = 0xFF;
     _SequenceNumber = 0x00;
 }
Exemplo n.º 15
0
        private void completeSearch(VarID sinkID)
        {
            byte hopCount = 0xff;
            PEQTableEntrySearch winner = null;
            foreach (PEQTableEntrySearch entry in _tableSearch)
            {
                if ((entry._HopCount < hopCount) && (entry._SinkID == sinkID))
                {
                    hopCount = entry._HopCount;
                    winner = entry;
                }
            }

            if (winner == null)
            {
                clearTableSearch(sinkID);
                startSearch(sinkID);
            }
            else
                completeSearch(winner);
        }
 public PEQMessageNotify(VarID DestinationID, VarID SenderID,
     Byte SequenceNumber, VarID SinkID, PEQData Data)
     : base(DestinationID, SenderID, SequenceNumber)
 {
     _MessageType = 0x02;
     _SinkID = SinkID;
     _Data = Data;
 }
Exemplo n.º 17
0
        private void processAckTimer(PEQTimerAck timer)
        {
            List<PEQTableEntryMessageAck> killList =
                new List<PEQTableEntryMessageAck>();
            VarID sinkID = new VarID(_NUM_ID_BYTES);

            foreach (PEQTableEntryMessageAck entry in _tableAck)
            {
                if (entry._SequenceNumber == timer._AckInfo._SequenceNumber)
                {
                    // Add entry to list for deletion
                    killList.Add(entry);

                    bool search = false;
                    // Check neighbor - if `holds current route?` Then `Search.`
                    foreach (PEQTableEntryRouting route in _tableRouting)
                    {
                        if (route._DestinationID == entry._DestinationID)
                            if (route._Valid)
                            {
                                route._Valid = false;
                                search = true;
                                sinkID = route._SinkID;
                            }
                    }

                    // Check neighbor subscription entries
                    foreach (PEQTableEntrySubscription subscription in
                        _tableSubscription)
                    {
                        if (subscription._DestinationID == entry._DestinationID)
                        {
                            subscription._Valid = false;
                            search = true;
                        }
                    }

                    if (search)
                        startSearch(sinkID, entry._DataMessage);

                    // Delete neighbor
                    _tableNeighbor.Remove(entry._DestinationID);
                }
            }

            // Clear the ack list of all matched entries.
            foreach (PEQTableEntryMessageAck entry in killList)
                _tableAck.Remove(entry);
        }
 public PEQMessageResponse(VarID DestinationID, VarID SenderID,
     Byte SequenceNumber, Byte HopCount, VarID SinkID)
     : base(DestinationID, SenderID, SequenceNumber)
 {
     _MessageType = 0x05;
     _HopCount = HopCount;
     _SinkID = SinkID;
 }
 public PEQMessage(VarID DestinationID, VarID SenderID, Byte SequenceNumber)
 {
     _DestinationID = DestinationID;
     _SenderID = SenderID;
     _SequenceNumber = SequenceNumber;
 }
 public PEQMessageSearch(VarID DestinationID, VarID SenderID,
     Byte SequenceNumber, VarID SinkID)
     : base(DestinationID, SenderID, SequenceNumber)
 {
     _MessageType = 0x04;
     _SinkID = SinkID;
 }
 PEQMessage(VarID DestinationID, VarID SenderID, Byte SequenceNumber,
     Byte MessageType)
     : this(DestinationID, SenderID, SequenceNumber)
 {
     _MessageType = MessageType;
 }
 public PEQMessageSubscribe(PEQMessage BaseMessage, VarID SinkID,
     Byte HopCount, PEQSubscriptionInfo SubscriptionInfo)
     : base(BaseMessage._DestinationID, BaseMessage._SenderID, 
       BaseMessage._SequenceNumber)
 {
     _MessageType = 0x01;
     _SinkID = SinkID;
     _HopCount = HopCount;
     _SubscriptionInfo = SubscriptionInfo;
 }
Exemplo n.º 23
0
 public PEQTableEntryMessageAck(Byte SequenceNumber, VarID DestinationID)
 {
     _SequenceNumber = SequenceNumber;
     _DestinationID = DestinationID;
 }