@@ -133,24 +133,15 @@ rmw_get_serialization_format(void);
133133/// Create a node and return a handle to that node.
134134/**
135135 * This function can fail, and therefore return `NULL`, if:
136- * - context, name, namespace_, or security_options is `NULL`
137- * - context, security_options is invalid
136+ * - name is not a valid non-null node name
137+ * - namespace_ is not a valid non-null namespace
138+ * - context is not valid i.e. it is zero-initialized, or
139+ * its implementation identifier does not match that of
140+ * this API implementation, or has been invalidated by
141+ * `rmw_shutdown()`
138142 * - memory allocation fails during node creation
139143 * - an unspecified error occurs
140144 *
141- * The context must be non-null and valid, i.e. it has been initialized
142- * by `rmw_init()` and has not been finalized by `rmw_shutdown()`.
143- *
144- * The name and namespace_ should be valid node name and namespace,
145- * and this should be asserted by the caller (e.g. `rcl`).
146- *
147- * The domain ID should be used to physically separate nodes at the
148- * communication graph level by the middleware.
149- * For RTPS/DDS this maps naturally to their concept of domain id.
150- *
151- * The security options should always be non-null and encapsulate the
152- * essential security configurations for the node and its entities.
153- *
154145 * <hr>
155146 * Attribute | Adherence
156147 * ------------------ | -------------
@@ -165,11 +156,7 @@ rmw_get_serialization_format(void);
165156 * \param[in] context init context that this node should be associated with
166157 * \param[in] name the node name
167158 * \param[in] namespace_ the node namespace
168- * \param[in] domain_id the id of the domain that the node should join
169- * \param[in] security_options the security configurations for the node
170- * \param[in] localhost_only whenever to use loopback only for communication or default
171- * network interfaces.
172- * \return rmw node handle or `NULL` if there was an error
159+ * \return rmw node handle, or `NULL` if there was an error
173160 */
174161RMW_PUBLIC
175162RMW_WARN_UNUSED
@@ -183,15 +170,22 @@ rmw_create_node(
183170
184171/// Finalize a given node handle, reclaim the resources, and deallocate the node handle.
185172/**
186- * The method may assume - but should verify - that all publishers, subscribers,
187- * services, and clients created from this node have already been destroyed.
188- * If the rmw implementation chooses to verify instead of assume, it should
189- * return `RMW_RET_ERROR` and set a human readable error message if any entity
190- * created from this node has not yet been destroyed.
173+ * This function will return early if a logical error, such as `RMW_RET_INVALID_ARGUMENT`
174+ * or `RMW_RET_INCORRECT_RMW_IMPLEMENTATION`, ensues, leaving the given node handle unchanged.
175+ * Otherwise, it will proceed despite errors, freeing as many resources as it can, including
176+ * the node handle. Usage of a deallocated node handle is undefined behavior.
177+ *
178+ * \pre All publishers, subscribers, services, and clients created from this node must
179+ * have been destroyed prior to this call. Some rmw implementations may verify this,
180+ * returning `RMW_RET_ERROR` and setting a human readable error message if any entity
181+ * created from this node has not yet been destroyed. However, this is not guaranteed
182+ * and so callers should ensure that this is the case before calling this function.
191183 *
192184 * \param[in] node the node handle to be destroyed
193185 * \return `RMW_RET_OK` if successful, or
194- * \return `RMW_RET_INVALID_ARGUMENT` if node is null, or
186+ * \return `RMW_RET_INVALID_ARGUMENT` if node is invalid, or
187+ * \return `RMW_RET_INCORRECT_RMW_IMPLEMENTATION` if the implementation
188+ * identifier does not match, or
195189 * \return `RMW_RET_ERROR` if an unexpected error occurs.
196190 */
197191RMW_PUBLIC
0 commit comments