public static AMQPHeader getAMQP(IByteBuffer buf) { TLVAmqp list = TLVFactory.getTlv(buf); if (list.Code != AMQPType.LIST_0 && list.Code != AMQPType.LIST_8 && list.Code != AMQPType.LIST_32) { throw new MalformedMessageException("Received amqp-header with malformed arguments"); } AMQPHeader header = null; Byte byteCode = list.Constructor.getDescriptorCode().Value; HeaderCodes code = (HeaderCodes)byteCode; switch (code) { case HeaderCodes.ATTACH: header = new AMQPAttach(); break; case HeaderCodes.BEGIN: header = new AMQPBegin(); break; case HeaderCodes.CLOSE: header = new AMQPClose(); break; case HeaderCodes.DETACH: header = new AMQPDetach(); break; case HeaderCodes.DISPOSITION: header = new AMQPDisposition(); break; case HeaderCodes.END: header = new AMQPEnd(); break; case HeaderCodes.FLOW: header = new AMQPFlow(); break; case HeaderCodes.OPEN: header = new AMQPOpen(); break; case HeaderCodes.TRANSFER: header = new AMQPTransfer(); break; default: throw new MalformedMessageException("Received amqp-header with unrecognized performative"); } header.fillArguments((TLVList)list); return(header); }
public static AMQPSection getSection(IByteBuffer buf) { TLVAmqp value = TLVFactory.getTlv(buf); AMQPSection section = null; Byte byteCode = value.Constructor.getDescriptorCode().Value; SectionCodes code = (SectionCodes)byteCode; switch (code) { case SectionCodes.APPLICATION_PROPERTIES: section = new ApplicationProperties(); break; case SectionCodes.DATA: section = new AMQPData(); break; case SectionCodes.DELIVERY_ANNOTATIONS: section = new DeliveryAnnotations(); break; case SectionCodes.FOOTER: section = new AMQPFooter(); break; case SectionCodes.HEADER: section = new MessageHeader(); break; case SectionCodes.MESSAGE_ANNOTATIONS: section = new MessageAnnotations(); break; case SectionCodes.PROPERTIES: section = new AMQPProperties(); break; case SectionCodes.SEQUENCE: section = new AMQPSequence(); break; case SectionCodes.VALUE: section = new AMQPValue(); break; default: throw new MalformedMessageException("Received header with unrecognized message section code"); } section.fill(value); return(section); }
public static AMQPHeader getSASL(IByteBuffer buf) { TLVAmqp list = TLVFactory.getTlv(buf); if (list.Code != AMQPType.LIST_0 && list.Code != AMQPType.LIST_8 && list.Code != AMQPType.LIST_32) { throw new MalformedMessageException("Received amqp-header with malformed arguments"); } AMQPHeader header = null; Byte byteCode = list.Constructor.getDescriptorCode().Value; HeaderCodes code = (HeaderCodes)byteCode; switch (code) { case HeaderCodes.CHALLENGE: header = new SASLChallenge(); break; case HeaderCodes.INIT: header = new SASLInit(); break; case HeaderCodes.MECHANISMS: header = new SASLMechanisms(); break; case HeaderCodes.OUTCOME: header = new SASLOutcome(); break; case HeaderCodes.RESPONSE: header = new SASLResponse(); break; default: throw new MalformedMessageException("Received sasl-header with unrecognized arguments code"); } header.fillArguments((TLVList)list); return(header); }