Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

security-context -> enclave #13

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions rmw_dds_common/include/rmw_dds_common/graph_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ class GraphCache
/// Add a discovered participant to the cache.
/**
* \param gid The participant guid.
* \param security_context Name of the security context.
* \param enclave Name of the enclave.
*/
RMW_DDS_COMMON_PUBLIC
void
add_participant(
const rmw_gid_t & participant_gid,
const std::string & security_context);
const std::string & enclave);

/// Remove a participant based on discovery.
/**
Expand Down Expand Up @@ -477,7 +477,7 @@ class GraphCache
* \param[inout] node_namespaces A zero initialized string array, where the node namespaces
* will be copied. Each item in this array corresponds to an item in the same position of
* node_names array. Must not be `nullptr`.
* \param[inout] security_contexts A zero initialized string array, where the security context
* \param[inout] enclaves A zero initialized string array, where the enclave
* name of the node will be copied. Each item in this array corresponds to an item in the same
* position of node_names array. In case is `nullptr`, it won't be used.
* \param[in] allocator.
Expand All @@ -491,7 +491,7 @@ class GraphCache
get_node_names(
rcutils_string_array_t * node_names,
rcutils_string_array_t * node_namespaces,
rcutils_string_array_t * security_contexts,
rcutils_string_array_t * enclaves,
rcutils_allocator_t * allocator) const;

/**
Expand Down Expand Up @@ -521,7 +521,7 @@ operator<<(std::ostream & ostream, const GraphCache & topic_cache);
struct ParticipantInfo
{
GraphCache::NodeEntitiesInfoSeq node_entities_info_seq;
std::string security_context;
std::string enclave;
};

struct EntityInfo
Expand Down
24 changes: 12 additions & 12 deletions rmw_dds_common/src/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ __create_participant_info_message(
void
GraphCache::add_participant(
const rmw_gid_t & participant_gid,
const std::string & security_context)
const std::string & enclave)
{
std::lock_guard<std::mutex> guard(mutex_);
auto it = participants_.find(participant_gid);
Expand All @@ -203,7 +203,7 @@ GraphCache::add_participant(
it = ret.first;
assert(ret.second);
}
it->second.security_context = security_context;
it->second.enclave = enclave;
GRAPH_CACHE_CALL_ON_CHANGE_CALLBACK(this);
}

Expand Down Expand Up @@ -924,7 +924,7 @@ rmw_ret_t
GraphCache::get_node_names(
rcutils_string_array_t * node_names,
rcutils_string_array_t * node_namespaces,
rcutils_string_array_t * security_contexts,
rcutils_string_array_t * enclaves,
rcutils_allocator_t * allocator) const
{
std::lock_guard<std::mutex> guard(mutex_);
Expand All @@ -935,8 +935,8 @@ GraphCache::get_node_names(
return RMW_RET_INVALID_ARGUMENT;
}
if (
security_contexts &&
RMW_RET_OK != rmw_check_zero_rmw_string_array(security_contexts))
enclaves &&
RMW_RET_OK != rmw_check_zero_rmw_string_array(enclaves))
{
return RMW_RET_INVALID_ARGUMENT;
}
Expand All @@ -960,9 +960,9 @@ GraphCache::get_node_names(
RMW_SET_ERROR_MSG(error_msg.str);
goto fail;
}
if (security_contexts) {
if (enclaves) {
rcutils_ret =
rcutils_string_array_init(security_contexts, nodes_number, allocator);
rcutils_string_array_init(enclaves, nodes_number, allocator);
if (RCUTILS_RET_OK != rcutils_ret) {
rcutils_error_string_t error_msg = rcutils_get_error_string();
rcutils_reset_error();
Expand All @@ -984,10 +984,10 @@ GraphCache::get_node_names(
if (!node_namespaces->data[j]) {
goto fail;
}
if (security_contexts) {
security_contexts->data[j] = rcutils_strdup(
nodes_info.security_context.c_str(), *allocator);
if (!security_contexts->data[j]) {
if (enclaves) {
enclaves->data[j] = rcutils_strdup(
nodes_info.enclave.c_str(), *allocator);
if (!enclaves->data[j]) {
goto fail;
}
}
Expand Down Expand Up @@ -1036,7 +1036,7 @@ rmw_dds_common::operator<<(std::ostream & ostream, const GraphCache & graph_cach
ss << " Discovered participants:" << std::endl;
for (const auto & item : graph_cache.participants_) {
ss << " gid: '" << item.first << std::endl;
ss << " security context name '" << item.second.security_context << std::endl;
ss << " enclave name '" << item.second.enclave << std::endl;
ss << " nodes:" << std::endl;
for (const auto & node_info : item.second.node_entities_info_seq) {
ss << " namespace: '" << node_info.node_namespace << "' name: '" <<
Expand Down