| 78 | const int encapsulation_session); |
| 79 | |
| 80 | EipStatus SetAttributeSingleTcp( |
| 81 | CipInstance *instance, |
| 82 | CipMessageRouterRequest *message_router_request, |
| 83 | CipMessageRouterResponse *message_router_response, |
| 84 | struct sockaddr *originator_address, |
| 85 | const int encapsulation_session) { |
| 86 | CipAttributeStruct *attribute = GetCipAttribute( |
| 87 | instance, message_router_request->request_path.attribute_number); |
| 88 | (void) instance; /*Suppress compiler warning */ |
| 89 | EipUint16 attribute_number = message_router_request->request_path |
| 90 | .attribute_number; |
| 91 | |
| 92 | if (NULL != attribute) { |
| 93 | uint8_t set_bit_mask = (instance->cip_class->set_bit_mask[CalculateIndex( |
| 94 | attribute_number) |
| 95 | ]); |
| 96 | if ( set_bit_mask & ( 1 << ( (attribute_number) % 8 ) ) ) { |
| 97 | switch (attribute_number) { |
| 98 | case 3: { |
| 99 | CipUint configuration_control_recieved = GetDintFromMessage( |
| 100 | &(message_router_request->data) ); |
| 101 | if ( (configuration_control_recieved >= 0x03) |
| 102 | && (configuration_control_recieved <= 0x0F) ) { |
| 103 | message_router_response->general_status = |
| 104 | kCipErrorInvalidAttributeValue; |
| 105 | |
| 106 | } else { |
| 107 | |
| 108 | OPENER_TRACE_INFO(" setAttribute %d\n", attribute_number); |
| 109 | |
| 110 | if (attribute->data != NULL) { |
| 111 | CipDword *data = (CipDword *) attribute->data; |
| 112 | *(data) = configuration_control_recieved; |
| 113 | message_router_response->general_status = kCipErrorSuccess; |
| 114 | } else { |
| 115 | message_router_response->general_status = kCipErrorNotEnoughData; |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | break; |
| 120 | |
| 121 | case 13: { |
| 122 | |
| 123 | CipUint inactivity_timeout_received = GetIntFromMessage( |
| 124 | &(message_router_request->data) ); |
| 125 | |
| 126 | if (inactivity_timeout_received > 3600) { |
| 127 | message_router_response->general_status = |
| 128 | kCipErrorInvalidAttributeValue; |
| 129 | } else { |
| 130 | |
| 131 | OPENER_TRACE_INFO("setAttribute %d\n", attribute_number); |
| 132 | |
| 133 | if (attribute->data != NULL) { |
| 134 | |
| 135 | CipUint *data = (CipUint *) attribute->data; |
| 136 | *(data) = inactivity_timeout_received; |
| 137 | message_router_response->general_status = kCipErrorSuccess; |
nothing calls this directly
no test coverage detected