OpENer - Open Source EtherNet/IP(TM) I/O Target Stack
2.1
|
#include <string.h>
#include <stdbool.h>
#include "cipconnectionmanager.h"
#include "opener_user_conf.h"
#include "cipcommon.h"
#include "cipmessagerouter.h"
#include "ciperror.h"
#include "endianconv.h"
#include "opener_api.h"
#include "encap.h"
#include "cipidentity.h"
#include "trace.h"
#include "cipconnectionobject.h"
#include "cipclass3connection.h"
#include "cipioconnection.h"
#include "cipassembly.h"
#include "cpf.h"
#include "appcontype.h"
#include "generic_networkhandler.h"
#include "cipepath.h"
#include "cipelectronickey.h"
#include "cipqos.h"
Go to the source code of this file.
Data Structures | |
struct | ConnectionManagementHandling |
Typedefs | |
typedef EipStatus(* | HandleForwardOpenRequestFunction )(CipConnectionObject *connection_object, CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response) |
Function prototype for all Forward Open handle functions. More... | |
Functions | |
EipStatus | AddConnectableObject (const EipUint32 class_id, OpenConnectionFunction open_connection_function) |
register open functions for an specific object. More... | |
void | AddNewActiveConnection (const CipConnectionObject *const connection_object) |
Insert the given connection object to the list of currently active and managed connections. More... | |
void | AddNullAddressItem (CipCommonPacketFormatData *common_data_packet_format_data) |
Adds a Null Address Item to the common data packet format data. More... | |
EipStatus | AssembleForwardCloseResponse (EipUint16 connection_serial_number, EipUint16 originatior_vendor_id, EipUint32 originator_serial_number, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response, EipUint16 extended_error_code) |
EipStatus | AssembleForwardOpenResponse (CipConnectionObject *connection_object, CipMessageRouterResponse *message_router_response, EipUint8 general_status, EipUint16 extended_status) |
Assembles the Forward Open Response. More... | |
EipStatus | CheckElectronicKeyData (EipUint8 key_format, void *key_data, EipUint16 *extended_status) |
Compare the electronic key received with a forward open request with the device's data. More... | |
CipConnectionObject * | CheckForExistingConnection (const CipConnectionObject *const connection_object) |
check if the data given in the connection object match with an already established connection 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... | |
EipStatus | ForwardClose (CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response, struct sockaddr *originator_address, const int encapsulation_session) |
EipStatus | ForwardOpen (CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response, struct sockaddr *originator_address, const int encapsulation_session) |
Check if resources for new connection available, generate ForwardOpen Reply message. 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... | |
ConnectionManagementHandling * | GetConnectionManagementEntry (const EipUint32 class_id) |
EipStatus | GetConnectionOwner (CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response, struct sockaddr *originator_address, const int encapsulation_session) |
unsigned int | GetPaddedLogicalPath (const EipUint8 **logical_path_segment) |
gets the padded logical path TODO: enhance documentation More... | |
EipStatus | HandleNonNullMatchingForwardOpenRequest (CipConnectionObject *connection_object, CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response) |
Handles a Non Null Matching Forward Open Request. More... | |
EipStatus | HandleNonNullNonMatchingForwardOpenRequest (CipConnectionObject *connection_object, CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response) |
Handles a Non Null Non Matching Forward Open Request. More... | |
EipStatus | HandleNullMatchingForwardOpenRequest (CipConnectionObject *connection_object, CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response) |
Handles a Null Matching Forward Open request. More... | |
EipStatus | HandleNullNonMatchingForwardOpenRequest (CipConnectionObject *connection_object, CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response) |
Handles a Null Non Matching Forward Open Request. More... | |
EipStatus | HandleReceivedConnectedData (const EipUint8 *const data, int data_length, struct sockaddr_in *from_address) |
Notify the connection manager that data for a connection has been received. More... | |
void | InitializeConnectionManager (CipClass *class) |
void | InitializeConnectionManagerData (void) |
EipBool8 | IsConnectedOutputAssembly (const EipUint32 instance_number) |
EipStatus | ManageConnections (MilliSeconds elapsed_time) |
Check if any of the connection timers (TransmissionTrigger or WatchdogTimeout) have timed out. More... | |
EipUint8 | ParseConnectionPath (CipConnectionObject *connection_object, CipMessageRouterRequest *message_router_request, EipUint16 *extended_error) |
Parse the connection path of a forward open request. More... | |
void | RemoveFromActiveConnections (CipConnectionObject *const connection_object) |
Removes connection from the list of active connections. More... | |
EipStatus | TriggerConnections (unsigned int output_assembly, unsigned int input_assembly) |
Trigger the production of an application triggered connection. More... | |
Variables | |
DoublyLinkedList | connection_list |
EipUint16 | device_type_ |
ConnectionManagementHandling | g_connection_management_list [2+OPENER_CIP_NUM_APPLICATION_SPECIFIC_CONNECTABLE_OBJECTS] |
CipConnectionObject | g_dummy_connection_object |
EipUint32 | g_incarnation_id |
Holds the connection ID's "incarnation ID" in the upper 16 bits. More... | |
const size_t | g_kForwardOpenHeaderLength = 36 |
EipUint16 | product_code_ |
CipRevision | revision_ |
EipUint16 | vendor_id_ |
typedef EipStatus(* HandleForwardOpenRequestFunction)(CipConnectionObject *connection_object, CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response) |
Function prototype for all Forward Open handle functions.
Definition at line 306 of file cipconnectionmanager.c.
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 AddNullAddressItem | ( | CipCommonPacketFormatData * | common_data_packet_format_data | ) |
Adds a Null Address Item to the common data packet format data.
common_data_packet_format_data | The CPF data packet where the Null Address Item shall be added |
Definition at line 846 of file cipconnectionmanager.c.
References CipCommonPacketFormatData::address_item, CipCommonPacketFormatData::data_item, kCipItemIdNullAddress, kCipItemIdUnconnectedDataItem, AddressItem::length, AddressItem::type_id, and DataItem::type_id.
Referenced by AssembleForwardCloseResponse(), and AssembleForwardOpenResponse().
EipStatus AssembleForwardCloseResponse | ( | EipUint16 | connection_serial_number, |
EipUint16 | originatior_vendor_id, | ||
EipUint32 | originator_serial_number, | ||
CipMessageRouterRequest * | message_router_request, | ||
CipMessageRouterResponse * | message_router_response, | ||
EipUint16 | extended_error_code | ||
) |
Definition at line 872 of file cipconnectionmanager.c.
References AddDintToMessage(), AddIntToMessage(), CipMessageRouterResponse::additional_status, AddNullAddressItem(), CipMessageRouterRequest::data, CipMessageRouterResponse::data, CipCommonPacketFormatData::data_item, CipMessageRouterResponse::data_length, g_common_packet_format_data_item, CipMessageRouterResponse::general_status, CipCommonPacketFormatData::item_count, kCipErrorConnectionFailure, kCipErrorPrivilegeViolation, kCipErrorSuccess, kCipItemIdUnconnectedDataItem, kConnectionManagerExtendedStatusCodeSuccess, kConnectionManagerExtendedStatusWrongCloser, kEipStatusOkSend, CipMessageRouterResponse::reply_service, CipMessageRouterRequest::service, CipMessageRouterResponse::size_of_additional_status, and DataItem::type_id.
Referenced by ForwardClose().
EipStatus AssembleForwardOpenResponse | ( | CipConnectionObject * | connection_object, |
CipMessageRouterResponse * | message_router_response, | ||
EipUint8 | general_status, | ||
EipUint16 | extended_status | ||
) |
Assembles the Forward Open Response.
connection_object | pointer to connection Object |
message_router_response | pointer to message router response |
general_status | the general status of the response |
extended_status | extended status in the case of an error otherwise 0 |
Definition at line 740 of file cipconnectionmanager.c.
References AddDintToMessage(), AddIntToMessage(), CipMessageRouterResponse::additional_status, AddNullAddressItem(), CipCommonPacketFormatData::address_info_item, cip_connection_object::cip_consumed_connection_id, cip_connection_object::cip_produced_connection_id, cip_connection_object::connection_serial_number, ConnectionObjectSetState(), CipMessageRouterResponse::data, CipCommonPacketFormatData::data_item, CipMessageRouterResponse::data_length, g_common_packet_format_data_item, CipMessageRouterResponse::general_status, CipCommonPacketFormatData::item_count, kCipErrorNotEnoughData, kCipErrorSuccess, kCipErrorTooMuchData, kCipItemIdUnconnectedDataItem, kConnectionManagerExtendedStatusCodeErrorInvalidOToTConnectionSize, kConnectionManagerExtendedStatusCodeErrorInvalidTToOConnectionSize, kConnectionObjectStateNonExistent, kEipStatusOkSend, kForwardOpen, cip_connection_object::o_to_t_requested_packet_interval, OPENER_TRACE_INFO, cip_connection_object::originator_serial_number, cip_connection_object::originator_vendor_id, CipMessageRouterResponse::reply_service, CipMessageRouterResponse::size_of_additional_status, cip_connection_object::t_to_o_requested_packet_interval, DataItem::type_id, and SocketAddressInfoItem::type_id.
Referenced by ForwardOpen(), HandleNonNullMatchingForwardOpenRequest(), HandleNonNullNonMatchingForwardOpenRequest(), HandleNullMatchingForwardOpenRequest(), and HandleNullNonMatchingForwardOpenRequest().
EipStatus CheckElectronicKeyData | ( | EipUint8 | key_format, |
void * | key_data, | ||
EipUint16 * | extended_status | ||
) |
Compare the electronic key received with a forward open request with the device's data.
key_format | format identifier given in the forward open request |
key_data | pointer to the electronic key data received in the forward open request |
extended_status | the extended error code in case an error happened |
Definition at line 972 of file cipconnectionmanager.c.
References device_type_, ElectronicKeyFormat4GetDeviceType(), ElectronicKeyFormat4GetMajorRevision(), ElectronicKeyFormat4GetMajorRevisionCompatibility(), ElectronicKeyFormat4GetMinorRevision(), ElectronicKeyFormat4GetProductCode(), ElectronicKeyFormat4GetVendorId(), kConnectionManagerExtendedStatusCodeErrorDeviceTypeError, kConnectionManagerExtendedStatusCodeErrorInvalidSegmentTypeInPath, kConnectionManagerExtendedStatusCodeErrorRevisionMismatch, kConnectionManagerExtendedStatusCodeErrorVendorIdOrProductcodeError, kConnectionManagerExtendedStatusCodeSuccess, kEipStatusError, kEipStatusOk, CipRevision::major_revision, CipRevision::minor_revision, product_code_, and vendor_id_.
Referenced by ParseConnectionPath().
CipConnectionObject * CheckForExistingConnection | ( | const CipConnectionObject *const | connection_object | ) |
check if the data given in the connection object match with an already established connection
The comparison is done according to the definitions in the CIP specification Section 3-5.5.2: The following elements have to be equal: Vendor ID, Connection Serial Number, Originator Serial Number
connection_object | connection object containing the comparison elements from the forward open request |
Definition at line 954 of file cipconnectionmanager.c.
References ConnectionObjectGetState(), doubly_linked_list_node::data, EqualConnectionTriad(), DoublyLinkedList::first, kConnectionObjectStateEstablished, and doubly_linked_list_node::next.
Referenced by ForwardOpen().
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().
EipStatus ForwardClose | ( | CipInstance * | instance, |
CipMessageRouterRequest * | message_router_request, | ||
CipMessageRouterResponse * | message_router_response, | ||
struct sockaddr * | originator_address, | ||
const int | encapsulation_session | ||
) |
Definition at line 560 of file cipconnectionmanager.c.
References CipCommonPacketFormatData::address_info_item, AssembleForwardCloseResponse(), cip_connection_object::connection_close_function, cip_connection_object::connection_serial_number, ConnectionObjectGetState(), doubly_linked_list_node::data, CipMessageRouterRequest::data, DoublyLinkedList::first, g_common_packet_format_data_item, GetDintFromMessage(), GetIntFromMessage(), kConnectionManagerExtendedStatusCodeErrorConnectionTargetConnectionNotFound, kConnectionManagerExtendedStatusCodeSuccess, kConnectionManagerExtendedStatusWrongCloser, kConnectionObjectStateEstablished, kConnectionObjectStateTimedOut, doubly_linked_list_node::next, OPENER_ASSERT, OPENER_TRACE_INFO, cip_connection_object::originator_address, cip_connection_object::originator_serial_number, cip_connection_object::originator_vendor_id, and SocketAddressInfoItem::type_id.
Referenced by ConnectionManagerInit().
EipStatus ForwardOpen | ( | CipInstance * | instance, |
CipMessageRouterRequest * | message_router_request, | ||
CipMessageRouterResponse * | message_router_response, | ||
struct sockaddr * | originator_address, | ||
const int | encapsulation_session | ||
) |
Check if resources for new connection available, generate ForwardOpen Reply message.
Forward Open four cases Non-Null/Not matching - open a connection Non-Null/Matching - error Null/Not matching - ping a device/configure Null/Matching - reconfigure
Null connection - both O->T and T->O connection parameter field are null Non-Null connection - one or both O->T and T->O connection parameter field are not null Matching - Connection Triad matches an existing connection (Connection Serial Number, Originator Vendor ID and Originator Serial Number)
instance | pointer to CIP object instance |
message_router_request | pointer to Message Router Request. |
message_router_response | pointer to Message Router Response. |
originator_address | address struct of the originator as received |
encapsulation_session | associated encapsulation session of the explicit message |
Definition at line 492 of file cipconnectionmanager.c.
References AssembleForwardOpenResponse(), cip_connection_object::associated_encapsulation_session, CheckForExistingConnection(), ConnectionObjectGetOToTConnectionType(), ConnectionObjectGetTToOConnectionType(), ConnectionObjectInitializeFromMessage(), CipMessageRouterRequest::data, kCipErrorConnectionFailure, kConnectionManagerExtendedStatusCodeErrorInvalidOToTConnectionType, kConnectionManagerExtendedStatusCodeErrorInvalidTToOConnectionType, kConnectionObjectConnectionTypeInvalid, kConnectionObjectConnectionTypeNull, OPENER_TRACE_INFO, and cip_connection_object::originator_address.
Referenced by ConnectionManagerInit().
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().
ConnectionManagementHandling * GetConnectionManagementEntry | ( | const EipUint32 | class_id | ) |
Definition at line 1465 of file cipconnectionmanager.c.
Referenced by HandleNonNullNonMatchingForwardOpenRequest().
EipStatus GetConnectionOwner | ( | CipInstance * | instance, |
CipMessageRouterRequest * | message_router_request, | ||
CipMessageRouterResponse * | message_router_response, | ||
struct sockaddr * | originator_address, | ||
const int | encapsulation_session | ||
) |
Definition at line 636 of file cipconnectionmanager.c.
References kEipStatusOk.
Referenced by ConnectionManagerInit().
unsigned int GetPaddedLogicalPath | ( | const EipUint8 ** | logical_path_segment | ) |
gets the padded logical path TODO: enhance documentation
logical_path_segment | TheLogical Path Segment |
Definition at line 155 of file cipconnectionmanager.c.
References OPENER_TRACE_ERR.
EipStatus HandleNonNullMatchingForwardOpenRequest | ( | CipConnectionObject * | connection_object, |
CipInstance * | instance, | ||
CipMessageRouterRequest * | message_router_request, | ||
CipMessageRouterResponse * | message_router_response | ||
) |
Handles a Non Null Matching Forward Open Request.
Non-Null, Matching request - Return General Status = kCipErrorConnectionFailure, Extended Status = kConnectionManagerExtendedStatusCodeErrorConnectionInUseOrDuplicateForwardOpen
Definition at line 375 of file cipconnectionmanager.c.
References AssembleForwardOpenResponse(), kCipErrorConnectionFailure, kConnectionManagerExtendedStatusCodeErrorConnectionInUseOrDuplicateForwardOpen, and OPENER_TRACE_INFO.
EipStatus HandleNonNullNonMatchingForwardOpenRequest | ( | CipConnectionObject * | connection_object, |
CipInstance * | instance, | ||
CipMessageRouterRequest * | message_router_request, | ||
CipMessageRouterResponse * | message_router_response | ||
) |
Handles a Non Null Non Matching Forward Open Request.
Non-Null, Non-Matching request - Establish a new connection
Definition at line 399 of file cipconnectionmanager.c.
References AssembleForwardOpenResponse(), connection_path_epath::class_id, cip_connection_object::configuration_path, ConnectionObjectGetTransportClassTriggerProductionTrigger(), doubly_linked_list_node::data, DoublyLinkedList::first, GetConnectionManagementEntry(), kCipErrorConnectionFailure, kCipErrorSuccess, kConnectionManagerExtendedStatusCodeErrorTransportClassAndTriggerCombinationNotSupported, kConnectionManagerExtendedStatusCodeInconsistentApplicationPathCombo, kConnectionManagerExtendedStatusCodeSuccess, kConnectionObjectTransportClassTriggerProductionTriggerInvalid, kEipStatusError, kEipStatusOk, ConnectionManagementHandling::open_connection_function, OPENER_TRACE_INFO, and ParseConnectionPath().
EipStatus HandleNullMatchingForwardOpenRequest | ( | CipConnectionObject * | connection_object, |
CipInstance * | instance, | ||
CipMessageRouterRequest * | message_router_request, | ||
CipMessageRouterResponse * | message_router_response | ||
) |
Handles a Null Matching Forward Open request.
Either reconfigure a target device’s application, or return General Status kCipErrorConnectionFailure and Extended Status kConnectionManagerExtendedStatusCodeNullForwardOpenNotSupported
Definition at line 350 of file cipconnectionmanager.c.
References AssembleForwardOpenResponse(), kCipErrorConnectionFailure, kConnectionManagerExtendedStatusCodeNullForwardOpenNotSupported, and OPENER_TRACE_INFO.
EipStatus HandleNullNonMatchingForwardOpenRequest | ( | CipConnectionObject * | connection_object, |
CipInstance * | instance, | ||
CipMessageRouterRequest * | message_router_request, | ||
CipMessageRouterResponse * | message_router_response | ||
) |
Handles a Null Non Matching Forward Open Request.
Null, Non-Matching - Either ping device, or configure a device’s application, or return General Status kCipErrorConnectionFailure and Extended Status kConnectionManagerExtendedStatusCodeNullForwardOpenNotSupported
Definition at line 324 of file cipconnectionmanager.c.
References AssembleForwardOpenResponse(), kCipErrorConnectionFailure, kConnectionManagerExtendedStatusCodeNullForwardOpenNotSupported, and OPENER_TRACE_INFO.
void InitializeConnectionManager | ( | CipClass * | class | ) |
Definition at line 183 of file cipconnectionmanager.c.
References cip_instance::cip_class, cip_class::class_instance, cip_class::highest_attribute_number, InsertAttribute(), kCipUint, kGetableSingle, kGetableSingleAndAll, and kNotSetOrGetable.
Referenced by ConnectionManagerInit().
void InitializeConnectionManagerData | ( | void | ) |
Definition at line 1528 of file cipconnectionmanager.c.
References InitializeClass3ConnectionData(), and InitializeIoConnectionData().
Referenced by ConnectionManagerInit().
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().
EipUint8 ParseConnectionPath | ( | CipConnectionObject * | connection_object, |
CipMessageRouterRequest * | message_router_request, | ||
EipUint16 * | extended_error | ||
) |
Parse the connection path of a forward open request.
This function will take the connection object and the received data stream and parse the connection path.
connection_object | pointer to the connection object structure for which the connection should be established |
message_router_request | pointer to the received request structure. The position of the data stream pointer has to be at the connection length entry |
extended_error | the extended error code in case an error happened |
Definition at line 1050 of file cipconnectionmanager.c.
References CheckElectronicKeyData(), CipEpathGetLogicalValue(), connection_path_epath::class_id, cip_connection_object::configuration_path, ConnectionObjectGetOToTConnectionType(), ConnectionObjectGetTransportClassTriggerProductionTrigger(), ConnectionObjectGetTransportClassTriggerTransportClass(), ConnectionObjectGetTToOConnectionType(), ConnectionObjectSetProductionInhibitTime(), cip_connection_object::consumed_connection_path, cip_connection_object::consumed_connection_path_length, cip_connection_object::consumed_path, CipMessageRouterRequest::data, cip_connection_object::electronic_key, ElectronicKeyFormat4Delete(), ElectronicKeyFormat4GetDeviceType(), ElectronicKeyFormat4GetMajorRevision(), ElectronicKeyFormat4GetMinorRevision(), ElectronicKeyFormat4GetProductCode(), ElectronicKeyFormat4GetVendorId(), ElectronicKeyFormat4New(), g_config_data_buffer, g_config_data_length, g_kForwardOpenHeaderLength, GetCipInstance(), GetElectronicKeyFormat4FromMessage(), GetPathDataSegmentSubtype(), GetPathLogicalSegmentElectronicKeyFormat(), GetPathLogicalSegmentLogicalType(), GetPathLogicalSegmentSpecialTypeLogicalType(), GetPathNetworkSegmentSubtype(), GetPathSegmentType(), GetSintFromMessage(), kCipErrorConnectionFailure, kCipErrorNotEnoughData, kCipErrorPathSegmentError, kCipErrorTooMuchData, kConnectionManagerExtendedStatusCodeErrorInvalidSegmentTypeInPath, kConnectionManagerExtendedStatusCodeInconsistentApplicationPathCombo, kConnectionManagerGeneralStatusPathSegmentErrorInUnconnectedSend, kConnectionObjectConnectionTypeNull, kConnectionObjectTransportClassTriggerProductionTriggerCyclic, kConnectionObjectTransportClassTriggerTransportClass3, kDataSegmentSubtypeSimpleData, kEipStatusOk, kElectronicKeySegmentFormatKeyFormat4, CipElectronicKey::key_data, CipElectronicKey::key_format, kLogicalSegmentLogicalTypeClassId, kLogicalSegmentLogicalTypeConnectionPoint, kLogicalSegmentLogicalTypeInstanceId, kLogicalSegmentLogicalTypeSpecial, kLogicalSegmentSpecialTypeLogicalFormatElectronicKey, kNetworkSegmentSubtypeProductionInhibitTimeInMilliseconds, kSegmentTypeDataSegment, kSegmentTypeLogicalSegment, kSegmentTypeNetworkSegment, OPENER_TRACE_ERR, OPENER_TRACE_INFO, OPENER_TRACE_WARN, cip_connection_object::produced_path, cip_connection_object::production_inhibit_time, and CipMessageRouterRequest::request_path_size.
Referenced by HandleNonNullNonMatchingForwardOpenRequest().
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().
DoublyLinkedList connection_list |
Definition at line 53 of file cipconnectionobject.c.
EipUint16 device_type_ |
Attribute 2: Device Type
Definition at line 42 of file cipidentity.c.
Referenced by CheckElectronicKeyData().
ConnectionManagementHandling g_connection_management_list[2+OPENER_CIP_NUM_APPLICATION_SPECIFIC_CONNECTABLE_OBJECTS] |
List holding information on the object classes and open/close function pointers to which connections may be established.
Definition at line 56 of file cipconnectionmanager.c.
CipConnectionObject g_dummy_connection_object |
buffer connection object needed for forward open
Definition at line 59 of file cipconnectionmanager.c.
EipUint32 g_incarnation_id |
Holds the connection ID's "incarnation ID" in the upper 16 bits.
Definition at line 62 of file cipconnectionmanager.c.
Referenced by ConnectionManagerInit(), and GetConnectionId().
const size_t g_kForwardOpenHeaderLength = 36 |
the length in bytes of the forward open command specific data till the start of the connection path (including con path size)
Definition at line 38 of file cipconnectionmanager.c.
Referenced by ParseConnectionPath().
EipUint16 product_code_ |
Attribute 3: Product Code
Definition at line 43 of file cipidentity.c.
Referenced by CheckElectronicKeyData().
CipRevision revision_ |
Attribute 4: Revision / USINT Major, USINT Minor
Definition at line 44 of file cipidentity.c.
EipUint16 vendor_id_ |
Attribute 1: Vendor ID
Definition at line 41 of file cipidentity.c.
Referenced by CheckElectronicKeyData().