/// <summary> /// Sends an unconfirmed request /// </summary> /// <param name="destination">The destination address</param> /// <param name="expectingReply">Whether or not a response is expected</param> /// <param name="request">The unconfirmed request</param> private void _sendUnconfirmedRequest(Address destination, bool expectingReply, IUnconfirmedRequest request) { UnconfirmedRequestMessage message = new UnconfirmedRequestMessage(); message.ServiceChoice = (byte)request.ServiceChoice; byte[] raw = _saveUnconfirmedRequest(request); OutboundAppgram appgram = new OutboundAppgram(); appgram.Content = new AppgramContent(message, new BufferSegment(raw, 0, raw.Length)); appgram.Destination = destination; appgram.ExpectingReply = expectingReply; appgram.Priority = NetgramPriority.Normal; if (_router != null) { _router.SendAppgram(appgram); } }
/// <summary> /// Processes a received unconfirmed request /// </summary> /// <param name="appgram">The inbound appgram</param> /// <param name="message">The unconfirmed request message</param> /// <param name="buffer">The buffer containing the request content</param> /// <param name="offset">The offset of the request content in the buffer</param> /// <param name="end">The end of the request content</param> private InboundUnconfirmedRequest _processUnconfirmedRequest(InboundAppgram appgram, UnconfirmedRequestMessage message, byte[] buffer, int offset, int end) { UnconfirmedServiceChoice choice = (UnconfirmedServiceChoice)message.ServiceChoice; IUnconfirmedRequest request = _loadUnconfirmedRequest(choice, buffer, offset, end); DeviceTableEntry source = null; if (request.ServiceChoice == UnconfirmedServiceChoice.IAm) { // the only request that we handle at the host level is an IAm request, // which is necessary for TSM operations, since information about the remote // host is needed source = _processIAmRequest(appgram, (IAmRequest)request); } else { source = _devices.GetByAddress(appgram.Source); } InboundUnconfirmedRequest inbound = new InboundUnconfirmedRequest( appgram.Source, source, request); return(inbound); }