From 9e10f4ea3b2f8ab6650f635cada48e4735ca20d7 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 28 Aug 2007 19:38:17 +0000 Subject: Updated message.transfer encoding to use header and content segments (including new structs). Unified more between the basic and message classes messages. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@570538 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/framing/AMQFrame.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cpp/src/qpid/framing/AMQFrame.cpp') diff --git a/cpp/src/qpid/framing/AMQFrame.cpp b/cpp/src/qpid/framing/AMQFrame.cpp index 780af71be4..a7fd068ee4 100644 --- a/cpp/src/qpid/framing/AMQFrame.cpp +++ b/cpp/src/qpid/framing/AMQFrame.cpp @@ -70,7 +70,7 @@ const AMQBody* AMQFrame::getBody() const { return boost::apply_visitor(GetBodyVisitor(), const_cast(body)); } -void AMQFrame::encode(Buffer& buffer) +void AMQFrame::encode(Buffer& buffer) const { buffer.putOctet(getBody()->type()); buffer.putShort(channel); @@ -80,8 +80,11 @@ void AMQFrame::encode(Buffer& buffer) } uint32_t AMQFrame::size() const{ - return 1/*type*/ + 2/*channel*/ + 4/*body size*/ + - boost::apply_visitor(SizeVisitor(), body) + 1/*0xCE*/; + return frameOverhead() + boost::apply_visitor(SizeVisitor(), body); +} + +uint32_t AMQFrame::frameOverhead() { + return 1/*type*/ + 2/*channel*/ + 4/*body size*/ + 1/*0xCE*/; } bool AMQFrame::decode(Buffer& buffer) -- cgit v1.2.1