qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1698427 - in /qpid/trunk/qpid/cpp/src/qpid: amqp/descriptors.h broker/amqp/Filter.cpp broker/amqp/Filter.h
Date Fri, 28 Aug 2015 22:16:34 GMT
Author: gsim
Date: Fri Aug 28 22:16:34 2015
New Revision: 1698427

URL: http://svn.apache.org/r1698427
Log:
QPID-6391: add support for no-local filter

Modified:
    qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.h

Modified: qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h?rev=1698427&r1=1698426&r2=1698427&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h Fri Aug 28 22:16:34 2015
@@ -85,12 +85,14 @@ namespace filters {
 const std::string LEGACY_DIRECT_FILTER_SYMBOL("apache.org:legacy-amqp-direct-binding:string");
 const std::string LEGACY_TOPIC_FILTER_SYMBOL("apache.org:legacy-amqp-topic-binding:string");
 const std::string LEGACY_HEADERS_FILTER_SYMBOL("apache.org:legacy-amqp-headers-binding:map");
+const std::string NO_LOCAL_FILTER_SYMBOL("apache.org:no-local-filter:list");
 const std::string SELECTOR_FILTER_SYMBOL("apache.org:selector-filter:string");
 const std::string XQUERY_FILTER_SYMBOL("apache.org:xquery-filter:string");
 
 const uint64_t LEGACY_DIRECT_FILTER_CODE(0x0000468C00000000ULL);
 const uint64_t LEGACY_TOPIC_FILTER_CODE(0x0000468C00000001ULL);
 const uint64_t LEGACY_HEADERS_FILTER_CODE(0x0000468C00000002ULL);
+const uint64_t NO_LOCAL_FILTER_CODE(0x0000468C00000003ULL);
 const uint64_t SELECTOR_FILTER_CODE(0x0000468C00000004ULL);
 const uint64_t XQUERY_FILTER_CODE(0x0000468C00000005ULL);
 }

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.cpp?rev=1698427&r1=1698426&r2=1698427&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.cpp Fri Aug 28 22:16:34 2015
@@ -46,7 +46,7 @@ const std::string DEFAULT_XQUERY_FILTER(
 const std::string DEFAULT_XQUERY_VALUE("true()");
 const std::string WILDCARD("#");
 }
-Filter::Filter() : inHeadersMap(false) {}
+Filter::Filter() : inHeadersMap(false), nolocal(false) {}
 
 void Filter::read(pn_data_t* data)
 {
@@ -88,6 +88,9 @@ void Filter::onStringValue(const qpid::a
                 setFilter(selectorFilter, filter);
             } else if (descriptor->match(qpid::amqp::filters::XQUERY_FILTER_SYMBOL, qpid::amqp::filters::XQUERY_FILTER_CODE))
{
                 setFilter(xqueryFilter, filter);
+            } else if (descriptor && descriptor->match(qpid::amqp::filters::NO_LOCAL_FILTER_SYMBOL,
qpid::amqp::filters::NO_LOCAL_FILTER_CODE)) {
+                //though the no-local-filter is define to be a list, the JMS client sends
it as a string
+                nolocal = true;
             } else {
                 QPID_LOG(notice, "Skipping unrecognised string filter with key " <<
filter.key << " and descriptor " << filter.descriptor);
             }
@@ -155,6 +158,14 @@ void Filter::onDoubleValue(const qpid::a
     headersFilter.value[std::string(key.data, key.size)] = value;
 }
 
+bool Filter::onStartListValue(const qpid::amqp::CharSequence& /*key*/, uint32_t /*count*/,
const qpid::amqp::Descriptor* descriptor)
+{
+    if (descriptor && descriptor->match(qpid::amqp::filters::NO_LOCAL_FILTER_SYMBOL,
qpid::amqp::filters::NO_LOCAL_FILTER_CODE)) {
+        nolocal = true;
+    }
+    return false;
+}
+
 bool Filter::onStartMapValue(const qpid::amqp::CharSequence& key, uint32_t /*count*/,
const qpid::amqp::Descriptor* descriptor)
 {
     if (inHeadersMap) {
@@ -234,6 +245,10 @@ void Filter::configure(QueueSettings& se
         settings.filter = getSelectorFilter();
         active.push_back(&selectorFilter);
     }
+    if (nolocal) {
+        settings.noLocal = true;
+        QPID_LOG(notice, "No local filter set");
+    }
 }
 
 std::string Filter::getBindingKey(boost::shared_ptr<Exchange> exchange) const

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.h?rev=1698427&r1=1698426&r2=1698427&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Filter.h Fri Aug 28 22:16:34 2015
@@ -101,6 +101,7 @@ class Filter : private qpid::amqp::MapRe
     void onLongValue(const qpid::amqp::CharSequence&, int64_t, const qpid::amqp::Descriptor*);
     void onFloatValue(const qpid::amqp::CharSequence&, float, const qpid::amqp::Descriptor*);
     void onDoubleValue(const qpid::amqp::CharSequence&, double, const qpid::amqp::Descriptor*);
+    bool onStartListValue(const qpid::amqp::CharSequence& key, uint32_t count, const
qpid::amqp::Descriptor* descriptor);
     bool onStartMapValue(const qpid::amqp::CharSequence& key, uint32_t count, const qpid::amqp::Descriptor*
descriptor);
     void onEndMapValue(const qpid::amqp::CharSequence& key, uint32_t count, const qpid::amqp::Descriptor*
descriptor);
     void setFilter(StringFilter&, const StringFilter&);
@@ -120,6 +121,7 @@ class Filter : private qpid::amqp::MapRe
     MapFilter headersFilter;
     std::vector<FilterBase*> active;
     bool inHeadersMap;
+    bool nolocal;
 };
 }}} // namespace qpid::broker::amqp
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message