OpENer - Open Source EtherNet/IP(TM) I/O Target Stack
2.1
|
#include "opener_user_conf.h"
#include "opener_api.h"
#include "typedefs.h"
#include "ciptypes.h"
#include "cipconnectionobject.h"
Go to the source code of this file.
Macros | |
#define | SEQ_GEQ16(a, b) ( (short)( (a) - (b) ) >= 0 ) |
#define | SEQ_GEQ32(a, b) ( (int)( (a) - (b) ) >= 0 ) |
#define | SEQ_GT32(a, b) ( (int)( (a) - (b) ) > 0 ) |
#define | SEQ_LEQ16(a, b) ( (short)( (a) - (b) ) <= 0 ) |
similar macros for comparing 16 bit sequence numbers More... | |
#define | SEQ_LEQ32(a, b) ( (int)( (a) - (b) ) <= 0 ) |
macros for comparing sequence numbers according to CIP spec vol 2 3-4.2 for int type variables More... | |
Typedefs | |
typedef void(* | CloseSessionFunction )(const CipConnectionObject *const connection_object) |
Functions | |
void | AddNewActiveConnection (const CipConnectionObject *const connection_object) |
Insert the given connection object to the list of currently active and managed connections. More... | |
void | CheckForTimedOutConnectionsAndCloseTCPConnections (const CipConnectionObject *const connection_object, CloseSessionFunction CloseSessions) |
void | CloseConnection (CipConnectionObject *RESTRICT connection_object) |
Close the given connection. More... | |
EipStatus | ConnectionManagerInit (EipUint16 unique_connection_id) |
Initialize the data of the connection manager object. More... | |
CipConnectionObject * | GetConnectedObject (const EipUint32 connection_id) |
Get a connected object dependent on requested ConnectionID. More... | |
CipConnectionObject * | GetConnectedOutputAssembly (const EipUint32 output_assembly_id) |
CipUint | GetConnectionId (void) |
Generate a new connection Id utilizing the Incarnation Id as described in the EIP specs. More... | |
EipBool8 | IsConnectedOutputAssembly (const EipUint32 instance_number) |
void | RemoveFromActiveConnections (CipConnectionObject *const connection_object) |
Removes connection from the list of active connections. More... | |
#define SEQ_GEQ16 | ( | a, | |
b | |||
) | ( (short)( (a) - (b) ) >= 0 ) |
b
Definition at line 160 of file cipconnectionmanager.h.
#define SEQ_GEQ32 | ( | a, | |
b | |||
) | ( (int)( (a) - (b) ) >= 0 ) |
b
Definition at line 151 of file cipconnectionmanager.h.
#define SEQ_GT32 | ( | a, | |
b | |||
) | ( (int)( (a) - (b) ) > 0 ) |
Definition at line 152 of file cipconnectionmanager.h.
Referenced by HandleReceivedConnectedData().
#define SEQ_LEQ16 | ( | a, | |
b | |||
) | ( (short)( (a) - (b) ) <= 0 ) |
similar macros for comparing 16 bit sequence numbers
Definition at line 159 of file cipconnectionmanager.h.
Referenced by HandleReceivedIoConnectionData().
#define SEQ_LEQ32 | ( | a, | |
b | |||
) | ( (int)( (a) - (b) ) <= 0 ) |
macros for comparing sequence numbers according to CIP spec vol 2 3-4.2 for int type variables
Definition at line 150 of file cipconnectionmanager.h.
typedef void(* CloseSessionFunction)(const CipConnectionObject *const connection_object) |
Definition at line 224 of file cipconnectionmanager.h.
Connection Manager Error codes.
Definition at line 35 of file cipconnectionmanager.h.
Connection Type constants of the Forward Open service request Indicates either a.
Definition at line 23 of file cipconnectionmanager.h.
void AddNewActiveConnection | ( | const CipConnectionObject *const | connection_object | ) |
Insert the given connection object to the list of currently active and managed connections.
By adding a connection to the active connection list the connection manager will perform the supervision and handle the timing (e.g., timeout, production inhibit, etc).
connection_object | pointer to the connection object to be added. |
Definition at line 1406 of file cipconnectionmanager.c.
References ConnectionObjectSetState(), DoublyLinkedListInsertAtHead(), and kConnectionObjectStateEstablished.
Referenced by EstablishClass3Connection(), and EstablishIoConnection().
void CheckForTimedOutConnectionsAndCloseTCPConnections | ( | const CipConnectionObject *const | connection_object, |
CloseSessionFunction | CloseSessions | ||
) |
Definition at line 1506 of file cipconnectionmanager.c.
References ConnectionObjectEqualOriginator(), ConnectionObjectGetState(), doubly_linked_list_node::data, DoublyLinkedList::first, kConnectionObjectStateTimedOut, and doubly_linked_list_node::next.
Referenced by Class3ConnectionTimeoutHandler(), and HandleIoConnectionTimeOut().
void CloseConnection | ( | CipConnectionObject *RESTRICT | connection_object | ) |
Close the given connection.
This function will take the data form the connection and correctly closes the connection (e.g., open sockets)
connection_object | pointer to the connection object structure to be closed |
Definition at line 1385 of file cipconnectionmanager.c.
References CloseUdpSocket(), ConnectionObjectGetTransportClassTriggerTransportClass(), ConnectionObjectInitializeEmpty(), kConnectionObjectTransportClassTriggerTransportClass3, kUdpCommuncationDirectionConsuming, kUdpCommuncationDirectionProducing, and RemoveFromActiveConnections().
Referenced by Class3ConnectionTimeoutHandler(), and EstablishClass3Connection().
Initialize the data of the connection manager object.
unique_connection_id | A unique connection id |
Definition at line 207 of file cipconnectionmanager.c.
References AddConnectableObject(), CreateCipClass(), EstablishClass3Connection(), EstablishIoConnection(), ForwardClose(), ForwardOpen(), g_incarnation_id, GetAttributeAll(), GetAttributeSingle(), GetConnectionOwner(), InitializeConnectionManager(), InitializeConnectionManagerData(), InsertService(), kEipStatusError, kEipStatusOk, kForwardClose, kForwardOpen, kGetAttributeAll, kGetAttributeSingle, and kGetConnectionOwner.
Referenced by CipStackInit().
CipConnectionObject* GetConnectedObject | ( | const EipUint32 | connection_id | ) |
Get a connected object dependent on requested ConnectionID.
connection_id | Connection ID of the Connection Object to get |
Definition at line 920 of file cipconnectionmanager.c.
References ConnectionObjectGetCipConsumedConnectionID(), ConnectionObjectGetState(), doubly_linked_list_node::data, DoublyLinkedList::first, kConnectionObjectStateEstablished, and doubly_linked_list_node::next.
Referenced by HandleReceivedConnectedData(), and NotifyConnectedCommonPacketFormat().
CipConnectionObject* GetConnectedOutputAssembly | ( | const EipUint32 | output_assembly_id | ) |
Get a connection object for a given output assembly.
output_assembly_id | requested output assembly of requested connection |
Definition at line 935 of file cipconnectionmanager.c.
References ConnectionObjectGetInstanceType(), ConnectionObjectGetState(), doubly_linked_list_node::data, DoublyLinkedList::first, kConnectionObjectInstanceTypeIOExclusiveOwner, kConnectionObjectStateEstablished, kConnectionObjectStateTimedOut, and doubly_linked_list_node::next.
Referenced by GetExclusiveOwnerConnection().
CipUint GetConnectionId | ( | void | ) |
Generate a new connection Id utilizing the Incarnation Id as described in the EIP specs.
A unique connectionID is formed from the boot-time-specified "incarnation ID" and the per-new-connection-incremented connection number/counter.
Definition at line 177 of file cipconnectionmanager.c.
References g_incarnation_id.
Referenced by ConnectionObjectGeneralConfiguration().
Definition at line 1424 of file cipconnectionmanager.c.
References ConnectionObjectIsTypeIOConnection(), cip_connection_object::consumed_path, doubly_linked_list_node::data, DoublyLinkedList::first, connection_path_epath::instance_id, and doubly_linked_list_node::next.
Referenced by SetAssemblyAttributeSingle().
void RemoveFromActiveConnections | ( | CipConnectionObject *const | connection_object | ) |
Removes connection from the list of active connections.
connection_object | Connection object to be removed from the active connection list |
Definition at line 1413 of file cipconnectionmanager.c.
References DoublyLinkedListRemoveNode(), DoublyLinkedList::first, doubly_linked_list_node::next, and OPENER_TRACE_ERR.
Referenced by CloseCommunicationChannelsAndRemoveFromActiveConnectionsList(), and CloseConnection().