summaryrefslogtreecommitdiff
path: root/qpid
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2012-09-10 13:32:07 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2012-09-10 13:32:07 +0000
commit968ba6fe6b6505754cbcb3044cd014b01caec4fd (patch)
treeb19331a4e2dc6495ef057a3a4f9dfbeb8e0e312e /qpid
parent35e75488ec3f1b0048f2948701bcfdc8106d760e (diff)
downloadqpid-python-968ba6fe6b6505754cbcb3044cd014b01caec4fd.tar.gz
QPID-4174: add client properties to client-related events. Original patch from Pavel Moravec
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1382830 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
-rw-r--r--qpid/cpp/src/qpid/broker/Connection.cpp4
-rw-r--r--qpid/cpp/src/qpid/broker/ConnectionHandler.cpp45
-rw-r--r--qpid/specs/management-schema.xml8
3 files changed, 33 insertions, 24 deletions
diff --git a/qpid/cpp/src/qpid/broker/Connection.cpp b/qpid/cpp/src/qpid/broker/Connection.cpp
index 8d250a32e5..8890ba45b6 100644
--- a/qpid/cpp/src/qpid/broker/Connection.cpp
+++ b/qpid/cpp/src/qpid/broker/Connection.cpp
@@ -142,7 +142,7 @@ Connection::~Connection()
// In a cluster, Connections destroyed during shutdown are in
// a cluster-unsafe context. Don't raise an event in that case.
if (!link && isClusterSafe())
- agent->raiseEvent(_qmf::EventClientDisconnect(mgmtId, ConnectionState::getUserId()));
+ agent->raiseEvent(_qmf::EventClientDisconnect(mgmtId, ConnectionState::getUserId(), mgmtObject->get_remoteProperties()));
QPID_LOG_CAT(debug, model, "Delete connection. user:" << ConnectionState::getUserId()
<< " rhost:" << mgmtId );
}
@@ -287,7 +287,7 @@ void Connection::setUserId(const string& userId)
void Connection::raiseConnectEvent() {
if (mgmtObject != 0) {
mgmtObject->set_authIdentity(userId);
- agent->raiseEvent(_qmf::EventClientConnect(mgmtId, userId));
+ agent->raiseEvent(_qmf::EventClientConnect(mgmtId, userId, mgmtObject->get_remoteProperties()));
}
QPID_LOG_CAT(debug, model, "Create connection. user:" << userId
diff --git a/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp b/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
index 06f442a47f..a484cc054e 100644
--- a/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
+++ b/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
@@ -32,6 +32,7 @@
#include "qpid/log/Statement.h"
#include "qpid/sys/SecurityLayer.h"
#include "qpid/broker/AclModule.h"
+#include "qpid/amqp_0_10/Codecs.h"
#include "qmf/org/apache/qpid/broker/EventClientConnectFail.h"
using namespace qpid;
@@ -148,6 +149,24 @@ void ConnectionHandler::Handler::startOk(const framing::FieldTable& /*clientProp
void ConnectionHandler::Handler::startOk(const ConnectionStartOkBody& body)
{
+ const framing::FieldTable& clientProperties = body.getClientProperties();
+ qmf::org::apache::qpid::broker::Connection* mgmtObject = connection.getMgmtObject();
+
+ if (mgmtObject != 0) {
+ string procName = clientProperties.getAsString(CLIENT_PROCESS_NAME);
+ uint32_t pid = clientProperties.getAsInt(CLIENT_PID);
+ uint32_t ppid = clientProperties.getAsInt(CLIENT_PPID);
+
+ types::Variant::Map properties;
+ amqp_0_10::translate(clientProperties, properties);
+ mgmtObject->set_remoteProperties(properties);
+ if (!procName.empty())
+ mgmtObject->set_remoteProcessName(procName);
+ if (pid != 0)
+ mgmtObject->set_remotePid(pid);
+ if (ppid != 0)
+ mgmtObject->set_remoteParentPid(ppid);
+ }
try {
authenticator->start(body.getMechanism(), body.hasResponse() ? &body.getResponse() : 0);
} catch (std::exception& /*e*/) {
@@ -160,8 +179,9 @@ void ConnectionHandler::Handler::startOk(const ConnectionStartOkBody& body)
string uid;
authenticator->getError(error);
authenticator->getUid(uid);
- if (agent) {
- agent->raiseEvent(_qmf::EventClientConnectFail(connection.getMgmtId(), uid, error));
+ if (agent && mgmtObject) {
+ agent->raiseEvent(_qmf::EventClientConnectFail(connection.getMgmtId(), uid, error,
+ mgmtObject->get_remoteProperties()));
}
QPID_LOG_CAT(debug, model, "Failed connection. rhost:" << connection.getMgmtId()
<< " user:" << uid
@@ -169,9 +189,8 @@ void ConnectionHandler::Handler::startOk(const ConnectionStartOkBody& body)
}
throw;
}
- const framing::FieldTable& clientProperties = body.getClientProperties();
- connection.setClientProperties(clientProperties);
+ connection.setClientProperties(clientProperties);
connection.setFederationLink(clientProperties.get(QPID_FED_LINK));
if (clientProperties.isSet(QPID_FED_TAG)) {
connection.setFederationPeerTag(clientProperties.getAsString(QPID_FED_TAG));
@@ -187,19 +206,6 @@ void ConnectionHandler::Handler::startOk(const ConnectionStartOkBody& body)
}
QPID_LOG(info, "Connection is a federation link");
}
-
- if (connection.getMgmtObject() != 0) {
- string procName = clientProperties.getAsString(CLIENT_PROCESS_NAME);
- uint32_t pid = clientProperties.getAsInt(CLIENT_PID);
- uint32_t ppid = clientProperties.getAsInt(CLIENT_PPID);
-
- if (!procName.empty())
- connection.getMgmtObject()->set_remoteProcessName(procName);
- if (pid != 0)
- connection.getMgmtObject()->set_remotePid(pid);
- if (ppid != 0)
- connection.getMgmtObject()->set_remoteParentPid(ppid);
- }
}
void ConnectionHandler::Handler::secureOk(const string& response)
@@ -216,8 +222,9 @@ void ConnectionHandler::Handler::secureOk(const string& response)
string uid;
authenticator->getError(error);
authenticator->getUid(uid);
- if (agent) {
- agent->raiseEvent(_qmf::EventClientConnectFail(connection.getMgmtId(), uid, error));
+ if (agent && connection.getMgmtObject()) {
+ agent->raiseEvent(_qmf::EventClientConnectFail(connection.getMgmtId(), uid, error,
+ connection.getMgmtObject()->get_remoteProperties()));
}
QPID_LOG_CAT(debug, model, "Failed connection. rhost:" << connection.getMgmtId()
<< " user:" << uid
diff --git a/qpid/specs/management-schema.xml b/qpid/specs/management-schema.xml
index 5d1fbe0110..7ae1c12f50 100644
--- a/qpid/specs/management-schema.xml
+++ b/qpid/specs/management-schema.xml
@@ -357,6 +357,7 @@
<property name="shadow" type="bool" access="RO" desc="True for shadow connections"/>
<property name="saslMechanism" type="sstr" access="RO" desc="SASL mechanism"/>
<property name="saslSsf" type="uint16" access="RO" desc="SASL security strength factor"/>
+ <property name="remoteProperties" type="map" access="RO" desc="optional map of identifying information sent by the remote"/>
<statistic name="closing" type="bool" desc="This client is closing by management request"/>
<statistic name="framesFromClient" type="count64"/>
<statistic name="framesToClient" type="count64"/>
@@ -496,11 +497,12 @@
<arg name="user" type="sstr" desc="Authentication identity"/>
<arg name="msgDepth" type="count64" desc="Current size of queue in messages"/>
<arg name="byteDepth" type="count64" desc="Current size of queue in bytes"/>
+ <arg name="properties" type="map" desc="optional identifying information sent by the remote"/>
</eventArguments>
- <event name="clientConnect" sev="inform" args="rhost, user"/>
- <event name="clientConnectFail" sev="warn" args="rhost, user, reason"/>
- <event name="clientDisconnect" sev="inform" args="rhost, user"/>
+ <event name="clientConnect" sev="inform" args="rhost, user, properties"/>
+ <event name="clientConnectFail" sev="warn" args="rhost, user, reason, properties"/>
+ <event name="clientDisconnect" sev="inform" args="rhost, user, properties"/>
<event name="brokerLinkUp" sev="inform" args="rhost"/>
<event name="brokerLinkDown" sev="warn" args="rhost"/>
<event name="queueDeclare" sev="inform" args="rhost, user, qName, durable, excl, autoDel, altEx, args, disp"/>