From 5e82fe0763fb526a15aaeab34ca5c614f4d531f5 Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Tue, 21 Feb 2023 20:18:07 -0800 Subject: [PATCH] Rosidl_runtime_c type hash struct Signed-off-by: Emerson Knapp --- rmw/include/rmw/topic_endpoint_info.h | 8 ++++---- rmw/src/topic_endpoint_info.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rmw/include/rmw/topic_endpoint_info.h b/rmw/include/rmw/topic_endpoint_info.h index dd53b5aa..82fec711 100644 --- a/rmw/include/rmw/topic_endpoint_info.h +++ b/rmw/include/rmw/topic_endpoint_info.h @@ -22,6 +22,7 @@ extern "C" #include "rcutils/allocator.h" #include "rcutils/sha256.h" +#include "rosidl_runtime_c/type_hash.h" #include "rmw/types.h" #include "rmw/visibility_control.h" @@ -34,10 +35,10 @@ typedef struct RMW_PUBLIC_TYPE rmw_topic_endpoint_info_s const char * node_name; /// Namespace of the node const char * node_namespace; - /// The associated topic type + /// The associated topic type's name const char * topic_type; /// Hashed value for topic type's description - uint8_t topic_type_hash[RCUTILS_SHA256_BLOCK_SIZE]; + rosidl_type_hash_t topic_type_hash; /// The endpoint type rmw_endpoint_type_t endpoint_type; /// The GID of the endpoint @@ -173,8 +174,7 @@ RMW_WARN_UNUSED rmw_ret_t rmw_topic_endpoint_info_set_topic_type_hash( rmw_topic_endpoint_info_t * topic_endpoint_info, - const uint8_t topic_type_hash[RCUTILS_SHA256_BLOCK_SIZE]); - + const rosidl_type_hash_t * type_hash); /// Set the node name in the given topic endpoint info data structure. /** diff --git a/rmw/src/topic_endpoint_info.c b/rmw/src/topic_endpoint_info.c index c890a3c9..b8d94eb9 100644 --- a/rmw/src/topic_endpoint_info.c +++ b/rmw/src/topic_endpoint_info.c @@ -152,12 +152,12 @@ rmw_topic_endpoint_info_set_topic_type( rmw_ret_t rmw_topic_endpoint_info_set_topic_type_hash( rmw_topic_endpoint_info_t * topic_endpoint_info, - const uint8_t topic_type_hash[RCUTILS_SHA256_BLOCK_SIZE]) + const rosidl_type_hash_t * type_hash) { RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_INVALID_ARGUMENT); RCUTILS_CHECK_ARGUMENT_FOR_NULL(topic_endpoint_info, RMW_RET_INVALID_ARGUMENT); - RCUTILS_CHECK_ARGUMENT_FOR_NULL(topic_type_hash, RMW_RET_INVALID_ARGUMENT); - memcpy(topic_endpoint_info->topic_type_hash, topic_type_hash, RCUTILS_SHA256_BLOCK_SIZE); + RCUTILS_CHECK_ARGUMENT_FOR_NULL(type_hash, RMW_RET_INVALID_ARGUMENT); + topic_endpoint_info->topic_type_hash = *type_hash; return RMW_RET_OK; }