summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2014-08-25 22:54:28 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2014-08-25 23:00:37 -0700
commit072191a6e9815c54bac2ce276db8b7abf26c3230 (patch)
tree9ac27e11e05dfca1cf410a80ab45a6c360ee3ad3
parent53286d6c69aa1290dcfc61847bae35c07c6e05aa (diff)
downloadrabbitmq-c-github-ask-072191a6e9815c54bac2ce276db8b7abf26c3230.tar.gz
Add platform, version, copyright client properties
Add 'platform' 'version', 'copyright' client-properties to start-ok method during connection handshake. Adapted from: https://github.com/synety-jdebp/rabbitmq-c/commit/e3c76e1887ff50378f6146167daa024dbd7d4eeb by: Jonathan de Boyne Pollard <jonathan.de.boyne.pollard@synety.com>
-rw-r--r--cmake/config.h.in2
-rw-r--r--configure.ac1
-rw-r--r--librabbitmq/amqp_private.h3
-rw-r--r--librabbitmq/amqp_socket.c22
4 files changed, 26 insertions, 2 deletions
diff --git a/cmake/config.h.in b/cmake/config.h.in
index e7a83c4..7f3fa71 100644
--- a/cmake/config.h.in
+++ b/cmake/config.h.in
@@ -8,4 +8,6 @@
#cmakedefine HAVE_HTONLL
+#define AMQ_PLATFORM "@CMAKE_SYSTEM@"
+
#endif /* CONFIG_H */
diff --git a/configure.ac b/configure.ac
index df9338d..6d465b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,6 +188,7 @@ AM_CONDITIONAL([EXAMPLES], [test "x$enable_examples" = "xyes"])
AC_SUBST([requires_private], [$ssl_pkg_required])
AC_SUBST([libs_private], [$LIBS])
+AC_DEFINE_UNQUOTED([AMQ_PLATFORM], ["$host_os"], [Host operating system string])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
librabbitmq.pc
diff --git a/librabbitmq/amqp_private.h b/librabbitmq/amqp_private.h
index e11ce16..21f4ead 100644
--- a/librabbitmq/amqp_private.h
+++ b/librabbitmq/amqp_private.h
@@ -41,6 +41,9 @@
#include "config.h"
#endif
+#define AMQ_COPYRIGHT "Copyright (c) 2007-2014 VMWare Inc, Tony Garnock-Jones," \
+ " and Alan Antonuk."
+
#include "amqp.h"
#include "amqp_framing.h"
#include <string.h>
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c
index 660ebbb..3a2881e 100644
--- a/librabbitmq/amqp_socket.c
+++ b/librabbitmq/amqp_socket.c
@@ -1158,7 +1158,7 @@ static amqp_rpc_reply_t amqp_login_inner(amqp_connection_state_t state,
}
{
- amqp_table_entry_t default_properties[2];
+ amqp_table_entry_t default_properties[5];
amqp_table_t default_table;
amqp_connection_start_ok_t s;
amqp_pool_t *channel_pool;
@@ -1182,9 +1182,27 @@ static amqp_rpc_reply_t amqp_login_inner(amqp_connection_state_t state,
default_properties[0].value.value.bytes =
amqp_cstring_bytes("rabbitmq-c");
- default_properties[1].key = amqp_cstring_bytes("information");
+ /* version */
+ default_properties[1].key = amqp_cstring_bytes("version");
default_properties[1].value.kind = AMQP_FIELD_KIND_UTF8;
default_properties[1].value.value.bytes =
+ amqp_cstring_bytes(AMQP_VERSION_STRING);
+
+ /* platform */
+ default_properties[2].key = amqp_cstring_bytes("platform");
+ default_properties[2].value.kind = AMQP_FIELD_KIND_UTF8;
+ default_properties[2].value.value.bytes =
+ amqp_cstring_bytes(AMQ_PLATFORM);
+
+ /* copyright */
+ default_properties[3].key = amqp_cstring_bytes("copyright");
+ default_properties[3].value.kind = AMQP_FIELD_KIND_UTF8;
+ default_properties[3].value.value.bytes =
+ amqp_cstring_bytes(AMQ_COPYRIGHT);
+
+ default_properties[4].key = amqp_cstring_bytes("information");
+ default_properties[4].value.kind = AMQP_FIELD_KIND_UTF8;
+ default_properties[4].value.value.bytes =
amqp_cstring_bytes("See https://github.com/alanxz/rabbitmq-c");
default_table.entries = default_properties;