Add PropertyPolicy to QoS API for Security settings (#278)
* Add PropertyPolicy to QoS API for Security settings This commit adds the public API for PropertyQosPolicy including tests. This policy can be used to set the parameters for the DDS security implementation, as an alternative for using the xml configuration. Tests are also inlcuded for setting security properties and conflict resolving when both security configuration and qos properties are present. Finally, the pubsub tool is updated so that is handles this qos correctly. Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Init binary_value.props to fix failing qos merge and moved init code in qset_prop functions Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Add additional test and some validation improvements based on review comments Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Refactoring of qos property Refactored the qos property handling based on review comments. Setting and unsettings functions are simplified and now use helper functions for lookup, property initialisation is simplified. Added an additional check for required security properties when creating participant using security settings from qos, and added a test-case for this code. Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Check for qos flag before getting property index from qos Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Participant creation should fail on inconsistent security qos properties, and some minor code improvements in property qos api functions Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Update log message in test security_config_qos Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Fixed unused label compiler error in q_entity.c when security is disabled Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Refactored qprop functions with macros to avoid code duplicate code Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
This commit is contained in:
parent
5399e5103c
commit
7f59a46ff8
11 changed files with 927 additions and 47 deletions
|
@ -379,6 +379,72 @@ dds_qset_ignorelocal (
|
|||
dds_qos_t * __restrict qos,
|
||||
dds_ignorelocal_kind_t ignore);
|
||||
|
||||
/**
|
||||
* @brief Stores a property with the provided name and string value in a qos structure.
|
||||
*
|
||||
* In the case a property with the provided name already exists in the qos structure,
|
||||
* the value for this entry is overwritten with the provided string value. If more than
|
||||
* one property with the provided name exists, only the value of the first of these
|
||||
* properties is updated.
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the property
|
||||
* @param[in] name - Pointer to name of the property
|
||||
* @param[in] value - Pointer to a (null-terminated) string that will be stored
|
||||
*/
|
||||
DDS_EXPORT void
|
||||
dds_qset_prop (
|
||||
dds_qos_t * __restrict qos,
|
||||
const char * name,
|
||||
const char * value);
|
||||
|
||||
/**
|
||||
* @brief Removes the property with the provided name from a qos structure.
|
||||
*
|
||||
* In case more than one property exists with this name, only the first property
|
||||
* is removed.
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that contains the property
|
||||
* @param[in] name - Pointer to name of the property
|
||||
*/
|
||||
DDS_EXPORT void
|
||||
dds_qunset_prop (
|
||||
dds_qos_t * __restrict qos,
|
||||
const char * name);
|
||||
|
||||
/**
|
||||
* @brief Stores the provided binary data as a property in a qos structure
|
||||
*
|
||||
* In the case a property with the provided name already exists in the qos structure,
|
||||
* the value for this entry is overwritten with the provided data. If more than one
|
||||
* property with the provided name exists, only the value of the first of these
|
||||
* properties is updated.
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the property
|
||||
* @param[in] name - Pointer to name of the property
|
||||
* @param[in] value - Pointer to data to be stored in the property
|
||||
* @param[in] sz - Size of the data
|
||||
*/
|
||||
DDS_EXPORT void
|
||||
dds_qset_bprop (
|
||||
dds_qos_t * __restrict qos,
|
||||
const char * name,
|
||||
const void * value,
|
||||
const size_t sz);
|
||||
|
||||
/**
|
||||
* @brief Removes the binary property with the provided name from a qos structure.
|
||||
*
|
||||
* In case more than one binary property exists with this name, only the first binary
|
||||
* property is removed.
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that contains the binary property
|
||||
* @param[in] name - Pointer to name of the property
|
||||
*/
|
||||
DDS_EXPORT void
|
||||
dds_qunset_bprop (
|
||||
dds_qos_t * __restrict qos,
|
||||
const char * name);
|
||||
|
||||
/**
|
||||
* @brief Get the userdata from a qos structure
|
||||
*
|
||||
|
@ -680,6 +746,74 @@ dds_qget_ignorelocal (
|
|||
const dds_qos_t * __restrict qos,
|
||||
dds_ignorelocal_kind_t *ignore);
|
||||
|
||||
/**
|
||||
* @brief Gets the names of the properties from a qos structure.
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that contains properties
|
||||
* @param[in,out] n - Pointer to number of property names that are returned (optional)
|
||||
* @param[in,out] names - Pointer that will store the string(s) containing property name(s) (optional). This function will allocate the memory for the list of names and for the strings containing the names; the caller gets ownership of the allocated memory
|
||||
*
|
||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||
*/
|
||||
DDS_EXPORT bool
|
||||
dds_qget_propnames (
|
||||
const dds_qos_t * __restrict qos,
|
||||
uint32_t * n,
|
||||
char *** names);
|
||||
|
||||
/**
|
||||
* @brief Get the value of the property with the provided name from a qos structure.
|
||||
*
|
||||
* In case more than one property exists with this name, the value for the first
|
||||
* property with this name will be returned.
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that contains the property
|
||||
* @param[in] name - Pointer to name of the property
|
||||
* @param[in,out] value - Pointer to a string that will store the value of the property. The memory for storing the string value will be allocated by this function and the caller gets ownership of the allocated memory
|
||||
*
|
||||
* @returns - false iff any of the arguments is invalid, the qos is not present in the qos object or there was no property found with the provided name
|
||||
*/
|
||||
DDS_EXPORT bool
|
||||
dds_qget_prop (
|
||||
const dds_qos_t * __restrict qos,
|
||||
const char * name,
|
||||
char ** value);
|
||||
|
||||
/**
|
||||
* @brief Gets the names of the binary properties from a qos structure.
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that contains binary properties
|
||||
* @param[in,out] n - Pointer to number of binary property names that are returned (optional)
|
||||
* @param[in,out] names - Pointer that will store the string(s) containing binary property name(s) (optional). This function will allocate the memory for the list of names and for the strings containing the names; the caller gets ownership of the allocated memory
|
||||
*
|
||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||
*/
|
||||
DDS_EXPORT bool
|
||||
dds_qget_bpropnames (
|
||||
const dds_qos_t * __restrict qos,
|
||||
uint32_t * n,
|
||||
char *** names);
|
||||
|
||||
/**
|
||||
* @brief Get the value of the binary property with the provided name from a qos structure.
|
||||
*
|
||||
* In case more than one binary property exists with this name, the value for the first
|
||||
* binary property with this name will be returned.
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that contains the property
|
||||
* @param[in] name - Pointer to name of the binary property
|
||||
* @param[in,out] value - Pointer to a buffer that will store the value of the property. If sz = 0 then a NULL pointer. The memory for storing the value will be allocated by this function and the caller gets ownership of the allocated memory
|
||||
* @param[in,out] sz - Pointer that will store the size of the returned buffer.
|
||||
*
|
||||
* @returns - false iff any of the arguments is invalid, the qos is not present in the qos object or there was no binary property found with the provided name
|
||||
*/
|
||||
DDS_EXPORT bool
|
||||
dds_qget_bprop (
|
||||
const dds_qos_t * __restrict qos,
|
||||
const char * name,
|
||||
void ** value,
|
||||
size_t * sz);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,8 @@ typedef enum dds_qos_policy_id {
|
|||
DDS_GROUPDATA_QOS_POLICY_ID,
|
||||
DDS_TRANSPORTPRIORITY_QOS_POLICY_ID,
|
||||
DDS_LIFESPAN_QOS_POLICY_ID,
|
||||
DDS_DURABILITYSERVICE_QOS_POLICY_ID
|
||||
DDS_DURABILITYSERVICE_QOS_POLICY_ID,
|
||||
DDS_PROPERTY_QOS_POLICY_ID,
|
||||
} dds_qos_policy_id_t;
|
||||
|
||||
/* QoS structure is opaque */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue