65 (
void *) &kCipUintZero,
68 (
void *) &kCipUintZero,
91 if (NULL == message_router) {
95 "GetAttributeSingle");
98 g_message_router_response.
reserved = 0;
114 while (NULL !=
object)
120 object =
object->
next;
128 if (message_router_object) {
138 if (instance_number == 0) {
143 for (
CipInstance *instance = cip_class->instances; instance; instance =
146 if (instance->instance_number == instance_number) {
157 while (*message_router_object) {
158 message_router_object = &(*message_router_object)->
next;
163 if (*message_router_object == 0) {
167 (*message_router_object)->cip_class =
cip_class;
168 (*message_router_object)->next = NULL;
175 const struct sockaddr *
const originator_address,
176 const int encapsulation_session) {
185 data, data_length, &g_message_router_request) ) ) {
187 "NotifyMessageRouter: error from createMRRequeststructure\n");
190 g_message_router_response.
reserved = 0;
193 | g_message_router_request.
199 if (registered_object == 0) {
201 "NotifyMessageRouter: sending CIP_ERROR_OBJECT_DOES_NOT_EXIST reply, class id 0x%x is not registered\n",
206 g_message_router_response.
reserved = 0;
209 | g_message_router_request.
214 g_message_router_response.
reserved = 0;
217 "NotifyMessageRouter: calling notify function of class '%s'\n",
220 &g_message_router_request,
221 &g_message_router_response,
223 encapsulation_session);
225 #ifdef OPENER_TRACE_ENABLED
228 "notifyMR: notify function of class '%s' returned an error\n",
232 "notifyMR: notify function of class '%s' returned no reply\n",
236 "notifyMR: notify function of class '%s' returned a reply\n",
250 message_router_request->
service = *data;
256 if (number_of_decoded_bytes < 0) {
260 message_router_request->
data = data;
262 - number_of_decoded_bytes;
277 while (NULL != message_router_object) {
278 message_router_object_to_delete = message_router_object;
279 message_router_object = message_router_object->
next;
282 while (NULL != instance) {
283 instance_to_delete = instance;
284 instance = instance->
next;
306 CipFree(message_router_object_to_delete);
308 g_first_object = NULL;
void InsertAttribute(CipInstance *const instance, const EipUint16 attribute_number, const EipUint8 cip_type, void *const data, const EipByte cip_flags)
Insert an attribute in an instance of a CIP class.
struct cip_service_struct * services
CipMessageRouterObject * GetRegisteredObject(EipUint32 class_id)
Get the registered MessageRouter object corresponding to ClassID. given a class ID, return a pointer to the registration node for that object.
EipUint16 number_of_instances
Tracing infrastructure for OpENer.
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...
EipUint16 number_of_attributes
int DecodePaddedEPath(CipEpath *epath, const EipUint8 **message)
Decodes padded EPath.
CipAttributeStruct * attributes
CipMessageRouterRequest g_message_router_request
CIP Message Router Request.
CipError CreateMessageRouterRequestStructure(const EipUint8 *data, EipInt16 data_length, CipMessageRouterRequest *message_router_request)
Create Message Router Request structure out of the received data.
Class is a subclass of Instance.
#define OPENER_ASSERT(assertion)
EipStatus NotifyClass(const CipClass *RESTRICT const 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.
Responsible for Endianess conversion.
#define OPENER_TRACE_ERR(...)
struct cip_message_router_object * next
EipUint8 g_message_data_reply_buffer[OPENER_MESSAGE_DATA_REPLY_BUFFER]
CipMessageRouterObject * g_first_object
Pointer to first registered object in MessageRouter.
void * CipCalloc(size_t number_of_elements, size_t size_of_element)
Allocate memory for the CIP stack.
CipClass * CreateCipClass(const EipUint32 class_id, const int number_of_class_attributes, const EipUint32 highest_class_attribute_number, const int number_of_class_services, const int number_of_instance_attributes, const EipUint32 highest_instance_attribute_number, const int number_of_instance_services, const int number_of_instances, char *name, const EipUint16 revision, void(*InitializeCipClass)(CipClass *))
void InitializeCipMessageRouterClass(CipClass *cip_class)
void DeleteAllClasses(void)
Free all data allocated by the classes created in the CIP stack.
EipStatus
EIP stack status enum.
CipMessageRouterResponse g_message_router_response
Structure for storing the Response generated by an explict message.
void InsertService(const CipClass *const class, const EipUint8 service_number, const CipServiceFunction service_function, char *const service_name)
Insert a service in an instance of a CIP object.
EipStatus RegisterCipClass(CipClass *cip_class)
Register a CIP Class to the message router.
CipInstance class_instance
struct cip_instance * next
EipStatus CipMessageRouterInit()
Initialize the data structures of the message router.
#define OPENER_TRACE_INFO(...)
void CipFree(void *data)
Free memory allocated by the OpENer.
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.
CipInstance * GetCipInstance(const CipClass *RESTRICT const cip_class, EipUint32 instance_number)
Get a pointer to an instance.
CipClass * GetCipClass(const EipUint32 class_id)
Get a pointer to a CIP object with given class code.
A class registry list node.
uint8_t EipByte
EIP Data type definitions.
EipUint16 highest_attribute_number
CIP Message Router Response.
struct cip_class * cip_class
EipInt16 request_path_size
struct cip_message_router_object CipMessageRouterObject
A class registry list node.
CipUsint size_of_additional_status