Esempio n. 1
0
 public static AmqpDescribed DecodeAmqpDescribed(ByteBuffer buffer)
 {
     return(AmqpCodec.DecodeAmqpDescribed(buffer, ExtendedCodec.knownTypesByName, ExtendedCodec.knownTypesByCode));
 }
Esempio n. 2
0
            void HandleFrameBuffer(ByteBuffer buffer)
            {
                Frame frame = Frame.Decode(buffer);

                if (frame.Command.DescriptorCode == OpenCommand.Code)
                {
                    if (this.parent.encoding && this.parent.isReceiver)
                    {
                        this.WriteCommand(frame.Command);
                    }
                }
                else if (frame.Command.DescriptorCode == Begin.Code)
                {
                    if (this.parent.encoding && this.parent.isReceiver)
                    {
                        this.WriteCommand(frame.Command);
                    }
                }
                else if (frame.Command.DescriptorCode == Attach.Code)
                {
                    if (this.parent.encoding && this.parent.isReceiver)
                    {
                        Attach attach = (Attach)frame.Command;
                        attach.Role = !attach.Role;
                        this.WriteCommand(attach);
                        this.WriteCommand(new Flow()
                        {
                            NextIncomingId = 0, NextOutgoingId = 0, IncomingWindow = uint.MaxValue, OutgoingWindow = uint.MaxValue, Handle = 0, LinkCredit = uint.MaxValue
                        });
                    }

                    this.State = AmqpObjectState.Opened;
                    this.CompleteOpen(false, null);
                }
                else if (frame.Command.DescriptorCode == Transfer.Code)
                {
                    Transfer            transfer = (Transfer)frame.Command;
                    Data                data     = AmqpCodec.DecodeKnownType <Data>(ByteBuffer.Wrap(transfer.Payload));
                    ArraySegment <byte> payload  = (ArraySegment <byte>)data.Value;
                    this.parent.messages.EnqueueAndDispatch(ByteBuffer.Wrap(payload));
                }
                else if (frame.Command.DescriptorCode == Detach.Code)
                {
                    if (this.parent.encoding)
                    {
                        this.WriteCommand(frame.Command);
                    }
                }
                else if (frame.Command.DescriptorCode == End.Code)
                {
                    if (this.parent.encoding)
                    {
                        this.WriteCommand(frame.Command);
                    }
                }
                else if (frame.Command.DescriptorCode == CloseCommand.Code)
                {
                    if (this.parent.encoding)
                    {
                        this.WriteCommand(frame.Command);
                    }

                    this.State = AmqpObjectState.End;
                    this.CompleteClose(false, null);
                    this.AsyncIO.Close();
                }
            }
Esempio n. 3
0
 public static AmqpDescribed CreateAmqpDescribed(ByteBuffer buffer)
 {
     return(AmqpCodec.CreateAmqpDescribed(buffer, AmqpCodec.knownTypesByName, AmqpCodec.knownTypesByCode));
 }