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 2013/02/21 15:28:49 UTC
svn commit: r1448649 [2/3] - in /qpid/trunk/qpid/extras: dispatch/
dispatch/include/qpid/dispatch/ dispatch/include/qpid/nexus/
dispatch/router/ dispatch/router/src/ dispatch/site/ dispatch/site/images/
dispatch/site/includes/ dispatch/src/ dispatch/sr...
Modified: qpid/trunk/qpid/extras/dispatch/src/container.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/container.c?rev=1448649&r1=1446735&r2=1448649&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/container.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/container.c Thu Feb 21 14:28:48 2013
@@ -19,42 +19,42 @@
#include <stdio.h>
#include <string.h>
-#include <qpid/nexus/container.h>
-#include <qpid/nexus/message.h>
+#include <qpid/dispatch/container.h>
+#include <qpid/dispatch/message.h>
#include <proton/engine.h>
#include <proton/message.h>
-#include <qpid/nexus/ctools.h>
-#include <qpid/nexus/hash.h>
-#include <qpid/nexus/threading.h>
-#include <qpid/nexus/iterator.h>
-#include <qpid/nexus/log.h>
+#include <qpid/dispatch/ctools.h>
+#include <qpid/dispatch/hash.h>
+#include <qpid/dispatch/threading.h>
+#include <qpid/dispatch/iterator.h>
+#include <qpid/dispatch/log.h>
static char *module="CONTAINER";
-struct nx_node_t {
- const nx_node_type_t *ntype;
+struct dx_node_t {
+ const dx_node_type_t *ntype;
char *name;
void *context;
- nx_dist_mode_t supported_dist;
- nx_lifetime_policy_t life_policy;
+ dx_dist_mode_t supported_dist;
+ dx_lifetime_policy_t life_policy;
};
-ALLOC_DECLARE(nx_node_t);
-ALLOC_DEFINE(nx_node_t);
-ALLOC_DEFINE(nx_link_item_t);
+ALLOC_DECLARE(dx_node_t);
+ALLOC_DEFINE(dx_node_t);
+ALLOC_DEFINE(dx_link_item_t);
-struct nx_link_t {
+struct dx_link_t {
pn_link_t *pn_link;
void *context;
- nx_node_t *node;
+ dx_node_t *node;
};
-ALLOC_DECLARE(nx_link_t);
-ALLOC_DEFINE(nx_link_t);
+ALLOC_DECLARE(dx_link_t);
+ALLOC_DEFINE(dx_link_t);
typedef struct nxc_node_type_t {
DEQ_LINKS(struct nxc_node_type_t);
- const nx_node_type_t *ntype;
+ const dx_node_type_t *ntype;
} nxc_node_type_t;
DEQ_DECLARE(nxc_node_type_t, nxc_node_type_list_t);
@@ -62,22 +62,22 @@ DEQ_DECLARE(nxc_node_type_t, nxc_node_ty
static hash_t *node_type_map;
static hash_t *node_map;
static sys_mutex_t *lock;
-static nx_node_t *default_node;
+static dx_node_t *default_node;
static nxc_node_type_list_t node_type_list;
static void setup_outgoing_link(pn_link_t *pn_link)
{
sys_mutex_lock(lock);
- nx_node_t *node;
+ dx_node_t *node;
int result;
const char *source = pn_terminus_get_address(pn_link_remote_source(pn_link));
- nx_field_iterator_t *iter;
+ dx_field_iterator_t *iter;
// TODO - Extract the name from the structured source
if (source) {
- iter = nx_field_iterator_string(source, ITER_VIEW_NODE_ID);
+ iter = dx_field_iterator_string(source, ITER_VIEW_NODE_ID);
result = hash_retrieve(node_map, iter, (void*) &node);
- nx_field_iterator_free(iter);
+ dx_field_iterator_free(iter);
} else
result = -1;
sys_mutex_unlock(lock);
@@ -93,7 +93,7 @@ static void setup_outgoing_link(pn_link_
}
}
- nx_link_t *link = new_nx_link_t();
+ dx_link_t *link = new_dx_link_t();
if (!link) {
pn_link_close(pn_link);
return;
@@ -111,16 +111,16 @@ static void setup_outgoing_link(pn_link_
static void setup_incoming_link(pn_link_t *pn_link)
{
sys_mutex_lock(lock);
- nx_node_t *node;
+ dx_node_t *node;
int result;
const char *target = pn_terminus_get_address(pn_link_remote_target(pn_link));
- nx_field_iterator_t *iter;
+ dx_field_iterator_t *iter;
// TODO - Extract the name from the structured target
if (target) {
- iter = nx_field_iterator_string(target, ITER_VIEW_NODE_ID);
+ iter = dx_field_iterator_string(target, ITER_VIEW_NODE_ID);
result = hash_retrieve(node_map, iter, (void*) &node);
- nx_field_iterator_free(iter);
+ dx_field_iterator_free(iter);
} else
result = -1;
sys_mutex_unlock(lock);
@@ -136,7 +136,7 @@ static void setup_incoming_link(pn_link_
}
}
- nx_link_t *link = new_nx_link_t();
+ dx_link_t *link = new_dx_link_t();
if (!link) {
pn_link_close(pn_link);
return;
@@ -153,11 +153,11 @@ static void setup_incoming_link(pn_link_
static int do_writable(pn_link_t *pn_link)
{
- nx_link_t *link = (nx_link_t*) pn_link_get_context(pn_link);
+ dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
if (!link)
return 0;
- nx_node_t *node = link->node;
+ dx_node_t *node = link->node;
if (!node)
return 0;
@@ -168,10 +168,10 @@ static int do_writable(pn_link_t *pn_lin
static void process_receive(pn_delivery_t *delivery)
{
pn_link_t *pn_link = pn_delivery_link(delivery);
- nx_link_t *link = (nx_link_t*) pn_link_get_context(pn_link);
+ dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
if (link) {
- nx_node_t *node = link->node;
+ dx_node_t *node = link->node;
if (node) {
node->ntype->rx_handler(node->context, link, delivery);
return;
@@ -191,10 +191,10 @@ static void process_receive(pn_delivery_
static void do_send(pn_delivery_t *delivery)
{
pn_link_t *pn_link = pn_delivery_link(delivery);
- nx_link_t *link = (nx_link_t*) pn_link_get_context(pn_link);
+ dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
if (link) {
- nx_node_t *node = link->node;
+ dx_node_t *node = link->node;
if (node) {
node->ntype->tx_handler(node->context, link, delivery);
return;
@@ -208,10 +208,10 @@ static void do_send(pn_delivery_t *deliv
static void do_updated(pn_delivery_t *delivery)
{
pn_link_t *pn_link = pn_delivery_link(delivery);
- nx_link_t *link = (nx_link_t*) pn_link_get_context(pn_link);
+ dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
if (link) {
- nx_node_t *node = link->node;
+ dx_node_t *node = link->node;
if (node)
node->ntype->disp_handler(node->context, link, delivery);
}
@@ -226,12 +226,12 @@ static int close_handler(void* unused, p
//
pn_link_t *pn_link = pn_link_head(conn, 0);
while (pn_link) {
- nx_link_t *link = (nx_link_t*) pn_link_get_context(pn_link);
- nx_node_t *node = link->node;
+ dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
+ dx_node_t *node = link->node;
if (node)
node->ntype->link_detach_handler(node->context, link, 0);
pn_link_close(pn_link);
- free_nx_link_t(link);
+ free_dx_link_t(link);
pn_link = pn_link_next(pn_link, 0);
}
@@ -321,8 +321,8 @@ static int process_handler(void* unused,
// teardown any terminating links
pn_link = pn_link_head(conn, PN_LOCAL_ACTIVE | PN_REMOTE_CLOSED);
while (pn_link) {
- nx_link_t *link = (nx_link_t*) pn_link_get_context(pn_link);
- nx_node_t *node = link->node;
+ dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
+ dx_node_t *node = link->node;
if (node)
node->ntype->link_detach_handler(node->context, link, 1); // TODO - get 'closed' from detach message
pn_link_close(pn_link);
@@ -348,9 +348,9 @@ static int process_handler(void* unused,
}
-static void open_handler(nx_connection_t *conn, nx_direction_t dir)
+static void open_handler(dx_connection_t *conn, dx_direction_t dir)
{
- const nx_node_type_t *nt;
+ const dx_node_type_t *nt;
//
// Note the locking structure in this function. Generally this would be unsafe, but since
@@ -361,11 +361,11 @@ static void open_handler(nx_connection_t
nxc_node_type_t *nt_item = DEQ_HEAD(node_type_list);
sys_mutex_unlock(lock);
- pn_connection_open(nx_connection_pn(conn));
+ pn_connection_open(dx_connection_pn(conn));
while (nt_item) {
nt = nt_item->ntype;
- if (dir == NX_INCOMING) {
+ if (dir == DX_INCOMING) {
if (nt->inbound_conn_open_handler)
nt->inbound_conn_open_handler(nt->type_context, conn);
} else {
@@ -380,24 +380,24 @@ static void open_handler(nx_connection_t
}
-static int handler(void* context, nx_conn_event_t event, nx_connection_t *nx_conn)
+static int handler(void* context, dx_conn_event_t event, dx_connection_t *dx_conn)
{
- pn_connection_t *conn = nx_connection_pn(nx_conn);
+ pn_connection_t *conn = dx_connection_pn(dx_conn);
switch (event) {
- case NX_CONN_EVENT_LISTENER_OPEN: open_handler(nx_conn, NX_INCOMING); break;
- case NX_CONN_EVENT_CONNECTOR_OPEN: open_handler(nx_conn, NX_OUTGOING); break;
- case NX_CONN_EVENT_CLOSE: return close_handler(context, conn);
- case NX_CONN_EVENT_PROCESS: return process_handler(context, conn);
+ case DX_CONN_EVENT_LISTENER_OPEN: open_handler(dx_conn, DX_INCOMING); break;
+ case DX_CONN_EVENT_CONNECTOR_OPEN: open_handler(dx_conn, DX_OUTGOING); break;
+ case DX_CONN_EVENT_CLOSE: return close_handler(context, conn);
+ case DX_CONN_EVENT_PROCESS: return process_handler(context, conn);
}
return 0;
}
-void nx_container_initialize(void)
+void dx_container_initialize(void)
{
- nx_log(module, LOG_TRACE, "Container Initializing");
+ dx_log(module, LOG_TRACE, "Container Initializing");
node_type_map = hash(6, 4, 1); // 64 buckets, item batches of 4
node_map = hash(10, 32, 0); // 1K buckets, item batches of 32
@@ -405,19 +405,19 @@ void nx_container_initialize(void)
default_node = 0;
DEQ_INIT(node_type_list);
- nx_server_set_conn_handler(handler);
+ dx_server_set_conn_handler(handler);
}
-void nx_container_finalize(void)
+void dx_container_finalize(void)
{
}
-int nx_container_register_node_type(const nx_node_type_t *nt)
+int dx_container_register_node_type(const dx_node_type_t *nt)
{
int result;
- nx_field_iterator_t *iter = nx_field_iterator_string(nt->type_name, ITER_VIEW_ALL);
+ dx_field_iterator_t *iter = dx_field_iterator_string(nt->type_name, ITER_VIEW_ALL);
nxc_node_type_t *nt_item = NEW(nxc_node_type_t);
DEQ_ITEM_INIT(nt_item);
nt_item->ntype = nt;
@@ -427,40 +427,40 @@ int nx_container_register_node_type(cons
DEQ_INSERT_TAIL(node_type_list, nt_item);
sys_mutex_unlock(lock);
- nx_field_iterator_free(iter);
+ dx_field_iterator_free(iter);
if (result < 0)
return result;
- nx_log(module, LOG_TRACE, "Node Type Registered - %s", nt->type_name);
+ dx_log(module, LOG_TRACE, "Node Type Registered - %s", nt->type_name);
return 0;
}
-void nx_container_set_default_node_type(const nx_node_type_t *nt,
+void dx_container_set_default_node_type(const dx_node_type_t *nt,
void *context,
- nx_dist_mode_t supported_dist)
+ dx_dist_mode_t supported_dist)
{
if (default_node)
- nx_container_destroy_node(default_node);
+ dx_container_destroy_node(default_node);
if (nt) {
- default_node = nx_container_create_node(nt, 0, context, supported_dist, NX_LIFE_PERMANENT);
- nx_log(module, LOG_TRACE, "Node of type '%s' installed as default node", nt->type_name);
+ default_node = dx_container_create_node(nt, 0, context, supported_dist, DX_LIFE_PERMANENT);
+ dx_log(module, LOG_TRACE, "Node of type '%s' installed as default node", nt->type_name);
} else {
default_node = 0;
- nx_log(module, LOG_TRACE, "Default node removed");
+ dx_log(module, LOG_TRACE, "Default node removed");
}
}
-nx_node_t *nx_container_create_node(const nx_node_type_t *nt,
+dx_node_t *dx_container_create_node(const dx_node_type_t *nt,
const char *name,
void *context,
- nx_dist_mode_t supported_dist,
- nx_lifetime_policy_t life_policy)
+ dx_dist_mode_t supported_dist,
+ dx_lifetime_policy_t life_policy)
{
int result;
- nx_node_t *node = new_nx_node_t();
+ dx_node_t *node = new_dx_node_t();
if (!node)
return 0;
@@ -471,13 +471,13 @@ nx_node_t *nx_container_create_node(cons
node->life_policy = life_policy;
if (name) {
- nx_field_iterator_t *iter = nx_field_iterator_string(name, ITER_VIEW_ALL);
+ dx_field_iterator_t *iter = dx_field_iterator_string(name, ITER_VIEW_ALL);
sys_mutex_lock(lock);
result = hash_insert(node_map, iter, node);
sys_mutex_unlock(lock);
- nx_field_iterator_free(iter);
+ dx_field_iterator_free(iter);
if (result < 0) {
- free_nx_node_t(node);
+ free_dx_node_t(node);
return 0;
}
@@ -486,51 +486,51 @@ nx_node_t *nx_container_create_node(cons
}
if (name)
- nx_log(module, LOG_TRACE, "Node of type '%s' created with name '%s'", nt->type_name, name);
+ dx_log(module, LOG_TRACE, "Node of type '%s' created with name '%s'", nt->type_name, name);
return node;
}
-void nx_container_destroy_node(nx_node_t *node)
+void dx_container_destroy_node(dx_node_t *node)
{
if (node->name) {
- nx_field_iterator_t *iter = nx_field_iterator_string(node->name, ITER_VIEW_ALL);
+ dx_field_iterator_t *iter = dx_field_iterator_string(node->name, ITER_VIEW_ALL);
sys_mutex_lock(lock);
hash_remove(node_map, iter);
sys_mutex_unlock(lock);
- nx_field_iterator_free(iter);
+ dx_field_iterator_free(iter);
free(node->name);
}
- free_nx_node_t(node);
+ free_dx_node_t(node);
}
-void nx_container_node_set_context(nx_node_t *node, void *node_context)
+void dx_container_node_set_context(dx_node_t *node, void *node_context)
{
node->context = node_context;
}
-nx_dist_mode_t nx_container_node_get_dist_modes(const nx_node_t *node)
+dx_dist_mode_t dx_container_node_get_dist_modes(const dx_node_t *node)
{
return node->supported_dist;
}
-nx_lifetime_policy_t nx_container_node_get_life_policy(const nx_node_t *node)
+dx_lifetime_policy_t dx_container_node_get_life_policy(const dx_node_t *node)
{
return node->life_policy;
}
-nx_link_t *nx_link(nx_node_t *node, nx_connection_t *conn, nx_direction_t dir, const char* name)
+dx_link_t *dx_link(dx_node_t *node, dx_connection_t *conn, dx_direction_t dir, const char* name)
{
- pn_session_t *sess = pn_session(nx_connection_pn(conn));
- nx_link_t *link = new_nx_link_t();
+ pn_session_t *sess = pn_session(dx_connection_pn(conn));
+ dx_link_t *link = new_dx_link_t();
- if (dir == NX_OUTGOING)
+ if (dir == DX_OUTGOING)
link->pn_link = pn_sender(sess, name);
else
link->pn_link = pn_receiver(sess, name);
@@ -545,49 +545,49 @@ nx_link_t *nx_link(nx_node_t *node, nx_c
}
-void nx_link_set_context(nx_link_t *link, void *context)
+void dx_link_set_context(dx_link_t *link, void *context)
{
link->context = context;
}
-void *nx_link_get_context(nx_link_t *link)
+void *dx_link_get_context(dx_link_t *link)
{
return link->context;
}
-pn_link_t *nx_link_pn(nx_link_t *link)
+pn_link_t *dx_link_pn(dx_link_t *link)
{
return link->pn_link;
}
-pn_terminus_t *nx_link_source(nx_link_t *link)
+pn_terminus_t *dx_link_source(dx_link_t *link)
{
return pn_link_source(link->pn_link);
}
-pn_terminus_t *nx_link_target(nx_link_t *link)
+pn_terminus_t *dx_link_target(dx_link_t *link)
{
return pn_link_target(link->pn_link);
}
-pn_terminus_t *nx_link_remote_source(nx_link_t *link)
+pn_terminus_t *dx_link_remote_source(dx_link_t *link)
{
return pn_link_remote_source(link->pn_link);
}
-pn_terminus_t *nx_link_remote_target(nx_link_t *link)
+pn_terminus_t *dx_link_remote_target(dx_link_t *link)
{
return pn_link_remote_target(link->pn_link);
}
-void nx_link_activate(nx_link_t *link)
+void dx_link_activate(dx_link_t *link)
{
if (!link || !link->pn_link)
return;
@@ -600,15 +600,15 @@ void nx_link_activate(nx_link_t *link)
if (!conn)
return;
- nx_connection_t *ctx = pn_connection_get_context(conn);
+ dx_connection_t *ctx = pn_connection_get_context(conn);
if (!ctx)
return;
- nx_server_activate(ctx);
+ dx_server_activate(ctx);
}
-void nx_link_close(nx_link_t *link)
+void dx_link_close(dx_link_t *link)
{
pn_link_close(link->pn_link);
}
Modified: qpid/trunk/qpid/extras/dispatch/src/hash.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/hash.c?rev=1448649&r1=1446735&r2=1448649&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/hash.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/hash.c Thu Feb 21 14:28:48 2013
@@ -17,9 +17,9 @@
* under the License.
*/
-#include <qpid/nexus/hash.h>
-#include <qpid/nexus/ctools.h>
-#include <qpid/nexus/alloc.h>
+#include <qpid/dispatch/hash.h>
+#include <qpid/dispatch/ctools.h>
+#include <qpid/dispatch/alloc.h>
#include <stdio.h>
#include <string.h>
@@ -53,13 +53,13 @@ struct hash_t {
// djb2 hash algorithm
-static unsigned long hash_function(nx_field_iterator_t *iter)
+static unsigned long hash_function(dx_field_iterator_t *iter)
{
unsigned long hash = 5381;
int c;
- while (!nx_field_iterator_end(iter)) {
- c = (int) nx_field_iterator_octet(iter);
+ while (!dx_field_iterator_end(iter)) {
+ c = (int) dx_field_iterator_octet(iter);
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
}
@@ -101,7 +101,7 @@ size_t hash_size(hash_t *h)
}
-static hash_item_t *hash_internal_insert(hash_t *h, nx_field_iterator_t *key, int *error)
+static hash_item_t *hash_internal_insert(hash_t *h, dx_field_iterator_t *key, int *error)
{
unsigned long idx = hash_function(key) & h->bucket_mask;
hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
@@ -109,7 +109,7 @@ static hash_item_t *hash_internal_insert
*error = 0;
while (item) {
- if (nx_field_iterator_equal(key, item->key))
+ if (dx_field_iterator_equal(key, item->key))
break;
item = item->next;
}
@@ -126,7 +126,7 @@ static hash_item_t *hash_internal_insert
}
DEQ_ITEM_INIT(item);
- item->key = nx_field_iterator_copy(key);
+ item->key = dx_field_iterator_copy(key);
DEQ_INSERT_TAIL(h->buckets[idx].items, item);
h->size++;
@@ -134,7 +134,7 @@ static hash_item_t *hash_internal_insert
}
-int hash_insert(hash_t *h, nx_field_iterator_t *key, void *val)
+int hash_insert(hash_t *h, dx_field_iterator_t *key, void *val)
{
int error = 0;
hash_item_t *item = hash_internal_insert(h, key, &error);
@@ -145,7 +145,7 @@ int hash_insert(hash_t *h, nx_field_iter
}
-int hash_insert_const(hash_t *h, nx_field_iterator_t *key, const void *val)
+int hash_insert_const(hash_t *h, dx_field_iterator_t *key, const void *val)
{
if (!h->is_const)
return -3;
@@ -159,13 +159,13 @@ int hash_insert_const(hash_t *h, nx_fiel
}
-static hash_item_t *hash_internal_retrieve(hash_t *h, nx_field_iterator_t *key)
+static hash_item_t *hash_internal_retrieve(hash_t *h, dx_field_iterator_t *key)
{
unsigned long idx = hash_function(key) & h->bucket_mask;
hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
while (item) {
- if (nx_field_iterator_equal(key, item->key))
+ if (dx_field_iterator_equal(key, item->key))
break;
item = item->next;
}
@@ -174,7 +174,7 @@ static hash_item_t *hash_internal_retrie
}
-int hash_retrieve(hash_t *h, nx_field_iterator_t *key, void **val)
+int hash_retrieve(hash_t *h, dx_field_iterator_t *key, void **val)
{
hash_item_t *item = hash_internal_retrieve(h, key);
if (item) {
@@ -185,7 +185,7 @@ int hash_retrieve(hash_t *h, nx_field_it
}
-int hash_retrieve_const(hash_t *h, nx_field_iterator_t *key, const void **val)
+int hash_retrieve_const(hash_t *h, dx_field_iterator_t *key, const void **val)
{
if (!h->is_const)
return -3;
@@ -199,13 +199,13 @@ int hash_retrieve_const(hash_t *h, nx_fi
}
-int hash_remove(hash_t *h, nx_field_iterator_t *key)
+int hash_remove(hash_t *h, dx_field_iterator_t *key)
{
unsigned long idx = hash_function(key) & h->bucket_mask;
hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
while (item) {
- if (nx_field_iterator_equal(key, item->key))
+ if (dx_field_iterator_equal(key, item->key))
break;
item = item->next;
}
Modified: qpid/trunk/qpid/extras/dispatch/src/iovec.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/iovec.c?rev=1448649&r1=1446735&r2=1448649&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/iovec.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/iovec.c Thu Feb 21 14:28:48 2013
@@ -17,33 +17,33 @@
* under the License.
*/
-#include <qpid/nexus/iovec.h>
-#include <qpid/nexus/alloc.h>
+#include <qpid/dispatch/iovec.h>
+#include <qpid/dispatch/alloc.h>
#include <string.h>
-#define NX_IOVEC_MAX 64
+#define DX_IOVEC_MAX 64
-struct nx_iovec_t {
- struct iovec iov_array[NX_IOVEC_MAX];
+struct dx_iovec_t {
+ struct iovec iov_array[DX_IOVEC_MAX];
struct iovec *iov;
int iov_count;
};
-ALLOC_DECLARE(nx_iovec_t);
-ALLOC_DEFINE(nx_iovec_t);
+ALLOC_DECLARE(dx_iovec_t);
+ALLOC_DEFINE(dx_iovec_t);
-nx_iovec_t *nx_iovec(int vector_count)
+dx_iovec_t *dx_iovec(int vector_count)
{
- nx_iovec_t *iov = new_nx_iovec_t();
+ dx_iovec_t *iov = new_dx_iovec_t();
if (!iov)
return 0;
- memset(iov, 0, sizeof(nx_iovec_t));
+ memset(iov, 0, sizeof(dx_iovec_t));
iov->iov_count = vector_count;
- if (vector_count > NX_IOVEC_MAX)
+ if (vector_count > DX_IOVEC_MAX)
iov->iov = (struct iovec*) malloc(sizeof(struct iovec) * vector_count);
else
iov->iov = &iov->iov_array[0];
@@ -52,7 +52,7 @@ nx_iovec_t *nx_iovec(int vector_count)
}
-void nx_iovec_free(nx_iovec_t *iov)
+void dx_iovec_free(dx_iovec_t *iov)
{
if (!iov)
return;
@@ -60,11 +60,11 @@ void nx_iovec_free(nx_iovec_t *iov)
if (iov->iov && iov->iov != &iov->iov_array[0])
free(iov->iov);
- free_nx_iovec_t(iov);
+ free_dx_iovec_t(iov);
}
-struct iovec *nx_iovec_array(nx_iovec_t *iov)
+struct iovec *dx_iovec_array(dx_iovec_t *iov)
{
if (!iov)
return 0;
@@ -72,7 +72,7 @@ struct iovec *nx_iovec_array(nx_iovec_t
}
-int nx_iovec_count(nx_iovec_t *iov)
+int dx_iovec_count(dx_iovec_t *iov)
{
if (!iov)
return 0;
Modified: qpid/trunk/qpid/extras/dispatch/src/iterator.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/iterator.c?rev=1448649&r1=1446735&r2=1448649&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/iterator.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/iterator.c Thu Feb 21 14:28:48 2013
@@ -17,9 +17,9 @@
* under the License.
*/
-#include <qpid/nexus/iterator.h>
-#include <qpid/nexus/ctools.h>
-#include <qpid/nexus/alloc.h>
+#include <qpid/dispatch/iterator.h>
+#include <qpid/dispatch/ctools.h>
+#include <qpid/dispatch/alloc.h>
#include "message_private.h"
#include <stdio.h>
#include <string.h>
@@ -29,20 +29,20 @@ MODE_TO_END,
MODE_TO_SLASH
} parse_mode_t;
-struct nx_field_iterator_t {
- nx_buffer_t *start_buffer;
+struct dx_field_iterator_t {
+ dx_buffer_t *start_buffer;
unsigned char *start_cursor;
int start_length;
- nx_buffer_t *buffer;
+ dx_buffer_t *buffer;
unsigned char *cursor;
int length;
- nx_iterator_view_t view;
+ dx_iterator_view_t view;
parse_mode_t mode;
};
-ALLOC_DECLARE(nx_field_iterator_t);
-ALLOC_DEFINE(nx_field_iterator_t);
+ALLOC_DECLARE(dx_field_iterator_t);
+ALLOC_DEFINE(dx_field_iterator_t);
typedef enum {
@@ -56,7 +56,7 @@ STATE_AT_NODE_ID
} state_t;
-static void view_initialize(nx_field_iterator_t *iter)
+static void view_initialize(dx_field_iterator_t *iter)
{
if (iter->view == ITER_VIEW_ALL) {
iter->mode = MODE_TO_END;
@@ -68,8 +68,8 @@ static void view_initialize(nx_field_ite
//
state_t state = STATE_START;
unsigned int octet;
- while (!nx_field_iterator_end(iter) && state != STATE_AT_NODE_ID) {
- octet = nx_field_iterator_octet(iter);
+ while (!dx_field_iterator_end(iter) && state != STATE_AT_NODE_ID) {
+ octet = dx_field_iterator_octet(iter);
switch (state) {
case STATE_START :
if (octet == '/')
@@ -139,8 +139,8 @@ static void view_initialize(nx_field_ite
if (iter->view == ITER_VIEW_NODE_SPECIFIC) {
iter->mode = MODE_TO_END;
- while (!nx_field_iterator_end(iter)) {
- octet = nx_field_iterator_octet(iter);
+ while (!dx_field_iterator_end(iter)) {
+ octet = dx_field_iterator_octet(iter);
if (octet == '/')
break;
}
@@ -149,9 +149,9 @@ static void view_initialize(nx_field_ite
}
-nx_field_iterator_t* nx_field_iterator_string(const char *text, nx_iterator_view_t view)
+dx_field_iterator_t* dx_field_iterator_string(const char *text, dx_iterator_view_t view)
{
- nx_field_iterator_t *iter = new_nx_field_iterator_t();
+ dx_field_iterator_t *iter = new_dx_field_iterator_t();
if (!iter)
return 0;
@@ -159,35 +159,35 @@ nx_field_iterator_t* nx_field_iterator_s
iter->start_cursor = (unsigned char*) text;
iter->start_length = strlen(text);
- nx_field_iterator_reset(iter, view);
+ dx_field_iterator_reset(iter, view);
return iter;
}
-nx_field_iterator_t *nx_field_iterator_buffer(nx_buffer_t *buffer, int offset, int length, nx_iterator_view_t view)
+dx_field_iterator_t *dx_field_iterator_buffer(dx_buffer_t *buffer, int offset, int length, dx_iterator_view_t view)
{
- nx_field_iterator_t *iter = new_nx_field_iterator_t();
+ dx_field_iterator_t *iter = new_dx_field_iterator_t();
if (!iter)
return 0;
iter->start_buffer = buffer;
- iter->start_cursor = nx_buffer_base(buffer) + offset;
+ iter->start_cursor = dx_buffer_base(buffer) + offset;
iter->start_length = length;
- nx_field_iterator_reset(iter, view);
+ dx_field_iterator_reset(iter, view);
return iter;
}
-void nx_field_iterator_free(nx_field_iterator_t *iter)
+void dx_field_iterator_free(dx_field_iterator_t *iter)
{
- free_nx_field_iterator_t(iter);
+ free_dx_field_iterator_t(iter);
}
-void nx_field_iterator_reset(nx_field_iterator_t *iter, nx_iterator_view_t view)
+void dx_field_iterator_reset(dx_field_iterator_t *iter, dx_iterator_view_t view)
{
iter->buffer = iter->start_buffer;
iter->cursor = iter->start_cursor;
@@ -198,7 +198,7 @@ void nx_field_iterator_reset(nx_field_it
}
-unsigned char nx_field_iterator_octet(nx_field_iterator_t *iter)
+unsigned char dx_field_iterator_octet(dx_field_iterator_t *iter)
{
if (iter->length == 0)
return (unsigned char) 0;
@@ -210,11 +210,11 @@ unsigned char nx_field_iterator_octet(nx
if (iter->length > 0) {
if (iter->buffer) {
- if (iter->cursor - nx_buffer_base(iter->buffer) == nx_buffer_size(iter->buffer)) {
+ if (iter->cursor - dx_buffer_base(iter->buffer) == dx_buffer_size(iter->buffer)) {
iter->buffer = iter->buffer->next;
if (iter->buffer == 0)
iter->length = 0;
- iter->cursor = nx_buffer_base(iter->buffer);
+ iter->cursor = dx_buffer_base(iter->buffer);
}
}
}
@@ -226,41 +226,41 @@ unsigned char nx_field_iterator_octet(nx
}
-int nx_field_iterator_end(nx_field_iterator_t *iter)
+int dx_field_iterator_end(dx_field_iterator_t *iter)
{
return iter->length == 0;
}
-int nx_field_iterator_equal(nx_field_iterator_t *iter, unsigned char *string)
+int dx_field_iterator_equal(dx_field_iterator_t *iter, unsigned char *string)
{
- nx_field_iterator_reset(iter, iter->view);
- while (!nx_field_iterator_end(iter) && *string) {
- if (*string != nx_field_iterator_octet(iter))
+ dx_field_iterator_reset(iter, iter->view);
+ while (!dx_field_iterator_end(iter) && *string) {
+ if (*string != dx_field_iterator_octet(iter))
return 0;
string++;
}
- return (nx_field_iterator_end(iter) && (*string == 0));
+ return (dx_field_iterator_end(iter) && (*string == 0));
}
-unsigned char *nx_field_iterator_copy(nx_field_iterator_t *iter)
+unsigned char *dx_field_iterator_copy(dx_field_iterator_t *iter)
{
int length = 0;
int idx = 0;
unsigned char *copy;
- nx_field_iterator_reset(iter, iter->view);
- while (!nx_field_iterator_end(iter)) {
- nx_field_iterator_octet(iter);
+ dx_field_iterator_reset(iter, iter->view);
+ while (!dx_field_iterator_end(iter)) {
+ dx_field_iterator_octet(iter);
length++;
}
- nx_field_iterator_reset(iter, iter->view);
+ dx_field_iterator_reset(iter, iter->view);
copy = (unsigned char*) malloc(length + 1);
- while (!nx_field_iterator_end(iter))
- copy[idx++] = nx_field_iterator_octet(iter);
+ while (!dx_field_iterator_end(iter))
+ copy[idx++] = dx_field_iterator_octet(iter);
copy[idx] = '\0';
return copy;
Modified: qpid/trunk/qpid/extras/dispatch/src/log.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/log.c?rev=1448649&r1=1446735&r2=1448649&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/log.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/log.c Thu Feb 21 14:28:48 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-#include <qpid/nexus/log.h>
+#include <qpid/dispatch/log.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -35,7 +35,7 @@ static char *cls_prefix(int cls)
return "";
}
-void nx_log(const char *module, int cls, const char *fmt, ...)
+void dx_log(const char *module, int cls, const char *fmt, ...)
{
if (!(cls & mask))
return;
@@ -49,7 +49,7 @@ void nx_log(const char *module, int cls,
fprintf(stderr, "%s (%s): %s\n", module, cls_prefix(cls), line);
}
-void nx_log_set_mask(int _mask)
+void dx_log_set_mask(int _mask)
{
mask = _mask;
}
Modified: qpid/trunk/qpid/extras/dispatch/src/message.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/message.c?rev=1448649&r1=1446735&r2=1448649&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/message.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/message.c Thu Feb 21 14:28:48 2013
@@ -17,22 +17,22 @@
* under the License.
*/
-#include <qpid/nexus/ctools.h>
-#include <qpid/nexus/threading.h>
+#include <qpid/dispatch/ctools.h>
+#include <qpid/dispatch/threading.h>
#include "message_private.h"
#include <string.h>
#include <stdio.h>
-ALLOC_DEFINE_CONFIG(nx_message_t, sizeof(nx_message_pvt_t), 0, 0);
-ALLOC_DEFINE(nx_message_content_t);
+ALLOC_DEFINE_CONFIG(dx_message_t, sizeof(dx_message_pvt_t), 0, 0);
+ALLOC_DEFINE(dx_message_content_t);
-static void advance(unsigned char **cursor, nx_buffer_t **buffer, int consume)
+static void advance(unsigned char **cursor, dx_buffer_t **buffer, int consume)
{
unsigned char *local_cursor = *cursor;
- nx_buffer_t *local_buffer = *buffer;
+ dx_buffer_t *local_buffer = *buffer;
- int remaining = nx_buffer_size(local_buffer) - (local_cursor - nx_buffer_base(local_buffer));
+ int remaining = dx_buffer_size(local_buffer) - (local_cursor - dx_buffer_base(local_buffer));
while (consume > 0) {
if (consume < remaining) {
local_cursor += consume;
@@ -44,8 +44,8 @@ static void advance(unsigned char **curs
local_cursor = 0;
break;
}
- local_cursor = nx_buffer_base(local_buffer);
- remaining = nx_buffer_size(local_buffer) - (local_cursor - nx_buffer_base(local_buffer));
+ local_cursor = dx_buffer_base(local_buffer);
+ remaining = dx_buffer_size(local_buffer) - (local_cursor - dx_buffer_base(local_buffer));
}
}
@@ -54,7 +54,7 @@ static void advance(unsigned char **curs
}
-static unsigned char next_octet(unsigned char **cursor, nx_buffer_t **buffer)
+static unsigned char next_octet(unsigned char **cursor, dx_buffer_t **buffer)
{
unsigned char result = **cursor;
advance(cursor, buffer, 1);
@@ -62,7 +62,7 @@ static unsigned char next_octet(unsigned
}
-static int traverse_field(unsigned char **cursor, nx_buffer_t **buffer, nx_field_location_t *field)
+static int traverse_field(unsigned char **cursor, dx_buffer_t **buffer, dx_field_location_t *field)
{
unsigned char tag = next_octet(cursor, buffer);
if (!(*cursor)) return 0;
@@ -96,7 +96,7 @@ static int traverse_field(unsigned char
if (field) {
field->buffer = *buffer;
- field->offset = *cursor - nx_buffer_base(*buffer);
+ field->offset = *cursor - dx_buffer_base(*buffer);
field->length = consume;
field->parsed = 1;
}
@@ -106,7 +106,7 @@ static int traverse_field(unsigned char
}
-static int start_list(unsigned char **cursor, nx_buffer_t **buffer)
+static int start_list(unsigned char **cursor, dx_buffer_t **buffer)
{
unsigned char tag = next_octet(cursor, buffer);
if (!(*cursor)) return 0;
@@ -163,20 +163,20 @@ static int start_list(unsigned char **cu
// Return 1 if the pattern matches and we've advanced the cursor/buffer
// Return 1 if the pattern does not match
//
-static int nx_check_and_advance(nx_buffer_t **buffer,
+static int dx_check_and_advance(dx_buffer_t **buffer,
unsigned char **cursor,
unsigned char *pattern,
int pattern_length,
unsigned char *expected_tags,
- nx_field_location_t *location)
+ dx_field_location_t *location)
{
- nx_buffer_t *test_buffer = *buffer;
+ dx_buffer_t *test_buffer = *buffer;
unsigned char *test_cursor = *cursor;
if (!test_cursor)
return 1; // no match
- unsigned char *end_of_buffer = nx_buffer_base(test_buffer) + nx_buffer_size(test_buffer);
+ unsigned char *end_of_buffer = dx_buffer_base(test_buffer) + dx_buffer_size(test_buffer);
int idx = 0;
while (idx < pattern_length && *test_cursor == pattern[idx]) {
@@ -186,8 +186,8 @@ static int nx_check_and_advance(nx_buffe
test_buffer = test_buffer->next;
if (test_buffer == 0)
return 1; // Pattern didn't match
- test_cursor = nx_buffer_base(test_buffer);
- end_of_buffer = test_cursor + nx_buffer_size(test_buffer);
+ test_cursor = dx_buffer_base(test_buffer);
+ end_of_buffer = test_cursor + dx_buffer_size(test_buffer);
}
}
@@ -210,7 +210,7 @@ static int nx_check_and_advance(nx_buffe
//
location->parsed = 1;
location->buffer = test_buffer;
- location->offset = test_cursor - nx_buffer_base(test_buffer);
+ location->offset = test_cursor - dx_buffer_base(test_buffer);
location->length = 0;
//
@@ -251,23 +251,23 @@ static int nx_check_and_advance(nx_buffe
}
-static void nx_insert(nx_message_content_t *msg, const uint8_t *seq, size_t len)
+static void dx_insert(dx_message_content_t *msg, const uint8_t *seq, size_t len)
{
- nx_buffer_t *buf = DEQ_TAIL(msg->buffers);
+ dx_buffer_t *buf = DEQ_TAIL(msg->buffers);
while (len > 0) {
- if (buf == 0 || nx_buffer_capacity(buf) == 0) {
- buf = nx_allocate_buffer();
+ if (buf == 0 || dx_buffer_capacity(buf) == 0) {
+ buf = dx_allocate_buffer();
if (buf == 0)
return;
DEQ_INSERT_TAIL(msg->buffers, buf);
}
- size_t to_copy = nx_buffer_capacity(buf);
+ size_t to_copy = dx_buffer_capacity(buf);
if (to_copy > len)
to_copy = len;
- memcpy(nx_buffer_cursor(buf), seq, to_copy);
- nx_buffer_insert(buf, to_copy);
+ memcpy(dx_buffer_cursor(buf), seq, to_copy);
+ dx_buffer_insert(buf, to_copy);
len -= to_copy;
seq += to_copy;
msg->length += to_copy;
@@ -275,24 +275,24 @@ static void nx_insert(nx_message_content
}
-static void nx_insert_8(nx_message_content_t *msg, uint8_t value)
+static void dx_insert_8(dx_message_content_t *msg, uint8_t value)
{
- nx_insert(msg, &value, 1);
+ dx_insert(msg, &value, 1);
}
-static void nx_insert_32(nx_message_content_t *msg, uint32_t value)
+static void dx_insert_32(dx_message_content_t *msg, uint32_t value)
{
uint8_t buf[4];
buf[0] = (uint8_t) ((value & 0xFF000000) >> 24);
buf[1] = (uint8_t) ((value & 0x00FF0000) >> 16);
buf[2] = (uint8_t) ((value & 0x0000FF00) >> 8);
buf[3] = (uint8_t) (value & 0x000000FF);
- nx_insert(msg, buf, 4);
+ dx_insert(msg, buf, 4);
}
-static void nx_insert_64(nx_message_content_t *msg, uint64_t value)
+static void dx_insert_64(dx_message_content_t *msg, uint64_t value)
{
uint8_t buf[8];
buf[0] = (uint8_t) ((value & 0xFF00000000000000L) >> 56);
@@ -303,18 +303,18 @@ static void nx_insert_64(nx_message_cont
buf[5] = (uint8_t) ((value & 0x0000000000FF0000L) >> 16);
buf[6] = (uint8_t) ((value & 0x000000000000FF00L) >> 8);
buf[7] = (uint8_t) (value & 0x00000000000000FFL);
- nx_insert(msg, buf, 8);
+ dx_insert(msg, buf, 8);
}
-static void nx_overwrite(nx_buffer_t **buf, size_t *cursor, uint8_t value)
+static void dx_overwrite(dx_buffer_t **buf, size_t *cursor, uint8_t value)
{
while (*buf) {
- if (*cursor >= nx_buffer_size(*buf)) {
+ if (*cursor >= dx_buffer_size(*buf)) {
*buf = (*buf)->next;
*cursor = 0;
} else {
- nx_buffer_base(*buf)[*cursor] = value;
+ dx_buffer_base(*buf)[*cursor] = value;
(*cursor)++;
return;
}
@@ -322,69 +322,69 @@ static void nx_overwrite(nx_buffer_t **b
}
-static void nx_overwrite_32(nx_field_location_t *field, uint32_t value)
+static void dx_overwrite_32(dx_field_location_t *field, uint32_t value)
{
- nx_buffer_t *buf = field->buffer;
+ dx_buffer_t *buf = field->buffer;
size_t cursor = field->offset;
- nx_overwrite(&buf, &cursor, (uint8_t) ((value & 0xFF000000) >> 24));
- nx_overwrite(&buf, &cursor, (uint8_t) ((value & 0x00FF0000) >> 24));
- nx_overwrite(&buf, &cursor, (uint8_t) ((value & 0x0000FF00) >> 24));
- nx_overwrite(&buf, &cursor, (uint8_t) (value & 0x000000FF));
+ dx_overwrite(&buf, &cursor, (uint8_t) ((value & 0xFF000000) >> 24));
+ dx_overwrite(&buf, &cursor, (uint8_t) ((value & 0x00FF0000) >> 24));
+ dx_overwrite(&buf, &cursor, (uint8_t) ((value & 0x0000FF00) >> 24));
+ dx_overwrite(&buf, &cursor, (uint8_t) (value & 0x000000FF));
}
-static void nx_start_list_performative(nx_message_content_t *msg, uint8_t code)
+static void dx_start_list_performative(dx_message_content_t *msg, uint8_t code)
{
//
// Insert the short-form performative tag
//
- nx_insert(msg, (const uint8_t*) "\x00\x53", 2);
- nx_insert_8(msg, code);
+ dx_insert(msg, (const uint8_t*) "\x00\x53", 2);
+ dx_insert_8(msg, code);
//
// Open the list with a list32 tag
//
- nx_insert_8(msg, 0xd0);
+ dx_insert_8(msg, 0xd0);
//
// Mark the current location to later overwrite the length
//
msg->compose_length.buffer = DEQ_TAIL(msg->buffers);
- msg->compose_length.offset = nx_buffer_size(msg->compose_length.buffer);
+ msg->compose_length.offset = dx_buffer_size(msg->compose_length.buffer);
msg->compose_length.length = 4;
msg->compose_length.parsed = 1;
- nx_insert(msg, (const uint8_t*) "\x00\x00\x00\x00", 4);
+ dx_insert(msg, (const uint8_t*) "\x00\x00\x00\x00", 4);
//
// Mark the current location to later overwrite the count
//
msg->compose_count.buffer = DEQ_TAIL(msg->buffers);
- msg->compose_count.offset = nx_buffer_size(msg->compose_count.buffer);
+ msg->compose_count.offset = dx_buffer_size(msg->compose_count.buffer);
msg->compose_count.length = 4;
msg->compose_count.parsed = 1;
- nx_insert(msg, (const uint8_t*) "\x00\x00\x00\x00", 4);
+ dx_insert(msg, (const uint8_t*) "\x00\x00\x00\x00", 4);
msg->length = 4; // Include the length of the count field
msg->count = 0;
}
-static void nx_end_list(nx_message_content_t *msg)
+static void dx_end_list(dx_message_content_t *msg)
{
- nx_overwrite_32(&msg->compose_length, msg->length);
- nx_overwrite_32(&msg->compose_count, msg->count);
+ dx_overwrite_32(&msg->compose_length, msg->length);
+ dx_overwrite_32(&msg->compose_count, msg->count);
}
-static nx_field_location_t *nx_message_field_location(nx_message_t *msg, nx_message_field_t field)
+static dx_field_location_t *dx_message_field_location(dx_message_t *msg, dx_message_field_t field)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
switch (field) {
- case NX_FIELD_TO:
+ case DX_FIELD_TO:
while (1) {
if (content->field_to.parsed)
return &content->field_to;
@@ -392,8 +392,8 @@ static nx_field_location_t *nx_message_f
if (content->section_message_properties.parsed == 0)
break;
- nx_buffer_t *buffer = content->section_message_properties.buffer;
- unsigned char *cursor = nx_buffer_base(buffer) + content->section_message_properties.offset;
+ dx_buffer_t *buffer = content->section_message_properties.buffer;
+ unsigned char *cursor = dx_buffer_base(buffer) + content->section_message_properties.offset;
int count = start_list(&cursor, &buffer);
int result;
@@ -410,7 +410,7 @@ static nx_field_location_t *nx_message_f
}
break;
- case NX_FIELD_BODY:
+ case DX_FIELD_BODY:
while (1) {
if (content->body.parsed)
return &content->body;
@@ -418,8 +418,8 @@ static nx_field_location_t *nx_message_f
if (content->section_body.parsed == 0)
break;
- nx_buffer_t *buffer = content->section_body.buffer;
- unsigned char *cursor = nx_buffer_base(buffer) + content->section_body.offset;
+ dx_buffer_t *buffer = content->section_body.buffer;
+ unsigned char *cursor = dx_buffer_base(buffer) + content->section_body.offset;
int result;
result = traverse_field(&cursor, &buffer, &content->body);
@@ -435,61 +435,61 @@ static nx_field_location_t *nx_message_f
}
-nx_message_t *nx_allocate_message()
+dx_message_t *dx_allocate_message()
{
- nx_message_pvt_t *msg = (nx_message_pvt_t*) new_nx_message_t();
+ dx_message_pvt_t *msg = (dx_message_pvt_t*) new_dx_message_t();
if (!msg)
return 0;
DEQ_ITEM_INIT(msg);
- msg->content = new_nx_message_content_t();
+ msg->content = new_dx_message_content_t();
msg->out_delivery = 0;
if (msg->content == 0) {
- free_nx_message_t((nx_message_t*) msg);
+ free_dx_message_t((dx_message_t*) msg);
return 0;
}
- memset(msg->content, 0, sizeof(nx_message_content_t));
+ memset(msg->content, 0, sizeof(dx_message_content_t));
msg->content->lock = sys_mutex();
msg->content->ref_count = 1;
- return (nx_message_t*) msg;
+ return (dx_message_t*) msg;
}
-void nx_free_message(nx_message_t *in_msg)
+void dx_free_message(dx_message_t *in_msg)
{
uint32_t rc;
- nx_message_pvt_t *msg = (nx_message_pvt_t*) in_msg;
- nx_message_content_t *content = msg->content;
+ dx_message_pvt_t *msg = (dx_message_pvt_t*) in_msg;
+ dx_message_content_t *content = msg->content;
sys_mutex_lock(content->lock);
rc = --content->ref_count;
sys_mutex_unlock(content->lock);
if (rc == 0) {
- nx_buffer_t *buf = DEQ_HEAD(content->buffers);
+ dx_buffer_t *buf = DEQ_HEAD(content->buffers);
while (buf) {
DEQ_REMOVE_HEAD(content->buffers);
- nx_free_buffer(buf);
+ dx_free_buffer(buf);
buf = DEQ_HEAD(content->buffers);
}
sys_mutex_free(content->lock);
- free_nx_message_content_t(content);
+ free_dx_message_content_t(content);
}
- free_nx_message_t((nx_message_t*) msg);
+ free_dx_message_t((dx_message_t*) msg);
}
-nx_message_t *nx_message_copy(nx_message_t *in_msg)
+dx_message_t *dx_message_copy(dx_message_t *in_msg)
{
- nx_message_pvt_t *msg = (nx_message_pvt_t*) in_msg;
- nx_message_content_t *content = msg->content;
- nx_message_pvt_t *copy = (nx_message_pvt_t*) new_nx_message_t();
+ dx_message_pvt_t *msg = (dx_message_pvt_t*) in_msg;
+ dx_message_content_t *content = msg->content;
+ dx_message_pvt_t *copy = (dx_message_pvt_t*) new_dx_message_t();
if (!copy)
return 0;
@@ -502,42 +502,42 @@ nx_message_t *nx_message_copy(nx_message
content->ref_count++;
sys_mutex_unlock(content->lock);
- return (nx_message_t*) copy;
+ return (dx_message_t*) copy;
}
-void nx_message_set_out_delivery(nx_message_t *msg, pn_delivery_t *delivery)
+void dx_message_set_out_delivery(dx_message_t *msg, pn_delivery_t *delivery)
{
- ((nx_message_pvt_t*) msg)->out_delivery = delivery;
+ ((dx_message_pvt_t*) msg)->out_delivery = delivery;
}
-pn_delivery_t *nx_message_out_delivery(nx_message_t *msg)
+pn_delivery_t *dx_message_out_delivery(dx_message_t *msg)
{
- return ((nx_message_pvt_t*) msg)->out_delivery;
+ return ((dx_message_pvt_t*) msg)->out_delivery;
}
-void nx_message_set_in_delivery(nx_message_t *msg, pn_delivery_t *delivery)
+void dx_message_set_in_delivery(dx_message_t *msg, pn_delivery_t *delivery)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
content->in_delivery = delivery;
}
-pn_delivery_t *nx_message_in_delivery(nx_message_t *msg)
+pn_delivery_t *dx_message_in_delivery(dx_message_t *msg)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
return content->in_delivery;
}
-nx_message_t *nx_message_receive(pn_delivery_t *delivery)
+dx_message_t *dx_message_receive(pn_delivery_t *delivery)
{
pn_link_t *link = pn_delivery_link(delivery);
- nx_message_pvt_t *msg = (nx_message_pvt_t*) pn_delivery_get_context(delivery);
+ dx_message_pvt_t *msg = (dx_message_pvt_t*) pn_delivery_get_context(delivery);
ssize_t rc;
- nx_buffer_t *buf;
+ dx_buffer_t *buf;
//
// If there is no message associated with the delivery, this is the first time
@@ -545,7 +545,7 @@ nx_message_t *nx_message_receive(pn_deli
// link it and the delivery together.
//
if (!msg) {
- msg = (nx_message_pvt_t*) nx_allocate_message();
+ msg = (dx_message_pvt_t*) dx_allocate_message();
pn_delivery_set_context(delivery, (void*) msg);
//
@@ -564,7 +564,7 @@ nx_message_t *nx_message_receive(pn_deli
//
buf = DEQ_TAIL(msg->content->buffers);
if (!buf) {
- buf = nx_allocate_buffer();
+ buf = dx_allocate_buffer();
DEQ_INSERT_TAIL(msg->content->buffers, buf);
}
@@ -572,7 +572,7 @@ nx_message_t *nx_message_receive(pn_deli
//
// Try to receive enough data to fill the remaining space in the tail buffer.
//
- rc = pn_link_recv(link, (char*) nx_buffer_cursor(buf), nx_buffer_capacity(buf));
+ rc = pn_link_recv(link, (char*) dx_buffer_cursor(buf), dx_buffer_capacity(buf));
//
// If we receive PN_EOS, we have come to the end of the message.
@@ -583,11 +583,11 @@ nx_message_t *nx_message_receive(pn_deli
// will only happen if the size of the message content is an exact multiple
// of the buffer size.
//
- if (nx_buffer_size(buf) == 0) {
+ if (dx_buffer_size(buf) == 0) {
DEQ_REMOVE_TAIL(msg->content->buffers);
- nx_free_buffer(buf);
+ dx_free_buffer(buf);
}
- return (nx_message_t*) msg;
+ return (dx_message_t*) msg;
}
if (rc > 0) {
@@ -595,14 +595,14 @@ nx_message_t *nx_message_receive(pn_deli
// We have received a positive number of bytes for the message. Advance
// the cursor in the buffer.
//
- nx_buffer_insert(buf, rc);
+ dx_buffer_insert(buf, rc);
//
// If the buffer is full, allocate a new empty buffer and append it to the
// tail of the message's list.
//
- if (nx_buffer_capacity(buf) == 0) {
- buf = nx_allocate_buffer();
+ if (dx_buffer_capacity(buf) == 0) {
+ buf = dx_allocate_buffer();
DEQ_INSERT_TAIL(msg->content->buffers, buf);
}
} else
@@ -618,20 +618,20 @@ nx_message_t *nx_message_receive(pn_deli
}
-void nx_message_send(nx_message_t *in_msg, pn_link_t *link)
+void dx_message_send(dx_message_t *in_msg, pn_link_t *link)
{
- nx_message_pvt_t *msg = (nx_message_pvt_t*) in_msg;
- nx_buffer_t *buf = DEQ_HEAD(msg->content->buffers);
+ dx_message_pvt_t *msg = (dx_message_pvt_t*) in_msg;
+ dx_buffer_t *buf = DEQ_HEAD(msg->content->buffers);
// TODO - Handle cases where annotations have been added or modified
while (buf) {
- pn_link_send(link, (char*) nx_buffer_base(buf), nx_buffer_size(buf));
+ pn_link_send(link, (char*) dx_buffer_base(buf), dx_buffer_size(buf));
buf = DEQ_NEXT(buf);
}
}
-int nx_message_check(nx_message_t *in_msg, nx_message_depth_t depth)
+int dx_message_check(dx_message_t *in_msg, dx_message_depth_t depth)
{
#define LONG 10
@@ -656,114 +656,114 @@ int nx_message_check(nx_message_t *in_ms
#define TAGS_MAP (unsigned char*) "\xc1\xd1"
#define TAGS_BINARY (unsigned char*) "\xa0\xb0"
- nx_message_pvt_t *msg = (nx_message_pvt_t*) in_msg;
- nx_message_content_t *content = msg->content;
- nx_buffer_t *buffer = DEQ_HEAD(content->buffers);
+ dx_message_pvt_t *msg = (dx_message_pvt_t*) in_msg;
+ dx_message_content_t *content = msg->content;
+ dx_buffer_t *buffer = DEQ_HEAD(content->buffers);
unsigned char *cursor;
if (!buffer)
return 0; // Invalid - No data in the message
- if (depth == NX_DEPTH_NONE)
+ if (depth == DX_DEPTH_NONE)
return 1;
- cursor = nx_buffer_base(buffer);
+ cursor = dx_buffer_base(buffer);
//
// MESSAGE HEADER
//
- if (0 == nx_check_and_advance(&buffer, &cursor, MSG_HDR_LONG, LONG, TAGS_LIST, &content->section_message_header))
+ if (0 == dx_check_and_advance(&buffer, &cursor, MSG_HDR_LONG, LONG, TAGS_LIST, &content->section_message_header))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, MSG_HDR_SHORT, SHORT, TAGS_LIST, &content->section_message_header))
+ if (0 == dx_check_and_advance(&buffer, &cursor, MSG_HDR_SHORT, SHORT, TAGS_LIST, &content->section_message_header))
return 0;
- if (depth == NX_DEPTH_HEADER)
+ if (depth == DX_DEPTH_HEADER)
return 1;
//
// DELIVERY ANNOTATION
//
- if (0 == nx_check_and_advance(&buffer, &cursor, DELIVERY_ANNOTATION_LONG, LONG, TAGS_MAP, &content->section_delivery_annotation))
+ if (0 == dx_check_and_advance(&buffer, &cursor, DELIVERY_ANNOTATION_LONG, LONG, TAGS_MAP, &content->section_delivery_annotation))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, DELIVERY_ANNOTATION_SHORT, SHORT, TAGS_MAP, &content->section_delivery_annotation))
+ if (0 == dx_check_and_advance(&buffer, &cursor, DELIVERY_ANNOTATION_SHORT, SHORT, TAGS_MAP, &content->section_delivery_annotation))
return 0;
- if (depth == NX_DEPTH_DELIVERY_ANNOTATIONS)
+ if (depth == DX_DEPTH_DELIVERY_ANNOTATIONS)
return 1;
//
// MESSAGE ANNOTATION
//
- if (0 == nx_check_and_advance(&buffer, &cursor, MESSAGE_ANNOTATION_LONG, LONG, TAGS_MAP, &content->section_message_annotation))
+ if (0 == dx_check_and_advance(&buffer, &cursor, MESSAGE_ANNOTATION_LONG, LONG, TAGS_MAP, &content->section_message_annotation))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, MESSAGE_ANNOTATION_SHORT, SHORT, TAGS_MAP, &content->section_message_annotation))
+ if (0 == dx_check_and_advance(&buffer, &cursor, MESSAGE_ANNOTATION_SHORT, SHORT, TAGS_MAP, &content->section_message_annotation))
return 0;
- if (depth == NX_DEPTH_MESSAGE_ANNOTATIONS)
+ if (depth == DX_DEPTH_MESSAGE_ANNOTATIONS)
return 1;
//
// PROPERTIES
//
- if (0 == nx_check_and_advance(&buffer, &cursor, PROPERTIES_LONG, LONG, TAGS_LIST, &content->section_message_properties))
+ if (0 == dx_check_and_advance(&buffer, &cursor, PROPERTIES_LONG, LONG, TAGS_LIST, &content->section_message_properties))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, PROPERTIES_SHORT, SHORT, TAGS_LIST, &content->section_message_properties))
+ if (0 == dx_check_and_advance(&buffer, &cursor, PROPERTIES_SHORT, SHORT, TAGS_LIST, &content->section_message_properties))
return 0;
- if (depth == NX_DEPTH_PROPERTIES)
+ if (depth == DX_DEPTH_PROPERTIES)
return 1;
//
// APPLICATION PROPERTIES
//
- if (0 == nx_check_and_advance(&buffer, &cursor, APPLICATION_PROPERTIES_LONG, LONG, TAGS_MAP, &content->section_application_properties))
+ if (0 == dx_check_and_advance(&buffer, &cursor, APPLICATION_PROPERTIES_LONG, LONG, TAGS_MAP, &content->section_application_properties))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, APPLICATION_PROPERTIES_SHORT, SHORT, TAGS_MAP, &content->section_application_properties))
+ if (0 == dx_check_and_advance(&buffer, &cursor, APPLICATION_PROPERTIES_SHORT, SHORT, TAGS_MAP, &content->section_application_properties))
return 0;
- if (depth == NX_DEPTH_APPLICATION_PROPERTIES)
+ if (depth == DX_DEPTH_APPLICATION_PROPERTIES)
return 1;
//
// BODY (Note that this function expects a single data section or a single AMQP sequence)
//
- if (0 == nx_check_and_advance(&buffer, &cursor, BODY_DATA_LONG, LONG, TAGS_BINARY, &content->section_body))
+ if (0 == dx_check_and_advance(&buffer, &cursor, BODY_DATA_LONG, LONG, TAGS_BINARY, &content->section_body))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, BODY_DATA_SHORT, SHORT, TAGS_BINARY, &content->section_body))
+ if (0 == dx_check_and_advance(&buffer, &cursor, BODY_DATA_SHORT, SHORT, TAGS_BINARY, &content->section_body))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, BODY_SEQUENCE_LONG, LONG, TAGS_LIST, &content->section_body))
+ if (0 == dx_check_and_advance(&buffer, &cursor, BODY_SEQUENCE_LONG, LONG, TAGS_LIST, &content->section_body))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, BODY_SEQUENCE_SHORT, SHORT, TAGS_LIST, &content->section_body))
+ if (0 == dx_check_and_advance(&buffer, &cursor, BODY_SEQUENCE_SHORT, SHORT, TAGS_LIST, &content->section_body))
return 0;
- if (depth == NX_DEPTH_BODY)
+ if (depth == DX_DEPTH_BODY)
return 1;
//
// FOOTER
//
- if (0 == nx_check_and_advance(&buffer, &cursor, FOOTER_LONG, LONG, TAGS_MAP, &content->section_footer))
+ if (0 == dx_check_and_advance(&buffer, &cursor, FOOTER_LONG, LONG, TAGS_MAP, &content->section_footer))
return 0;
- if (0 == nx_check_and_advance(&buffer, &cursor, FOOTER_SHORT, SHORT, TAGS_MAP, &content->section_footer))
+ if (0 == dx_check_and_advance(&buffer, &cursor, FOOTER_SHORT, SHORT, TAGS_MAP, &content->section_footer))
return 0;
return 1;
}
-nx_field_iterator_t *nx_message_field_iterator(nx_message_t *msg, nx_message_field_t field)
+dx_field_iterator_t *dx_message_field_iterator(dx_message_t *msg, dx_message_field_t field)
{
- nx_field_location_t *loc = nx_message_field_location(msg, field);
+ dx_field_location_t *loc = dx_message_field_location(msg, field);
if (!loc)
return 0;
- return nx_field_iterator_buffer(loc->buffer, loc->offset, loc->length, ITER_VIEW_ALL);
+ return dx_field_iterator_buffer(loc->buffer, loc->offset, loc->length, ITER_VIEW_ALL);
}
-nx_iovec_t *nx_message_field_iovec(nx_message_t *msg, nx_message_field_t field)
+dx_iovec_t *dx_message_field_iovec(dx_message_t *msg, dx_message_field_t field)
{
- nx_field_location_t *loc = nx_message_field_location(msg, field);
+ dx_field_location_t *loc = dx_message_field_location(msg, field);
if (!loc)
return 0;
@@ -771,8 +771,8 @@ nx_iovec_t *nx_message_field_iovec(nx_me
// Count the number of buffers this field straddles
//
int bufcnt = 1;
- nx_buffer_t *buf = loc->buffer;
- size_t bufsize = nx_buffer_size(buf) - loc->offset;
+ dx_buffer_t *buf = loc->buffer;
+ size_t bufsize = dx_buffer_size(buf) - loc->offset;
ssize_t remaining = loc->length - bufsize;
while (remaining > 0) {
@@ -780,13 +780,13 @@ nx_iovec_t *nx_message_field_iovec(nx_me
buf = buf->next;
if (!buf)
return 0;
- remaining -= nx_buffer_size(buf);
+ remaining -= dx_buffer_size(buf);
}
//
// Allocate an iovec object big enough to hold the number of buffers
//
- nx_iovec_t *iov = nx_iovec(bufcnt);
+ dx_iovec_t *iov = dx_iovec(bufcnt);
if (!iov)
return 0;
@@ -795,19 +795,19 @@ nx_iovec_t *nx_message_field_iovec(nx_me
//
bufcnt = 0;
buf = loc->buffer;
- bufsize = nx_buffer_size(buf) - loc->offset;
- void *base = nx_buffer_base(buf) + loc->offset;
+ bufsize = dx_buffer_size(buf) - loc->offset;
+ void *base = dx_buffer_base(buf) + loc->offset;
remaining = loc->length;
while (remaining > 0) {
- nx_iovec_array(iov)[bufcnt].iov_base = base;
- nx_iovec_array(iov)[bufcnt].iov_len = bufsize;
+ dx_iovec_array(iov)[bufcnt].iov_base = base;
+ dx_iovec_array(iov)[bufcnt].iov_len = bufsize;
bufcnt++;
remaining -= bufsize;
if (remaining > 0) {
buf = buf->next;
- base = nx_buffer_base(buf);
- bufsize = nx_buffer_size(buf);
+ base = dx_buffer_base(buf);
+ bufsize = dx_buffer_size(buf);
if (bufsize > remaining)
bufsize = remaining;
}
@@ -817,121 +817,121 @@ nx_iovec_t *nx_message_field_iovec(nx_me
}
-void nx_message_compose_1(nx_message_t *msg, const char *to, nx_buffer_list_t *buffers)
+void dx_message_compose_1(dx_message_t *msg, const char *to, dx_buffer_list_t *buffers)
{
- nx_message_begin_header(msg);
- nx_message_insert_boolean(msg, 0); // durable
- //nx_message_insert_null(msg); // priority
- //nx_message_insert_null(msg); // ttl
- //nx_message_insert_boolean(msg, 0); // first-acquirer
- //nx_message_insert_uint(msg, 0); // delivery-count
- nx_message_end_header(msg);
-
- nx_message_begin_message_properties(msg);
- nx_message_insert_null(msg); // message-id
- nx_message_insert_null(msg); // user-id
- nx_message_insert_string(msg, to); // to
- //nx_message_insert_null(msg); // subject
- //nx_message_insert_null(msg); // reply-to
- //nx_message_insert_null(msg); // correlation-id
- //nx_message_insert_null(msg); // content-type
- //nx_message_insert_null(msg); // content-encoding
- //nx_message_insert_timestamp(msg, 0); // absolute-expiry-time
- //nx_message_insert_timestamp(msg, 0); // creation-time
- //nx_message_insert_null(msg); // group-id
- //nx_message_insert_uint(msg, 0); // group-sequence
- //nx_message_insert_null(msg); // reply-to-group-id
- nx_message_end_message_properties(msg);
+ dx_message_begin_header(msg);
+ dx_message_insert_boolean(msg, 0); // durable
+ //dx_message_insert_null(msg); // priority
+ //dx_message_insert_null(msg); // ttl
+ //dx_message_insert_boolean(msg, 0); // first-acquirer
+ //dx_message_insert_uint(msg, 0); // delivery-count
+ dx_message_end_header(msg);
+
+ dx_message_begin_message_properties(msg);
+ dx_message_insert_null(msg); // message-id
+ dx_message_insert_null(msg); // user-id
+ dx_message_insert_string(msg, to); // to
+ //dx_message_insert_null(msg); // subject
+ //dx_message_insert_null(msg); // reply-to
+ //dx_message_insert_null(msg); // correlation-id
+ //dx_message_insert_null(msg); // content-type
+ //dx_message_insert_null(msg); // content-encoding
+ //dx_message_insert_timestamp(msg, 0); // absolute-expiry-time
+ //dx_message_insert_timestamp(msg, 0); // creation-time
+ //dx_message_insert_null(msg); // group-id
+ //dx_message_insert_uint(msg, 0); // group-sequence
+ //dx_message_insert_null(msg); // reply-to-group-id
+ dx_message_end_message_properties(msg);
if (buffers)
- nx_message_append_body_data(msg, buffers);
+ dx_message_append_body_data(msg, buffers);
}
-void nx_message_begin_header(nx_message_t *msg)
+void dx_message_begin_header(dx_message_t *msg)
{
- nx_start_list_performative(MSG_CONTENT(msg), 0x70);
+ dx_start_list_performative(MSG_CONTENT(msg), 0x70);
}
-void nx_message_end_header(nx_message_t *msg)
+void dx_message_end_header(dx_message_t *msg)
{
- nx_end_list(MSG_CONTENT(msg));
+ dx_end_list(MSG_CONTENT(msg));
}
-void nx_message_begin_delivery_annotations(nx_message_t *msg)
+void dx_message_begin_delivery_annotations(dx_message_t *msg)
{
assert(0); // Not Implemented
}
-void nx_message_end_delivery_annotations(nx_message_t *msg)
+void dx_message_end_delivery_annotations(dx_message_t *msg)
{
assert(0); // Not Implemented
}
-void nx_message_begin_message_annotations(nx_message_t *msg)
+void dx_message_begin_message_annotations(dx_message_t *msg)
{
assert(0); // Not Implemented
}
-void nx_message_end_message_annotations(nx_message_t *msg)
+void dx_message_end_message_annotations(dx_message_t *msg)
{
assert(0); // Not Implemented
}
-void nx_message_begin_message_properties(nx_message_t *msg)
+void dx_message_begin_message_properties(dx_message_t *msg)
{
- nx_start_list_performative(MSG_CONTENT(msg), 0x73);
+ dx_start_list_performative(MSG_CONTENT(msg), 0x73);
}
-void nx_message_end_message_properties(nx_message_t *msg)
+void dx_message_end_message_properties(dx_message_t *msg)
{
- nx_end_list(MSG_CONTENT(msg));
+ dx_end_list(MSG_CONTENT(msg));
}
-void nx_message_begin_application_properties(nx_message_t *msg)
+void dx_message_begin_application_properties(dx_message_t *msg)
{
assert(0); // Not Implemented
}
-void nx_message_end_application_properties(nx_message_t *msg)
+void dx_message_end_application_properties(dx_message_t *msg)
{
assert(0); // Not Implemented
}
-void nx_message_append_body_data(nx_message_t *msg, nx_buffer_list_t *buffers)
+void dx_message_append_body_data(dx_message_t *msg, dx_buffer_list_t *buffers)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
- nx_buffer_t *buf = DEQ_HEAD(*buffers);
+ dx_message_content_t *content = MSG_CONTENT(msg);
+ dx_buffer_t *buf = DEQ_HEAD(*buffers);
uint32_t len = 0;
//
// Calculate the size of the body to be appended.
//
while (buf) {
- len += nx_buffer_size(buf);
+ len += dx_buffer_size(buf);
buf = DEQ_NEXT(buf);
}
//
// Insert a DATA section performative header.
//
- nx_insert(content, (const uint8_t*) "\x00\x53\x75", 3);
+ dx_insert(content, (const uint8_t*) "\x00\x53\x75", 3);
if (len < 256) {
- nx_insert_8(content, 0xa0); // vbin8
- nx_insert_8(content, (uint8_t) len);
+ dx_insert_8(content, 0xa0); // vbin8
+ dx_insert_8(content, (uint8_t) len);
} else {
- nx_insert_8(content, 0xb0); // vbin32
- nx_insert_32(content, len);
+ dx_insert_8(content, 0xb0); // vbin32
+ dx_insert_32(content, len);
}
//
@@ -946,174 +946,174 @@ void nx_message_append_body_data(nx_mess
}
-void nx_message_begin_body_sequence(nx_message_t *msg)
+void dx_message_begin_body_sequence(dx_message_t *msg)
{
}
-void nx_message_end_body_sequence(nx_message_t *msg)
+void dx_message_end_body_sequence(dx_message_t *msg)
{
}
-void nx_message_begin_footer(nx_message_t *msg)
+void dx_message_begin_footer(dx_message_t *msg)
{
assert(0); // Not Implemented
}
-void nx_message_end_footer(nx_message_t *msg)
+void dx_message_end_footer(dx_message_t *msg)
{
assert(0); // Not Implemented
}
-void nx_message_insert_null(nx_message_t *msg)
+void dx_message_insert_null(dx_message_t *msg)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
- nx_insert_8(content, 0x40);
+ dx_message_content_t *content = MSG_CONTENT(msg);
+ dx_insert_8(content, 0x40);
content->count++;
}
-void nx_message_insert_boolean(nx_message_t *msg, int value)
+void dx_message_insert_boolean(dx_message_t *msg, int value)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
if (value)
- nx_insert(content, (const uint8_t*) "\x56\x01", 2);
+ dx_insert(content, (const uint8_t*) "\x56\x01", 2);
else
- nx_insert(content, (const uint8_t*) "\x56\x00", 2);
+ dx_insert(content, (const uint8_t*) "\x56\x00", 2);
content->count++;
}
-void nx_message_insert_ubyte(nx_message_t *msg, uint8_t value)
+void dx_message_insert_ubyte(dx_message_t *msg, uint8_t value)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
- nx_insert_8(content, 0x50);
- nx_insert_8(content, value);
+ dx_message_content_t *content = MSG_CONTENT(msg);
+ dx_insert_8(content, 0x50);
+ dx_insert_8(content, value);
content->count++;
}
-void nx_message_insert_uint(nx_message_t *msg, uint32_t value)
+void dx_message_insert_uint(dx_message_t *msg, uint32_t value)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
if (value == 0) {
- nx_insert_8(content, 0x43); // uint0
+ dx_insert_8(content, 0x43); // uint0
} else if (value < 256) {
- nx_insert_8(content, 0x52); // smalluint
- nx_insert_8(content, (uint8_t) value);
+ dx_insert_8(content, 0x52); // smalluint
+ dx_insert_8(content, (uint8_t) value);
} else {
- nx_insert_8(content, 0x70); // uint
- nx_insert_32(content, value);
+ dx_insert_8(content, 0x70); // uint
+ dx_insert_32(content, value);
}
content->count++;
}
-void nx_message_insert_ulong(nx_message_t *msg, uint64_t value)
+void dx_message_insert_ulong(dx_message_t *msg, uint64_t value)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
if (value == 0) {
- nx_insert_8(content, 0x44); // ulong0
+ dx_insert_8(content, 0x44); // ulong0
} else if (value < 256) {
- nx_insert_8(content, 0x53); // smallulong
- nx_insert_8(content, (uint8_t) value);
+ dx_insert_8(content, 0x53); // smallulong
+ dx_insert_8(content, (uint8_t) value);
} else {
- nx_insert_8(content, 0x80); // ulong
- nx_insert_64(content, value);
+ dx_insert_8(content, 0x80); // ulong
+ dx_insert_64(content, value);
}
content->count++;
}
-void nx_message_insert_binary(nx_message_t *msg, const uint8_t *start, size_t len)
+void dx_message_insert_binary(dx_message_t *msg, const uint8_t *start, size_t len)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
if (len < 256) {
- nx_insert_8(content, 0xa0); // vbin8
- nx_insert_8(content, (uint8_t) len);
+ dx_insert_8(content, 0xa0); // vbin8
+ dx_insert_8(content, (uint8_t) len);
} else {
- nx_insert_8(content, 0xb0); // vbin32
- nx_insert_32(content, len);
+ dx_insert_8(content, 0xb0); // vbin32
+ dx_insert_32(content, len);
}
- nx_insert(content, start, len);
+ dx_insert(content, start, len);
content->count++;
}
-void nx_message_insert_string(nx_message_t *msg, const char *start)
+void dx_message_insert_string(dx_message_t *msg, const char *start)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
uint32_t len = strlen(start);
if (len < 256) {
- nx_insert_8(content, 0xa1); // str8-utf8
- nx_insert_8(content, (uint8_t) len);
- nx_insert(content, (const uint8_t*) start, len);
+ dx_insert_8(content, 0xa1); // str8-utf8
+ dx_insert_8(content, (uint8_t) len);
+ dx_insert(content, (const uint8_t*) start, len);
} else {
- nx_insert_8(content, 0xb1); // str32-utf8
- nx_insert_32(content, len);
- nx_insert(content, (const uint8_t*) start, len);
+ dx_insert_8(content, 0xb1); // str32-utf8
+ dx_insert_32(content, len);
+ dx_insert(content, (const uint8_t*) start, len);
}
content->count++;
}
-void nx_message_insert_uuid(nx_message_t *msg, const uint8_t *value)
+void dx_message_insert_uuid(dx_message_t *msg, const uint8_t *value)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
- nx_insert_8(content, 0x98); // uuid
- nx_insert(content, value, 16);
+ dx_message_content_t *content = MSG_CONTENT(msg);
+ dx_insert_8(content, 0x98); // uuid
+ dx_insert(content, value, 16);
content->count++;
}
-void nx_message_insert_symbol(nx_message_t *msg, const char *start, size_t len)
+void dx_message_insert_symbol(dx_message_t *msg, const char *start, size_t len)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
+ dx_message_content_t *content = MSG_CONTENT(msg);
if (len < 256) {
- nx_insert_8(content, 0xa3); // sym8
- nx_insert_8(content, (uint8_t) len);
- nx_insert(content, (const uint8_t*) start, len);
+ dx_insert_8(content, 0xa3); // sym8
+ dx_insert_8(content, (uint8_t) len);
+ dx_insert(content, (const uint8_t*) start, len);
} else {
- nx_insert_8(content, 0xb3); // sym32
- nx_insert_32(content, len);
- nx_insert(content, (const uint8_t*) start, len);
+ dx_insert_8(content, 0xb3); // sym32
+ dx_insert_32(content, len);
+ dx_insert(content, (const uint8_t*) start, len);
}
content->count++;
}
-void nx_message_insert_timestamp(nx_message_t *msg, uint64_t value)
+void dx_message_insert_timestamp(dx_message_t *msg, uint64_t value)
{
- nx_message_content_t *content = MSG_CONTENT(msg);
- nx_insert_8(content, 0x83); // timestamp
- nx_insert_64(content, value);
+ dx_message_content_t *content = MSG_CONTENT(msg);
+ dx_insert_8(content, 0x83); // timestamp
+ dx_insert_64(content, value);
content->count++;
}
-void nx_message_begin_list(nx_message_t* msg)
+void dx_message_begin_list(dx_message_t* msg)
{
assert(0); // Not Implemented
}
-void nx_message_end_list(nx_message_t* msg)
+void dx_message_end_list(dx_message_t* msg)
{
assert(0); // Not Implemented
}
-void nx_message_begin_map(nx_message_t* msg)
+void dx_message_begin_map(dx_message_t* msg)
{
assert(0); // Not Implemented
}
-void nx_message_end_map(nx_message_t* msg)
+void dx_message_end_map(dx_message_t* msg)
{
assert(0); // Not Implemented
}
Modified: qpid/trunk/qpid/extras/dispatch/src/message_private.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/message_private.h?rev=1448649&r1=1446735&r2=1448649&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/message_private.h (original)
+++ qpid/trunk/qpid/extras/dispatch/src/message_private.h Thu Feb 21 14:28:48 2013
@@ -19,22 +19,22 @@
* under the License.
*/
-#include <qpid/nexus/message.h>
-#include <qpid/nexus/alloc.h>
-#include <qpid/nexus/threading.h>
+#include <qpid/dispatch/message.h>
+#include <qpid/dispatch/alloc.h>
+#include <qpid/dispatch/threading.h>
/**
* Architecture of the message module:
*
* +--------------+ +----------------------+
* | | | |
- * | nx_message_t |----------->| nx_message_content_t |
+ * | dx_message_t |----------->| dx_message_content_t |
* | | +----->| |
* +--------------+ | +----------------------+
* | |
* +--------------+ | | +-------------+ +-------------+ +-------------+
- * | | | +--->| nx_buffer_t |-->| nx_buffer_t |-->| nx_buffer_t |--/
- * | nx_message_t |-----+ +-------------+ +-------------+ +-------------+
+ * | | | +--->| dx_buffer_t |-->| dx_buffer_t |-->| dx_buffer_t |--/
+ * | dx_message_t |-----+ +-------------+ +-------------+ +-------------+
* | |
* +--------------+
*
@@ -45,14 +45,14 @@
*/
typedef struct {
- nx_buffer_t *buffer; // Buffer that contains the first octet of the field, null if the field is not present
+ dx_buffer_t *buffer; // Buffer that contains the first octet of the field, null if the field is not present
size_t offset; // Offset in the buffer to the first octet
size_t length; // Length of the field or zero if unneeded
int parsed; // non-zero iff the buffer chain has been parsed to find this field
-} nx_field_location_t;
+} dx_field_location_t;
-// TODO - consider using pointers to nx_field_location_t below to save memory
+// TODO - consider using pointers to dx_field_location_t below to save memory
// TODO - we need a second buffer list for modified annotations and header
// There are three message scenarios:
// 1) Received message is held and forwarded unmodified - single buffer list
@@ -62,33 +62,33 @@ typedef struct {
typedef struct {
sys_mutex_t *lock;
uint32_t ref_count; // The number of qmessages referencing this
- nx_buffer_list_t buffers; // The buffer chain containing the message
+ dx_buffer_list_t buffers; // The buffer chain containing the message
pn_delivery_t *in_delivery; // The delivery on which the message arrived
- nx_field_location_t section_message_header; // The message header list
- nx_field_location_t section_delivery_annotation; // The delivery annotation map
- nx_field_location_t section_message_annotation; // The message annotation map
- nx_field_location_t section_message_properties; // The message properties list
- nx_field_location_t section_application_properties; // The application properties list
- nx_field_location_t section_body; // The message body: Data
- nx_field_location_t section_footer; // The footer
- nx_field_location_t field_user_id; // The string value of the user-id
- nx_field_location_t field_to; // The string value of the to field
- nx_field_location_t body; // The body of the message
- nx_field_location_t compose_length;
- nx_field_location_t compose_count;
+ dx_field_location_t section_message_header; // The message header list
+ dx_field_location_t section_delivery_annotation; // The delivery annotation map
+ dx_field_location_t section_message_annotation; // The message annotation map
+ dx_field_location_t section_message_properties; // The message properties list
+ dx_field_location_t section_application_properties; // The application properties list
+ dx_field_location_t section_body; // The message body: Data
+ dx_field_location_t section_footer; // The footer
+ dx_field_location_t field_user_id; // The string value of the user-id
+ dx_field_location_t field_to; // The string value of the to field
+ dx_field_location_t body; // The body of the message
+ dx_field_location_t compose_length;
+ dx_field_location_t compose_count;
uint32_t length;
uint32_t count;
-} nx_message_content_t;
+} dx_message_content_t;
typedef struct {
- DEQ_LINKS(nx_message_t); // Deq linkage that overlays the nx_message_t
- nx_message_content_t *content;
+ DEQ_LINKS(dx_message_t); // Deq linkage that overlays the dx_message_t
+ dx_message_content_t *content;
pn_delivery_t *out_delivery;
-} nx_message_pvt_t;
+} dx_message_pvt_t;
-ALLOC_DECLARE(nx_message_t);
-ALLOC_DECLARE(nx_message_content_t);
+ALLOC_DECLARE(dx_message_t);
+ALLOC_DECLARE(dx_message_content_t);
-#define MSG_CONTENT(m) (((nx_message_pvt_t*) m)->content)
+#define MSG_CONTENT(m) (((dx_message_pvt_t*) m)->content)
#endif
Modified: qpid/trunk/qpid/extras/dispatch/src/posix/threading.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/posix/threading.c?rev=1448649&r1=1446735&r2=1448649&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/posix/threading.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/posix/threading.c Thu Feb 21 14:28:48 2013
@@ -17,8 +17,8 @@
* under the License.
*/
-#include <qpid/nexus/threading.h>
-#include <qpid/nexus/ctools.h>
+#include <qpid/dispatch/threading.h>
+#include <qpid/dispatch/ctools.h>
#include <stdio.h>
#include <pthread.h>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org