private void HandleAddressReply( MacAddress srcAddr, MacAddress dstAddr, ref Frame sdu) { Message.AddressReply arep = new Message.AddressReply(); if (arep.ReadFromFrame(sdu)) { if (dstAddr.Mode == MacAddressingMode.ExtendedAddress && dstAddr.ExtendedAddress == _addrExt) { // address is for us if (_addrShort == cUnallocatedShortAddr) { _addrShort = arep.ShortAddr; PibValue value = new PibValue(); value.Int = _addrShort; _mac.SetRequest(PibAttribute.macShortAddress, 0, value, null); _getAddressEvent.Set(); SetDiscoveryTimer(arep.DiscoveryInterval); } } else { if (arep.HopsLeft > 0) { arep.HopsLeft--; Frame frame = Frame.GetFrame(_macHeader, Message.AddressRequest.cLength + _macTailer); if (arep.WriteToFrame(frame)) { if (arep.BrokerAddr == _addrShort) { // we are the broker MacDataRequest(arep.DeviceAddr, ref frame); } else { // forward to broker _routingTable.DataRequest(arep.BrokerAddr, ref frame, 0, null, true); } } Frame.Release(ref frame); } } } }