OpENer - Open Source EtherNet/IP(TM) I/O Target Stack
2.1
|
#include <string.h>
#include "appcontype.h"
#include "cipconnectionmanager.h"
#include "cipconnectionobject.h"
#include "opener_api.h"
#include "assert.h"
#include "trace.h"
#include "cipepath.h"
Go to the source code of this file.
Data Structures | |
struct | ExclusiveOwnerConnection |
Exclusive Owner connection data. More... | |
struct | InputOnlyConnection |
Input Only connection data. More... | |
struct | ListenOnlyConnection |
Listen Only connection data. More... | |
Functions | |
void | CloseAllConnections (void) |
void | CloseAllConnectionsForInputWithSameType (const EipUint32 input_point, const ConnectionObjectInstanceType instance_type) |
Close all connection producing the same input and have the same type (i.e., listen only or input only). More... | |
void | ConfigureExclusiveOwnerConnectionPoint (const unsigned int connection_number, const unsigned int output_assembly, const unsigned int input_assembly, const unsigned int config_assembly) |
Configures the connection point for an exclusive owner connection. More... | |
void | ConfigureInputOnlyConnectionPoint (const unsigned int connection_number, const unsigned int output_assembly, const unsigned int input_assembly, const unsigned int config_assembly) |
Configures the connection point for an input only connection. More... | |
void | ConfigureListenOnlyConnectionPoint (const unsigned int connection_number, const unsigned int output_assembly, const unsigned int input_assembly, const unsigned int config_assembly) |
Configures the connection point for a listen only connection. More... | |
bool | ConnectionWithSameConfigPointExists (const EipUint32 config_point) |
Check if there is an established connection that uses the same config point. More... | |
CipConnectionObject * | GetExclusiveOwnerConnection (const CipConnectionObject *const RESTRICT connection_object, EipUint16 *const extended_error) |
Takes an ConnectionObject and searches and returns an Exclusive Owner Connection based on the ConnectionObject, if there is non it returns NULL. More... | |
CipConnectionObject * | GetExistingProducerMulticastConnection (const EipUint32 input_point) |
Check if there exists already an exclusive owner or listen only connection which produces the input assembly. More... | |
CipConnectionObject * | GetInputOnlyConnection (const CipConnectionObject *const RESTRICT connection_object, EipUint16 *const extended_error) |
Takes an ConnectionObject and searches and returns an Input Only Connection based on the ConnectionObject, if there is non it returns NULL. More... | |
CipConnectionObject * | GetIoConnectionForConnectionData (CipConnectionObject *const RESTRICT connection_object, EipUint16 *const extended_error) |
check if for the given connection data received in a forward_open request a suitable connection is available. More... | |
CipConnectionObject * | GetListenOnlyConnection (const CipConnectionObject *const RESTRICT connection_object, EipUint16 *const extended_error) |
Takes an ConnectionObject and searches and returns an Listen Only Connection based on the ConnectionObject, if there is non it returns NULL. More... | |
CipConnectionObject * | GetNextNonControlMasterConnection (const EipUint32 input_point) |
check if there exists an producing multicast exclusive owner or listen only connection that should produce the same input but is not in charge of the connection. More... | |
void | InitializeIoConnectionData (void) |
void CloseAllConnections | ( | void | ) |
@ brief close all open connections.
For I/O connections the sockets will be freed. The sockets for explicit connections are handled by the encapsulation layer, and freed there.
Definition at line 407 of file appcontype.c.
References cip_connection_object::connection_close_function, connection_list, doubly_linked_list_node::data, and DoublyLinkedList::first.
Referenced by ResetDevice(), and ShutdownCipStack().
void CloseAllConnectionsForInputWithSameType | ( | const EipUint32 | input_point, |
const ConnectionObjectInstanceType | instance_type | ||
) |
Close all connection producing the same input and have the same type (i.e., listen only or input only).
input_point | the input point |
instance_type | the connection application type |
Definition at line 384 of file appcontype.c.
References CheckIoConnectionEvent(), cip_connection_object::connection_close_function, connection_list, ConnectionObjectGetInstanceType(), cip_connection_object::consumed_path, doubly_linked_list_node::data, DoublyLinkedList::first, connection_path_epath::instance_id, kIoConnectionEventClosed, doubly_linked_list_node::next, OPENER_TRACE_INFO, and cip_connection_object::produced_path.
Referenced by CloseIoConnection(), and HandleIoConnectionTimeOut().
bool ConnectionWithSameConfigPointExists | ( | const EipUint32 | config_point | ) |
Check if there is an established connection that uses the same config point.
config_point | The configuration point |
Definition at line 417 of file appcontype.c.
References cip_connection_object::configuration_path, connection_list, doubly_linked_list_node::data, DoublyLinkedList::first, connection_path_epath::instance_id, doubly_linked_list_node::next, and OPENER_ASSERT.
Referenced by HandleConfigData().
CipConnectionObject * GetExclusiveOwnerConnection | ( | const CipConnectionObject *const RESTRICT | connection_object, |
EipUint16 *const | extended_error | ||
) |
Takes an ConnectionObject and searches and returns an Exclusive Owner Connection based on the ConnectionObject, if there is non it returns NULL.
connection_object | Connection Object which will be searched for in the Exclusive Owner Connections |
extended_error | Pointer to the extended error variable, will be written if an error occurs |
Definition at line 177 of file appcontype.c.
References ExclusiveOwnerConnection::config_assembly, ExclusiveOwnerConnection::connection_data, ConnectionObjectEqualOriginator(), ConnectionObjectGetState(), GetConnectedOutputAssembly(), ExclusiveOwnerConnection::input_assembly, kConnectionManagerExtendedStatusCodeErrorOwnershipConflict, kConnectionObjectStateEstablished, kConnectionObjectStateTimedOut, OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS, and OPENER_TRACE_INFO.
Referenced by GetIoConnectionForConnectionData().
CipConnectionObject* GetExistingProducerMulticastConnection | ( | const EipUint32 | input_point | ) |
Check if there exists already an exclusive owner or listen only connection which produces the input assembly.
input_point | the Input point to be produced |
Definition at line 335 of file appcontype.c.
References connection_list, ConnectionObjectGetTToOConnectionType(), ConnectionObjectIsTypeIOConnection(), doubly_linked_list_node::data, DoublyLinkedList::first, connection_path_epath::instance_id, kConnectionObjectConnectionTypeMulticast, kUdpCommuncationDirectionProducing, doubly_linked_list_node::next, cip_connection_object::produced_path, and cip_connection_object::socket.
Referenced by GetListenOnlyConnection(), and OpenProducingMulticastConnection().
CipConnectionObject * GetInputOnlyConnection | ( | const CipConnectionObject *const RESTRICT | connection_object, |
EipUint16 *const | extended_error | ||
) |
Takes an ConnectionObject and searches and returns an Input Only Connection based on the ConnectionObject, if there is non it returns NULL.
connection_object | Connection Object which will be searched for in the Input Only Connections |
extended_error | Pointer to the extended error variable, will be written if an error occurs |
Definition at line 223 of file appcontype.c.
References InputOnlyConnection::connection_data, ConnectionObjectEqualOriginator(), ConnectionObjectGetState(), kConnectionManagerExtendedStatusCodeInconsistentApplicationPathCombo, kConnectionManagerExtendedStatusCodeInvalidProducingApplicationPath, kConnectionManagerExtendedStatusCodeTargetObjectOutOfConnections, kConnectionObjectStateNonExistent, kConnectionObjectStateTimedOut, OPENER_CIP_NUM_INPUT_ONLY_CONNS, and OPENER_CIP_NUM_INPUT_ONLY_CONNS_PER_CON_PATH.
Referenced by GetIoConnectionForConnectionData().
CipConnectionObject* GetIoConnectionForConnectionData | ( | CipConnectionObject *const RESTRICT | connection_object, |
EipUint16 *const | extended_error | ||
) |
check if for the given connection data received in a forward_open request a suitable connection is available.
If a suitable connection is found the connection data is transfered the application connection type is set (i.e., EConnType).
connection_object | connection data to be used |
extended_error | pointer to the extended_error variable, if an error occurred this value has the according error code for the response |
Definition at line 127 of file appcontype.c.
References ConnectionObjectDeepCopy(), ConnectionObjectSetInstanceType(), GetExclusiveOwnerConnection(), GetInputOnlyConnection(), GetListenOnlyConnection(), kCipErrorSuccess, kConnectionManagerExtendedStatusCodeInconsistentApplicationPathCombo, kConnectionManagerExtendedStatusCodeSuccess, kConnectionObjectInstanceTypeIOExclusiveOwner, kConnectionObjectInstanceTypeIOInputOnly, kConnectionObjectInstanceTypeIOListenOnly, and OPENER_TRACE_INFO.
Referenced by EstablishIoConnection().
CipConnectionObject * GetListenOnlyConnection | ( | const CipConnectionObject *const RESTRICT | connection_object, |
EipUint16 *const | extended_error | ||
) |
Takes an ConnectionObject and searches and returns an Listen Only Connection based on the ConnectionObject, if there is non it returns NULL.
connection_object | Connection Object which will be searched for in the Listen Only Connections |
extended_error | Pointer to the extended error variable, will be written if an error occurs |
Definition at line 275 of file appcontype.c.
References ListenOnlyConnection::connection_data, ConnectionObjectEqualOriginator(), ConnectionObjectGetState(), GetExistingProducerMulticastConnection(), kConnectionManagerExtendedStatusCodeInconsistentApplicationPathCombo, kConnectionManagerExtendedStatusCodeInvalidProducingApplicationPath, kConnectionManagerExtendedStatusCodeNonListenOnlyConnectionNotOpened, kConnectionManagerExtendedStatusCodeTargetObjectOutOfConnections, kConnectionObjectStateNonExistent, kConnectionObjectStateTimedOut, OPENER_CIP_NUM_LISTEN_ONLY_CONNS, and OPENER_CIP_NUM_LISTEN_ONLY_CONNS_PER_CON_PATH.
Referenced by GetIoConnectionForConnectionData().
CipConnectionObject* GetNextNonControlMasterConnection | ( | const EipUint32 | input_point | ) |
check if there exists an producing multicast exclusive owner or listen only connection that should produce the same input but is not in charge of the connection.
input_point | the produced input |
Definition at line 362 of file appcontype.c.
References connection_list, ConnectionObjectGetState(), ConnectionObjectGetTToOConnectionType(), ConnectionObjectIsTypeNonLOIOConnection(), doubly_linked_list_node::data, DoublyLinkedList::first, connection_path_epath::instance_id, kConnectionObjectConnectionTypeMulticast, kConnectionObjectStateEstablished, kUdpCommuncationDirectionProducing, doubly_linked_list_node::next, cip_connection_object::produced_path, and cip_connection_object::socket.
Referenced by CloseIoConnection(), and HandleIoConnectionTimeOut().
void InitializeIoConnectionData | ( | void | ) |
Definition at line 431 of file appcontype.c.
References OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS, OPENER_CIP_NUM_INPUT_ONLY_CONNS, and OPENER_CIP_NUM_LISTEN_ONLY_CONNS.
Referenced by InitializeConnectionManagerData().
ExclusiveOwnerConnection g_exlusive_owner_connections[OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS] |
Exclusive Owner connections
Definition at line 46 of file appcontype.c.
InputOnlyConnection g_input_only_connections[OPENER_CIP_NUM_INPUT_ONLY_CONNS] |
Input Only connections
Definition at line 48 of file appcontype.c.
ListenOnlyConnection g_listen_only_connections[OPENER_CIP_NUM_LISTEN_ONLY_CONNS] |
Listen Only connections
Definition at line 50 of file appcontype.c.