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

Function GetIoConnectionForConnectionData

source/src/cip/appcontype.c:127–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127CipConnectionObject *GetIoConnectionForConnectionData(
128 CipConnectionObject *const RESTRICT connection_object,
129 EipUint16 *const extended_error) {
130
131 *extended_error = 0;
132
133 CipConnectionObject *io_connection = GetExclusiveOwnerConnection(
134 connection_object,
135 extended_error);
136 if (NULL == io_connection) {
137 if (kConnectionManagerExtendedStatusCodeSuccess == *extended_error) {
138 /* we found no connection and don't have an error so try input only next */
139 io_connection = GetInputOnlyConnection(connection_object, extended_error);
140 if (NULL == io_connection) {
141 if (kConnectionManagerExtendedStatusCodeSuccess == *extended_error) {
142 /* we found no connection and don't have an error so try listen only next */
143 io_connection = GetListenOnlyConnection(connection_object,
144 extended_error);
145 if ( (NULL == io_connection) &&
146 (kCipErrorSuccess == *extended_error) ) {
147 /* no application connection type was found that suits the given data */
148 *extended_error =
149 kConnectionManagerExtendedStatusCodeInconsistentApplicationPathCombo;
150 } else {
151 ConnectionObjectSetInstanceType(connection_object,
152 kConnectionObjectInstanceTypeIOListenOnly);
153 OPENER_TRACE_INFO("IO Listen only connection requested\n");
154 //Is listen only connection
155 }
156 }
157 } else {
158 ConnectionObjectSetInstanceType(connection_object,
159 kConnectionObjectInstanceTypeIOInputOnly);
160 OPENER_TRACE_INFO("IO Input only connection requested\n");
161 //is Input only connection
162 }
163 }
164 } else {
165 ConnectionObjectSetInstanceType(connection_object,
166 kConnectionObjectInstanceTypeIOExclusiveOwner);
167 OPENER_TRACE_INFO("IO Exclusive Owner connection requested\n");
168 //Is exclusive owner connection
169 }
170
171 if (NULL != io_connection) {
172 ConnectionObjectDeepCopy(io_connection, connection_object);
173 }
174
175 return io_connection;
176}
177
178CipConnectionObject *GetExclusiveOwnerConnection(
179 const CipConnectionObject *const RESTRICT connection_object,

Callers 1

EstablishIoConnectionFunction · 0.85

Calls 5

GetInputOnlyConnectionFunction · 0.85
GetListenOnlyConnectionFunction · 0.85
ConnectionObjectDeepCopyFunction · 0.85

Tested by

no test coverage detected