Author: gsim
Date: Fri Feb 15 00:26:00 2008
New Revision: 627971
URL: http://svn.apache.org/viewvc?rev=627971&view=rev
Log:
* updated c++ build to work with recent gentools changes
* add null exchange.bound impl to SessionHandlerImpl (to reflect change to spec
file)
* pass AMQDataBlocks rather than AMQFrames to OutputHandler
* allow client to pass messages frames to io layer in one go (via FrameList) if
it will fit in a single buffer
Added:
incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.cpp
(with props)
incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.cpp (with
props)
incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.h (with
props)
incubator/qpid/branches/M2.1/gentools/templ.cpp/method/
incubator/qpid/branches/M2.1/gentools/templ.cpp/method/MethodBodyClass.h.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/MethodBodyClass.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_ClientOperations.h.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_ClientProxy.cpp.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_ClientProxy.h.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_Constants.h.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_Constants.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_HighestVersion.h.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_HighestVersion.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_MethodVersionMap.cpp.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_MethodVersionMap.h.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_MethodVersionMap.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_ServerOperations.h.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_ServerProxy.cpp.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/model/AMQP_ServerProxy.h.tmpl
- copied unchanged from r627427,
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl
Removed:
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_Constants.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_HighestVersion.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_MethodVersionMap.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl
incubator/qpid/branches/M2.1/gentools/templ.cpp/MethodBodyClass.h.tmpl
Modified:
incubator/qpid/branches/M2.1/cpp/gen/Makefile.am
incubator/qpid/branches/M2.1/cpp/lib/broker/SessionHandlerImpl.h
incubator/qpid/branches/M2.1/cpp/lib/client/ClientChannel.cpp
incubator/qpid/branches/M2.1/cpp/lib/client/Connector.cpp
incubator/qpid/branches/M2.1/cpp/lib/client/Connector.h
incubator/qpid/branches/M2.1/cpp/lib/common/Makefile.am
incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.h
incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.cpp
incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.h
incubator/qpid/branches/M2.1/cpp/lib/common/framing/OutputHandler.h
incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.cpp
incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.h
incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.cpp
incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.h
incubator/qpid/branches/M2.1/cpp/tests/ChannelTest.cpp
incubator/qpid/branches/M2.1/cpp/tests/InMemoryContentTest.cpp
incubator/qpid/branches/M2.1/cpp/tests/LazyLoadedContentTest.cpp
incubator/qpid/branches/M2.1/cpp/tests/MessageTest.cpp
incubator/qpid/branches/M2.1/cpp/tests/client_test.cpp
Modified: incubator/qpid/branches/M2.1/cpp/gen/Makefile.am
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/gen/Makefile.am?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/gen/Makefile.am (original)
+++ incubator/qpid/branches/M2.1/cpp/gen/Makefile.am Fri Feb 15 00:26:00 2008
@@ -32,16 +32,21 @@
#
if CAN_GENERATE_CODE
+
gentools_dir = $(srcdir)/../../gentools
spec_dir = $(srcdir)/../../specs
spec = $(spec_dir)/amqp.0-8.xml
gentools_srcdir = $(gentools_dir)/src/org/apache/qpid/gentools
+gentools_libs =
$(gentools_dir)/lib/velocity-1.4.jar:$(gentools_dir)/lib/velocity-dep-1.4.jar
$(BUILT_SOURCES) timestamp: $(spec) $(java_sources) $(cxx_templates)
rm -f $(generated_sources)
- cd $(gentools_srcdir) && rm -f *.class && $(JAVAC) *.java
- $(JAVA) -cp $(gentools_dir)/src org.apache.qpid.gentools.Main \
+ cd $(gentools_srcdir) && rm -f *.class
+ $(JAVAC) -cp $(gentools_libs) -sourcepath $(gentools_srcdir) -d
$(gentools_dir)/src $(gentools_srcdir)/*.java
+ $(JAVA) -cp $(gentools_dir)/src:$(gentools_libs)
org.apache.qpid.gentools.Main \
-c -o . -t $(gentools_dir)/templ.cpp $(spec)
+ echo $(JAVA) -cp $(gentools_dir)/src:$(gentools_libs)
org.apache.qpid.gentools.Main \
+ -c -o . -t $(gentools_dir)/templ.cpp $(spec) >> debug
touch timestamp
gen-src.mk: timestamp
Modified: incubator/qpid/branches/M2.1/cpp/lib/broker/SessionHandlerImpl.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/broker/SessionHandlerImpl.h?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/broker/SessionHandlerImpl.h (original)
+++ incubator/qpid/branches/M2.1/cpp/lib/broker/SessionHandlerImpl.h Fri Feb 15
00:26:00 2008
@@ -177,7 +177,12 @@
// Change to match new code generator function signature (adding const
to string&) - kpvdr 2006-11-20
virtual void delete_(u_int16_t channel, u_int16_t ticket, const
string& exchange, bool ifUnused, bool nowait);
-
+
+ virtual void bound( u_int16_t /*channel*/,
+ const string& /*exchange*/,
+ const string& /*routingKey*/,
+ const string& /*queue*/ ) {}
+
virtual ~ExchangeHandlerImpl(){}
};
Modified: incubator/qpid/branches/M2.1/cpp/lib/client/ClientChannel.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/client/ClientChannel.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/client/ClientChannel.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/lib/client/ClientChannel.cpp Fri Feb 15
00:26:00 2008
@@ -23,6 +23,7 @@
#include <ClientMessage.h>
#include <QpidError.h>
#include <MethodBodyInstances.h>
+#include <framing/FrameList.h>
using namespace boost; //to use dynamic_pointer_cast
using namespace qpid::client;
@@ -219,19 +220,25 @@
string e = exchange.getName();
string key = routingKey;
- out->send(new AMQFrame(version, id, new BasicPublishBody(version, 0, e,
key, mandatory, immediate)));
+ std::auto_ptr<FrameList> message(new FrameList());
+
+ message->add(new AMQFrame(version, id, new BasicPublishBody(version, 0, e,
key, mandatory, immediate)));
//break msg up into header frame and content frame(s) and send these
string data = msg.getData();
msg.header->setContentSize(data.length());
AMQBody::shared_ptr body(static_pointer_cast<AMQBody,
AMQHeaderBody>(msg.header));
- out->send(new AMQFrame(version, id, body));
+ message->add(new AMQFrame(version, id, body));
u_int64_t data_length = data.length();
if(data_length > 0){
u_int32_t frag_size = con->getMaxFrameSize() - 8;//frame itself uses 8
bytes
- if(data_length < frag_size){
- out->send(new AMQFrame(version, id, new AMQContentBody(data)));
+ if(data_length + message->size() < frag_size){
+ message->add(new AMQFrame(version, id, new AMQContentBody(data)));
+ } else if(data_length < frag_size){
+ out->send(message.release());
+ out->send(new AMQFrame(version, id, new AMQContentBody(data)));
}else{
+ out->send(message.release());
u_int32_t offset = 0;
u_int32_t remaining = data_length - offset;
while (remaining > 0) {
@@ -244,6 +251,7 @@
}
}
}
+ if (message.get()) out->send(message.release());
}
void Channel::commit(){
Modified: incubator/qpid/branches/M2.1/cpp/lib/client/Connector.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/client/Connector.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/client/Connector.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/lib/client/Connector.cpp Fri Feb 15
00:26:00 2008
@@ -78,7 +78,7 @@
return this;
}
-void Connector::send(AMQFrame* frame){
+void Connector::send(AMQDataBlock* frame){
writeBlock(frame);
if(debug) std::cout << "SENT: " << *frame << std::endl;
delete frame;
Modified: incubator/qpid/branches/M2.1/cpp/lib/client/Connector.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/client/Connector.h?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/client/Connector.h (original)
+++ incubator/qpid/branches/M2.1/cpp/lib/client/Connector.h Fri Feb 15 00:26:00
2008
@@ -85,7 +85,7 @@
virtual void setTimeoutHandler(qpid::sys::TimeoutHandler* handler);
virtual void setShutdownHandler(qpid::sys::ShutdownHandler* handler);
virtual qpid::framing::OutputHandler* getOutputHandler();
- virtual void send(qpid::framing::AMQFrame* frame);
+ virtual void send(qpid::framing::AMQDataBlock* frame);
virtual void setReadTimeout(u_int16_t timeout);
virtual void setWriteTimeout(u_int16_t timeout);
};
Modified: incubator/qpid/branches/M2.1/cpp/lib/common/Makefile.am
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/Makefile.am?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/Makefile.am (original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/Makefile.am Fri Feb 15 00:26:00
2008
@@ -76,6 +76,7 @@
$(platform_src) \
$(framing)/AMQBody.cpp \
$(framing)/AMQContentBody.cpp \
+ $(framing)/AMQDataBlock.cpp \
$(framing)/AMQFrame.cpp \
$(framing)/AMQHeaderBody.cpp \
$(framing)/AMQHeartbeatBody.cpp \
@@ -84,6 +85,7 @@
$(framing)/BodyHandler.cpp \
$(framing)/Buffer.cpp \
$(framing)/FieldTable.cpp \
+ $(framing)/FrameList.cpp \
$(framing)/FramingContent.cpp \
$(framing)/InitiationHandler.cpp \
$(framing)/ProtocolInitiation.cpp \
@@ -114,6 +116,7 @@
$(framing)/BodyHandler.h \
$(framing)/Buffer.h \
$(framing)/FieldTable.h \
+ $(framing)/FrameList.h \
$(framing)/FramingContent.h \
$(framing)/HeaderProperties.h \
$(framing)/InitiationHandler.h \
Added: incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.cpp?rev=627971&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.cpp (added)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.cpp Fri
Feb 15 00:26:00 2008
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "AMQDataBlock.h"
+
+
+namespace qpid {
+namespace framing {
+
+std::ostream& operator<<(std::ostream& out, const AMQDataBlock& b)
+{
+ b.print(out);
+ return out;
+}
+
+}}
Propchange: incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.h?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.h
(original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQDataBlock.h Fri Feb
15 00:26:00 2008
@@ -33,10 +33,12 @@
virtual void encode(Buffer& buffer) = 0;
virtual bool decode(Buffer& buffer) = 0;
virtual u_int32_t size() const = 0;
+ virtual void print(std::ostream& out) const = 0;
+
+ friend std::ostream& operator<<(std::ostream& out, const AMQDataBlock&
block);
};
}
}
-
#endif
Modified: incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.cpp Fri Feb 15
00:26:00 2008
@@ -119,14 +119,18 @@
body->decode(buffer, bufSize);
}
-std::ostream& qpid::framing::operator<<(std::ostream& out, const AMQFrame& t)
+void AMQFrame::print(std::ostream& out) const
{
- out << "Frame[channel=" << t.channel << "; ";
- if (t.body.get() == 0)
+ out << "Frame[channel=" << channel << "; ";
+ if (body.get() == 0)
out << "empty";
else
- out << *t.body;
+ out << *body;
out << "]";
+}
+std::ostream& qpid::framing::operator<<(std::ostream& out, const AMQFrame& t)
+{
+ t.print(out);
return out;
}
Modified: incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.h?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.h (original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/AMQFrame.h Fri Feb 15
00:26:00 2008
@@ -61,6 +61,8 @@
u_int32_t decodeHead(Buffer& buffer);
void decodeBody(Buffer& buffer, uint32_t size);
+ void print(std::ostream& out) const;
+
friend std::ostream& operator<<(std::ostream& out, const AMQFrame&
body);
};
Added: incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.cpp?rev=627971&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.cpp (added)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.cpp Fri Feb
15 00:26:00 2008
@@ -0,0 +1,69 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "FrameList.h"
+#include "Exception.h"
+
+namespace qpid {
+namespace framing {
+
+FrameList::~FrameList()
+{
+ for (Frames::iterator i = frames.begin(); i != frames.end(); i++) {
+ delete (*i);
+ }
+}
+
+void FrameList::encode(Buffer& buffer)
+{
+ for (Frames::iterator i = frames.begin(); i != frames.end(); i++) {
+ (*i)->encode(buffer);
+ }
+}
+
+bool FrameList::decode(Buffer&)
+{
+ throw Exception("FrameList::decode() not valid!");
+}
+
+u_int32_t FrameList::size() const
+{
+ uint32_t s(0);
+ for (Frames::const_iterator i = frames.begin(); i != frames.end(); i++) {
+ s += (*i)->size();
+ }
+ return s;
+}
+
+void FrameList::print(std::ostream& out) const
+{
+ out << "Frames: ";
+ for (Frames::const_iterator i = frames.begin(); i != frames.end(); i++) {
+ (*i)->print(out);
+ out << "; ";
+ }
+}
+
+void FrameList::add(AMQFrame* f)
+{
+ frames.push_back(f);
+}
+
+}}
Propchange: incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.h?rev=627971&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.h (added)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.h Fri Feb 15
00:26:00 2008
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "Buffer.h"
+#include "AMQDataBlock.h"
+#include "AMQFrame.h"
+
+#include <list>
+
+#ifndef _FrameList_
+#define _FrameList_
+
+namespace qpid {
+namespace framing {
+
+class FrameList : public AMQDataBlock
+{
+ typedef std::list<AMQFrame*> Frames;
+ Frames frames;
+public:
+ virtual ~FrameList();
+ void encode(Buffer& buffer);
+ bool decode(Buffer& buffer);
+ u_int32_t size() const;
+ void add(AMQFrame* f);
+ void print(std::ostream& out) const;
+};
+
+}
+}
+
+
+#endif
Propchange: incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/branches/M2.1/cpp/lib/common/framing/FrameList.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/qpid/branches/M2.1/cpp/lib/common/framing/OutputHandler.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/OutputHandler.h?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/OutputHandler.h
(original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/OutputHandler.h Fri Feb
15 00:26:00 2008
@@ -22,6 +22,7 @@
*
*/
#include <boost/noncopyable.hpp>
+#include <AMQDataBlock.h>
#include <AMQFrame.h>
namespace qpid {
@@ -30,7 +31,7 @@
class OutputHandler : private boost::noncopyable {
public:
virtual ~OutputHandler() {}
- virtual void send(AMQFrame* frame) = 0;
+ virtual void send(AMQDataBlock* frame) = 0;
};
}}
Modified:
incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.cpp
(original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.cpp
Fri Feb 15 00:26:00 2008
@@ -19,6 +19,7 @@
*
*/
#include <ProtocolInitiation.h>
+#include <iostream>
qpid::framing::ProtocolInitiation::ProtocolInitiation(){}
@@ -53,6 +54,11 @@
}else{
return false;
}
+}
+
+void qpid::framing::ProtocolInitiation::print(std::ostream& out) const
+{
+ out << "AMQP(" << getMajor() << "-" << getMinor() << ")";
}
//TODO: this should prbably be generated from the spec at some point to keep
the version numbers up to date
Modified:
incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.h?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.h
(original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/framing/ProtocolInitiation.h
Fri Feb 15 00:26:00 2008
@@ -45,6 +45,7 @@
inline u_int8_t getMajor() const { return version.getMajor(); }
inline u_int8_t getMinor() const { return version.getMinor(); }
inline const ProtocolVersion& getVersion() const { return version; }
+ void print(std::ostream& out) const;
};
}
Modified:
incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.cpp
(original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.cpp
Fri Feb 15 00:26:00 2008
@@ -96,7 +96,7 @@
if(!framesToWrite.empty()){
out.clear();
bool encoded(false);
- AMQFrame* frame = framesToWrite.front();
+ AMQDataBlock* frame = framesToWrite.front();
while(frame && out.available() >= frame->size()){
encoded = true;
frame->encode(out);
@@ -120,7 +120,7 @@
}
}
-void LFSessionContext::send(AMQFrame* frame){
+void LFSessionContext::send(AMQDataBlock* frame){
Mutex::ScopedLock l(writeLock);
if(!closing){
framesToWrite.push(frame);
@@ -173,9 +173,9 @@
processor->add(&fd);
}
-void LFSessionContext::log(const std::string& desc, AMQFrame* const frame){
+void LFSessionContext::log(const std::string& desc, AMQDataBlock* const block){
Mutex::ScopedLock l(logLock);
- std::cout << desc << " [" << &socket << "]: " << *frame << std::endl;
+ std::cout << desc << " [" << &socket << "]: " << *block << std::endl;
}
Mutex LFSessionContext::logLock;
Modified: incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.h?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.h
(original)
+++ incubator/qpid/branches/M2.1/cpp/lib/common/sys/apr/LFSessionContext.h Fri
Feb 15 00:26:00 2008
@@ -54,7 +54,7 @@
apr_pollfd_t fd;
- std::queue<qpid::framing::AMQFrame*> framesToWrite;
+ std::queue<qpid::framing::AMQDataBlock*> framesToWrite;
qpid::sys::Mutex writeLock;
bool processing;
@@ -62,7 +62,7 @@
static qpid::sys::Mutex logLock;
void log(const std::string& desc,
- qpid::framing::AMQFrame* const frame);
+ qpid::framing::AMQDataBlock* const block);
public:
@@ -70,7 +70,7 @@
LFProcessor* const processor,
bool debug = false);
virtual ~LFSessionContext();
- virtual void send(qpid::framing::AMQFrame* frame);
+ virtual void send(qpid::framing::AMQDataBlock* frame);
virtual void close();
void read();
void write();
Modified: incubator/qpid/branches/M2.1/cpp/tests/ChannelTest.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/ChannelTest.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/ChannelTest.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/ChannelTest.cpp Fri Feb 15 00:26:00
2008
@@ -39,8 +39,8 @@
struct DummyHandler : OutputHandler{
std::vector<AMQFrame*> frames;
- virtual void send(AMQFrame* frame){
- frames.push_back(frame);
+ virtual void send(AMQDataBlock* block){
+ frames.push_back(dynamic_cast<AMQFrame*>(block));
}
};
Modified: incubator/qpid/branches/M2.1/cpp/tests/InMemoryContentTest.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/InMemoryContentTest.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/InMemoryContentTest.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/InMemoryContentTest.cpp Fri Feb 15
00:26:00 2008
@@ -33,8 +33,9 @@
struct DummyHandler : OutputHandler{
std::vector<AMQFrame*> frames;
- virtual void send(AMQFrame* frame){
- frames.push_back(frame);
+
+ virtual void send(AMQDataBlock* block){
+ frames.push_back(dynamic_cast<AMQFrame*>(block));
}
};
Modified: incubator/qpid/branches/M2.1/cpp/tests/LazyLoadedContentTest.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/LazyLoadedContentTest.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/LazyLoadedContentTest.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/LazyLoadedContentTest.cpp Fri Feb 15
00:26:00 2008
@@ -35,8 +35,8 @@
struct DummyHandler : OutputHandler{
std::vector<AMQFrame*> frames;
- virtual void send(AMQFrame* frame){
- frames.push_back(frame);
+ virtual void send(AMQDataBlock* block){
+ frames.push_back(dynamic_cast<AMQFrame*>(block));
}
};
Modified: incubator/qpid/branches/M2.1/cpp/tests/MessageTest.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/MessageTest.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/MessageTest.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/MessageTest.cpp Fri Feb 15 00:26:00
2008
@@ -30,8 +30,8 @@
struct DummyHandler : OutputHandler{
std::vector<AMQFrame*> frames;
- virtual void send(AMQFrame* frame){
- frames.push_back(frame);
+ virtual void send(AMQDataBlock* block){
+ frames.push_back(dynamic_cast<AMQFrame*>(block));
}
};
Modified: incubator/qpid/branches/M2.1/cpp/tests/client_test.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/client_test.cpp?rev=627971&r1=627970&r2=627971&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/client_test.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/client_test.cpp Fri Feb 15 00:26:00
2008
@@ -35,6 +35,7 @@
#include <MessageListener.h>
#include <sys/Monitor.h>
#include <FieldTable.h>
+#include <cstdlib>
using namespace qpid::client;
using namespace qpid::sys;
@@ -52,12 +53,28 @@
inline SimpleListener(Monitor* _monitor) : monitor(_monitor){}
inline virtual void received(Message& msg){
- std::cout << "Received message " << msg.getData() << std::endl;
+ std::cout << "Received message " << msg.getData().substr(0, 5) << "..."
<< std::endl;
monitor->notify();
}
};
-int main(int argc, char**)
+const std::string
chars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+std::string generateData(uint size)
+{
+ if (size < chars.length()) {
+ return chars.substr(0, size);
+ }
+ std::string data;
+ for (uint i = 0; i < (size / chars.length()); i++) {
+ data += chars;
+ }
+ data += chars.substr(0, size % chars.length());
+ return data;
+}
+
+
+int main(int argc, char** argv)
{
try{
//Use a custom exchange
@@ -109,10 +126,17 @@
//Now we create and publish a message to our exchange with a
//routing key that will cause it to be routed to our queue
Message msg;
- string data("MyMessage");
- msg.setData(data);
+ uint size = 0;
+ if (argc > 1) {
+ size = atoi(argv[1]);
+ }
+ if (size) {
+ msg.setData(generateData(size));
+ } else {
+ msg.setData("MyMessage");
+ }
channel.publish(msg, exchange, "MyTopic");
- std::cout << "Published message: " << data << std::endl;
+ std::cout << "Published message: " << msg.getData().substr(0, 5) <<
"..." << std::endl;
{
Monitor::ScopedLock l(monitor);