MCPcopy Create free account
hub / github.com/EIPStackGroup/OpENer / HandleConfigData

Function HandleConfigData

source/src/cip/cipioconnection.c:622–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622EipUint16 HandleConfigData(CipConnectionObject *connection_object) {
623
624 CipClass *const assembly_class = GetCipClass(kCipAssemblyClassCode);
625 EipUint16 connection_manager_status = 0;
626 CipInstance *config_instance = GetCipInstance(
627 assembly_class, connection_object->configuration_path.instance_id);
628
629 if (0 != g_config_data_length) {
630 OPENER_ASSERT(NULL != config_instance)
631 if ( ConnectionWithSameConfigPointExists(
632 connection_object->configuration_path.instance_id) ) {
633 /* there is a connected connection with the same config point
634 * we have to have the same data as already present in the config point*/
635 CipAttributeStruct *attribute_three = GetCipAttribute(
636 config_instance,
637 3);
638 OPENER_ASSERT(NULL != attribute_three)
639 CipByteArray * attribute_three_data =
640 (CipByteArray *) attribute_three->data;
641 OPENER_ASSERT(NULL != attribute_three_data)
642 if (attribute_three_data->length != g_config_data_length) {
643 connection_manager_status =
644 kConnectionManagerExtendedStatusCodeErrorOwnershipConflict;
645 OPENER_TRACE_INFO(
646 "Hit an Ownership conflict in cipioconnection.c occurrence 1");
647 } else {
648 /*FIXME check if this is correct */
649 if ( memcmp(attribute_three_data->data, g_config_data_buffer,
650 g_config_data_length) ) {
651 connection_manager_status =
652 kConnectionManagerExtendedStatusCodeErrorOwnershipConflict;
653 OPENER_TRACE_INFO(
654 "Hit an Ownership conflict in cipioconnection.c occurrence 2");
655 }
656 }
657 } else {
658 /* put the data on the configuration assembly object with the current
659 design this can be done rather efficiently */
660 if ( kEipStatusOk
661 != NotifyAssemblyConnectedDataReceived(config_instance,
662 g_config_data_buffer,
663 g_config_data_length) ) {
664 OPENER_TRACE_WARN("Configuration data was invalid\n");
665 connection_manager_status =
666 kConnectionManagerExtendedStatusCodeInvalidConfigurationApplicationPath;
667 }
668 }
669 }
670 return connection_manager_status;
671}
672
673void CloseIoConnection(CipConnectionObject *connection_object) {
674

Callers 1

EstablishIoConnectionFunction · 0.85

Calls 5

GetCipClassFunction · 0.85
GetCipInstanceFunction · 0.85
GetCipAttributeFunction · 0.85

Tested by

no test coverage detected