/** * For sending global broadcasts * * @param source * optional source address */ public NPDU(Address source) { version = 1; control = new NLPCI(0); //new BitArray(1)); control.IsDestinationSpecific = true; destinationNetworkAddress = ushort.MaxValue; //(ushort) 0xFFFF; hopCount = 0xFF; setSourceAddress(source); }
public NPDU(ByteStream source) { version = source.ReadByte(); control = new NLPCI(source.ReadByte()); if (control.IsDestinationSpecific) { destinationNetworkAddress = source.popU2B(); destinationMacLyerAddressLength = source.popU1B(); if (destinationMacLyerAddressLength > 0) { destinationAddress = new byte[destinationMacLyerAddressLength]; source.Read(destinationAddress); } } if (control.IsSourceSpecific) { // TODO Check address length sourceNetworkAddress = source.popU2B(); sourceMacLyerAddressLength = source.popU1B(); sourceAddress = new byte[sourceMacLyerAddressLength]; source.Read(destinationAddress); } if (control.IsDestinationSpecific) { hopCount = source.popU1B(); } if (control.IsNetworkLayerMessage) { messageType = source.popU1B(); if (messageType >= 80) { vendorId = source.popU2B(); } } }
public NPDU(Address destination, Address source, bool expectsReply) { version = 1; control = new NLPCI(1); //new BitArray(1)); if (destination != null) { control.IsDestinationSpecific = true; destinationNetworkAddress = (ushort)destination.NetworkNumber.Value; destinationAddress = destination.MacAddress.Bytes; if (destinationAddress != null) { destinationMacLyerAddressLength = (byte)destinationAddress.Length; } hopCount = 0xFF; } setSourceAddress(source); if (expectsReply) { control.ExpectsReply = true; } }