diff --git a/rmw/include/rmw/init.h b/rmw/include/rmw/init.h index fc59b2a2..4312700f 100644 --- a/rmw/include/rmw/init.h +++ b/rmw/include/rmw/init.h @@ -41,6 +41,8 @@ typedef struct RMW_PUBLIC_TYPE rmw_init_options_t { * It is designed to be used with `rcl_init()` and `rcl_get_instance_id()`. */ uint64_t instance_id; + /// Implementation identifier, used to ensure two different implementations are not being mixed. + const char * implementation_identifier; /// Implementation defined init options. rmw_init_options_impl_t * impl; } rmw_init_options_t; @@ -64,6 +66,8 @@ typedef struct rmw_init_context_impl_t rmw_init_context_impl_t; typedef struct RMW_PUBLIC_TYPE rmw_init_context_t { /// Locally (process local) unique ID that represents this init/shutdown cycle. uint64_t instance_id; + /// Implementation identifier, used to ensure two different implementations are not being mixed. + const char * implementation_identifier; /// Implementation defined init context information. rmw_init_context_impl_t * impl; } rmw_init_context_t; @@ -94,6 +98,8 @@ rmw_get_zero_initialized_init_context(void); * \param[in] options initialization options to be used during initialization * \param[out] context resulting context struct * \return `RMW_RET_OK` if successful, or + * \return `RMW_RET_INCORRECT_RMW_IMPLEMENTATION` if the implementation + * identifier does not match, or * \return `RMW_RET_INVALID_ARGUMENT` if any arguments are null or invalid, or * \return `RMW_RET_ERROR` if an unexpected error occurs. */ @@ -119,6 +125,8 @@ rmw_init(const rmw_init_options_t * options, rmw_init_context_t * context); * * \param[in] context resulting context struct * \return `RMW_RET_OK` if successful, or + * \return `RMW_RET_INCORRECT_RMW_IMPLEMENTATION` if the implementation + * identifier does not match, or * \return `RMW_RET_INVALID_ARGUMENT` if the argument is null or invalid, or * \return `RMW_RET_ERROR` if an unexpected error occurs. */ diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index 0a74df98..52c008b0 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -39,6 +39,8 @@ typedef int rmw_ret_t; #define RMW_RET_BAD_ALLOC 10 /// Invalid argument return code. #define RMW_RET_INVALID_ARGUMENT 11 +/// Incorrect rmw implementation. +#define RMW_RET_INCORRECT_RMW_IMPLEMENTATION 12 // 24 bytes is the most memory needed to represent the GID by any current // implementation. It may need to be increased in the future.