| 1605 | #endif |
| 1606 | |
| 1607 | DDS::ReturnCode_t |
| 1608 | DomainParticipantImpl::enable() |
| 1609 | { |
| 1610 | //According spec: |
| 1611 | // - Calling enable on an already enabled Entity returns OK and has no |
| 1612 | // effect. |
| 1613 | // - Calling enable on an Entity whose factory is not enabled will fail |
| 1614 | // and return PRECONDITION_NOT_MET. |
| 1615 | |
| 1616 | if (this->is_enabled()) { |
| 1617 | return DDS::RETCODE_OK; |
| 1618 | } |
| 1619 | |
| 1620 | #if OPENDDS_CONFIG_SECURITY |
| 1621 | if (!security_config_ && TheServiceParticipant->get_security()) { |
| 1622 | security_config_ = TheSecurityRegistry->default_config(); |
| 1623 | if (!security_config_) { |
| 1624 | security_config_ = TheSecurityRegistry->builtin_config(); |
| 1625 | TheSecurityRegistry->default_config(security_config_); |
| 1626 | } |
| 1627 | } |
| 1628 | #endif |
| 1629 | |
| 1630 | Discovery_rch disco = TheServiceParticipant->get_discovery(domain_id_); |
| 1631 | |
| 1632 | if (disco.is_nil()) { |
| 1633 | if (DCPS_debug_level > 0) { |
| 1634 | ACE_ERROR((LM_ERROR, |
| 1635 | ACE_TEXT("(%P|%t) ERROR: DomainParticipantImpl::enable, ") |
| 1636 | ACE_TEXT("no discovery found for domain id: %d.\n"), domain_id_)); |
| 1637 | } |
| 1638 | return DDS::RETCODE_ERROR; |
| 1639 | } |
| 1640 | |
| 1641 | #if OPENDDS_CONFIG_SECURITY |
| 1642 | if (TheServiceParticipant->get_security() && !security_config_) { |
| 1643 | if (DCPS::security_debug.new_entity_error) { |
| 1644 | ACE_ERROR((LM_ERROR, |
| 1645 | ACE_TEXT("(%P|%t) ERROR: DomainParticipantImpl::enable, ") |
| 1646 | ACE_TEXT("DCPSSecurity flag is set, but unable to load security plugin configuration.\n"))); |
| 1647 | } |
| 1648 | return DDS::RETCODE_ERROR; |
| 1649 | } |
| 1650 | #endif |
| 1651 | |
| 1652 | AddDomainStatus value = {GUID_UNKNOWN, false}; |
| 1653 | |
| 1654 | #if OPENDDS_CONFIG_SECURITY |
| 1655 | if (TheServiceParticipant->get_security() && security_config_->qos_implies_security(qos_)) { |
| 1656 | Security::Authentication_var auth = security_config_->get_authentication(); |
| 1657 | |
| 1658 | DDS::Security::SecurityException se; |
| 1659 | DDS::Security::ValidationResult_t val_res = |
| 1660 | auth->validate_local_identity(id_handle_, dp_id_, domain_id_, qos_, disco->generate_participant_guid(), se); |
| 1661 | |
| 1662 | /* TODO - Handle VALIDATION_PENDING_RETRY */ |
| 1663 | if (val_res != DDS::Security::VALIDATION_OK) { |
| 1664 | if (DCPS::security_debug.new_entity_error) { |
no test coverage detected