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/11/19 20:21:32 UTC
svn commit: r1543534 [3/8] - in /qpid/dispatch/trunk: ./ etc/
include/qpid/dispatch/ python/qpiddx/router/ router/ router/src/ src/
tests/ tools/src/py/
Modified: qpid/dispatch/trunk/src/compose.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/compose.c?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/compose.c (original)
+++ qpid/dispatch/trunk/src/compose.c Tue Nov 19 19:21:30 2013
@@ -24,36 +24,36 @@
#include "compose_private.h"
#include <memory.h>
-ALLOC_DEFINE(dx_composite_t);
-ALLOC_DEFINE(dx_composed_field_t);
+ALLOC_DEFINE(qd_composite_t);
+ALLOC_DEFINE(qd_composed_field_t);
-static void bump_count(dx_composed_field_t *field)
+static void bump_count(qd_composed_field_t *field)
{
- dx_composite_t *comp = DEQ_HEAD(field->fieldStack);
+ qd_composite_t *comp = DEQ_HEAD(field->fieldStack);
if (comp)
comp->count++;
}
-static void dx_insert(dx_composed_field_t *field, const uint8_t *seq, size_t len)
+static void qd_insert(qd_composed_field_t *field, const uint8_t *seq, size_t len)
{
- dx_buffer_t *buf = DEQ_TAIL(field->buffers);
- dx_composite_t *comp = DEQ_HEAD(field->fieldStack);
+ qd_buffer_t *buf = DEQ_TAIL(field->buffers);
+ qd_composite_t *comp = DEQ_HEAD(field->fieldStack);
while (len > 0) {
- if (buf == 0 || dx_buffer_capacity(buf) == 0) {
- buf = dx_buffer();
+ if (buf == 0 || qd_buffer_capacity(buf) == 0) {
+ buf = qd_buffer();
if (buf == 0)
return;
DEQ_INSERT_TAIL(field->buffers, buf);
}
- size_t to_copy = dx_buffer_capacity(buf);
+ size_t to_copy = qd_buffer_capacity(buf);
if (to_copy > len)
to_copy = len;
- memcpy(dx_buffer_cursor(buf), seq, to_copy);
- dx_buffer_insert(buf, to_copy);
+ memcpy(qd_buffer_cursor(buf), seq, to_copy);
+ qd_buffer_insert(buf, to_copy);
len -= to_copy;
seq += to_copy;
if (comp)
@@ -62,24 +62,24 @@ static void dx_insert(dx_composed_field_
}
-static void dx_insert_8(dx_composed_field_t *field, uint8_t value)
+static void qd_insert_8(qd_composed_field_t *field, uint8_t value)
{
- dx_insert(field, &value, 1);
+ qd_insert(field, &value, 1);
}
-static void dx_insert_32(dx_composed_field_t *field, uint32_t value)
+static void qd_insert_32(qd_composed_field_t *field, 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);
- dx_insert(field, buf, 4);
+ qd_insert(field, buf, 4);
}
-static void dx_insert_64(dx_composed_field_t *field, uint64_t value)
+static void qd_insert_64(qd_composed_field_t *field, uint64_t value)
{
uint8_t buf[8];
buf[0] = (uint8_t) ((value & 0xFF00000000000000L) >> 56);
@@ -90,18 +90,18 @@ static void dx_insert_64(dx_composed_fie
buf[5] = (uint8_t) ((value & 0x0000000000FF0000L) >> 16);
buf[6] = (uint8_t) ((value & 0x000000000000FF00L) >> 8);
buf[7] = (uint8_t) (value & 0x00000000000000FFL);
- dx_insert(field, buf, 8);
+ qd_insert(field, buf, 8);
}
-static void dx_overwrite(dx_buffer_t **buf, size_t *cursor, uint8_t value)
+static void qd_overwrite(qd_buffer_t **buf, size_t *cursor, uint8_t value)
{
while (*buf) {
- if (*cursor >= dx_buffer_size(*buf)) {
+ if (*cursor >= qd_buffer_size(*buf)) {
*buf = (*buf)->next;
*cursor = 0;
} else {
- dx_buffer_base(*buf)[*cursor] = value;
+ qd_buffer_base(*buf)[*cursor] = value;
(*cursor)++;
return;
}
@@ -109,29 +109,29 @@ static void dx_overwrite(dx_buffer_t **b
}
-static void dx_overwrite_32(dx_field_location_t *field, uint32_t value)
+static void qd_overwrite_32(qd_field_location_t *field, uint32_t value)
{
- dx_buffer_t *buf = field->buffer;
+ qd_buffer_t *buf = field->buffer;
size_t cursor = field->offset;
- dx_overwrite(&buf, &cursor, (uint8_t) ((value & 0xFF000000) >> 24));
- dx_overwrite(&buf, &cursor, (uint8_t) ((value & 0x00FF0000) >> 16));
- dx_overwrite(&buf, &cursor, (uint8_t) ((value & 0x0000FF00) >> 8));
- dx_overwrite(&buf, &cursor, (uint8_t) (value & 0x000000FF));
+ qd_overwrite(&buf, &cursor, (uint8_t) ((value & 0xFF000000) >> 24));
+ qd_overwrite(&buf, &cursor, (uint8_t) ((value & 0x00FF0000) >> 16));
+ qd_overwrite(&buf, &cursor, (uint8_t) ((value & 0x0000FF00) >> 8));
+ qd_overwrite(&buf, &cursor, (uint8_t) (value & 0x000000FF));
}
-static void dx_compose_start_composite(dx_composed_field_t *field, int isMap)
+static void qd_compose_start_composite(qd_composed_field_t *field, int isMap)
{
if (isMap)
- dx_insert_8(field, DX_AMQP_MAP32);
+ qd_insert_8(field, QD_AMQP_MAP32);
else
- dx_insert_8(field, DX_AMQP_LIST32);
+ qd_insert_8(field, QD_AMQP_LIST32);
//
// Push a composite descriptor on the field stack
//
- dx_composite_t *comp = new_dx_composite_t();
+ qd_composite_t *comp = new_qd_composite_t();
DEQ_ITEM_INIT(comp);
comp->isMap = isMap;
@@ -139,21 +139,21 @@ static void dx_compose_start_composite(d
// Mark the current location to later overwrite the length
//
comp->length_location.buffer = DEQ_TAIL(field->buffers);
- comp->length_location.offset = dx_buffer_size(comp->length_location.buffer);
+ comp->length_location.offset = qd_buffer_size(comp->length_location.buffer);
comp->length_location.length = 4;
comp->length_location.parsed = 1;
- dx_insert(field, (const uint8_t*) "\x00\x00\x00\x00", 4);
+ qd_insert(field, (const uint8_t*) "\x00\x00\x00\x00", 4);
//
// Mark the current location to later overwrite the count
//
comp->count_location.buffer = DEQ_TAIL(field->buffers);
- comp->count_location.offset = dx_buffer_size(comp->count_location.buffer);
+ comp->count_location.offset = qd_buffer_size(comp->count_location.buffer);
comp->count_location.length = 4;
comp->count_location.parsed = 1;
- dx_insert(field, (const uint8_t*) "\x00\x00\x00\x00", 4);
+ qd_insert(field, (const uint8_t*) "\x00\x00\x00\x00", 4);
comp->length = 4; // Include the length of the count field
comp->count = 0;
@@ -162,37 +162,37 @@ static void dx_compose_start_composite(d
}
-static void dx_compose_end_composite(dx_composed_field_t *field)
+static void qd_compose_end_composite(qd_composed_field_t *field)
{
- dx_composite_t *comp = DEQ_HEAD(field->fieldStack);
+ qd_composite_t *comp = DEQ_HEAD(field->fieldStack);
assert(comp);
- dx_overwrite_32(&comp->length_location, comp->length);
- dx_overwrite_32(&comp->count_location, comp->count);
+ qd_overwrite_32(&comp->length_location, comp->length);
+ qd_overwrite_32(&comp->count_location, comp->count);
DEQ_REMOVE_HEAD(field->fieldStack);
//
// If there is an enclosing composite, update its length and count
//
- dx_composite_t *enclosing = DEQ_HEAD(field->fieldStack);
+ qd_composite_t *enclosing = DEQ_HEAD(field->fieldStack);
if (enclosing) {
enclosing->length += (comp->length - 4); // the length and count were already accounted for
enclosing->count++;
}
- free_dx_composite_t(comp);
+ free_qd_composite_t(comp);
}
-dx_composed_field_t *dx_compose(uint64_t performative, dx_composed_field_t *extend)
+qd_composed_field_t *qd_compose(uint64_t performative, qd_composed_field_t *extend)
{
- dx_composed_field_t *field = extend;
+ qd_composed_field_t *field = extend;
if (field) {
assert(DEQ_SIZE(field->fieldStack) == 0);
} else {
- field = new_dx_composed_field_t();
+ field = new_qd_composed_field_t();
if (!field)
return 0;
@@ -200,174 +200,174 @@ dx_composed_field_t *dx_compose(uint64_t
DEQ_INIT(field->fieldStack);
}
- dx_insert_8(field, 0x00);
- dx_compose_insert_ulong(field, performative);
+ qd_insert_8(field, 0x00);
+ qd_compose_insert_ulong(field, performative);
return field;
}
-void dx_compose_free(dx_composed_field_t *field)
+void qd_compose_free(qd_composed_field_t *field)
{
- dx_buffer_t *buf = DEQ_HEAD(field->buffers);
+ qd_buffer_t *buf = DEQ_HEAD(field->buffers);
while (buf) {
DEQ_REMOVE_HEAD(field->buffers);
- dx_buffer_free(buf);
+ qd_buffer_free(buf);
buf = DEQ_HEAD(field->buffers);
}
- dx_composite_t *comp = DEQ_HEAD(field->fieldStack);
+ qd_composite_t *comp = DEQ_HEAD(field->fieldStack);
while (comp) {
DEQ_REMOVE_HEAD(field->fieldStack);
- free_dx_composite_t(comp);
+ free_qd_composite_t(comp);
comp = DEQ_HEAD(field->fieldStack);
}
- free_dx_composed_field_t(field);
+ free_qd_composed_field_t(field);
}
-void dx_compose_start_list(dx_composed_field_t *field)
+void qd_compose_start_list(qd_composed_field_t *field)
{
- dx_compose_start_composite(field, 0);
+ qd_compose_start_composite(field, 0);
}
-void dx_compose_end_list(dx_composed_field_t *field)
+void qd_compose_end_list(qd_composed_field_t *field)
{
- dx_compose_end_composite(field);
+ qd_compose_end_composite(field);
}
-void dx_compose_empty_list(dx_composed_field_t *field)
+void qd_compose_empty_list(qd_composed_field_t *field)
{
- dx_insert_8(field, DX_AMQP_LIST0);
+ qd_insert_8(field, QD_AMQP_LIST0);
bump_count(field);
}
-void dx_compose_start_map(dx_composed_field_t *field)
+void qd_compose_start_map(qd_composed_field_t *field)
{
- dx_compose_start_composite(field, 1);
+ qd_compose_start_composite(field, 1);
}
-void dx_compose_end_map(dx_composed_field_t *field)
+void qd_compose_end_map(qd_composed_field_t *field)
{
- dx_compose_end_composite(field);
+ qd_compose_end_composite(field);
}
-void dx_compose_insert_null(dx_composed_field_t *field)
+void qd_compose_insert_null(qd_composed_field_t *field)
{
- dx_insert_8(field, DX_AMQP_NULL);
+ qd_insert_8(field, QD_AMQP_NULL);
bump_count(field);
}
-void dx_compose_insert_bool(dx_composed_field_t *field, int value)
+void qd_compose_insert_bool(qd_composed_field_t *field, int value)
{
- dx_insert_8(field, value ? DX_AMQP_TRUE : DX_AMQP_FALSE);
+ qd_insert_8(field, value ? QD_AMQP_TRUE : QD_AMQP_FALSE);
bump_count(field);
}
-void dx_compose_insert_uint(dx_composed_field_t *field, uint32_t value)
+void qd_compose_insert_uint(qd_composed_field_t *field, uint32_t value)
{
if (value == 0) {
- dx_insert_8(field, DX_AMQP_UINT0);
+ qd_insert_8(field, QD_AMQP_UINT0);
} else if (value < 256) {
- dx_insert_8(field, DX_AMQP_SMALLUINT);
- dx_insert_8(field, (uint8_t) value);
+ qd_insert_8(field, QD_AMQP_SMALLUINT);
+ qd_insert_8(field, (uint8_t) value);
} else {
- dx_insert_8(field, DX_AMQP_UINT);
- dx_insert_32(field, value);
+ qd_insert_8(field, QD_AMQP_UINT);
+ qd_insert_32(field, value);
}
bump_count(field);
}
-void dx_compose_insert_ulong(dx_composed_field_t *field, uint64_t value)
+void qd_compose_insert_ulong(qd_composed_field_t *field, uint64_t value)
{
if (value == 0) {
- dx_insert_8(field, DX_AMQP_ULONG0);
+ qd_insert_8(field, QD_AMQP_ULONG0);
} else if (value < 256) {
- dx_insert_8(field, DX_AMQP_SMALLULONG);
- dx_insert_8(field, (uint8_t) value);
+ qd_insert_8(field, QD_AMQP_SMALLULONG);
+ qd_insert_8(field, (uint8_t) value);
} else {
- dx_insert_8(field, DX_AMQP_ULONG);
- dx_insert_64(field, value);
+ qd_insert_8(field, QD_AMQP_ULONG);
+ qd_insert_64(field, value);
}
bump_count(field);
}
-void dx_compose_insert_int(dx_composed_field_t *field, int32_t value)
+void qd_compose_insert_int(qd_composed_field_t *field, int32_t value)
{
if (value >= -128 && value <= 127) {
- dx_insert_8(field, DX_AMQP_SMALLINT);
- dx_insert_8(field, (uint8_t) value);
+ qd_insert_8(field, QD_AMQP_SMALLINT);
+ qd_insert_8(field, (uint8_t) value);
} else {
- dx_insert_8(field, DX_AMQP_INT);
- dx_insert_32(field, (uint32_t) value);
+ qd_insert_8(field, QD_AMQP_INT);
+ qd_insert_32(field, (uint32_t) value);
}
bump_count(field);
}
-void dx_compose_insert_long(dx_composed_field_t *field, int64_t value)
+void qd_compose_insert_long(qd_composed_field_t *field, int64_t value)
{
if (value >= -128 && value <= 127) {
- dx_insert_8(field, DX_AMQP_SMALLLONG);
- dx_insert_8(field, (uint8_t) value);
+ qd_insert_8(field, QD_AMQP_SMALLLONG);
+ qd_insert_8(field, (uint8_t) value);
} else {
- dx_insert_8(field, DX_AMQP_LONG);
- dx_insert_64(field, (uint64_t) value);
+ qd_insert_8(field, QD_AMQP_LONG);
+ qd_insert_64(field, (uint64_t) value);
}
bump_count(field);
}
-void dx_compose_insert_timestamp(dx_composed_field_t *field, uint64_t value)
+void qd_compose_insert_timestamp(qd_composed_field_t *field, uint64_t value)
{
- dx_insert_8(field, DX_AMQP_TIMESTAMP);
- dx_insert_64(field, value);
+ qd_insert_8(field, QD_AMQP_TIMESTAMP);
+ qd_insert_64(field, value);
bump_count(field);
}
-void dx_compose_insert_uuid(dx_composed_field_t *field, const uint8_t *value)
+void qd_compose_insert_uuid(qd_composed_field_t *field, const uint8_t *value)
{
- dx_insert_8(field, DX_AMQP_UUID);
- dx_insert(field, value, 16);
+ qd_insert_8(field, QD_AMQP_UUID);
+ qd_insert(field, value, 16);
bump_count(field);
}
-void dx_compose_insert_binary(dx_composed_field_t *field, const uint8_t *value, uint32_t len)
+void qd_compose_insert_binary(qd_composed_field_t *field, const uint8_t *value, uint32_t len)
{
if (len < 256) {
- dx_insert_8(field, DX_AMQP_VBIN8);
- dx_insert_8(field, (uint8_t) len);
+ qd_insert_8(field, QD_AMQP_VBIN8);
+ qd_insert_8(field, (uint8_t) len);
} else {
- dx_insert_8(field, DX_AMQP_VBIN32);
- dx_insert_32(field, len);
+ qd_insert_8(field, QD_AMQP_VBIN32);
+ qd_insert_32(field, len);
}
- dx_insert(field, value, len);
+ qd_insert(field, value, len);
bump_count(field);
}
-void dx_compose_insert_binary_buffers(dx_composed_field_t *field, dx_buffer_list_t *buffers)
+void qd_compose_insert_binary_buffers(qd_composed_field_t *field, qd_buffer_list_t *buffers)
{
- dx_buffer_t *buf = DEQ_HEAD(*buffers);
+ qd_buffer_t *buf = DEQ_HEAD(*buffers);
uint32_t len = 0;
//
// Calculate the size of the binary field to be appended.
//
while (buf) {
- len += dx_buffer_size(buf);
+ len += qd_buffer_size(buf);
buf = DEQ_NEXT(buf);
}
@@ -375,11 +375,11 @@ void dx_compose_insert_binary_buffers(dx
// Supply the appropriate binary tag for the length.
//
if (len < 256) {
- dx_insert_8(field, DX_AMQP_VBIN8);
- dx_insert_8(field, (uint8_t) len);
+ qd_insert_8(field, QD_AMQP_VBIN8);
+ qd_insert_8(field, (uint8_t) len);
} else {
- dx_insert_8(field, DX_AMQP_VBIN32);
- dx_insert_32(field, len);
+ qd_insert_8(field, QD_AMQP_VBIN32);
+ qd_insert_32(field, len);
}
//
@@ -394,78 +394,78 @@ void dx_compose_insert_binary_buffers(dx
}
-void dx_compose_insert_string(dx_composed_field_t *field, const char *value)
+void qd_compose_insert_string(qd_composed_field_t *field, const char *value)
{
uint32_t len = strlen(value);
if (len < 256) {
- dx_insert_8(field, DX_AMQP_STR8_UTF8);
- dx_insert_8(field, (uint8_t) len);
+ qd_insert_8(field, QD_AMQP_STR8_UTF8);
+ qd_insert_8(field, (uint8_t) len);
} else {
- dx_insert_8(field, DX_AMQP_STR32_UTF8);
- dx_insert_32(field, len);
+ qd_insert_8(field, QD_AMQP_STR32_UTF8);
+ qd_insert_32(field, len);
}
- dx_insert(field, (const uint8_t*) value, len);
+ qd_insert(field, (const uint8_t*) value, len);
bump_count(field);
}
-void dx_compose_insert_string_iterator(dx_composed_field_t *field, dx_field_iterator_t *iter)
+void qd_compose_insert_string_iterator(qd_composed_field_t *field, qd_field_iterator_t *iter)
{
uint32_t len = 0;
- while (!dx_field_iterator_end(iter)) {
- dx_field_iterator_octet(iter);
+ while (!qd_field_iterator_end(iter)) {
+ qd_field_iterator_octet(iter);
len++;
}
- dx_field_iterator_reset(iter);
+ qd_field_iterator_reset(iter);
if (len < 256) {
- dx_insert_8(field, DX_AMQP_STR8_UTF8);
- dx_insert_8(field, (uint8_t) len);
+ qd_insert_8(field, QD_AMQP_STR8_UTF8);
+ qd_insert_8(field, (uint8_t) len);
} else {
- dx_insert_8(field, DX_AMQP_STR32_UTF8);
- dx_insert_32(field, len);
+ qd_insert_8(field, QD_AMQP_STR32_UTF8);
+ qd_insert_32(field, len);
}
- while (!dx_field_iterator_end(iter)) {
- uint8_t octet = dx_field_iterator_octet(iter);
- dx_insert_8(field, octet);
+ while (!qd_field_iterator_end(iter)) {
+ uint8_t octet = qd_field_iterator_octet(iter);
+ qd_insert_8(field, octet);
}
bump_count(field);
}
-void dx_compose_insert_symbol(dx_composed_field_t *field, const char *value)
+void qd_compose_insert_symbol(qd_composed_field_t *field, const char *value)
{
uint32_t len = strlen(value);
if (len < 256) {
- dx_insert_8(field, DX_AMQP_SYM8);
- dx_insert_8(field, (uint8_t) len);
+ qd_insert_8(field, QD_AMQP_SYM8);
+ qd_insert_8(field, (uint8_t) len);
} else {
- dx_insert_8(field, DX_AMQP_SYM32);
- dx_insert_32(field, len);
+ qd_insert_8(field, QD_AMQP_SYM32);
+ qd_insert_32(field, len);
}
- dx_insert(field, (const uint8_t*) value, len);
+ qd_insert(field, (const uint8_t*) value, len);
bump_count(field);
}
-void dx_compose_insert_typed_iterator(dx_composed_field_t *field, dx_field_iterator_t *iter)
+void qd_compose_insert_typed_iterator(qd_composed_field_t *field, qd_field_iterator_t *iter)
{
- while (!dx_field_iterator_end(iter)) {
- uint8_t octet = dx_field_iterator_octet(iter);
- dx_insert_8(field, octet);
+ while (!qd_field_iterator_end(iter)) {
+ uint8_t octet = qd_field_iterator_octet(iter);
+ qd_insert_8(field, octet);
}
bump_count(field);
}
-dx_buffer_list_t *dx_compose_buffers(dx_composed_field_t *field)
+qd_buffer_list_t *qd_compose_buffers(qd_composed_field_t *field)
{
return &field->buffers;
}
Modified: qpid/dispatch/trunk/src/compose_private.h
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/compose_private.h?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/compose_private.h (original)
+++ qpid/dispatch/trunk/src/compose_private.h Tue Nov 19 19:21:30 2013
@@ -22,26 +22,26 @@
#include <qpid/dispatch/compose.h>
#include "message_private.h"
-dx_buffer_list_t *dx_compose_buffers(dx_composed_field_t *field);
+qd_buffer_list_t *qd_compose_buffers(qd_composed_field_t *field);
-typedef struct dx_composite_t {
- DEQ_LINKS(struct dx_composite_t);
+typedef struct qd_composite_t {
+ DEQ_LINKS(struct qd_composite_t);
int isMap;
uint32_t count;
uint32_t length;
- dx_field_location_t length_location;
- dx_field_location_t count_location;
-} dx_composite_t;
+ qd_field_location_t length_location;
+ qd_field_location_t count_location;
+} qd_composite_t;
-ALLOC_DECLARE(dx_composite_t);
-DEQ_DECLARE(dx_composite_t, dx_field_stack_t);
+ALLOC_DECLARE(qd_composite_t);
+DEQ_DECLARE(qd_composite_t, qd_field_stack_t);
-struct dx_composed_field_t {
- dx_buffer_list_t buffers;
- dx_field_stack_t fieldStack;
+struct qd_composed_field_t {
+ qd_buffer_list_t buffers;
+ qd_field_stack_t fieldStack;
};
-ALLOC_DECLARE(dx_composed_field_t);
+ALLOC_DECLARE(qd_composed_field_t);
#endif
Modified: qpid/dispatch/trunk/src/config.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/config.c?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/config.c (original)
+++ qpid/dispatch/trunk/src/config.c Tue Nov 19 19:21:30 2013
@@ -26,30 +26,30 @@
static const char *log_module = "CONFIG";
-struct dx_config_t {
+struct qd_config_t {
PyObject *pModule;
PyObject *pClass;
PyObject *pObject;
};
-ALLOC_DECLARE(dx_config_t);
-ALLOC_DEFINE(dx_config_t);
+ALLOC_DECLARE(qd_config_t);
+ALLOC_DEFINE(qd_config_t);
-void dx_config_initialize()
+void qd_config_initialize()
{
- dx_python_start();
+ qd_python_start();
}
-void dx_config_finalize()
+void qd_config_finalize()
{
- dx_python_stop();
+ qd_python_stop();
}
-dx_config_t *dx_config(const char *filename)
+qd_config_t *qd_config(const char *filename)
{
- dx_config_t *config = new_dx_config_t();
+ qd_config_t *config = new_qd_config_t();
//
// Load the Python configuration module and get a reference to the config class.
@@ -60,8 +60,8 @@ dx_config_t *dx_config(const char *filen
if (!config->pModule) {
PyErr_Print();
- free_dx_config_t(config);
- dx_log(log_module, LOG_ERROR, "Unable to load configuration module: %s", PYTHON_MODULE);
+ free_qd_config_t(config);
+ qd_log(log_module, LOG_ERROR, "Unable to load configuration module: %s", PYTHON_MODULE);
return 0;
}
@@ -69,8 +69,8 @@ dx_config_t *dx_config(const char *filen
if (!config->pClass || !PyClass_Check(config->pClass)) {
PyErr_Print();
Py_DECREF(config->pModule);
- free_dx_config_t(config);
- dx_log(log_module, LOG_ERROR, "Problem with configuration module: Missing DXConfig class");
+ free_qd_config_t(config);
+ qd_log(log_module, LOG_ERROR, "Problem with configuration module: Missing DXConfig class");
return 0;
}
@@ -86,8 +86,8 @@ dx_config_t *dx_config(const char *filen
if (config->pObject == 0) {
PyErr_Print();
Py_DECREF(config->pModule);
- free_dx_config_t(config);
- dx_log(log_module, LOG_ERROR, "Configuration file '%s' could not be read", filename);
+ free_qd_config_t(config);
+ qd_log(log_module, LOG_ERROR, "Configuration file '%s' could not be read", filename);
return 0;
}
@@ -95,7 +95,7 @@ dx_config_t *dx_config(const char *filen
}
-void dx_config_read(dx_config_t *config)
+void qd_config_read(qd_config_t *config)
{
PyObject *pMethod;
PyObject *pArgs;
@@ -106,7 +106,7 @@ void dx_config_read(dx_config_t *config)
pMethod = PyObject_GetAttrString(config->pObject, "read_file");
if (!pMethod || !PyCallable_Check(pMethod)) {
- dx_log(log_module, LOG_ERROR, "Problem with configuration module: No callable 'item_count'");
+ qd_log(log_module, LOG_ERROR, "Problem with configuration module: No callable 'item_count'");
if (pMethod) {
Py_DECREF(pMethod);
}
@@ -125,17 +125,17 @@ void dx_config_read(dx_config_t *config)
}
-void dx_config_free(dx_config_t *config)
+void qd_config_free(qd_config_t *config)
{
if (config) {
Py_DECREF(config->pClass);
Py_DECREF(config->pModule);
- free_dx_config_t(config);
+ free_qd_config_t(config);
}
}
-int dx_config_item_count(const dx_config_t *config, const char *section)
+int qd_config_item_count(const qd_config_t *config, const char *section)
{
PyObject *pSection;
PyObject *pMethod;
@@ -148,7 +148,7 @@ int dx_config_item_count(const dx_config
pMethod = PyObject_GetAttrString(config->pObject, "item_count");
if (!pMethod || !PyCallable_Check(pMethod)) {
- dx_log(log_module, LOG_ERROR, "Problem with configuration module: No callable 'item_count'");
+ qd_log(log_module, LOG_ERROR, "Problem with configuration module: No callable 'item_count'");
if (pMethod) {
Py_DECREF(pMethod);
}
@@ -171,7 +171,7 @@ int dx_config_item_count(const dx_config
}
-static PyObject *item_value(const dx_config_t *config, const char *section, int index, const char* key, const char* method)
+static PyObject *item_value(const qd_config_t *config, const char *section, int index, const char* key, const char* method)
{
PyObject *pSection;
PyObject *pIndex;
@@ -185,7 +185,7 @@ static PyObject *item_value(const dx_con
pMethod = PyObject_GetAttrString(config->pObject, method);
if (!pMethod || !PyCallable_Check(pMethod)) {
- dx_log(log_module, LOG_ERROR, "Problem with configuration module: No callable '%s'", method);
+ qd_log(log_module, LOG_ERROR, "Problem with configuration module: No callable '%s'", method);
if (pMethod) {
Py_DECREF(pMethod);
}
@@ -207,7 +207,7 @@ static PyObject *item_value(const dx_con
}
-const char *dx_config_item_value_string(const dx_config_t *config, const char *section, int index, const char* key)
+const char *qd_config_item_value_string(const qd_config_t *config, const char *section, int index, const char* key)
{
PyObject *pResult = item_value(config, section, index, key, "value_string");
char *value = 0;
@@ -226,7 +226,7 @@ const char *dx_config_item_value_string(
}
-uint32_t dx_config_item_value_int(const dx_config_t *config, const char *section, int index, const char* key)
+uint32_t qd_config_item_value_int(const qd_config_t *config, const char *section, int index, const char* key)
{
PyObject *pResult = item_value(config, section, index, key, "value_int");
uint32_t value = 0;
@@ -242,7 +242,7 @@ uint32_t dx_config_item_value_int(const
}
-int dx_config_item_value_bool(const dx_config_t *config, const char *section, int index, const char* key)
+int qd_config_item_value_bool(const qd_config_t *config, const char *section, int index, const char* key)
{
PyObject *pResult = item_value(config, section, index, key, "value_bool");
int value = 0;
Modified: qpid/dispatch/trunk/src/config_private.h
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/config_private.h?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/config_private.h (original)
+++ qpid/dispatch/trunk/src/config_private.h Tue Nov 19 19:21:30 2013
@@ -21,10 +21,10 @@
#include <qpid/dispatch/config.h>
-void dx_config_initialize();
-void dx_config_finalize();
-dx_config_t *dx_config(const char *filename);
-void dx_config_read(dx_config_t *config);
-void dx_config_free(dx_config_t *config);
+void qd_config_initialize();
+void qd_config_finalize();
+qd_config_t *qd_config(const char *filename);
+void qd_config_read(qd_config_t *config);
+void qd_config_free(qd_config_t *config);
#endif
Modified: qpid/dispatch/trunk/src/container.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/container.c?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/container.c (original)
+++ qpid/dispatch/trunk/src/container.c Tue Nov 19 19:21:30 2013
@@ -42,83 +42,83 @@ static bool pn_link_get_drain(pn_link_t
static char *module="CONTAINER";
-struct dx_node_t {
- dx_container_t *container;
- const dx_node_type_t *ntype;
+struct qd_node_t {
+ qd_container_t *container;
+ const qd_node_type_t *ntype;
char *name;
void *context;
- dx_dist_mode_t supported_dist;
- dx_lifetime_policy_t life_policy;
+ qd_dist_mode_t supported_dist;
+ qd_lifetime_policy_t life_policy;
};
-ALLOC_DECLARE(dx_node_t);
-ALLOC_DEFINE(dx_node_t);
-ALLOC_DEFINE(dx_link_item_t);
+ALLOC_DECLARE(qd_node_t);
+ALLOC_DEFINE(qd_node_t);
+ALLOC_DEFINE(qd_link_item_t);
-struct dx_link_t {
+struct qd_link_t {
pn_link_t *pn_link;
void *context;
- dx_node_t *node;
+ qd_node_t *node;
bool drain_mode;
};
-ALLOC_DECLARE(dx_link_t);
-ALLOC_DEFINE(dx_link_t);
+ALLOC_DECLARE(qd_link_t);
+ALLOC_DEFINE(qd_link_t);
-struct dx_delivery_t {
+struct qd_delivery_t {
pn_delivery_t *pn_delivery;
- dx_delivery_t *peer;
+ qd_delivery_t *peer;
void *context;
uint64_t disposition;
- dx_link_t *link;
+ qd_link_t *link;
};
-ALLOC_DECLARE(dx_delivery_t);
-ALLOC_DEFINE(dx_delivery_t);
+ALLOC_DECLARE(qd_delivery_t);
+ALLOC_DEFINE(qd_delivery_t);
-typedef struct dxc_node_type_t {
- DEQ_LINKS(struct dxc_node_type_t);
- const dx_node_type_t *ntype;
-} dxc_node_type_t;
-DEQ_DECLARE(dxc_node_type_t, dxc_node_type_list_t);
-
-static int DX_CONTAINER_CLASS_CONTAINER = 1;
-static int DX_CONTAINER_CLASS_NODE_TYPE = 2;
-static int DX_CONTAINER_CLASS_NODE = 3;
+typedef struct qdc_node_type_t {
+ DEQ_LINKS(struct qdc_node_type_t);
+ const qd_node_type_t *ntype;
+} qdc_node_type_t;
+DEQ_DECLARE(qdc_node_type_t, qdc_node_type_list_t);
+
+static int QD_CONTAINER_CLASS_CONTAINER = 1;
+static int QD_CONTAINER_CLASS_NODE_TYPE = 2;
+static int QD_CONTAINER_CLASS_NODE = 3;
typedef struct container_class_t {
- dx_container_t *container;
+ qd_container_t *container;
int class_id;
} container_class_t;
-struct dx_container_t {
- dx_dispatch_t *dx;
- dx_server_t *server;
- dx_hash_t *node_type_map;
- dx_hash_t *node_map;
+struct qd_container_t {
+ qd_dispatch_t *qd;
+ qd_server_t *server;
+ qd_hash_t *node_type_map;
+ qd_hash_t *node_map;
sys_mutex_t *lock;
- dx_node_t *default_node;
- dxc_node_type_list_t node_type_list;
- dx_agent_class_t *class_container;
- dx_agent_class_t *class_node_type;
- dx_agent_class_t *class_node;
+ qd_node_t *default_node;
+ qdc_node_type_list_t node_type_list;
+ qd_agent_class_t *class_container;
+ qd_agent_class_t *class_node_type;
+ qd_agent_class_t *class_node;
};
-static void setup_outgoing_link(dx_container_t *container, pn_link_t *pn_link)
+static void setup_outgoing_link(qd_container_t *container, pn_link_t *pn_link)
{
sys_mutex_lock(container->lock);
- dx_node_t *node = 0;
+ qd_node_t *node = 0;
const char *source = pn_terminus_get_address(pn_link_remote_source(pn_link));
- dx_field_iterator_t *iter;
+ qd_field_iterator_t *iter;
// TODO - Extract the name from the structured source
if (source) {
- iter = dx_field_iterator_string(source, ITER_VIEW_NODE_ID);
- dx_hash_retrieve(container->node_map, iter, (void*) &node);
- dx_field_iterator_free(iter);
+ iter = qd_field_iterator_string(source, ITER_VIEW_NODE_ID);
+ qd_hash_retrieve(container->node_map, iter, (void*) &node);
+ qd_field_iterator_free(iter);
}
sys_mutex_unlock(container->lock);
@@ -133,7 +133,7 @@ static void setup_outgoing_link(dx_conta
}
}
- dx_link_t *link = new_dx_link_t();
+ qd_link_t *link = new_qd_link_t();
if (!link) {
pn_link_close(pn_link);
return;
@@ -149,18 +149,18 @@ static void setup_outgoing_link(dx_conta
}
-static void setup_incoming_link(dx_container_t *container, pn_link_t *pn_link)
+static void setup_incoming_link(qd_container_t *container, pn_link_t *pn_link)
{
sys_mutex_lock(container->lock);
- dx_node_t *node = 0;
+ qd_node_t *node = 0;
const char *target = pn_terminus_get_address(pn_link_remote_target(pn_link));
- dx_field_iterator_t *iter;
+ qd_field_iterator_t *iter;
// TODO - Extract the name from the structured target
if (target) {
- iter = dx_field_iterator_string(target, ITER_VIEW_NODE_ID);
- dx_hash_retrieve(container->node_map, iter, (void*) &node);
- dx_field_iterator_free(iter);
+ iter = qd_field_iterator_string(target, ITER_VIEW_NODE_ID);
+ qd_hash_retrieve(container->node_map, iter, (void*) &node);
+ qd_field_iterator_free(iter);
}
sys_mutex_unlock(container->lock);
@@ -175,7 +175,7 @@ static void setup_incoming_link(dx_conta
}
}
- dx_link_t *link = new_dx_link_t();
+ qd_link_t *link = new_qd_link_t();
if (!link) {
pn_link_close(pn_link);
return;
@@ -193,11 +193,11 @@ static void setup_incoming_link(dx_conta
static int do_writable(pn_link_t *pn_link)
{
- dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
+ qd_link_t *link = (qd_link_t*) pn_link_get_context(pn_link);
if (!link)
return 0;
- dx_node_t *node = link->node;
+ qd_node_t *node = link->node;
if (!node)
return 0;
@@ -208,14 +208,14 @@ static int do_writable(pn_link_t *pn_lin
static void do_receive(pn_delivery_t *pnd)
{
pn_link_t *pn_link = pn_delivery_link(pnd);
- dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
- dx_delivery_t *delivery = (dx_delivery_t*) pn_delivery_get_context(pnd);
+ qd_link_t *link = (qd_link_t*) pn_link_get_context(pn_link);
+ qd_delivery_t *delivery = (qd_delivery_t*) pn_delivery_get_context(pnd);
if (link) {
- dx_node_t *node = link->node;
+ qd_node_t *node = link->node;
if (node) {
if (!delivery) {
- delivery = new_dx_delivery_t();
+ delivery = new_qd_delivery_t();
delivery->pn_delivery = pnd;
delivery->peer = 0;
delivery->context = 0;
@@ -242,11 +242,11 @@ static void do_receive(pn_delivery_t *pn
static void do_updated(pn_delivery_t *pnd)
{
pn_link_t *pn_link = pn_delivery_link(pnd);
- dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
- dx_delivery_t *delivery = (dx_delivery_t*) pn_delivery_get_context(pnd);
+ qd_link_t *link = (qd_link_t*) pn_link_get_context(pn_link);
+ qd_delivery_t *delivery = (qd_delivery_t*) pn_delivery_get_context(pnd);
if (link && delivery) {
- dx_node_t *node = link->node;
+ qd_node_t *node = link->node;
if (node)
node->ntype->disp_handler(node->context, link, delivery);
}
@@ -261,12 +261,12 @@ static int close_handler(void* unused, p
//
pn_link_t *pn_link = pn_link_head(conn, PN_LOCAL_ACTIVE);
while (pn_link) {
- dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
- dx_node_t *node = link->node;
+ qd_link_t *link = (qd_link_t*) pn_link_get_context(pn_link);
+ qd_node_t *node = link->node;
if (node && link)
node->ntype->link_detach_handler(node->context, link, 0);
pn_link_close(pn_link);
- free_dx_link_t(link);
+ free_qd_link_t(link);
pn_link = pn_link_next(pn_link, PN_LOCAL_ACTIVE);
}
@@ -283,7 +283,7 @@ static int close_handler(void* unused, p
}
-static int process_handler(dx_container_t *container, void* unused, pn_connection_t *conn)
+static int process_handler(qd_container_t *container, void* unused, pn_connection_t *conn)
{
pn_session_t *ssn;
pn_link_t *pn_link;
@@ -355,8 +355,8 @@ static int process_handler(dx_container_
// teardown any terminating links
pn_link = pn_link_head(conn, PN_LOCAL_ACTIVE | PN_REMOTE_CLOSED);
while (pn_link) {
- dx_link_t *link = (dx_link_t*) pn_link_get_context(pn_link);
- dx_node_t *node = link->node;
+ qd_link_t *link = (qd_link_t*) pn_link_get_context(pn_link);
+ qd_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);
@@ -382,9 +382,9 @@ static int process_handler(dx_container_
}
-static void open_handler(dx_container_t *container, dx_connection_t *conn, dx_direction_t dir)
+static void open_handler(qd_container_t *container, qd_connection_t *conn, qd_direction_t dir)
{
- const dx_node_type_t *nt;
+ const qd_node_type_t *nt;
//
// Note the locking structure in this function. Generally this would be unsafe, but since
@@ -392,14 +392,14 @@ static void open_handler(dx_container_t
// this usage is safe in this case.
//
sys_mutex_lock(container->lock);
- dxc_node_type_t *nt_item = DEQ_HEAD(container->node_type_list);
+ qdc_node_type_t *nt_item = DEQ_HEAD(container->node_type_list);
sys_mutex_unlock(container->lock);
- pn_connection_open(dx_connection_pn(conn));
+ pn_connection_open(qd_connection_pn(conn));
while (nt_item) {
nt = nt_item->ntype;
- if (dir == DX_INCOMING) {
+ if (dir == QD_INCOMING) {
if (nt->inbound_conn_open_handler)
nt->inbound_conn_open_handler(nt->type_context, conn);
} else {
@@ -414,16 +414,16 @@ static void open_handler(dx_container_t
}
-static int handler(void *handler_context, void *conn_context, dx_conn_event_t event, dx_connection_t *dx_conn)
+static int handler(void *handler_context, void *conn_context, qd_conn_event_t event, qd_connection_t *qd_conn)
{
- dx_container_t *container = (dx_container_t*) handler_context;
- pn_connection_t *conn = dx_connection_pn(dx_conn);
+ qd_container_t *container = (qd_container_t*) handler_context;
+ pn_connection_t *conn = qd_connection_pn(qd_conn);
switch (event) {
- case DX_CONN_EVENT_LISTENER_OPEN: open_handler(container, dx_conn, DX_INCOMING); break;
- case DX_CONN_EVENT_CONNECTOR_OPEN: open_handler(container, dx_conn, DX_OUTGOING); break;
- case DX_CONN_EVENT_CLOSE: return close_handler(conn_context, conn);
- case DX_CONN_EVENT_PROCESS: return process_handler(container, conn_context, conn);
+ case QD_CONN_EVENT_LISTENER_OPEN: open_handler(container, qd_conn, QD_INCOMING); break;
+ case QD_CONN_EVENT_CONNECTOR_OPEN: open_handler(container, qd_conn, QD_OUTGOING); break;
+ case QD_CONN_EVENT_CLOSE: return close_handler(conn_context, conn);
+ case QD_CONN_EVENT_PROCESS: return process_handler(container, conn_context, conn);
}
return 0;
@@ -439,66 +439,66 @@ static void container_query_handler(void
{
container_class_t *cls = (container_class_t*) context;
- if (cls->class_id == DX_CONTAINER_CLASS_CONTAINER) {
- dx_agent_value_uint(correlator, "node_type_count", dx_hash_size(cls->container->node_type_map));
- dx_agent_value_uint(correlator, "node_count", dx_hash_size(cls->container->node_map));
+ if (cls->class_id == QD_CONTAINER_CLASS_CONTAINER) {
+ qd_agent_value_uint(correlator, "node_type_count", qd_hash_size(cls->container->node_type_map));
+ qd_agent_value_uint(correlator, "node_count", qd_hash_size(cls->container->node_map));
if (cls->container->default_node)
- dx_agent_value_string(correlator, "default_node_type", cls->container->default_node->ntype->type_name);
+ qd_agent_value_string(correlator, "default_node_type", cls->container->default_node->ntype->type_name);
else
- dx_agent_value_null(correlator, "default_node_type");
- dx_agent_value_complete(correlator, false);
+ qd_agent_value_null(correlator, "default_node_type");
+ qd_agent_value_complete(correlator, false);
- } else if (cls->class_id == DX_CONTAINER_CLASS_NODE_TYPE) {
+ } else if (cls->class_id == QD_CONTAINER_CLASS_NODE_TYPE) {
- } else if (cls->class_id == DX_CONTAINER_CLASS_NODE) {
+ } else if (cls->class_id == QD_CONTAINER_CLASS_NODE) {
}
}
-dx_agent_class_t *setup_class(dx_container_t *container, const char *fqname, int id)
+qd_agent_class_t *setup_class(qd_container_t *container, const char *fqname, int id)
{
container_class_t *cls = NEW(container_class_t);
cls->container = container;
cls->class_id = id;
- return dx_agent_register_class(container->dx, fqname, cls,
+ return qd_agent_register_class(container->qd, fqname, cls,
container_schema_handler,
container_query_handler);
}
-dx_container_t *dx_container(dx_dispatch_t *dx)
+qd_container_t *qd_container(qd_dispatch_t *qd)
{
- dx_container_t *container = NEW(dx_container_t);
+ qd_container_t *container = NEW(qd_container_t);
- container->dx = dx;
- container->server = dx->server;
- container->node_type_map = dx_hash(6, 4, 1); // 64 buckets, item batches of 4
- container->node_map = dx_hash(10, 32, 0); // 1K buckets, item batches of 32
+ container->qd = qd;
+ container->server = qd->server;
+ container->node_type_map = qd_hash(6, 4, 1); // 64 buckets, item batches of 4
+ container->node_map = qd_hash(10, 32, 0); // 1K buckets, item batches of 32
container->lock = sys_mutex();
container->default_node = 0;
DEQ_INIT(container->node_type_list);
- dx_log(module, LOG_TRACE, "Container Initializing");
- dx_server_set_conn_handler(dx, handler, container);
+ qd_log(module, LOG_TRACE, "Container Initializing");
+ qd_server_set_conn_handler(qd, handler, container);
return container;
}
-void dx_container_setup_agent(dx_dispatch_t *dx)
+void qd_container_setup_agent(qd_dispatch_t *qd)
{
- dx->container->class_container =
- setup_class(dx->container, "org.apache.qpid.dispatch.container", DX_CONTAINER_CLASS_CONTAINER);
- dx->container->class_node_type =
- setup_class(dx->container, "org.apache.qpid.dispatch.container.node_type", DX_CONTAINER_CLASS_NODE_TYPE);
- dx->container->class_node =
- setup_class(dx->container, "org.apache.qpid.dispatch.container.node", DX_CONTAINER_CLASS_NODE);
+ qd->container->class_container =
+ setup_class(qd->container, "org.apache.qpid.dispatch.container", QD_CONTAINER_CLASS_CONTAINER);
+ qd->container->class_node_type =
+ setup_class(qd->container, "org.apache.qpid.dispatch.container.node_type", QD_CONTAINER_CLASS_NODE_TYPE);
+ qd->container->class_node =
+ setup_class(qd->container, "org.apache.qpid.dispatch.container.node", QD_CONTAINER_CLASS_NODE);
}
-void dx_container_free(dx_container_t *container)
+void qd_container_free(qd_container_t *container)
{
// TODO - Free the nodes
// TODO - Free the node types
@@ -507,62 +507,62 @@ void dx_container_free(dx_container_t *c
}
-int dx_container_register_node_type(dx_dispatch_t *dx, const dx_node_type_t *nt)
+int qd_container_register_node_type(qd_dispatch_t *qd, const qd_node_type_t *nt)
{
- dx_container_t *container = dx->container;
+ qd_container_t *container = qd->container;
int result;
- dx_field_iterator_t *iter = dx_field_iterator_string(nt->type_name, ITER_VIEW_ALL);
- dxc_node_type_t *nt_item = NEW(dxc_node_type_t);
+ qd_field_iterator_t *iter = qd_field_iterator_string(nt->type_name, ITER_VIEW_ALL);
+ qdc_node_type_t *nt_item = NEW(qdc_node_type_t);
DEQ_ITEM_INIT(nt_item);
nt_item->ntype = nt;
sys_mutex_lock(container->lock);
- result = dx_hash_insert_const(container->node_type_map, iter, nt, 0);
+ result = qd_hash_insert_const(container->node_type_map, iter, nt, 0);
DEQ_INSERT_TAIL(container->node_type_list, nt_item);
sys_mutex_unlock(container->lock);
- dx_field_iterator_free(iter);
+ qd_field_iterator_free(iter);
if (result < 0)
return result;
- dx_log(module, LOG_TRACE, "Node Type Registered - %s", nt->type_name);
+ qd_log(module, LOG_TRACE, "Node Type Registered - %s", nt->type_name);
return 0;
}
-dx_node_t *dx_container_set_default_node_type(dx_dispatch_t *dx,
- const dx_node_type_t *nt,
+qd_node_t *qd_container_set_default_node_type(qd_dispatch_t *qd,
+ const qd_node_type_t *nt,
void *context,
- dx_dist_mode_t supported_dist)
+ qd_dist_mode_t supported_dist)
{
- dx_container_t *container = dx->container;
+ qd_container_t *container = qd->container;
if (container->default_node)
- dx_container_destroy_node(container->default_node);
+ qd_container_destroy_node(container->default_node);
if (nt) {
- container->default_node = dx_container_create_node(dx, nt, 0, context, supported_dist, DX_LIFE_PERMANENT);
- dx_log(module, LOG_TRACE, "Node of type '%s' installed as default node", nt->type_name);
+ container->default_node = qd_container_create_node(qd, nt, 0, context, supported_dist, QD_LIFE_PERMANENT);
+ qd_log(module, LOG_TRACE, "Node of type '%s' installed as default node", nt->type_name);
} else {
container->default_node = 0;
- dx_log(module, LOG_TRACE, "Default node removed");
+ qd_log(module, LOG_TRACE, "Default node removed");
}
return container->default_node;
}
-dx_node_t *dx_container_create_node(dx_dispatch_t *dx,
- const dx_node_type_t *nt,
+qd_node_t *qd_container_create_node(qd_dispatch_t *qd,
+ const qd_node_type_t *nt,
const char *name,
void *context,
- dx_dist_mode_t supported_dist,
- dx_lifetime_policy_t life_policy)
+ qd_dist_mode_t supported_dist,
+ qd_lifetime_policy_t life_policy)
{
- dx_container_t *container = dx->container;
+ qd_container_t *container = qd->container;
int result;
- dx_node_t *node = new_dx_node_t();
+ qd_node_t *node = new_qd_node_t();
if (!node)
return 0;
@@ -574,13 +574,13 @@ dx_node_t *dx_container_create_node(dx_d
node->life_policy = life_policy;
if (name) {
- dx_field_iterator_t *iter = dx_field_iterator_string(name, ITER_VIEW_ALL);
+ qd_field_iterator_t *iter = qd_field_iterator_string(name, ITER_VIEW_ALL);
sys_mutex_lock(container->lock);
- result = dx_hash_insert(container->node_map, iter, node, 0);
+ result = qd_hash_insert(container->node_map, iter, node, 0);
sys_mutex_unlock(container->lock);
- dx_field_iterator_free(iter);
+ qd_field_iterator_free(iter);
if (result < 0) {
- free_dx_node_t(node);
+ free_qd_node_t(node);
return 0;
}
@@ -589,53 +589,53 @@ dx_node_t *dx_container_create_node(dx_d
}
if (name)
- dx_log(module, LOG_TRACE, "Node of type '%s' created with name '%s'", nt->type_name, name);
+ qd_log(module, LOG_TRACE, "Node of type '%s' created with name '%s'", nt->type_name, name);
return node;
}
-void dx_container_destroy_node(dx_node_t *node)
+void qd_container_destroy_node(qd_node_t *node)
{
- dx_container_t *container = node->container;
+ qd_container_t *container = node->container;
if (node->name) {
- dx_field_iterator_t *iter = dx_field_iterator_string(node->name, ITER_VIEW_ALL);
+ qd_field_iterator_t *iter = qd_field_iterator_string(node->name, ITER_VIEW_ALL);
sys_mutex_lock(container->lock);
- dx_hash_remove(container->node_map, iter);
+ qd_hash_remove(container->node_map, iter);
sys_mutex_unlock(container->lock);
- dx_field_iterator_free(iter);
+ qd_field_iterator_free(iter);
free(node->name);
}
- free_dx_node_t(node);
+ free_qd_node_t(node);
}
-void dx_container_node_set_context(dx_node_t *node, void *node_context)
+void qd_container_node_set_context(qd_node_t *node, void *node_context)
{
node->context = node_context;
}
-dx_dist_mode_t dx_container_node_get_dist_modes(const dx_node_t *node)
+qd_dist_mode_t qd_container_node_get_dist_modes(const qd_node_t *node)
{
return node->supported_dist;
}
-dx_lifetime_policy_t dx_container_node_get_life_policy(const dx_node_t *node)
+qd_lifetime_policy_t qd_container_node_get_life_policy(const qd_node_t *node)
{
return node->life_policy;
}
-dx_link_t *dx_link(dx_node_t *node, dx_connection_t *conn, dx_direction_t dir, const char* name)
+qd_link_t *qd_link(qd_node_t *node, qd_connection_t *conn, qd_direction_t dir, const char* name)
{
- pn_session_t *sess = pn_session(dx_connection_pn(conn));
- dx_link_t *link = new_dx_link_t();
+ pn_session_t *sess = pn_session(qd_connection_pn(conn));
+ qd_link_t *link = new_qd_link_t();
- if (dir == DX_OUTGOING)
+ if (dir == QD_OUTGOING)
link->pn_link = pn_sender(sess, name);
else
link->pn_link = pn_receiver(sess, name);
@@ -652,19 +652,19 @@ dx_link_t *dx_link(dx_node_t *node, dx_c
}
-void dx_link_set_context(dx_link_t *link, void *context)
+void qd_link_set_context(qd_link_t *link, void *context)
{
link->context = context;
}
-void *dx_link_get_context(dx_link_t *link)
+void *qd_link_get_context(qd_link_t *link)
{
return link->context;
}
-void dx_link_set_conn_context(dx_link_t *link, void *context)
+void qd_link_set_conn_context(qd_link_t *link, void *context)
{
pn_session_t *pn_sess = pn_link_session(link->pn_link);
if (!pn_sess)
@@ -672,14 +672,14 @@ void dx_link_set_conn_context(dx_link_t
pn_connection_t *pn_conn = pn_session_connection(pn_sess);
if (!pn_conn)
return;
- dx_connection_t *conn = (dx_connection_t*) pn_connection_get_context(pn_conn);
+ qd_connection_t *conn = (qd_connection_t*) pn_connection_get_context(pn_conn);
if (!conn)
return;
- dx_connection_set_link_context(conn, context);
+ qd_connection_set_link_context(conn, context);
}
-void *dx_link_get_conn_context(dx_link_t *link)
+void *qd_link_get_conn_context(qd_link_t *link)
{
pn_session_t *pn_sess = pn_link_session(link->pn_link);
if (!pn_sess)
@@ -687,20 +687,20 @@ void *dx_link_get_conn_context(dx_link_t
pn_connection_t *pn_conn = pn_session_connection(pn_sess);
if (!pn_conn)
return 0;
- dx_connection_t *conn = (dx_connection_t*) pn_connection_get_context(pn_conn);
+ qd_connection_t *conn = (qd_connection_t*) pn_connection_get_context(pn_conn);
if (!conn)
return 0;
- return dx_connection_get_link_context(conn);
+ return qd_connection_get_link_context(conn);
}
-pn_link_t *dx_link_pn(dx_link_t *link)
+pn_link_t *qd_link_pn(qd_link_t *link)
{
return link->pn_link;
}
-dx_connection_t *dx_link_connection(dx_link_t *link)
+qd_connection_t *qd_link_connection(qd_link_t *link)
{
if (!link || !link->pn_link)
return 0;
@@ -713,7 +713,7 @@ dx_connection_t *dx_link_connection(dx_l
if (!conn)
return 0;
- dx_connection_t *ctx = pn_connection_get_context(conn);
+ qd_connection_t *ctx = pn_connection_get_context(conn);
if (!ctx)
return 0;
@@ -721,31 +721,31 @@ dx_connection_t *dx_link_connection(dx_l
}
-pn_terminus_t *dx_link_source(dx_link_t *link)
+pn_terminus_t *qd_link_source(qd_link_t *link)
{
return pn_link_source(link->pn_link);
}
-pn_terminus_t *dx_link_target(dx_link_t *link)
+pn_terminus_t *qd_link_target(qd_link_t *link)
{
return pn_link_target(link->pn_link);
}
-pn_terminus_t *dx_link_remote_source(dx_link_t *link)
+pn_terminus_t *qd_link_remote_source(qd_link_t *link)
{
return pn_link_remote_source(link->pn_link);
}
-pn_terminus_t *dx_link_remote_target(dx_link_t *link)
+pn_terminus_t *qd_link_remote_target(qd_link_t *link)
{
return pn_link_remote_target(link->pn_link);
}
-void dx_link_activate(dx_link_t *link)
+void qd_link_activate(qd_link_t *link)
{
if (!link || !link->pn_link || pn_link_state(link->pn_link) != (PN_LOCAL_ACTIVE|PN_REMOTE_ACTIVE))
return;
@@ -758,21 +758,21 @@ void dx_link_activate(dx_link_t *link)
if (!conn || pn_connection_state(conn) != (PN_LOCAL_ACTIVE|PN_REMOTE_ACTIVE))
return;
- dx_connection_t *ctx = pn_connection_get_context(conn);
+ qd_connection_t *ctx = pn_connection_get_context(conn);
if (!ctx)
return;
- dx_server_activate(ctx);
+ qd_server_activate(ctx);
}
-void dx_link_close(dx_link_t *link)
+void qd_link_close(qd_link_t *link)
{
pn_link_close(link->pn_link);
}
-bool dx_link_drain_changed(dx_link_t *link, bool *mode)
+bool qd_link_drain_changed(qd_link_t *link, bool *mode)
{
bool pn_mode = pn_link_get_drain(link->pn_link);
bool changed = pn_mode != link->drain_mode;
@@ -784,9 +784,9 @@ bool dx_link_drain_changed(dx_link_t *li
}
-dx_delivery_t *dx_delivery(dx_link_t *link, pn_delivery_tag_t tag)
+qd_delivery_t *qd_delivery(qd_link_t *link, pn_delivery_tag_t tag)
{
- pn_link_t *pnl = dx_link_pn(link);
+ pn_link_t *pnl = qd_link_pn(link);
//
// If there is a current delivery on this outgoing link, something
@@ -802,7 +802,7 @@ dx_delivery_t *dx_delivery(dx_link_t *li
if (!pnd)
return 0;
- dx_delivery_t *delivery = new_dx_delivery_t();
+ qd_delivery_t *delivery = new_qd_delivery_t();
delivery->pn_delivery = pnd;
delivery->peer = 0;
delivery->context = 0;
@@ -814,7 +814,7 @@ dx_delivery_t *dx_delivery(dx_link_t *li
}
-void dx_delivery_free(dx_delivery_t *delivery, uint64_t final_disposition)
+void qd_delivery_free(qd_delivery_t *delivery, uint64_t final_disposition)
{
if (delivery->pn_delivery) {
if (final_disposition > 0)
@@ -824,41 +824,41 @@ void dx_delivery_free(dx_delivery_t *del
}
if (delivery->peer)
delivery->peer->peer = 0;
- free_dx_delivery_t(delivery);
+ free_qd_delivery_t(delivery);
}
-void dx_delivery_set_peer(dx_delivery_t *delivery, dx_delivery_t *peer)
+void qd_delivery_set_peer(qd_delivery_t *delivery, qd_delivery_t *peer)
{
delivery->peer = peer;
}
-void dx_delivery_set_context(dx_delivery_t *delivery, void *context)
+void qd_delivery_set_context(qd_delivery_t *delivery, void *context)
{
delivery->context = context;
}
-void *dx_delivery_context(dx_delivery_t *delivery)
+void *qd_delivery_context(qd_delivery_t *delivery)
{
return delivery->context;
}
-dx_delivery_t *dx_delivery_peer(dx_delivery_t *delivery)
+qd_delivery_t *qd_delivery_peer(qd_delivery_t *delivery)
{
return delivery->peer;
}
-pn_delivery_t *dx_delivery_pn(dx_delivery_t *delivery)
+pn_delivery_t *qd_delivery_pn(qd_delivery_t *delivery)
{
return delivery->pn_delivery;
}
-void dx_delivery_settle(dx_delivery_t *delivery)
+void qd_delivery_settle(qd_delivery_t *delivery)
{
if (delivery->pn_delivery) {
pn_delivery_settle(delivery->pn_delivery);
@@ -867,26 +867,26 @@ void dx_delivery_settle(dx_delivery_t *d
}
-bool dx_delivery_settled(dx_delivery_t *delivery)
+bool qd_delivery_settled(qd_delivery_t *delivery)
{
return pn_delivery_settled(delivery->pn_delivery);
}
-bool dx_delivery_disp_changed(dx_delivery_t *delivery)
+bool qd_delivery_disp_changed(qd_delivery_t *delivery)
{
return delivery->disposition != pn_delivery_remote_state(delivery->pn_delivery);
}
-uint64_t dx_delivery_disp(dx_delivery_t *delivery)
+uint64_t qd_delivery_disp(qd_delivery_t *delivery)
{
delivery->disposition = pn_delivery_remote_state(delivery->pn_delivery);
return delivery->disposition;
}
-dx_link_t *dx_delivery_link(dx_delivery_t *delivery)
+qd_link_t *qd_delivery_link(qd_delivery_t *delivery)
{
return delivery->link;
}
Modified: qpid/dispatch/trunk/src/dispatch.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/dispatch.c?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/dispatch.c (original)
+++ qpid/dispatch/trunk/src/dispatch.c Tue Nov 19 19:21:30 2013
@@ -29,20 +29,20 @@
/**
* Private Function Prototypes
*/
-dx_server_t *dx_server(int tc, const char *container_name);
-void dx_server_setup_agent(dx_dispatch_t *dx);
-void dx_server_free(dx_server_t *server);
-dx_container_t *dx_container(dx_dispatch_t *dx);
-void dx_container_setup_agent(dx_dispatch_t *dx);
-void dx_container_free(dx_container_t *container);
-dx_router_t *dx_router(dx_dispatch_t *dx, dx_router_mode_t mode, const char *area, const char *id);
-void dx_router_setup_late(dx_dispatch_t *dx);
-void dx_router_free(dx_router_t *router);
-dx_agent_t *dx_agent(dx_dispatch_t *dx);
-void dx_agent_free(dx_agent_t *agent);
+qd_server_t *qd_server(int tc, const char *container_name);
+void qd_server_setup_agent(qd_dispatch_t *qd);
+void qd_server_free(qd_server_t *server);
+qd_container_t *qd_container(qd_dispatch_t *qd);
+void qd_container_setup_agent(qd_dispatch_t *qd);
+void qd_container_free(qd_container_t *container);
+qd_router_t *qd_router(qd_dispatch_t *qd, qd_router_mode_t mode, const char *area, const char *id);
+void qd_router_setup_late(qd_dispatch_t *qd);
+void qd_router_free(qd_router_t *router);
+qd_agent_t *qd_agent(qd_dispatch_t *qd);
+void qd_agent_free(qd_agent_t *agent);
-ALLOC_DEFINE(dx_config_listener_t);
-ALLOC_DEFINE(dx_config_connector_t);
+ALLOC_DEFINE(qd_config_listener_t);
+ALLOC_DEFINE(qd_config_connector_t);
static const char *CONF_CONTAINER = "container";
static const char *CONF_ROUTER = "router";
@@ -50,9 +50,9 @@ static const char *CONF_LISTENER = "l
static const char *CONF_CONNECTOR = "connector";
-dx_dispatch_t *dx_dispatch(const char *config_path)
+qd_dispatch_t *qd_dispatch(const char *config_path)
{
- dx_dispatch_t *dx = NEW(dx_dispatch_t);
+ qd_dispatch_t *qd = NEW(qd_dispatch_t);
int thread_count = 0;
const char *container_name = 0;
@@ -60,31 +60,31 @@ dx_dispatch_t *dx_dispatch(const char *c
const char *router_area = "0";
const char *router_id = 0;
- dx_router_mode_t router_mode = DX_ROUTER_MODE_STANDALONE;
+ qd_router_mode_t router_mode = QD_ROUTER_MODE_STANDALONE;
- DEQ_INIT(dx->config_listeners);
- DEQ_INIT(dx->config_connectors);
+ DEQ_INIT(qd->config_listeners);
+ DEQ_INIT(qd->config_connectors);
- dx_python_initialize(dx);
- dx_log_initialize();
- dx_alloc_initialize();
+ qd_python_initialize(qd);
+ qd_log_initialize();
+ qd_alloc_initialize();
- dx_config_initialize();
- dx->config = dx_config(config_path);
- dx_config_read(dx->config);
+ qd_config_initialize();
+ qd->config = qd_config(config_path);
+ qd_config_read(qd->config);
- if (dx->config) {
- int count = dx_config_item_count(dx->config, CONF_CONTAINER);
+ if (qd->config) {
+ int count = qd_config_item_count(qd->config, CONF_CONTAINER);
if (count == 1) {
- thread_count = dx_config_item_value_int(dx->config, CONF_CONTAINER, 0, "worker-threads");
- container_name = dx_config_item_value_string(dx->config, CONF_CONTAINER, 0, "container-name");
+ thread_count = qd_config_item_value_int(qd->config, CONF_CONTAINER, 0, "worker-threads");
+ container_name = qd_config_item_value_string(qd->config, CONF_CONTAINER, 0, "container-name");
}
- count = dx_config_item_count(dx->config, CONF_ROUTER);
+ count = qd_config_item_count(qd->config, CONF_ROUTER);
if (count == 1) {
- router_mode_str = dx_config_item_value_string(dx->config, CONF_ROUTER, 0, "mode");
- //router_area = dx_config_item_value_string(dx->config, CONF_ROUTER, 0, "0");
- router_id = dx_config_item_value_string(dx->config, CONF_ROUTER, 0, "router-id");
+ router_mode_str = qd_config_item_value_string(qd->config, CONF_ROUTER, 0, "mode");
+ //router_area = qd_config_item_value_string(qd->config, CONF_ROUTER, 0, "0");
+ router_id = qd_config_item_value_string(qd->config, CONF_ROUTER, 0, "router-id");
}
}
@@ -95,10 +95,10 @@ dx_dispatch_t *dx_dispatch(const char *c
container_name = "00000000-0000-0000-0000-000000000000"; // TODO - gen a real uuid
if (router_mode_str && strcmp(router_mode_str, "interior") == 0)
- router_mode = DX_ROUTER_MODE_INTERIOR;
+ router_mode = QD_ROUTER_MODE_INTERIOR;
if (router_mode_str && strcmp(router_mode_str, "edge") == 0)
- router_mode = DX_ROUTER_MODE_EDGE;
+ router_mode = QD_ROUTER_MODE_EDGE;
if (!router_area)
router_area = "area";
@@ -106,71 +106,71 @@ dx_dispatch_t *dx_dispatch(const char *c
if (!router_id)
router_id = container_name;
- dx->server = dx_server(thread_count, container_name);
- dx->container = dx_container(dx);
- dx->router = dx_router(dx, router_mode, router_area, router_id);
- dx->agent = dx_agent(dx);
+ qd->server = qd_server(thread_count, container_name);
+ qd->container = qd_container(qd);
+ qd->router = qd_router(qd, router_mode, router_area, router_id);
+ qd->agent = qd_agent(qd);
- dx_alloc_setup_agent(dx);
- dx_server_setup_agent(dx);
- dx_container_setup_agent(dx);
- dx_router_setup_late(dx);
+ qd_alloc_setup_agent(qd);
+ qd_server_setup_agent(qd);
+ qd_container_setup_agent(qd);
+ qd_router_setup_late(qd);
- return dx;
+ return qd;
}
-void dx_dispatch_free(dx_dispatch_t *dx)
+void qd_dispatch_free(qd_dispatch_t *qd)
{
- dx_config_free(dx->config);
- dx_config_finalize();
- dx_agent_free(dx->agent);
- dx_router_free(dx->router);
- dx_container_free(dx->container);
- dx_server_free(dx->server);
- dx_log_finalize();
- dx_python_finalize();
+ qd_config_free(qd->config);
+ qd_config_finalize();
+ qd_agent_free(qd->agent);
+ qd_router_free(qd->router);
+ qd_container_free(qd->container);
+ qd_server_free(qd->server);
+ qd_log_finalize();
+ qd_python_finalize();
}
-static void load_server_config(dx_dispatch_t *dx, dx_server_config_t *config, const char *section, int i)
+static void load_server_config(qd_dispatch_t *qd, qd_server_config_t *config, const char *section, int i)
{
- config->host = dx_config_item_value_string(dx->config, section, i, "addr");
- config->port = dx_config_item_value_string(dx->config, section, i, "port");
- config->role = dx_config_item_value_string(dx->config, section, i, "role");
+ config->host = qd_config_item_value_string(qd->config, section, i, "addr");
+ config->port = qd_config_item_value_string(qd->config, section, i, "port");
+ config->role = qd_config_item_value_string(qd->config, section, i, "role");
config->sasl_mechanisms =
- dx_config_item_value_string(dx->config, section, i, "sasl-mechanisms");
+ qd_config_item_value_string(qd->config, section, i, "sasl-mechanisms");
config->ssl_enabled =
- dx_config_item_value_bool(dx->config, section, i, "ssl-profile");
+ qd_config_item_value_bool(qd->config, section, i, "ssl-profile");
if (config->ssl_enabled) {
config->ssl_server = 1;
config->ssl_allow_unsecured_client =
- dx_config_item_value_bool(dx->config, section, i, "allow-unsecured");
+ qd_config_item_value_bool(qd->config, section, i, "allow-unsecured");
config->ssl_certificate_file =
- dx_config_item_value_string(dx->config, section, i, "cert-file");
+ qd_config_item_value_string(qd->config, section, i, "cert-file");
config->ssl_private_key_file =
- dx_config_item_value_string(dx->config, section, i, "key-file");
+ qd_config_item_value_string(qd->config, section, i, "key-file");
config->ssl_password =
- dx_config_item_value_string(dx->config, section, i, "password");
+ qd_config_item_value_string(qd->config, section, i, "password");
config->ssl_trusted_certificate_db =
- dx_config_item_value_string(dx->config, section, i, "cert-db");
+ qd_config_item_value_string(qd->config, section, i, "cert-db");
config->ssl_require_peer_authentication =
- dx_config_item_value_bool(dx->config, section, i, "require-peer-auth");
+ qd_config_item_value_bool(qd->config, section, i, "require-peer-auth");
}
}
-static void configure_listeners(dx_dispatch_t *dx)
+static void configure_listeners(qd_dispatch_t *qd)
{
int count;
- if (!dx->config)
+ if (!qd->config)
return;
- count = dx_config_item_count(dx->config, CONF_LISTENER);
+ count = qd_config_item_count(qd->config, CONF_LISTENER);
for (int i = 0; i < count; i++) {
- dx_config_listener_t *cl = new_dx_config_listener_t();
- load_server_config(dx, &cl->configuration, CONF_LISTENER, i);
+ qd_config_listener_t *cl = new_qd_config_listener_t();
+ load_server_config(qd, &cl->configuration, CONF_LISTENER, i);
printf("\nListener : %s:%s\n", cl->configuration.host, cl->configuration.port);
printf(" SASL: %s\n", cl->configuration.sasl_mechanisms);
@@ -183,24 +183,24 @@ static void configure_listeners(dx_dispa
printf(" peer-auth: %d\n", cl->configuration.ssl_require_peer_authentication);
}
- cl->listener = dx_server_listen(dx, &cl->configuration, cl);
+ cl->listener = qd_server_listen(qd, &cl->configuration, cl);
DEQ_ITEM_INIT(cl);
- DEQ_INSERT_TAIL(dx->config_listeners, cl);
+ DEQ_INSERT_TAIL(qd->config_listeners, cl);
}
}
-static void configure_connectors(dx_dispatch_t *dx)
+static void configure_connectors(qd_dispatch_t *qd)
{
int count;
- if (!dx->config)
+ if (!qd->config)
return;
- count = dx_config_item_count(dx->config, CONF_CONNECTOR);
+ count = qd_config_item_count(qd->config, CONF_CONNECTOR);
for (int i = 0; i < count; i++) {
- dx_config_connector_t *cc = new_dx_config_connector_t();
- load_server_config(dx, &cc->configuration, CONF_CONNECTOR, i);
+ qd_config_connector_t *cc = new_qd_config_connector_t();
+ load_server_config(qd, &cc->configuration, CONF_CONNECTOR, i);
printf("\nConnector : %s:%s\n", cc->configuration.host, cc->configuration.port);
printf(" SASL: %s\n", cc->configuration.sasl_mechanisms);
@@ -212,16 +212,16 @@ static void configure_connectors(dx_disp
printf(" peer-auth: %d\n", cc->configuration.ssl_require_peer_authentication);
}
- cc->connector = dx_server_connect(dx, &cc->configuration, cc);
+ cc->connector = qd_server_connect(qd, &cc->configuration, cc);
DEQ_ITEM_INIT(cc);
- DEQ_INSERT_TAIL(dx->config_connectors, cc);
+ DEQ_INSERT_TAIL(qd->config_connectors, cc);
}
}
-void dx_dispatch_configure(dx_dispatch_t *dx)
+void qd_dispatch_configure(qd_dispatch_t *qd)
{
- configure_listeners(dx);
- configure_connectors(dx);
+ configure_listeners(qd);
+ configure_connectors(qd);
}
Modified: qpid/dispatch/trunk/src/dispatch_private.h
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/dispatch_private.h?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/dispatch_private.h (original)
+++ qpid/dispatch/trunk/src/dispatch_private.h Tue Nov 19 19:21:30 2013
@@ -23,38 +23,38 @@
#include "config_private.h"
#include <qpid/dispatch/ctools.h>
-typedef struct dx_container_t dx_container_t;
-typedef struct dx_router_t dx_router_t;
-typedef struct dx_agent_t dx_agent_t;
-
-typedef struct dx_config_listener_t {
- DEQ_LINKS(struct dx_config_listener_t);
- dx_listener_t *listener;
- dx_server_config_t configuration;
-} dx_config_listener_t;
-
-DEQ_DECLARE(dx_config_listener_t, dx_config_listener_list_t);
-ALLOC_DECLARE(dx_config_listener_t);
-
-
-typedef struct dx_config_connector_t {
- DEQ_LINKS(struct dx_config_connector_t);
- dx_connector_t *connector;
- dx_server_config_t configuration;
-} dx_config_connector_t;
-
-DEQ_DECLARE(dx_config_connector_t, dx_config_connector_list_t);
-ALLOC_DECLARE(dx_config_connector_t);
-
-struct dx_dispatch_t {
- dx_server_t *server;
- dx_container_t *container;
- dx_router_t *router;
- dx_agent_t *agent;
- dx_config_t *config;
+typedef struct qd_container_t qd_container_t;
+typedef struct qd_router_t qd_router_t;
+typedef struct qd_agent_t qd_agent_t;
+
+typedef struct qd_config_listener_t {
+ DEQ_LINKS(struct qd_config_listener_t);
+ qd_listener_t *listener;
+ qd_server_config_t configuration;
+} qd_config_listener_t;
+
+DEQ_DECLARE(qd_config_listener_t, qd_config_listener_list_t);
+ALLOC_DECLARE(qd_config_listener_t);
+
+
+typedef struct qd_config_connector_t {
+ DEQ_LINKS(struct qd_config_connector_t);
+ qd_connector_t *connector;
+ qd_server_config_t configuration;
+} qd_config_connector_t;
+
+DEQ_DECLARE(qd_config_connector_t, qd_config_connector_list_t);
+ALLOC_DECLARE(qd_config_connector_t);
+
+struct qd_dispatch_t {
+ qd_server_t *server;
+ qd_container_t *container;
+ qd_router_t *router;
+ qd_agent_t *agent;
+ qd_config_t *config;
- dx_config_listener_list_t config_listeners;
- dx_config_connector_list_t config_connectors;
+ qd_config_listener_list_t config_listeners;
+ qd_config_connector_list_t config_connectors;
};
#endif
Modified: qpid/dispatch/trunk/src/hash.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/hash.c?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/hash.c (original)
+++ qpid/dispatch/trunk/src/hash.c Tue Nov 19 19:21:30 2013
@@ -23,18 +23,18 @@
#include <stdio.h>
#include <string.h>
-typedef struct dx_hash_item_t {
- DEQ_LINKS(struct dx_hash_item_t);
+typedef struct qd_hash_item_t {
+ DEQ_LINKS(struct qd_hash_item_t);
unsigned char *key;
union {
void *val;
const void *val_const;
} v;
-} dx_hash_item_t;
+} qd_hash_item_t;
-ALLOC_DECLARE(dx_hash_item_t);
-ALLOC_DEFINE(dx_hash_item_t);
-DEQ_DECLARE(dx_hash_item_t, items_t);
+ALLOC_DECLARE(qd_hash_item_t);
+ALLOC_DEFINE(qd_hash_item_t);
+DEQ_DECLARE(qd_hash_item_t, items_t);
typedef struct bucket_t {
@@ -42,7 +42,7 @@ typedef struct bucket_t {
} bucket_t;
-struct dx_hash_t {
+struct qd_hash_t {
bucket_t *buckets;
unsigned int bucket_count;
unsigned int bucket_mask;
@@ -52,24 +52,24 @@ struct dx_hash_t {
};
-struct dx_hash_handle_t {
+struct qd_hash_handle_t {
bucket_t *bucket;
- dx_hash_item_t *item;
+ qd_hash_item_t *item;
};
-ALLOC_DECLARE(dx_hash_handle_t);
-ALLOC_DEFINE(dx_hash_handle_t);
+ALLOC_DECLARE(qd_hash_handle_t);
+ALLOC_DEFINE(qd_hash_handle_t);
// djb2 hash algorithm
-static unsigned long dx_hash_function(dx_field_iterator_t *iter)
+static unsigned long qd_hash_function(qd_field_iterator_t *iter)
{
unsigned long hash = 5381;
int c;
- dx_field_iterator_reset(iter);
- while (!dx_field_iterator_end(iter)) {
- c = (int) dx_field_iterator_octet(iter);
+ qd_field_iterator_reset(iter);
+ while (!qd_field_iterator_end(iter)) {
+ c = (int) qd_field_iterator_octet(iter);
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
}
@@ -77,10 +77,10 @@ static unsigned long dx_hash_function(dx
}
-dx_hash_t *dx_hash(int bucket_exponent, int batch_size, int value_is_const)
+qd_hash_t *qd_hash(int bucket_exponent, int batch_size, int value_is_const)
{
int i;
- dx_hash_t *h = NEW(dx_hash_t);
+ qd_hash_t *h = NEW(qd_hash_t);
if (!h)
return 0;
@@ -99,25 +99,25 @@ dx_hash_t *dx_hash(int bucket_exponent,
}
-void dx_hash_free(dx_hash_t *h)
+void qd_hash_free(qd_hash_t *h)
{
// TODO - Implement this
}
-size_t dx_hash_size(dx_hash_t *h)
+size_t qd_hash_size(qd_hash_t *h)
{
return h ? h->size : 0;
}
-static dx_hash_item_t *dx_hash_internal_insert(dx_hash_t *h, dx_field_iterator_t *key, int *exists, dx_hash_handle_t **handle)
+static qd_hash_item_t *qd_hash_internal_insert(qd_hash_t *h, qd_field_iterator_t *key, int *exists, qd_hash_handle_t **handle)
{
- unsigned long idx = dx_hash_function(key) & h->bucket_mask;
- dx_hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
+ unsigned long idx = qd_hash_function(key) & h->bucket_mask;
+ qd_hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
while (item) {
- if (dx_field_iterator_equal(key, item->key))
+ if (qd_field_iterator_equal(key, item->key))
break;
item = item->next;
}
@@ -129,12 +129,12 @@ static dx_hash_item_t *dx_hash_internal_
return item;
}
- item = new_dx_hash_item_t();
+ item = new_qd_hash_item_t();
if (!item)
return 0;
DEQ_ITEM_INIT(item);
- item->key = dx_field_iterator_copy(key);
+ item->key = qd_field_iterator_copy(key);
DEQ_INSERT_TAIL(h->buckets[idx].items, item);
h->size++;
@@ -144,7 +144,7 @@ static dx_hash_item_t *dx_hash_internal_
// If a pointer to a handle-pointer was supplied, create a handle for this item.
//
if (handle) {
- *handle = new_dx_hash_handle_t();
+ *handle = new_qd_hash_handle_t();
(*handle)->bucket = &h->buckets[idx];
(*handle)->item = item;
}
@@ -153,29 +153,29 @@ static dx_hash_item_t *dx_hash_internal_
}
-dx_error_t dx_hash_insert(dx_hash_t *h, dx_field_iterator_t *key, void *val, dx_hash_handle_t **handle)
+qd_error_t qd_hash_insert(qd_hash_t *h, qd_field_iterator_t *key, void *val, qd_hash_handle_t **handle)
{
int exists = 0;
- dx_hash_item_t *item = dx_hash_internal_insert(h, key, &exists, handle);
+ qd_hash_item_t *item = qd_hash_internal_insert(h, key, &exists, handle);
if (!item)
- return DX_ERROR_ALLOC;
+ return QD_ERROR_ALLOC;
if (exists)
- return DX_ERROR_ALREADY_EXISTS;
+ return QD_ERROR_ALREADY_EXISTS;
item->v.val = val;
- return DX_ERROR_NONE;
+ return QD_ERROR_NONE;
}
-dx_error_t dx_hash_insert_const(dx_hash_t *h, dx_field_iterator_t *key, const void *val, dx_hash_handle_t **handle)
+qd_error_t qd_hash_insert_const(qd_hash_t *h, qd_field_iterator_t *key, const void *val, qd_hash_handle_t **handle)
{
assert(h->is_const);
int error = 0;
- dx_hash_item_t *item = dx_hash_internal_insert(h, key, &error, handle);
+ qd_hash_item_t *item = qd_hash_internal_insert(h, key, &error, handle);
if (item)
item->v.val_const = val;
@@ -183,13 +183,13 @@ dx_error_t dx_hash_insert_const(dx_hash_
}
-static dx_hash_item_t *dx_hash_internal_retrieve(dx_hash_t *h, dx_field_iterator_t *key)
+static qd_hash_item_t *qd_hash_internal_retrieve(qd_hash_t *h, qd_field_iterator_t *key)
{
- unsigned long idx = dx_hash_function(key) & h->bucket_mask;
- dx_hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
+ unsigned long idx = qd_hash_function(key) & h->bucket_mask;
+ qd_hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
while (item) {
- if (dx_field_iterator_equal(key, item->key))
+ if (qd_field_iterator_equal(key, item->key))
break;
item = item->next;
}
@@ -198,39 +198,39 @@ static dx_hash_item_t *dx_hash_internal_
}
-dx_error_t dx_hash_retrieve(dx_hash_t *h, dx_field_iterator_t *key, void **val)
+qd_error_t qd_hash_retrieve(qd_hash_t *h, qd_field_iterator_t *key, void **val)
{
- dx_hash_item_t *item = dx_hash_internal_retrieve(h, key);
+ qd_hash_item_t *item = qd_hash_internal_retrieve(h, key);
if (item)
*val = item->v.val;
else
*val = 0;
- return DX_ERROR_NONE;
+ return QD_ERROR_NONE;
}
-dx_error_t dx_hash_retrieve_const(dx_hash_t *h, dx_field_iterator_t *key, const void **val)
+qd_error_t qd_hash_retrieve_const(qd_hash_t *h, qd_field_iterator_t *key, const void **val)
{
assert(h->is_const);
- dx_hash_item_t *item = dx_hash_internal_retrieve(h, key);
+ qd_hash_item_t *item = qd_hash_internal_retrieve(h, key);
if (item)
*val = item->v.val_const;
else
*val = 0;
- return DX_ERROR_NONE;
+ return QD_ERROR_NONE;
}
-dx_error_t dx_hash_remove(dx_hash_t *h, dx_field_iterator_t *key)
+qd_error_t qd_hash_remove(qd_hash_t *h, qd_field_iterator_t *key)
{
- unsigned long idx = dx_hash_function(key) & h->bucket_mask;
- dx_hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
+ unsigned long idx = qd_hash_function(key) & h->bucket_mask;
+ qd_hash_item_t *item = DEQ_HEAD(h->buckets[idx].items);
while (item) {
- if (dx_field_iterator_equal(key, item->key))
+ if (qd_field_iterator_equal(key, item->key))
break;
item = item->next;
}
@@ -238,23 +238,23 @@ dx_error_t dx_hash_remove(dx_hash_t *h,
if (item) {
free(item->key);
DEQ_REMOVE(h->buckets[idx].items, item);
- free_dx_hash_item_t(item);
+ free_qd_hash_item_t(item);
h->size--;
- return DX_ERROR_NONE;
+ return QD_ERROR_NONE;
}
- return DX_ERROR_NOT_FOUND;
+ return QD_ERROR_NOT_FOUND;
}
-void dx_hash_handle_free(dx_hash_handle_t *handle)
+void qd_hash_handle_free(qd_hash_handle_t *handle)
{
if (handle)
- free_dx_hash_handle_t(handle);
+ free_qd_hash_handle_t(handle);
}
-const unsigned char *dx_hash_key_by_handle(const dx_hash_handle_t *handle)
+const unsigned char *qd_hash_key_by_handle(const qd_hash_handle_t *handle)
{
if (handle)
return handle->item->key;
@@ -262,24 +262,24 @@ const unsigned char *dx_hash_key_by_hand
}
-dx_error_t dx_hash_remove_by_handle(dx_hash_t *h, dx_hash_handle_t *handle)
+qd_error_t qd_hash_remove_by_handle(qd_hash_t *h, qd_hash_handle_t *handle)
{
unsigned char *key = 0;
- dx_error_t error = dx_hash_remove_by_handle2(h, handle, &key);
+ qd_error_t error = qd_hash_remove_by_handle2(h, handle, &key);
if (key)
free(key);
return error;
}
-dx_error_t dx_hash_remove_by_handle2(dx_hash_t *h, dx_hash_handle_t *handle, unsigned char **key)
+qd_error_t qd_hash_remove_by_handle2(qd_hash_t *h, qd_hash_handle_t *handle, unsigned char **key)
{
if (!handle)
- return DX_ERROR_NOT_FOUND;
+ return QD_ERROR_NOT_FOUND;
*key = handle->item->key;
DEQ_REMOVE(handle->bucket->items, handle->item);
- free_dx_hash_item_t(handle->item);
+ free_qd_hash_item_t(handle->item);
h->size--;
- return DX_ERROR_NONE;
+ return QD_ERROR_NONE;
}
Modified: qpid/dispatch/trunk/src/iovec.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/iovec.c?rev=1543534&r1=1543533&r2=1543534&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/iovec.c (original)
+++ qpid/dispatch/trunk/src/iovec.c Tue Nov 19 19:21:30 2013
@@ -21,29 +21,29 @@
#include <qpid/dispatch/alloc.h>
#include <string.h>
-#define DX_IOVEC_MAX 64
+#define QD_IOVEC_MAX 64
-struct dx_iovec_t {
- struct iovec iov_array[DX_IOVEC_MAX];
+struct qd_iovec_t {
+ struct iovec iov_array[QD_IOVEC_MAX];
struct iovec *iov;
int iov_count;
};
-ALLOC_DECLARE(dx_iovec_t);
-ALLOC_DEFINE(dx_iovec_t);
+ALLOC_DECLARE(qd_iovec_t);
+ALLOC_DEFINE(qd_iovec_t);
-dx_iovec_t *dx_iovec(int vector_count)
+qd_iovec_t *qd_iovec(int vector_count)
{
- dx_iovec_t *iov = new_dx_iovec_t();
+ qd_iovec_t *iov = new_qd_iovec_t();
if (!iov)
return 0;
- memset(iov, 0, sizeof(dx_iovec_t));
+ memset(iov, 0, sizeof(qd_iovec_t));
iov->iov_count = vector_count;
- if (vector_count > DX_IOVEC_MAX)
+ if (vector_count > QD_IOVEC_MAX)
iov->iov = (struct iovec*) malloc(sizeof(struct iovec) * vector_count);
else
iov->iov = &iov->iov_array[0];
@@ -52,7 +52,7 @@ dx_iovec_t *dx_iovec(int vector_count)
}
-void dx_iovec_free(dx_iovec_t *iov)
+void qd_iovec_free(qd_iovec_t *iov)
{
if (!iov)
return;
@@ -60,11 +60,11 @@ void dx_iovec_free(dx_iovec_t *iov)
if (iov->iov && iov->iov != &iov->iov_array[0])
free(iov->iov);
- free_dx_iovec_t(iov);
+ free_qd_iovec_t(iov);
}
-struct iovec *dx_iovec_array(dx_iovec_t *iov)
+struct iovec *qd_iovec_array(qd_iovec_t *iov)
{
if (!iov)
return 0;
@@ -72,7 +72,7 @@ struct iovec *dx_iovec_array(dx_iovec_t
}
-int dx_iovec_count(dx_iovec_t *iov)
+int qd_iovec_count(qd_iovec_t *iov)
{
if (!iov)
return 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org