OpENer - Open Source EtherNet/IP(TM) I/O Target Stack  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cipcommon.h File Reference
#include "typedefs.h"
#include "ciptypes.h"
Include dependency graph for cipcommon.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int DecodePaddedEPath (CipEpath *epath, const EipUint8 **message)
 Decodes padded EPath. More...
 
EipStatus GetAttributeAll (CipInstance *instance, CipMessageRouterRequest *message_router_request, CipMessageRouterResponse *message_router_response, struct sockaddr *originator_address, const int encapsulation_session)
 Generic implementation of the GetAttributeAll CIP service. More...
 
EipStatus GetAttributeSingle (CipInstance *RESTRICT const instance, CipMessageRouterRequest *const message_router_request, CipMessageRouterResponse *const message_router_response, struct sockaddr *originator_address, const int encapsulation_session)
 Generic implementation of the GetAttributeSingle CIP service. More...
 
size_t GetSizeOfAttribute (const CipAttributeStruct *const attribute_struct)
 
EipStatus NotifyClass (const CipClass *const RESTRICT cip_class, CipMessageRouterRequest *const message_router_request, CipMessageRouterResponse *const message_router_response, struct sockaddr *originator_address, const int encapsulation_session)
 Check if requested service present in class/instance and call appropriate service. More...
 

Variables

EipUint8 g_message_data_reply_buffer []
 

Detailed Description

Common CIP object interface

Definition in file cipcommon.h.

Function Documentation

int DecodePaddedEPath ( CipEpath epath,
const EipUint8 **  message 
)

Decodes padded EPath.

Parameters
epathEPath object to the receiving element
messagepointer to the message to decode
Returns
Number of decoded bytes

Definition at line 804 of file cipcommon.c.

References CipEpath::attribute_number, CipEpath::class_id, GetIntFromMessage(), CipEpath::instance_number, kEipStatusError, kSegmentTypeReserved, LOGICAL_SEGMENT_FORMAT_EIGHT_BIT, LOGICAL_SEGMENT_FORMAT_SIXTEEN_BIT, LOGICAL_SEGMENT_TYPE_ATTRIBUTE_ID, LOGICAL_SEGMENT_TYPE_CLASS_ID, LOGICAL_SEGMENT_TYPE_INSTANCE_ID, LOGICAL_SEGMENT_TYPE_MEMBER_ID, OPENER_TRACE_ERR, CipEpath::path_size, and SEGMENT_TYPE_LOGICAL_SEGMENT.

Referenced by CreateMessageRouterRequestStructure().

Here is the call graph for this function:

Here is the caller graph for this function:

EipStatus GetAttributeAll ( CipInstance instance,
CipMessageRouterRequest message_router_request,
CipMessageRouterResponse message_router_response,
struct sockaddr *  originator_address,
const int  encapsulation_session 
)

Generic implementation of the GetAttributeAll CIP service.

Copy all attributes from Object into the global message buffer.

Parameters
instancepointer to object instance with data.
message_router_requestpointer to MR request.
message_router_responsepointer for MR response.
originator_addressaddress struct of the originator as received
encapsulation_sessionassociated encapsulation session of the explicit message
Returns
length of data stream >0 .. success 0 .. no reply to send

Definition at line 704 of file cipcommon.c.

References CipEpath::attribute_number, CipAttributeStruct::attribute_number, cip_instance::attributes, CalculateIndex(), cip_instance::cip_class, CipMessageRouterResponse::data, CipMessageRouterResponse::data_length, CipMessageRouterResponse::general_status, cip_class::get_all_bit_mask, GetCipService(), kCipErrorServiceNotSupported, kEipStatusError, kEipStatusOk, kEipStatusOkSend, kGetAttributeSingle, cip_class::number_of_attributes, CipMessageRouterResponse::reply_service, CipMessageRouterRequest::request_path, CipMessageRouterRequest::service, cip_service_struct::service_function, and CipMessageRouterResponse::size_of_additional_status.

Referenced by CipEthernetLinkInit(), CipIdentityInit(), ConnectionManagerInit(), and CreateCipClass().

Here is the call graph for this function:

Here is the caller graph for this function:

EipStatus GetAttributeSingle ( CipInstance *RESTRICT const  instance,
CipMessageRouterRequest *const  message_router_request,
CipMessageRouterResponse *const  message_router_response,
struct sockaddr *  originator_address,
const int  encapsulation_session 
)

Generic implementation of the GetAttributeSingle CIP service.

Check from classID which Object requests an attribute, search if object has the appropriate attribute implemented.

Parameters
instancepointer to instance.
message_router_requestpointer to request.
message_router_responsepointer to response.
originator_addressaddress struct of the originator as received
encapsulation_sessionassociated encapsulation session of the explicit message
Returns
status >0 .. success -1 .. requested attribute not available

Definition at line 391 of file cipcommon.c.

References CipEpath::attribute_number, BeforeAssemblyDataSend(), CalculateIndex(), CipMessageRouterResponse::data, CipAttributeStruct::data, CipMessageRouterResponse::data_length, EncodeData(), CipMessageRouterResponse::general_status, GetCipAttribute(), kCipByteArray, kCipErrorAttributeNotSupported, kCipErrorSuccess, kEipStatusOkSend, kGetAttributeAll, OPENER_ASSERT, OPENER_TRACE_INFO, CipMessageRouterResponse::reply_service, CipMessageRouterRequest::request_path, CipMessageRouterRequest::service, CipMessageRouterResponse::size_of_additional_status, and CipAttributeStruct::type.

Referenced by CipIdentityInit(), CipMessageRouterInit(), ConnectionManagerInit(), CreateAssemblyClass(), CreateCipClass(), GetAttributeSingleEthernetLink(), and GetAttributeSingleQoS().

Here is the call graph for this function:

Here is the caller graph for this function:

EipStatus NotifyClass ( const CipClass *const RESTRICT  cip_class,
CipMessageRouterRequest *const  message_router_request,
CipMessageRouterResponse *const  message_router_response,
struct sockaddr *  originator_address,
const int  encapsulation_session 
)

Check if requested service present in class/instance and call appropriate service.

Parameters
cip_classclass receiving the message
message_router_requestrequest message
message_router_responsereply message
originator_addressaddress struct of the originator as received
encapsulation_sessionassociated encapsulation session of the explicit message
Returns
  • kEipStatusOkSend ... success
  • kEipStatusOk ... no reply to send back
  • kEipStatusError ... error

Definition at line 75 of file cipcommon.c.

References cip_instance::cip_class, CipMessageRouterResponse::data_length, CipMessageRouterResponse::general_status, GetCipInstance(), CipEpath::instance_number, kCipErrorPathDestinationUnknown, kCipErrorServiceNotSupported, kEipStatusOkSend, cip_service_struct::name, cip_class::number_of_services, OPENER_ASSERT, OPENER_TRACE_INFO, OPENER_TRACE_WARN, CipMessageRouterResponse::reply_service, CipMessageRouterRequest::request_path, CipMessageRouterRequest::service, cip_service_struct::service_function, cip_service_struct::service_number, cip_class::services, and CipMessageRouterResponse::size_of_additional_status.

Referenced by NotifyMessageRouter().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

EipUint8 g_message_data_reply_buffer[]

A buffer for holding the replay generated by explicit message requests or producing I/O connections. These will use this buffer in the following ways:

  1. Explicit messages will use this buffer to store the data generated by the request
  2. I/O Connections will use this buffer for the produced data

Reply buffer

Definition at line 30 of file cipcommon.c.

Referenced by CipMessageRouterInit(), and NotifyMessageRouter().