00001 #ifndef QPID_FRAMING_MESSAGEPROPERTIES_H
00002 #define QPID_FRAMING_MESSAGEPROPERTIES_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028
00029
00030 #include "qpid/framing/ReplyTo.h"
00031
00032 #include <ostream>
00033 #include "qpid/framing/amqp_types_full.h"
00034
00035 namespace qpid {
00036 namespace framing {
00037
00038 class MessageProperties {
00039 uint64_t contentLength;
00040 Uuid messageId;
00041 string correlationId;
00042 ReplyTo replyTo;
00043 string contentType;
00044 string contentEncoding;
00045 string userId;
00046 string appId;
00047 FieldTable applicationHeaders;
00048 uint16_t flags;
00049 public:
00050 static const uint16_t TYPE = 1027;
00051 MessageProperties(
00052 uint64_t _contentLength,
00053 const Uuid& _messageId,
00054 const string& _correlationId,
00055 const ReplyTo& _replyTo,
00056 const string& _contentType,
00057 const string& _contentEncoding,
00058 const string& _userId,
00059 const string& _appId,
00060 const FieldTable& _applicationHeaders) :
00061 contentLength(_contentLength),
00062 messageId(_messageId),
00063 correlationId(_correlationId),
00064 replyTo(_replyTo),
00065 contentType(_contentType),
00066 contentEncoding(_contentEncoding),
00067 userId(_userId),
00068 appId(_appId),
00069 applicationHeaders(_applicationHeaders),
00070 flags(0){
00071 flags |= (1 << 8);
00072 flags |= (1 << 9);
00073 flags |= (1 << 10);
00074 flags |= (1 << 11);
00075 flags |= (1 << 12);
00076 flags |= (1 << 13);
00077 flags |= (1 << 14);
00078 flags |= (1 << 15);
00079 flags |= (1 << 0);
00080 }
00081 MessageProperties() : contentLength(0), flags(0) {}
00082
00083 void setContentLength(uint64_t _contentLength);
00084 uint64_t getContentLength() const;
00085 bool hasContentLength() const;
00086 void clearContentLengthFlag();
00087 void setMessageId(const Uuid& _messageId);
00088 const Uuid& getMessageId() const;
00089 bool hasMessageId() const;
00090 void clearMessageIdFlag();
00091 void setCorrelationId(const string& _correlationId);
00092 const string& getCorrelationId() const;
00093 bool hasCorrelationId() const;
00094 void clearCorrelationIdFlag();
00095 void setReplyTo(const ReplyTo& _replyTo);
00096 const ReplyTo& getReplyTo() const;
00097 bool hasReplyTo() const;
00098 void clearReplyToFlag();
00099 void setContentType(const string& _contentType);
00100 const string& getContentType() const;
00101 bool hasContentType() const;
00102 void clearContentTypeFlag();
00103 void setContentEncoding(const string& _contentEncoding);
00104 const string& getContentEncoding() const;
00105 bool hasContentEncoding() const;
00106 void clearContentEncodingFlag();
00107 void setUserId(const string& _userId);
00108 const string& getUserId() const;
00109 bool hasUserId() const;
00110 void clearUserIdFlag();
00111 void setAppId(const string& _appId);
00112 const string& getAppId() const;
00113 bool hasAppId() const;
00114 void clearAppIdFlag();
00115 void setApplicationHeaders(const FieldTable& _applicationHeaders);
00116 const FieldTable& getApplicationHeaders() const;
00117 FieldTable& getApplicationHeaders();
00118 bool hasApplicationHeaders() const;
00119 void clearApplicationHeadersFlag();
00120 friend std::ostream& operator<<(std::ostream&, const MessageProperties&);
00121 void encode(Buffer&) const;
00122 void decode(Buffer&, uint32_t=0);
00123 void encodeStructBody(Buffer&) const;
00124 void decodeStructBody(Buffer&, uint32_t=0);
00125 uint32_t size() const;
00126 uint32_t bodySize() const;
00127 void print(std::ostream& out) const;
00128 };
00129
00130 }}
00131 #endif