diff options
author | Alan Antonuk <alan.antonuk@gmail.com> | 2013-08-15 13:40:44 -0700 |
---|---|---|
committer | Alan Antonuk <alan.antonuk@gmail.com> | 2013-08-15 13:40:44 -0700 |
commit | 1c213703c9fdd747bc71ea4f64943c3b4269f8cf (patch) | |
tree | 363403985fdb0125497016227308e1db4f1e0a63 /librabbitmq | |
parent | 5c7c40adc100c3a29ec9df5959e2124abcfed487 (diff) | |
download | rabbitmq-c-github-ask-1c213703c9fdd747bc71ea4f64943c3b4269f8cf.tar.gz |
Add amqp_get_broker_properties() function
Add function to return the properties table advertised by the broker on
connection to the broker.
Diffstat (limited to 'librabbitmq')
-rw-r--r-- | librabbitmq/amqp.h | 14 | ||||
-rw-r--r-- | librabbitmq/amqp_connection.c | 3 | ||||
-rw-r--r-- | librabbitmq/amqp_private.h | 3 | ||||
-rw-r--r-- | librabbitmq/amqp_socket.c | 7 |
4 files changed, 27 insertions, 0 deletions
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h index 9424a6a..968f7fa 100644 --- a/librabbitmq/amqp.h +++ b/librabbitmq/amqp.h @@ -2296,6 +2296,20 @@ AMQP_PUBLIC_FUNCTION amqp_socket_t * amqp_get_socket(amqp_connection_state_t state); +/** + * Get the broker properties table + * + * \param [in] state the connection object + * \return a pointer to an amqp_table_t containing the properties advertised + * by the broker on connection. The connection object owns the table, it + * should not be modified. + * + * \since v0.5.0 + */ +AMQP_PUBLIC_FUNCTION +amqp_table_t * +amqp_get_server_properties(amqp_connection_state_t state); + AMQP_END_DECLS diff --git a/librabbitmq/amqp_connection.c b/librabbitmq/amqp_connection.c index df6a462..d3491fb 100644 --- a/librabbitmq/amqp_connection.c +++ b/librabbitmq/amqp_connection.c @@ -91,6 +91,8 @@ amqp_connection_state_t amqp_new_connection(void) goto out_nomem; } + init_amqp_pool(&state->properties_pool, 512); + return state; out_nomem: @@ -181,6 +183,7 @@ int amqp_destroy_connection(amqp_connection_state_t state) free(state->outbound_buffer.bytes); free(state->sock_inbound_buffer.bytes); amqp_socket_delete(state->socket); + empty_amqp_pool(&state->properties_pool); free(state); } return status; diff --git a/librabbitmq/amqp_private.h b/librabbitmq/amqp_private.h index 7fc5b57..1d74773 100644 --- a/librabbitmq/amqp_private.h +++ b/librabbitmq/amqp_private.h @@ -161,6 +161,9 @@ struct amqp_connection_state_t_ { uint64_t next_recv_heartbeat; uint64_t next_send_heartbeat; + + amqp_table_t server_properties; + amqp_pool_t properties_pool; }; amqp_pool_t *amqp_get_or_create_channel_pool(amqp_connection_state_t connection, amqp_channel_t channel); diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c index 87673aa..061e739 100644 --- a/librabbitmq/amqp_socket.c +++ b/librabbitmq/amqp_socket.c @@ -1102,6 +1102,13 @@ static amqp_rpc_reply_t amqp_login_inner(amqp_connection_state_t state, goto error_res; } + res = amqp_table_clone(&s->server_properties, &state->server_properties, + &state->properties_pool); + + if (AMQP_STATUS_OK != res) { + goto error_res; + } + /* TODO: check that our chosen SASL mechanism is in the list of acceptable mechanisms. Or even let the application choose from the list! */ |