OpENer - Open Source EtherNet/IP(TM) I/O Target Stack  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cipclass3connection.c File Reference
#include <string.h>
#include "cipclass3connection.h"
#include "encap.h"
Include dependency graph for cipclass3connection.c:

Go to the source code of this file.

Functions

EipStatus CipClass3ConnectionObjectStateEstablishedHandler (CipConnectionObject *RESTRICT const connection_object, ConnectionObjectState new_state)
 
EipStatus CipClass3ConnectionObjectStateNonExistentHandler (CipConnectionObject *RESTRICT const connection_object, ConnectionObjectState new_state)
 
void Class3ConnectionTimeoutHandler (CipConnectionObject *connection_object)
 
EipStatus EstablishClass3Connection (CipConnectionObject *RESTRICT const connection_object, EipUint16 *const extended_error)
 Check if Class3 connection is available and if yes setup all data. More...
 
CipConnectionObjectGetFreeExplicitConnection (void)
 Searches and returns a free explicit connection slot. More...
 
void InitializeClass3ConnectionData (void)
 Initializes the explicit connections mechanism. More...
 

Variables

CipConnectionObject explicit_connection_object_pool [OPENER_CIP_NUM_EXPLICIT_CONNS]
 Array of the available explicit connections. More...
 

Function Documentation

EipStatus CipClass3ConnectionObjectStateEstablishedHandler ( CipConnectionObject *RESTRICT const  connection_object,
ConnectionObjectState  new_state 
)

Definition at line 76 of file cipclass3connection.c.

References ConnectionObjectInitializeEmpty(), ConnectionObjectSetState(), kConnectionObjectStateNonExistent, kEipStatusError, and kEipStatusOk.

Here is the call graph for this function:

EipStatus CipClass3ConnectionObjectStateNonExistentHandler ( CipConnectionObject *RESTRICT const  connection_object,
ConnectionObjectState  new_state 
)

Definition at line 88 of file cipclass3connection.c.

References ConnectionObjectSetState(), kConnectionObjectStateEstablished, kEipStatusError, and kEipStatusOk.

Here is the call graph for this function:

void Class3ConnectionTimeoutHandler ( CipConnectionObject connection_object)

Definition at line 19 of file cipclass3connection.c.

References CheckForTimedOutConnectionsAndCloseTCPConnections(), CloseConnection(), and CloseSessionBySessionHandle().

Referenced by EstablishClass3Connection().

Here is the call graph for this function:

Here is the caller graph for this function:

EipStatus EstablishClass3Connection ( CipConnectionObject *RESTRICT const  connection_object,
EipUint16 *const  extended_error 
)

Check if Class3 connection is available and if yes setup all data.

This function can be called after all data has been parsed from the forward open request

Parameters
connection_objectpointer to the connection object structure holding the parsed data from the forward open request
extended_errorthe extended error code in case an error happened
Returns
general status on the establishment
  • kEipStatusOk ... on success
  • On an error the general status code to be put into the response

Definition at line 26 of file cipclass3connection.c.

References AddNewActiveConnection(), Class3ConnectionTimeoutHandler(), CloseConnection(), cip_connection_object::connection_close_function, cip_connection_object::connection_timeout_function, ConnectionObjectDeepCopy(), ConnectionObjectGeneralConfiguration(), ConnectionObjectSetInstanceType(), GetFreeExplicitConnection(), kCipErrorConnectionFailure, kConnectionManagerExtendedStatusCodeErrorNoMoreConnectionsAvailable, kConnectionObjectInstanceTypeExplicitMessaging, and kEipStatusOk.

Referenced by ConnectionManagerInit().

Here is the call graph for this function:

Here is the caller graph for this function:

CipConnectionObject * GetFreeExplicitConnection ( void  )

Searches and returns a free explicit connection slot.

Returns
Free explicit connection slot, or NULL if no slot is free

Definition at line 61 of file cipclass3connection.c.

References ConnectionObjectGetState(), kConnectionObjectStateNonExistent, and OPENER_CIP_NUM_EXPLICIT_CONNS.

Referenced by EstablishClass3Connection().

Here is the call graph for this function:

Here is the caller graph for this function:

void InitializeClass3ConnectionData ( void  )

Initializes the explicit connections mechanism.

Prepares the available explicit connection slots for use at the start of the OpENer

Definition at line 71 of file cipclass3connection.c.

References OPENER_CIP_NUM_EXPLICIT_CONNS.

Referenced by InitializeConnectionManagerData().

Here is the caller graph for this function:

Variable Documentation

CipConnectionObject explicit_connection_object_pool[OPENER_CIP_NUM_EXPLICIT_CONNS]

Array of the available explicit connections.

Definition at line 57 of file cipconnectionobject.c.