Initializing domain with configuration as a string
For targets that do not support ddsrt_setenv and ddsrt_getenv, an alternative method is needed to supply an application specific configuration. One way to implement this, is to add a function for creating a domain with a string arguments, which needs to be called before any call to dds_create_participant for given domain identifier. The function dds_create_domain has been added, which has as arguments a domain identifier and a configuration string. The string is treated in the same way as the string that is retrieved from the environment variable, in that it may containt a comma separated list of file names and/or XML fragments for the configuration. Two tests have been added. One limits the number of participants to two and verifies that creating a third participant fails. The other tests checks incorrect calls to dds_create_domain. An assert in dds_handle_delete has been weakened. Signed-off-by: Frans Faase <frans.faase@adlinktech.com>
This commit is contained in:
		
							parent
							
								
									67f7f56a62
								
							
						
					
					
						commit
						f48bbd3d1c
					
				
					 8 changed files with 173 additions and 75 deletions
				
			
		| 
						 | 
				
			
			@ -726,7 +726,7 @@ dds_set_listener(dds_entity_t entity, const dds_listener_t * listener);
 | 
			
		|||
 * If no configuration file exists, the default domain is configured as 0.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * @param[in]  domain The domain in which to create the participant (can be DDS_DOMAIN_DEFAULT). Valid values for domain id are between 0 and 230. DDS_DOMAIN_DEFAULT is for using the domain in the configuration.
 | 
			
		||||
 * @param[in]  domain The domain in which to create the participant (can be DDS_DOMAIN_DEFAULT). DDS_DOMAIN_DEFAULT is for using the domain in the configuration.
 | 
			
		||||
 * @param[in]  qos The QoS to set on the new participant (can be NULL).
 | 
			
		||||
 * @param[in]  listener Any listener functions associated with the new participant (can be NULL).
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -743,6 +743,33 @@ dds_create_participant(
 | 
			
		|||
  const dds_qos_t *qos,
 | 
			
		||||
  const dds_listener_t *listener);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Creates a domain with a given configuration
 | 
			
		||||
 *
 | 
			
		||||
 * To explicitly create a domain based on a configuration passed as a string.
 | 
			
		||||
 * Normally, the domain is created implicitly on the first call to
 | 
			
		||||
 * dds_create_particiant based on the configuration specified throught
 | 
			
		||||
 * the environment. This function allows to by-pass this behaviour.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * @param[in]  domain The domain to be created. DEFAULT_DOMAIN is not allowed.
 | 
			
		||||
 * @param[in]  config A configuration string containing file names and/or XML fragments representing the configuration.
 | 
			
		||||
 *
 | 
			
		||||
 * @returns A return code
 | 
			
		||||
 *
 | 
			
		||||
 * @retval DDS_RETCODE_OK
 | 
			
		||||
 *             The domain with the domain identifier has been created from
 | 
			
		||||
 *             given configuration string.
 | 
			
		||||
 * @retval DDS_RETCODE_BAD_PARAMETER
 | 
			
		||||
 *             Illegal value for domain id or the configfile parameter is NULL.
 | 
			
		||||
 * @retval DDS_PRECONDITION_NOT_MET
 | 
			
		||||
 *             The domain already existed and cannot be created again.
 | 
			
		||||
 * @retval DDS_RETCODE_ERROR
 | 
			
		||||
 *             An internal error has occurred.
 | 
			
		||||
 */
 | 
			
		||||
DDS_EXPORT dds_return_t
 | 
			
		||||
dds_create_domain(const dds_domainid_t domain, const char *config);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Get entity parent.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue