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 2015/11/12 20:35:56 UTC
qpid-dispatch git commit: DISPATCH-179 - Updated the API for
management create, delete,
and read. - Added further connection management implementation.
Repository: qpid-dispatch
Updated Branches:
refs/heads/tross-DISPATCH-179-1 41c6e23e3 -> ad27ead36
DISPATCH-179 - Updated the API for management create, delete, and read.
- Added further connection management implementation.
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/ad27ead3
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/ad27ead3
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/ad27ead3
Branch: refs/heads/tross-DISPATCH-179-1
Commit: ad27ead36c14fd04e389647e866566711e762f5b
Parents: 41c6e23
Author: Ted Ross <tr...@redhat.com>
Authored: Thu Nov 12 14:35:08 2015 -0500
Committer: Ted Ross <tr...@redhat.com>
Committed: Thu Nov 12 14:35:08 2015 -0500
----------------------------------------------------------------------
include/qpid/dispatch/router_core.h | 57 +++++++++++++++++++++++++++---
src/router_core/agent.c | 9 +++--
src/router_core/connections.c | 20 ++++++-----
src/router_core/router_core_private.h | 8 +++--
src/router_node.c | 33 ++++++++++++++---
5 files changed, 105 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ad27ead3/include/qpid/dispatch/router_core.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/router_core.h b/include/qpid/dispatch/router_core.h
index 553d0da..6688292 100644
--- a/include/qpid/dispatch/router_core.h
+++ b/include/qpid/dispatch/router_core.h
@@ -89,6 +89,12 @@ void qdr_core_subscribe(qdr_core_t *core, const char *address, char aclass, char
******************************************************************************
*/
+typedef enum {
+ QDR_ROLE_NORMAL,
+ QDR_ROLE_INTER_ROUTER,
+ QDR_ROLE_ON_DEMAND
+} qdr_connection_role_t;
+
/**
* qdr_connection_opened
*
@@ -96,11 +102,13 @@ void qdr_core_subscribe(qdr_core_t *core, const char *address, char aclass, char
* Once a new connection has been both remotely and locally opened, the core must be notified.
*
* @param core Pointer to the core object
+ * @param incoming True iff this connection is associated with a listener, False if a connector
+ * @param role The configured role of this connection
* @param label Optional label provided in the connection's configuration. This is used to
* correlate the connection with waypoints and link-route destinations that use the connection.
* @return Pointer to a connection object that can be used to refer to this connection over its lifetime.
*/
-qdr_connection_t *qdr_connection_opened(qdr_core_t *core, const char *label);
+qdr_connection_t *qdr_connection_opened(qdr_core_t *core, bool incoming, qdr_connection_role_t role, const char *label);
/**
* qdr_connection_closed
@@ -213,9 +221,50 @@ typedef enum {
typedef struct qdr_query_t qdr_query_t;
-void qdr_manage_create(qdr_core_t *core, void *context, qd_router_entity_type_t type, qd_parsed_field_t *attributes);
-void qdr_manage_delete(qdr_core_t *core, void *context, qd_router_entity_type_t type, qd_parsed_field_t *attributes);
-void qdr_manage_read(qdr_core_t *core, void *context, qd_router_entity_type_t type, qd_parsed_field_t *attributes);
+/**
+ * qdr_manage_create
+ *
+ * Request a managed entity to be created in the router core.
+ *
+ * @param core Pointer to the core object returned by qd_core()
+ * @param context An opaque context that will be passed back in the invocation of the response callback
+ * @param type The entity type for the create request
+ * @param name The name supplied for the entity
+ * @param in_body The body of the request message
+ * @param out_body A composed field for the body of the response message
+ */
+void qdr_manage_create(qdr_core_t *core, void *context, qd_router_entity_type_t type,
+ qd_field_iterator_t *name, qd_parsed_field_t *in_body, qd_composed_field_t *out_body);
+
+/**
+ * qdr_manage_delete
+ *
+ * Request the deletion of a managed entity in the router core.
+ *
+ * @param core Pointer to the core object returned by qd_core()
+ * @param context An opaque context that will be passed back in the invocation of the response callback
+ * @param type The entity type for the create request
+ * @param name The name supplied with the request (or 0 if the identity was supplied)
+ * @param identity The identity supplied with the request (or 0 if the name was supplied)
+ */
+void qdr_manage_delete(qdr_core_t *core, void *context, qd_router_entity_type_t type,
+ qd_field_iterator_t *name, qd_field_iterator_t *identity);
+
+/**
+ * qdr_manage_read
+ *
+ * Request a read of a managed entity in the router core.
+ *
+ * @param core Pointer to the core object returned by qd_core()
+ * @param context An opaque context that will be passed back in the invocation of the response callback
+ * @param type The entity type for the create request
+ * @param name The name supplied with the request (or 0 if the identity was supplied)
+ * @param identity The identity supplied with the request (or 0 if the name was supplied)
+ * @param body A composed field for the body of the response message
+ */
+void qdr_manage_read(qdr_core_t *core, void *context, qd_router_entity_type_t type,
+ qd_field_iterator_t *name, qd_field_iterator_t *identity, qd_composed_field_t *body);
+
/**
* Sequence for running a query:
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ad27ead3/src/router_core/agent.c
----------------------------------------------------------------------
diff --git a/src/router_core/agent.c b/src/router_core/agent.c
index d3a56cb..480f83a 100644
--- a/src/router_core/agent.c
+++ b/src/router_core/agent.c
@@ -107,17 +107,20 @@ static void qdr_agent_set_columns(qdr_query_t *query, qd_parsed_field_t *attribu
// Interface Functions
//==================================================================================
-void qdr_manage_create(qdr_core_t *core, void *context, qd_router_entity_type_t type, qd_parsed_field_t *attributes)
+void qdr_manage_create(qdr_core_t *core, void *context, qd_router_entity_type_t type,
+ qd_field_iterator_t *name, qd_parsed_field_t *in_body, qd_composed_field_t *out_body)
{
}
-void qdr_manage_delete(qdr_core_t *core, void *context, qd_router_entity_type_t type, qd_parsed_field_t *attributes)
+void qdr_manage_delete(qdr_core_t *core, void *context, qd_router_entity_type_t type,
+ qd_field_iterator_t *name, qd_field_iterator_t *identity)
{
}
-void qdr_manage_read(qdr_core_t *core, void *context, qd_router_entity_type_t type, qd_parsed_field_t *attributes)
+void qdr_manage_read(qdr_core_t *core, void *context, qd_router_entity_type_t type,
+ qd_field_iterator_t *name, qd_field_iterator_t *identity, qd_composed_field_t *body)
{
}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ad27ead3/src/router_core/connections.c
----------------------------------------------------------------------
diff --git a/src/router_core/connections.c b/src/router_core/connections.c
index 2d7fdc0..53e4550 100644
--- a/src/router_core/connections.c
+++ b/src/router_core/connections.c
@@ -36,13 +36,15 @@ ALLOC_DEFINE(qdr_connection_t);
// Interface Functions
//==================================================================================
-qdr_connection_t *qdr_connection_opened(qdr_core_t *core, const char *label)
+qdr_connection_t *qdr_connection_opened(qdr_core_t *core, bool incoming, qdr_connection_role_t role, const char *label)
{
qdr_action_t *action = qdr_action(qdr_connection_opened_CT);
qdr_connection_t *conn = new_qdr_connection_t();
conn->core = core;
conn->user_context = 0;
+ conn->incoming = incoming;
+ conn->role = role;
conn->label = label;
action->args.connection.conn = conn;
@@ -127,13 +129,15 @@ static void qdr_connection_opened_CT(qdr_core_t *core, qdr_action_t *action, boo
DEQ_INSERT_TAIL(core->open_connections, conn);
//
- // TODO - Look for waypoints that need to be activated now that their connection
- // is open.
- //
-
- //
- // TODO - Look for link-route destinations to be activated now that their connection
- // is open.
+ // If the role of this connection is NORMAL, there is no further work to do.
+ // If the role is INTER_ROUTER:
+ // Assign this connection a neighbor mask-bit
+ // If the connection is not incoming:
+ // Establish a receiver and sender for router control
+ // Establish a receiver and sender for inter-router message routing
+ // If the role is ON_DEMAND:
+ // Activate waypoints associated with this connection
+ // Activate link-route destinations associated with this connection
//
}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ad27ead3/src/router_core/router_core_private.h
----------------------------------------------------------------------
diff --git a/src/router_core/router_core_private.h b/src/router_core/router_core_private.h
index 69b990a..19f6c15 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -241,9 +241,11 @@ void qdr_del_node_ref(qdr_router_ref_list_t *ref_list, qdr_node_t *rnode);
struct qdr_connection_t {
DEQ_LINKS(qdr_connection_t);
- qdr_core_t *core;
- void *user_context;
- const char *label;
+ qdr_core_t *core;
+ void *user_context;
+ bool incoming;
+ qdr_connection_role_t role;
+ const char *label;
};
ALLOC_DECLARE(qdr_connection_t);
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ad27ead3/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 7d6635b..b776f28 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -223,7 +223,25 @@ void qd_router_check_addr(qd_router_t *router, qd_address_t *addr, int was_local
/**
+ * Determine the role of a connection
+ */
+static qdr_connection_role_t qd_router_connection_role(const qd_connection_t *conn)
+{
+ if (conn) {
+ const qd_server_config_t *cf = qd_connection_config(conn);
+ if (cf && strcmp(cf->role, router_role) == 0)
+ return QDR_ROLE_INTER_ROUTER;
+ if (cf && strcmp(cf->role, on_demand_role) == 0)
+ return QDR_ROLE_ON_DEMAND;
+ }
+
+ return QDR_ROLE_NORMAL;
+}
+
+
+/**
* Determine whether a connection is configured in the inter-router role.
+ * DEPRECATE
*/
static int qd_router_connection_is_inter_router(const qd_connection_t *conn)
{
@@ -240,6 +258,7 @@ static int qd_router_connection_is_inter_router(const qd_connection_t *conn)
/**
* Determine whether a connection is configured in the on-demand role.
+ * DEPRECATE
*/
static int qd_router_connection_is_on_demand(const qd_connection_t *conn)
{
@@ -1665,8 +1684,10 @@ static int router_link_detach_handler(void* context, qd_link_t *link, qd_detach_
static void router_inbound_opened_handler(void *type_context, qd_connection_t *conn, void *context)
{
- qd_router_t *router = (qd_router_t*) type_context;
- qdr_connection_t *qdrc = qdr_connection_opened(router->router_core, 0); // TODO - get label
+ qd_router_t *router = (qd_router_t*) type_context;
+ qdr_connection_role_t role = qd_router_connection_role(conn);
+ qdr_connection_t *qdrc = qdr_connection_opened(router->router_core, true, role, 0); // TODO - get label
+
qd_connection_set_context(conn, qdrc);
qdr_connection_set_context(qdrc, conn);
}
@@ -1674,11 +1695,15 @@ static void router_inbound_opened_handler(void *type_context, qd_connection_t *c
static void router_outbound_opened_handler(void *type_context, qd_connection_t *conn, void *context)
{
- qd_router_t *router = (qd_router_t*) type_context;
- qdr_connection_t *qdrc = qdr_connection_opened(router->router_core, 0); // TODO - get label
+ qd_router_t *router = (qd_router_t*) type_context;
+ qdr_connection_role_t role = qd_router_connection_role(conn);
+ qdr_connection_t *qdrc = qdr_connection_opened(router->router_core, false, role, 0); // TODO - get label
+
qd_connection_set_context(conn, qdrc);
qdr_connection_set_context(qdrc, conn);
+ // DEPRECATE:
+
//
// If the connection is on-demand, visit all waypoints that are waiting for their
// connection to arrive.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org