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 "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 string messageId;
00041 string correlationId;
00042 ReplyTo replyTo;
00043 string contentType;
00044 string contentEncoding;
00045 string type;
00046 string userId;
00047 string appId;
00048 string transactionId;
00049 string securityToken;
00050 FieldTable applicationHeaders;
00051 uint16_t flags;
00052 public:
00053 static const uint16_t TYPE = 1;
00054 MessageProperties(
00055 uint64_t _contentLength,
00056 const string& _messageId,
00057 const string& _correlationId,
00058 const ReplyTo& _replyTo,
00059 const string& _contentType,
00060 const string& _contentEncoding,
00061 const string& _type,
00062 const string& _userId,
00063 const string& _appId,
00064 const string& _transactionId,
00065 const string& _securityToken,
00066 const FieldTable& _applicationHeaders) :
00067 contentLength(_contentLength),
00068 messageId(_messageId),
00069 correlationId(_correlationId),
00070 replyTo(_replyTo),
00071 contentType(_contentType),
00072 contentEncoding(_contentEncoding),
00073 type(_type),
00074 userId(_userId),
00075 appId(_appId),
00076 transactionId(_transactionId),
00077 securityToken(_securityToken),
00078 applicationHeaders(_applicationHeaders),
00079 flags(0){
00080 flags |= (1 << 8);
00081 flags |= (1 << 9);
00082 flags |= (1 << 10);
00083 flags |= (1 << 11);
00084 flags |= (1 << 12);
00085 flags |= (1 << 13);
00086 flags |= (1 << 14);
00087 flags |= (1 << 15);
00088 flags |= (1 << 0);
00089 flags |= (1 << 1);
00090 flags |= (1 << 2);
00091 flags |= (1 << 3);
00092 }
00093 MessageProperties() : contentLength(0), flags(0) {}
00094
00095 void setContentLength(uint64_t _contentLength);
00096 uint64_t getContentLength() const;
00097 bool hasContentLength() const;
00098 void clearContentLengthFlag();
00099 void setMessageId(const string& _messageId);
00100 const string& getMessageId() const;
00101 bool hasMessageId() const;
00102 void clearMessageIdFlag();
00103 void setCorrelationId(const string& _correlationId);
00104 const string& getCorrelationId() const;
00105 bool hasCorrelationId() const;
00106 void clearCorrelationIdFlag();
00107 void setReplyTo(const ReplyTo& _replyTo);
00108 const ReplyTo& getReplyTo() const;
00109 bool hasReplyTo() const;
00110 void clearReplyToFlag();
00111 void setContentType(const string& _contentType);
00112 const string& getContentType() const;
00113 bool hasContentType() const;
00114 void clearContentTypeFlag();
00115 void setContentEncoding(const string& _contentEncoding);
00116 const string& getContentEncoding() const;
00117 bool hasContentEncoding() const;
00118 void clearContentEncodingFlag();
00119 void setType(const string& _type);
00120 const string& getType() const;
00121 bool hasType() const;
00122 void clearTypeFlag();
00123 void setUserId(const string& _userId);
00124 const string& getUserId() const;
00125 bool hasUserId() const;
00126 void clearUserIdFlag();
00127 void setAppId(const string& _appId);
00128 const string& getAppId() const;
00129 bool hasAppId() const;
00130 void clearAppIdFlag();
00131 void setTransactionId(const string& _transactionId);
00132 const string& getTransactionId() const;
00133 bool hasTransactionId() const;
00134 void clearTransactionIdFlag();
00135 void setSecurityToken(const string& _securityToken);
00136 const string& getSecurityToken() const;
00137 bool hasSecurityToken() const;
00138 void clearSecurityTokenFlag();
00139 void setApplicationHeaders(const FieldTable& _applicationHeaders);
00140 const FieldTable& getApplicationHeaders() const;
00141 FieldTable& getApplicationHeaders();
00142 bool hasApplicationHeaders() const;
00143 void clearApplicationHeadersFlag();
00144 friend std::ostream& operator<<(std::ostream&, const MessageProperties&);
00145 void encode(Buffer&) const;
00146 void decode(Buffer&, uint32_t=0);
00147 void encodeStructBody(Buffer&) const;
00148 void decodeStructBody(Buffer&, uint32_t=0);
00149 uint32_t size() const;
00150 uint32_t bodySize() const;
00151 void print(std::ostream& out) const;
00152 };
00153
00154 }}
00155 #endif