00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef qpid_framing_FileDeliverBody__
00029 #define qpid_framing_FileDeliverBody__
00030
00031 #include <string>
00032 #include <sstream>
00033
00034 #include "qpid/framing/amqp_types.h"
00035 #include "qpid/framing/AMQRequestBody.h"
00036 #include "qpid/framing/Buffer.h"
00037 #include "qpid/framing/FieldTable.h"
00038 #include "qpid/framing/FramingContent.h"
00039
00040 namespace qpid
00041 {
00042 namespace framing
00043 {
00044
00045
00046 class FileDeliverBody : public AMQRequestBody
00047 {
00048
00049
00050
00051 string consumerTag;
00052 u_int64_t deliveryTag;
00053 bool redelivered;
00054 string exchange;
00055 string routingKey;
00056 string identifier;
00057
00058
00059 public:
00060 static const ClassId CLASS_ID= 70;
00061 static const MethodId METHOD_ID = 80;
00062
00063 typedef boost::shared_ptr<FileDeliverBody> shared_ptr;
00064
00065
00066
00067 FileDeliverBody(ProtocolVersion version,
00068 const string& consumerTag,
00069 u_int64_t deliveryTag,
00070 bool redelivered,
00071 const string& exchange,
00072 const string& routingKey,
00073 const string& identifier
00074 ) : AMQRequestBody(version),
00075 consumerTag(consumerTag),
00076 deliveryTag(deliveryTag),
00077 redelivered(redelivered),
00078 exchange(exchange),
00079 routingKey(routingKey),
00080 identifier(identifier)
00081 { }
00082
00083
00084 FileDeliverBody(ProtocolVersion version): AMQRequestBody(version) {}
00085 virtual ~FileDeliverBody() {}
00086
00087
00088
00089 const string& getConsumerTag() { return consumerTag; }
00090 u_int64_t getDeliveryTag() { return deliveryTag; }
00091 bool getRedelivered() { return redelivered; }
00092 const string& getExchange() { return exchange; }
00093 const string& getRoutingKey() { return routingKey; }
00094 const string& getIdentifier() { return identifier; }
00095
00096
00097
00098 inline void print(std::ostream& out) const
00099 {
00100 printPrefix(out);
00101 out << "FileDeliver: ";
00102 out << "consumerTag=" << consumerTag;
00103 out << "; deliveryTag=" << deliveryTag;
00104 out << "; redelivered=" << redelivered;
00105 out << "; exchange=" << exchange;
00106 out << "; routingKey=" << routingKey;
00107 out << "; identifier=" << identifier;
00108 }
00109
00110 inline ClassId amqpClassId() const { return CLASS_ID; }
00111 inline MethodId amqpMethodId() const { return METHOD_ID; }
00112
00113 u_int32_t size() const
00114 {
00115 u_int32_t sz = baseSize();
00116 sz += 1 + consumerTag.length();
00117 sz += 8;
00118 sz += 1;
00119 sz += 1 + exchange.length();
00120 sz += 1 + routingKey.length();
00121 sz += 1 + identifier.length();
00122 return sz;
00123 }
00124
00125 void encodeContent(Buffer& buffer) const
00126 {
00127 buffer.putShortString(consumerTag);
00128 buffer.putLongLong(deliveryTag);
00129 u_int8_t flags_3[1] = {0};
00130 flags_3[0] |= redelivered << 0;
00131 buffer.putOctet(flags_3[0]);
00132 buffer.putShortString(exchange);
00133 buffer.putShortString(routingKey);
00134 buffer.putShortString(identifier);
00135 }
00136
00137 inline void decodeContent(Buffer& buffer)
00138 {
00139 buffer.getShortString(consumerTag);
00140 deliveryTag = buffer.getLongLong();
00141 u_int8_t flags_3[1];
00142 flags_3[0] = buffer.getOctet();
00143 redelivered = (1 << 0) & flags_3[0];
00144 buffer.getShortString(exchange);
00145 buffer.getShortString(routingKey);
00146 buffer.getShortString(identifier);
00147 }
00148
00149
00150
00151 };
00152
00153
00154 }
00155 }
00156
00157 #endif
00158