You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2017/01/03 14:30:54 UTC

[2/3] qpid-dispatch git commit: DISPATCH-557 - Added name and tenant to the connection entity.

DISPATCH-557 - Added name and tenant to the connection entity.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/d1b0ea36
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/d1b0ea36
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/d1b0ea36

Branch: refs/heads/master
Commit: d1b0ea36a3b0a080e763313cb25b132ccc1b13e1
Parents: a38673a
Author: Ted Ross <tr...@redhat.com>
Authored: Thu Dec 22 15:37:14 2016 -0500
Committer: Ted Ross <tr...@redhat.com>
Committed: Tue Jan 3 09:30:24 2017 -0500

----------------------------------------------------------------------
 include/qpid/dispatch/compose.h               |  1 +
 python/qpid_dispatch/management/qdrouter.json |  4 ++
 src/compose.c                                 | 19 +++++++++
 src/router_core/agent_connection.c            | 45 +++++++++++++++-------
 src/router_core/agent_connection.h            |  2 +-
 5 files changed, 56 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d1b0ea36/include/qpid/dispatch/compose.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/compose.h b/include/qpid/dispatch/compose.h
index 00d505e..761aa49 100644
--- a/include/qpid/dispatch/compose.h
+++ b/include/qpid/dispatch/compose.h
@@ -182,6 +182,7 @@ void qd_compose_insert_binary_buffers(qd_composed_field_t *field, qd_buffer_list
  * @param value A pointer to a null-terminated string.
  */
 void qd_compose_insert_string(qd_composed_field_t *field, const char *value);
+void qd_compose_insert_string2(qd_composed_field_t *field, const char *value1, const char *value2);
 
 /**
  * Insert a utf8-encoded string into the field from an iterator

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d1b0ea36/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index 0edec2f..3c6bb88 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -1310,6 +1310,10 @@
                     "description": "SSL strength factor in effect",
                     "type": "integer"
                 },
+                "tenant": {
+                    "description": "If multi-tenancy is on for this connection, the tenant space in effect",
+                    "type": "string"
+                },
                 "properties": {
                     "description": "Connection properties supplied by the peer.",
                     "type": "map"

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d1b0ea36/src/compose.c
----------------------------------------------------------------------
diff --git a/src/compose.c b/src/compose.c
index 77b705d..fada2d6 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -432,6 +432,25 @@ void qd_compose_insert_string(qd_composed_field_t *field, const char *value)
 }
 
 
+void qd_compose_insert_string2(qd_composed_field_t *field, const char *value1, const char *value2)
+{
+    uint32_t len1 = strlen(value1);
+    uint32_t len2 = strlen(value2);
+    uint32_t len  = len1 + len2;
+
+    if (len < 256) {
+        qd_insert_8(field, QD_AMQP_STR8_UTF8);
+        qd_insert_8(field, (uint8_t) len);
+    } else {
+        qd_insert_8(field, QD_AMQP_STR32_UTF8);
+        qd_insert_32(field, len);
+    }
+    qd_insert(field, (const uint8_t*) value1, len1);
+    qd_insert(field, (const uint8_t*) value2, len2);
+    bump_count(field);
+}
+
+
 void qd_compose_insert_string_iterator(qd_composed_field_t *field, qd_iterator_t *iter)
 {
     uint32_t len = 0;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d1b0ea36/src/router_core/agent_connection.c
----------------------------------------------------------------------
diff --git a/src/router_core/agent_connection.c b/src/router_core/agent_connection.c
index a2570f5..f302e56 100644
--- a/src/router_core/agent_connection.c
+++ b/src/router_core/agent_connection.c
@@ -22,19 +22,21 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-#define QDR_CONNECTION_IDENTITY         0
-#define QDR_CONNECTION_HOST             1
-#define QDR_CONNECTION_ROLE             2
-#define QDR_CONNECTION_DIR              3
-#define QDR_CONNECTION_CONTAINER_ID     4
-#define QDR_CONNECTION_SASL_MECHANISMS  5
-#define QDR_CONNECTION_IS_AUTHENTICATED 6
-#define QDR_CONNECTION_USER             7
-#define QDR_CONNECTION_IS_ENCRYPTED     8
-#define QDR_CONNECTION_SSLPROTO         9
-#define QDR_CONNECTION_SSLCIPHER        10
-#define QDR_CONNECTION_PROPERTIES       11
-#define QDR_CONNECTION_SSLSSF           12
+#define QDR_CONNECTION_NAME             0
+#define QDR_CONNECTION_IDENTITY         1
+#define QDR_CONNECTION_HOST             2
+#define QDR_CONNECTION_ROLE             3
+#define QDR_CONNECTION_DIR              4
+#define QDR_CONNECTION_CONTAINER_ID     5
+#define QDR_CONNECTION_SASL_MECHANISMS  6
+#define QDR_CONNECTION_IS_AUTHENTICATED 7
+#define QDR_CONNECTION_USER             8
+#define QDR_CONNECTION_IS_ENCRYPTED     9
+#define QDR_CONNECTION_SSLPROTO         10
+#define QDR_CONNECTION_SSLCIPHER        11
+#define QDR_CONNECTION_PROPERTIES       12
+#define QDR_CONNECTION_SSLSSF           13
+#define QDR_CONNECTION_TENANT           14
 
 const char * const QDR_CONNECTION_DIR_IN  = "in";
 const char * const QDR_CONNECTION_DIR_OUT = "out";
@@ -47,7 +49,8 @@ const char *qdr_connection_roles[] =
      0};
 
 const char *qdr_connection_columns[] =
-    {"identity",
+    {"name",
+     "identity",
      "host",
      "role",
      "dir",
@@ -60,6 +63,7 @@ const char *qdr_connection_columns[] =
      "sslCipher",
      "properties",
      "sslSsf",
+     "tenant",
      0};
 
 const char *CONFIG_CONNECTION_TYPE = "org.apache.qpid.dispatch.connection";
@@ -92,6 +96,10 @@ static void qdr_connection_insert_column_CT(qdr_connection_t *conn, int col, qd_
         qd_compose_insert_string(body, qdr_connection_columns[col]);
 
     switch(col) {
+    case QDR_CONNECTION_NAME:
+        qd_compose_insert_string2(body, "connection/", conn->connection_info->host);
+        break;
+
     case QDR_CONNECTION_IDENTITY: {
         snprintf(id_str, 100, "%"PRId64, conn->identity);
         qd_compose_insert_string(body, id_str);
@@ -152,9 +160,18 @@ static void qdr_connection_insert_column_CT(qdr_connection_t *conn, int col, qd_
         else
             qd_compose_insert_null(body);
         break;
+
     case QDR_CONNECTION_SSLSSF:
         qd_compose_insert_long(body, conn->connection_info->ssl_ssf);
         break;
+
+    case QDR_CONNECTION_TENANT:
+        if (conn->tenant_space)
+            qd_compose_insert_string(body, conn->tenant_space);
+        else
+            qd_compose_insert_null(body);
+        break;
+
     case QDR_CONNECTION_PROPERTIES: {
         pn_data_t *data = conn->connection_info->connection_properties;
         qd_compose_start_map(body);

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d1b0ea36/src/router_core/agent_connection.h
----------------------------------------------------------------------
diff --git a/src/router_core/agent_connection.h b/src/router_core/agent_connection.h
index 72c15af..230149b 100644
--- a/src/router_core/agent_connection.h
+++ b/src/router_core/agent_connection.h
@@ -30,7 +30,7 @@ void qdra_connection_get_CT(qdr_core_t          *core,
                             const char          *qdr_connection_columns[]);
 
 
-#define QDR_CONNECTION_COLUMN_COUNT 13
+#define QDR_CONNECTION_COLUMN_COUNT 15
 const char *qdr_connection_columns[QDR_CONNECTION_COLUMN_COUNT + 1];
 
 #endif


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