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

Go to the source code of this file.

Functions

EipStatus CipMessageRouterInit (void)
 Initialize the data structures of the message router. More...
 
void DeleteAllClasses (void)
 Free all data allocated by the classes created in the CIP stack. More...
 
EipStatus NotifyMessageRouter (EipUint8 *data, int data_length, const struct sockaddr *const originator_address, const int encapsulation_session)
 Notify the MessageRouter that an explicit message (connected or unconnected) has been received. This function will be called from the encapsulation layer. The CPF structure is already parsed an can be accessed via the global variable: g_stCPFDataItem. More...
 
EipStatus RegisterCipClass (CipClass *cip_class)
 Register a CIP Class to the message router. More...
 

Variables

CipMessageRouterResponse g_message_router_response
 Structure for storing the Response generated by an explict message. More...
 

Function Documentation

EipStatus CipMessageRouterInit ( void  )

Initialize the data structures of the message router.

Returns
kEipStatusOk if class was initialized, otherwise kEipStatusError

Definition at line 78 of file cipmessagerouter.c.

References CreateCipClass(), CipMessageRouterResponse::data, g_message_data_reply_buffer, GetAttributeSingle(), InitializeCipMessageRouterClass(), InsertService(), kEipStatusError, kEipStatusOk, kGetAttributeSingle, and CipMessageRouterResponse::reserved.

Referenced by CipStackInit().

Here is the call graph for this function:

Here is the caller graph for this function:

void DeleteAllClasses ( void  )

Free all data allocated by the classes created in the CIP stack.

Definition at line 271 of file cipmessagerouter.c.

References cip_instance::attributes, cip_message_router_object::cip_class, cip_instance::cip_class, CipFree(), cip_class::class_instance, cip_class::class_name, g_first_object, cip_class::instances, cip_message_router_object::next, cip_instance::next, cip_class::number_of_attributes, and cip_class::services.

Referenced by ShutdownCipStack().

Here is the call graph for this function:

Here is the caller graph for this function:

EipStatus NotifyMessageRouter ( EipUint8 data,
int  data_length,
const struct sockaddr *const  originator_address,
const int  encapsulation_session 
)

Notify the MessageRouter that an explicit message (connected or unconnected) has been received. This function will be called from the encapsulation layer. The CPF structure is already parsed an can be accessed via the global variable: g_stCPFDataItem.

Parameters
datapointer to the data buffer of the message directly at the beginning of the CIP part.
data_lengthnumber of bytes in the data buffer
originator_addressThe address of the originator as received
encapsulation_sessionThe associated encapsulation session of the explicit message
Returns
kEipStatusError on fault kEipStatusOk on success

Definition at line 173 of file cipmessagerouter.c.

References cip_message_router_object::cip_class, CipEpath::class_id, cip_class::class_name, CreateMessageRouterRequestStructure(), CipMessageRouterResponse::data, CipMessageRouterResponse::data_length, g_message_data_reply_buffer, CipMessageRouterResponse::general_status, GetRegisteredObject(), kCipErrorPathDestinationUnknown, kCipErrorSuccess, kEipStatusError, kEipStatusOk, kEipStatusOkSend, NotifyClass(), OPENER_ASSERT, OPENER_TRACE_ERR, OPENER_TRACE_INFO, CipMessageRouterResponse::reply_service, CipMessageRouterRequest::request_path, CipMessageRouterResponse::reserved, and CipMessageRouterResponse::size_of_additional_status.

Referenced by NotifyCommonPacketFormat(), and NotifyConnectedCommonPacketFormat().

Here is the call graph for this function:

Here is the caller graph for this function:

EipStatus RegisterCipClass ( CipClass cip_class)

Register a CIP Class to the message router.

Register a class at the message router. In order that the message router can deliver explicit messages each class has to register. Will be automatically done when invoking create createCIPClass.

Parameters
cip_classCIP class to be registered
Returns
kEipStatusOk on success
Parameters
cip_classPointer to a class object to be registered.
Returns
kEipStatusOk on success kEipStatusError on no memory available to register more objects

Definition at line 154 of file cipmessagerouter.c.

References cip_message_router_object::cip_class, CipCalloc(), g_first_object, kEipStatusError, kEipStatusOk, and cip_message_router_object::next.

Referenced by CreateCipClass().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

CipMessageRouterResponse g_message_router_response

Structure for storing the Response generated by an explict message.

This buffer will be used for storing the result. The response message will be generated by assembleLinearMsg.

Definition at line 14 of file cipmessagerouter.c.

Referenced by NotifyCommonPacketFormat(), and NotifyConnectedCommonPacketFormat().