micsat 2 vuotta sitten
vanhempi
sitoutus
d546b6f05d

+ 3 - 3
source/src/cip/cipethernetlink.c

@@ -570,9 +570,9 @@ static bool IsIfaceControlAllowed(CipUdint instance_id,
 }
 
 int DecodeCipEthernetLinkInterfaceControl(
-		CipEthernetLinkInterfaceControl *const data,
-		CipMessageRouterRequest *const message_router_request,
-		CipMessageRouterResponse *const message_router_response) {
+  CipEthernetLinkInterfaceControl *const data,
+  CipMessageRouterRequest *const message_router_request,
+  CipMessageRouterResponse *const message_router_response) {
 
   CipInstance *const instance = GetCipInstance(
     GetCipClass(message_router_request->request_path.class_id),

+ 4 - 4
source/src/cip/cipidentity.c

@@ -167,10 +167,10 @@ void CipIdentitySetExtendedDeviceStatus(
  * @returns Currently always kEipOkSend is returned
  */
 EipStatus IdentityObjectPreResetCallback(
-    CipInstance *RESTRICT const instance,
-    const CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response
-) {
+  CipInstance *RESTRICT const instance,
+  const CipMessageRouterRequest *const message_router_request,
+  CipMessageRouterResponse *const message_router_response
+  ) {
   (void) instance;
 
   EipStatus eip_status = kEipStatusOkSend;

+ 1 - 2
source/src/cip/cipioconnection.c

@@ -91,8 +91,7 @@ void CipRunIdleHeaderSetT2O(bool onoff) {
   s_produce_run_idle = onoff;
 }
 
-bool CipRunIdleHeaderGetT2O(void)
-{
+bool CipRunIdleHeaderGetT2O(void) {
   return s_produce_run_idle;
 }
 

+ 3 - 2
source/src/cip/cipqos.c

@@ -69,8 +69,9 @@ static CipQosDscpValues s_active_dscp = {
  *          -1 .. error
  */
 int DecodeCipQoSAttribute(CipUsint *const data,
-		CipMessageRouterRequest *const message_router_request,
-		CipMessageRouterResponse *const message_router_response) {
+                          CipMessageRouterRequest *const message_router_request,
+                          CipMessageRouterResponse *const message_router_response)
+{
 
   const EipUint8 **const cip_message = message_router_request->data;
 

+ 102 - 102
source/src/cip/ciptcpipinterface.c

@@ -372,9 +372,9 @@ void EncodeCipLastConflictDetected(const void *const data,
 
 
 int DecodeTcpIpInterfaceConfigurationControl( /* Attribute 3 */
-		CipDword *const data,
-		CipMessageRouterRequest *const message_router_request,
-		CipMessageRouterResponse *const message_router_response) {
+  CipDword *const data,
+  CipMessageRouterRequest *const message_router_request,
+  CipMessageRouterResponse *const message_router_response) {
 
   int number_of_decoded_bytes = -1;
 
@@ -403,115 +403,115 @@ int DecodeTcpIpInterfaceConfigurationControl( /* Attribute 3 */
   0 != OPENER_TCPIP_IFACE_CFG_SETTABLE
 
 int DecodeCipTcpIpInterfaceConfiguration( /* Attribute 5 */
-		CipTcpIpInterfaceConfiguration *const data, //kCipUdintUdintUdintUdintUdintString
-		CipMessageRouterRequest *const message_router_request,
-		CipMessageRouterResponse *const message_router_response) {
-
-	int number_of_decoded_bytes = -1;
-
-	CipTcpIpInterfaceConfiguration if_cfg;
-	CipUdint tmp_ip;
-
-	if (IsIOConnectionActive()) {
-		message_router_response->general_status = kCipErrorDeviceStateConflict;
-		return number_of_decoded_bytes;
-	}
-	if (kTcpipCfgCtrlStaticIp
-			!= (g_tcpip.config_control & kTcpipCfgCtrlMethodMask)) {
-		message_router_response->general_status = kCipErrorObjectStateConflict;
-		return number_of_decoded_bytes;
-	}
-	memset(&if_cfg, 0, sizeof if_cfg);
-	tmp_ip = GetUdintFromMessage(&(message_router_request->data));
-	if_cfg.ip_address = htonl(tmp_ip);
-	tmp_ip = GetUdintFromMessage(&(message_router_request->data));
-	if_cfg.network_mask = htonl(tmp_ip);
-	tmp_ip = GetUdintFromMessage(&(message_router_request->data));
-	if_cfg.gateway = htonl(tmp_ip);
-	tmp_ip = GetUdintFromMessage(&(message_router_request->data));
-	if_cfg.name_server = htonl(tmp_ip);
-	tmp_ip = GetUdintFromMessage(&(message_router_request->data));
-	if_cfg.name_server_2 = htonl(tmp_ip);
-
-	CipUint domain_name_length = GetUintFromMessage(
-			&(message_router_request->data));
-	if (domain_name_length > 48) { /* see Vol. 2, Table 5-4.3 Instance Attributes */
-		message_router_response->general_status = kCipErrorTooMuchData;
-		return number_of_decoded_bytes;
-	}
-	SetCipStringByData(&if_cfg.domain_name, domain_name_length,
-			message_router_request->data);
-	domain_name_length = (domain_name_length + 1) & (~0x0001u); /* Align for possible pad byte */
-	OPENER_TRACE_INFO("Domain: ds %hu '%s'\n",
-			domain_name_length,
-			if_cfg.domain_name.string);
-
-	if (!IsValidNetworkConfig(&if_cfg)
-			|| (domain_name_length > 0
-					&& !IsValidDomain(if_cfg.domain_name.string))) {
-		message_router_response->general_status =
-				kCipErrorInvalidAttributeValue;
-		return number_of_decoded_bytes;
-	}
-
-	*data = if_cfg; //write data to attribute
-	number_of_decoded_bytes = 20 + domain_name_length;
-
-	/* Tell that this configuration change becomes active after a reset */
-	g_tcpip.status |= kTcpipStatusIfaceCfgPend;
-	message_router_response->general_status = kCipErrorSuccess;
-
-	return number_of_decoded_bytes;
+  CipTcpIpInterfaceConfiguration *const data,               //kCipUdintUdintUdintUdintUdintString
+  CipMessageRouterRequest *const message_router_request,
+  CipMessageRouterResponse *const message_router_response) {
+
+  int number_of_decoded_bytes = -1;
+
+  CipTcpIpInterfaceConfiguration if_cfg;
+  CipUdint tmp_ip;
+
+  if ( IsIOConnectionActive() ) {
+    message_router_response->general_status = kCipErrorDeviceStateConflict;
+    return number_of_decoded_bytes;
+  }
+  if ( kTcpipCfgCtrlStaticIp
+       != (g_tcpip.config_control & kTcpipCfgCtrlMethodMask) ) {
+    message_router_response->general_status = kCipErrorObjectStateConflict;
+    return number_of_decoded_bytes;
+  }
+  memset(&if_cfg, 0, sizeof if_cfg);
+  tmp_ip = GetUdintFromMessage( &(message_router_request->data) );
+  if_cfg.ip_address = htonl(tmp_ip);
+  tmp_ip = GetUdintFromMessage( &(message_router_request->data) );
+  if_cfg.network_mask = htonl(tmp_ip);
+  tmp_ip = GetUdintFromMessage( &(message_router_request->data) );
+  if_cfg.gateway = htonl(tmp_ip);
+  tmp_ip = GetUdintFromMessage( &(message_router_request->data) );
+  if_cfg.name_server = htonl(tmp_ip);
+  tmp_ip = GetUdintFromMessage( &(message_router_request->data) );
+  if_cfg.name_server_2 = htonl(tmp_ip);
+
+  CipUint domain_name_length = GetUintFromMessage(
+    &(message_router_request->data) );
+  if (domain_name_length > 48) {       /* see Vol. 2, Table 5-4.3 Instance Attributes */
+    message_router_response->general_status = kCipErrorTooMuchData;
+    return number_of_decoded_bytes;
+  }
+  SetCipStringByData(&if_cfg.domain_name, domain_name_length,
+                     message_router_request->data);
+  domain_name_length = (domain_name_length + 1) & (~0x0001u);       /* Align for possible pad byte */
+  OPENER_TRACE_INFO("Domain: ds %hu '%s'\n",
+                    domain_name_length,
+                    if_cfg.domain_name.string);
+
+  if ( !IsValidNetworkConfig(&if_cfg)
+       || ( domain_name_length > 0
+            && !IsValidDomain(if_cfg.domain_name.string) ) ) {
+    message_router_response->general_status =
+      kCipErrorInvalidAttributeValue;
+    return number_of_decoded_bytes;
+  }
+
+  *data = if_cfg;       //write data to attribute
+  number_of_decoded_bytes = 20 + domain_name_length;
+
+  /* Tell that this configuration change becomes active after a reset */
+  g_tcpip.status |= kTcpipStatusIfaceCfgPend;
+  message_router_response->general_status = kCipErrorSuccess;
+
+  return number_of_decoded_bytes;
 
 }
 
 int DecodeCipTcpIpInterfaceHostName( /* Attribute 6 */
-		CipString *const data,
-		CipMessageRouterRequest *const message_router_request,
-		CipMessageRouterResponse *const message_router_response) {
-
-	int number_of_decoded_bytes = -1;
-
-	          CipString tmp_host_name = {
-	            .length = 0u,
-	            .string = NULL
-	          };
-	          CipUint host_name_length =
-	            GetUintFromMessage(&(message_router_request->data) );
-	          if (host_name_length > 64) {  /* see RFC 1123 on more details */
-	            message_router_response->general_status = kCipErrorTooMuchData;
-	            return number_of_decoded_bytes;
-	          }
-	          SetCipStringByData(&tmp_host_name,
-	                             host_name_length,
-	                             message_router_request->data);
-	          host_name_length = (host_name_length + 1) & (~0x0001u);  /* Align for possible pad byte */
-	          OPENER_TRACE_INFO("Host Name: ds %hu '%s'\n",
-	                            host_name_length,
-	                            tmp_host_name.string);
-
-	          if (!IsValidNameLabel(tmp_host_name.string) ) {
-	            message_router_response->general_status =
-	              kCipErrorInvalidAttributeValue;
-	            return number_of_decoded_bytes;
-	          }
-
-	          *data = tmp_host_name; //write data to attribute
-
-	          /* Tell that this configuration change becomes active after a reset */
-	          g_tcpip.status |= kTcpipStatusIfaceCfgPend;
-	          message_router_response->general_status = kCipErrorSuccess;
-
-	return number_of_decoded_bytes;
+  CipString *const data,
+  CipMessageRouterRequest *const message_router_request,
+  CipMessageRouterResponse *const message_router_response) {
+
+  int number_of_decoded_bytes = -1;
+
+  CipString tmp_host_name = {
+    .length = 0u,
+    .string = NULL
+  };
+  CipUint host_name_length =
+    GetUintFromMessage( &(message_router_request->data) );
+  if (host_name_length > 64) {                  /* see RFC 1123 on more details */
+    message_router_response->general_status = kCipErrorTooMuchData;
+    return number_of_decoded_bytes;
+  }
+  SetCipStringByData(&tmp_host_name,
+                     host_name_length,
+                     message_router_request->data);
+  host_name_length = (host_name_length + 1) & (~0x0001u);                  /* Align for possible pad byte */
+  OPENER_TRACE_INFO("Host Name: ds %hu '%s'\n",
+                    host_name_length,
+                    tmp_host_name.string);
+
+  if ( !IsValidNameLabel(tmp_host_name.string) ) {
+    message_router_response->general_status =
+      kCipErrorInvalidAttributeValue;
+    return number_of_decoded_bytes;
+  }
+
+  *data = tmp_host_name;                 //write data to attribute
+
+  /* Tell that this configuration change becomes active after a reset */
+  g_tcpip.status |= kTcpipStatusIfaceCfgPend;
+  message_router_response->general_status = kCipErrorSuccess;
+
+  return number_of_decoded_bytes;
 
 }
 
 #endif /* defined (OPENER_TCPIP_IFACE_CFG_SETTABLE) && 0 != OPENER_TCPIP_IFACE_CFG_SETTABLE*/
 
 int DecodeCipTcpIpInterfaceEncapsulationInactivityTimeout( /* Attribute 13 */
-		CipUint *const data,
-		CipMessageRouterRequest *const message_router_request,
-		CipMessageRouterResponse *const message_router_response) {
+  CipUint *const data,
+  CipMessageRouterRequest *const message_router_request,
+  CipMessageRouterResponse *const message_router_response) {
 
   int number_of_decoded_bytes = -1;