You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2021/06/10 15:07:22 UTC
[qpid-dispatch] branch main updated: DISPATCH-2097: Identify TCP
connections with property qd.adaptor=tcp
This is an automated email from the ASF dual-hosted git repository.
chug pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/main by this push:
new 00a2b3b DISPATCH-2097: Identify TCP connections with property qd.adaptor=tcp
00a2b3b is described below
commit 00a2b3ba484a0d991956e35fce84ae5c93bd5cd4
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Thu Jun 10 11:06:42 2021 -0400
DISPATCH-2097: Identify TCP connections with property qd.adaptor=tcp
This closes #1254
---
include/qpid/dispatch/amqp.h | 2 ++
src/adaptors/tcp_adaptor.c | 21 +++++++++++++++++++--
src/amqp.c | 2 ++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/include/qpid/dispatch/amqp.h b/include/qpid/dispatch/amqp.h
index 6c1064f..9b8665a 100644
--- a/include/qpid/dispatch/amqp.h
+++ b/include/qpid/dispatch/amqp.h
@@ -168,6 +168,8 @@ extern const char * const QD_CONNECTION_PROPERTY_FAILOVER_NETHOST_KEY;
extern const char * const QD_CONNECTION_PROPERTY_FAILOVER_PORT_KEY;
extern const char * const QD_CONNECTION_PROPERTY_FAILOVER_SCHEME_KEY;
extern const char * const QD_CONNECTION_PROPERTY_FAILOVER_HOSTNAME_KEY;
+extern const char * const QD_CONNECTION_PROPERTY_ADAPTOR_KEY;
+extern const char * const QD_CONNECTION_PROPERTY_TCP_ADAPTOR_VALUE;
/// @}
/** @name Terminus Addresses */
diff --git a/src/adaptors/tcp_adaptor.c b/src/adaptors/tcp_adaptor.c
index c262088..51cce49 100644
--- a/src/adaptors/tcp_adaptor.c
+++ b/src/adaptors/tcp_adaptor.c
@@ -25,6 +25,7 @@
#include "qpid/dispatch/ctools.h"
#include "qpid/dispatch/protocol_adaptor.h"
+#include <proton/codec.h>
#include <proton/condition.h>
#include <proton/listener.h>
#include <proton/netaddr.h>
@@ -671,6 +672,22 @@ static char *get_address_string(pn_raw_connection_t *socket)
}
}
+static pn_data_t * qdr_tcp_conn_properties()
+{
+ // Return a new tcp connection properties map.
+ pn_data_t *props = pn_data(0);
+ pn_data_put_map(props);
+ pn_data_enter(props);
+ pn_data_put_symbol(props,
+ pn_bytes(strlen(QD_CONNECTION_PROPERTY_ADAPTOR_KEY),
+ QD_CONNECTION_PROPERTY_ADAPTOR_KEY));
+ pn_data_put_string(props,
+ pn_bytes(strlen(QD_CONNECTION_PROPERTY_TCP_ADAPTOR_VALUE),
+ QD_CONNECTION_PROPERTY_TCP_ADAPTOR_VALUE));
+ pn_data_exit(props);
+ return props;
+}
+
static void qdr_tcp_connection_ingress_accept(qdr_tcp_connection_t* tc)
{
allocate_tcp_write_buffer(&tc->write_buffer);
@@ -687,7 +704,7 @@ static void qdr_tcp_connection_ingress_accept(qdr_tcp_connection_t* tc)
"", // *ssl_cipher,
"", // *user,
"TcpAdaptor", // *container,
- 0, // *connection_properties,
+ qdr_tcp_conn_properties(), // *connection_properties,
0, // ssl_ssf,
false, // ssl,
"", // peer router version,
@@ -935,7 +952,7 @@ static void qdr_tcp_open_server_side_connection(qdr_tcp_connection_t* tc)
"", //const char *ssl_cipher,
"", //const char *user,
"TcpAdaptor",//const char *container,
- 0, //pn_data_t *connection_properties,
+ qdr_tcp_conn_properties(),// pn_data_t *connection_properties,
0, //int ssl_ssf,
false, //bool ssl,
"", // peer router version,
diff --git a/src/amqp.c b/src/amqp.c
index 4dee1f5..e9defc4 100644
--- a/src/amqp.c
+++ b/src/amqp.c
@@ -65,6 +65,8 @@ const char * const QD_CONNECTION_PROPERTY_FAILOVER_NETHOST_KEY = "network-host"
const char * const QD_CONNECTION_PROPERTY_FAILOVER_PORT_KEY = "port";
const char * const QD_CONNECTION_PROPERTY_FAILOVER_SCHEME_KEY = "scheme";
const char * const QD_CONNECTION_PROPERTY_FAILOVER_HOSTNAME_KEY = "hostname";
+const char * const QD_CONNECTION_PROPERTY_ADAPTOR_KEY = "qd.adaptor";
+const char * const QD_CONNECTION_PROPERTY_TCP_ADAPTOR_VALUE = "tcp";
const char * const QD_TERMINUS_EDGE_ADDRESS_TRACKING = "_$qd.edge_addr_tracking";
const char * const QD_TERMINUS_ADDRESS_LOOKUP = "_$qd.addr_lookup";
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org