MCPcopy Create free account
hub / github.com/EIPStackGroup/OpENer / GetAttributeAll

Function GetAttributeAll

source/src/cip/cipcommon.c:705–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

703}
704
705EipStatus GetAttributeAll(CipInstance *instance,
706 CipMessageRouterRequest *message_router_request,
707 CipMessageRouterResponse *message_router_response,
708 struct sockaddr *originator_address,
709 const int encapsulation_session) {
710
711 EipUint8 *reply = message_router_response->data; /* pointer into the reply */
712 CipAttributeStruct *attribute = instance->attributes; /* pointer to list of attributes*/
713 CipServiceStruct *service = GetCipService(instance, kGetAttributeSingle); /* pointer to list of services*/
714
715 if(NULL == service) {
716 /* GetAttributeAll service not found */
717 /* Return kEipStatusOk if cannot find GET_ATTRIBUTE_SINGLE service*/
718 return kEipStatusOk;
719 }
720
721 if (0 == instance->cip_class->number_of_attributes) {
722 message_router_response->data_length = 0; /*there are no attributes to be sent back*/
723 message_router_response->reply_service =
724 (0x80 | message_router_request->service);
725 message_router_response->general_status = kCipErrorServiceNotSupported;
726 message_router_response->size_of_additional_status = 0;
727 } else {
728 for (size_t j = 0; j < instance->cip_class->number_of_attributes; j++) {
729 /* for each instance attribute of this class */
730 int attribute_number = attribute->attribute_number;
731 if (attribute_number < 32 &&
732 ( (instance->cip_class->get_all_bit_mask[CalculateIndex(
733 attribute_number)])
734 &
735 (1 << (attribute_number % 8) ) ) ) {
736 /* only return attributes that are flagged as being part of GetAttributeALl */
737 message_router_request->request_path.attribute_number =
738 attribute_number;
739 if (kEipStatusOkSend !=
740 service->service_function(instance, message_router_request,
741 message_router_response,
742 originator_address,
743 encapsulation_session) ) {
744 message_router_response->data = reply;
745 return kEipStatusError;
746 }
747 message_router_response->data += message_router_response->data_length;
748 }
749 attribute++;
750 }
751 message_router_response->data_length = message_router_response->data -
752 reply;
753 message_router_response->data = reply;
754 }
755 return kEipStatusOkSend;
756}
757
758int EncodeEPath(CipEpath *epath,
759 EipUint8 **message) {

Callers

nothing calls this directly

Calls 2

GetCipServiceFunction · 0.85
CalculateIndexFunction · 0.85

Tested by

no test coverage detected