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

Function EstablishClass3Connection

source/src/cip/cipclass3connection.c:26–55  ·  view source on GitHub ↗

Implementation ****/

Source from the content-addressed store, hash-verified

24
25/**** Implementation ****/
26EipStatus EstablishClass3Connection(
27 CipConnectionObject *RESTRICT const connection_object,
28 EipUint16 *const extended_error) {
29 EipStatus eip_status = kEipStatusOk;
30
31 CipConnectionObject *explicit_connection = GetFreeExplicitConnection();
32
33 if (NULL == explicit_connection) {
34 eip_status = kCipErrorConnectionFailure;
35 *extended_error =
36 kConnectionManagerExtendedStatusCodeErrorNoMoreConnectionsAvailable;
37 } else {
38 ConnectionObjectDeepCopy(explicit_connection, connection_object);
39
40 ConnectionObjectGeneralConfiguration(explicit_connection);
41
42 ConnectionObjectSetInstanceType(explicit_connection,
43 kConnectionObjectInstanceTypeExplicitMessaging);
44
45 /* set the connection call backs */
46 explicit_connection->connection_close_function =
47 CloseConnection;
48 /* explicit connection have to be closed on time out*/
49 explicit_connection->connection_timeout_function =
50 Class3ConnectionTimeoutHandler;
51
52 AddNewActiveConnection(explicit_connection);
53 }
54 return eip_status;
55}
56
57/** @brief Searches and returns a free explicit connection slot
58 *

Callers

nothing calls this directly

Tested by

no test coverage detected