diff options
Diffstat (limited to 'librabbitmq/amqp_api.c')
-rw-r--r-- | librabbitmq/amqp_api.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/librabbitmq/amqp_api.c b/librabbitmq/amqp_api.c index 1d329e0..7cb865d 100644 --- a/librabbitmq/amqp_api.c +++ b/librabbitmq/amqp_api.c @@ -10,17 +10,15 @@ #include <assert.h> -amqp_rpc_reply_t amqp_rpc_reply; - -#define RPC_REPLY(replytype) \ - (amqp_rpc_reply.reply_type == AMQP_RESPONSE_NORMAL \ - ? (replytype *) amqp_rpc_reply.reply.decoded \ +#define RPC_REPLY(replytype) \ + (state->most_recent_api_result.reply_type == AMQP_RESPONSE_NORMAL \ + ? (replytype *) state->most_recent_api_result.reply.decoded \ : NULL) amqp_channel_open_ok_t *amqp_channel_open(amqp_connection_state_t state, amqp_channel_t channel) { - amqp_rpc_reply = + state->most_recent_api_result = AMQP_SIMPLE_RPC(state, channel, CHANNEL, OPEN, OPEN_OK, amqp_channel_open_t, AMQP_EMPTY_BYTES); @@ -118,7 +116,7 @@ amqp_exchange_declare_ok_t *amqp_exchange_declare(amqp_connection_state_t state, amqp_boolean_t auto_delete, amqp_table_t arguments) { - amqp_rpc_reply = + state->most_recent_api_result = AMQP_SIMPLE_RPC(state, channel, EXCHANGE, DECLARE, DECLARE_OK, amqp_exchange_declare_t, 0, exchange, type, passive, durable, auto_delete, 0, 0, arguments); @@ -134,7 +132,7 @@ amqp_queue_declare_ok_t *amqp_queue_declare(amqp_connection_state_t state, amqp_boolean_t auto_delete, amqp_table_t arguments) { - amqp_rpc_reply = + state->most_recent_api_result = AMQP_SIMPLE_RPC(state, channel, QUEUE, DECLARE, DECLARE_OK, amqp_queue_declare_t, 0, queue, passive, durable, exclusive, auto_delete, 0, arguments); @@ -148,7 +146,7 @@ amqp_queue_bind_ok_t *amqp_queue_bind(amqp_connection_state_t state, amqp_bytes_t routing_key, amqp_table_t arguments) { - amqp_rpc_reply = + state->most_recent_api_result = AMQP_SIMPLE_RPC(state, channel, QUEUE, BIND, BIND_OK, amqp_queue_bind_t, 0, queue, exchange, routing_key, 0, arguments); @@ -162,7 +160,7 @@ amqp_queue_unbind_ok_t *amqp_queue_unbind(amqp_connection_state_t state, amqp_bytes_t binding_key, amqp_table_t arguments) { - amqp_rpc_reply = + state->most_recent_api_result = AMQP_SIMPLE_RPC(state, channel, QUEUE, UNBIND, UNBIND_OK, amqp_queue_unbind_t, 0, queue, exchange, binding_key, arguments); @@ -177,7 +175,7 @@ amqp_basic_consume_ok_t *amqp_basic_consume(amqp_connection_state_t state, amqp_boolean_t no_ack, amqp_boolean_t exclusive) { - amqp_rpc_reply = + state->most_recent_api_result = AMQP_SIMPLE_RPC(state, channel, BASIC, CONSUME, CONSUME_OK, amqp_basic_consume_t, 0, queue, consumer_tag, no_local, no_ack, exclusive, 0); @@ -203,8 +201,9 @@ amqp_queue_purge_ok_t *amqp_queue_purge(amqp_connection_state_t state, amqp_bytes_t queue, amqp_boolean_t no_wait) { - amqp_rpc_reply = AMQP_SIMPLE_RPC(state, channel, QUEUE, PURGE, PURGE_OK, - amqp_queue_purge_t, channel, queue, no_wait); + state->most_recent_api_result = + AMQP_SIMPLE_RPC(state, channel, QUEUE, PURGE, PURGE_OK, + amqp_queue_purge_t, channel, queue, no_wait); return RPC_REPLY(amqp_queue_purge_ok_t); } @@ -216,17 +215,14 @@ amqp_rpc_reply_t amqp_basic_get(amqp_connection_state_t state, amqp_method_number_t replies[] = { AMQP_BASIC_GET_OK_METHOD, AMQP_BASIC_GET_EMPTY_METHOD, 0 }; - amqp_rpc_reply = + state->most_recent_api_result = AMQP_MULTIPLE_RESPONSE_RPC(state, channel, BASIC, GET, replies, amqp_basic_get_t, channel, queue, no_ack); - return amqp_rpc_reply; + return state->most_recent_api_result; } -/* - * Expose amqp_rpc_reply to dynamically linked libraries - */ -amqp_rpc_reply_t amqp_get_rpc_reply(void) +amqp_rpc_reply_t amqp_get_rpc_reply(amqp_connection_state_t state) { - return amqp_rpc_reply; + return state->most_recent_api_result; } |