Просмотр исходного кода

32-bit working

Signed-off-by: Martin Melik Merkumians <melik-merkumians@acin.tuwien.ac.at>
Martin Melik Merkumians 5 лет назад
Родитель
Сommit
cbf4c183ea

+ 1 - 1
source/src/cip/cipcommon.c

@@ -703,7 +703,7 @@ int DecodeData(const EipUint8 cip_data_type,
     case (kCipUdint):
     case (kCipUdint):
     case (kCipDword):
     case (kCipDword):
     case (kCipReal):
     case (kCipReal):
-      (*(EipUint32 *) (cip_data) ) = GetDintFromMessage(cip_message);
+      (*(EipUint32 *) (cip_data) ) = GetUdintFromMessage(cip_message);
       number_of_decoded_bytes = 4;
       number_of_decoded_bytes = 4;
       break;
       break;
 
 

+ 1 - 1
source/src/cip/cipconnectionmanager.c

@@ -629,7 +629,7 @@ EipStatus ForwardClose(CipInstance *instance,
     &message_router_request->data);
     &message_router_request->data);
   EipUint16 originator_vendor_id = GetUintFromMessage(
   EipUint16 originator_vendor_id = GetUintFromMessage(
     &message_router_request->data);
     &message_router_request->data);
-  EipUint32 originator_serial_number = GetDintFromMessage(
+  EipUint32 originator_serial_number = GetUdintFromMessage(
     &message_router_request->data);
     &message_router_request->data);
 
 
   OPENER_TRACE_INFO("ForwardClose: ConnSerNo %d\n", connection_serial_number);
   OPENER_TRACE_INFO("ForwardClose: ConnSerNo %d\n", connection_serial_number);

+ 7 - 7
source/src/cip/cipconnectionobject.c

@@ -124,17 +124,17 @@ void ConnectionObjectInitializeFromMessage(const CipOctet **message,
 
 
   /* O_to_T Conn ID */
   /* O_to_T Conn ID */
   ConnectionObjectSetCipConsumedConnectionID(connection_object,
   ConnectionObjectSetCipConsumedConnectionID(connection_object,
-                                             GetDintFromMessage(message) );
+                                             GetUdintFromMessage(message) );
   /* T_to_O Conn ID */
   /* T_to_O Conn ID */
   ConnectionObjectSetCipProducedConnectionID(connection_object,
   ConnectionObjectSetCipProducedConnectionID(connection_object,
-                                             GetDintFromMessage(message) );
+                                             GetUdintFromMessage(message) );
 
 
   ConnectionObjectSetConnectionSerialNumber(connection_object,
   ConnectionObjectSetConnectionSerialNumber(connection_object,
                                             GetUintFromMessage(message) );
                                             GetUintFromMessage(message) );
   ConnectionObjectSetOriginatorVendorId(connection_object,
   ConnectionObjectSetOriginatorVendorId(connection_object,
                                         GetUintFromMessage(message) );
                                         GetUintFromMessage(message) );
   ConnectionObjectSetOriginatorSerialNumber(connection_object,
   ConnectionObjectSetOriginatorSerialNumber(connection_object,
-                                            GetDintFromMessage(message) );
+                                            GetUdintFromMessage(message) );
 
 
   /* keep it to none existent till the setup is done this eases error handling and
   /* keep it to none existent till the setup is done this eases error handling and
    * the state changes within the forward open request can not be detected from
    * the state changes within the forward open request can not be detected from
@@ -158,13 +158,13 @@ void ConnectionObjectInitializeFromMessage(const CipOctet **message,
     connection_object->connection_serial_number);
     connection_object->connection_serial_number);
 
 
   ConnectionObjectSetOToTRequestedPacketInterval(connection_object,
   ConnectionObjectSetOToTRequestedPacketInterval(connection_object,
-                                                 GetDintFromMessage(message) );
+                                                 GetUdintFromMessage(message) );
 
 
   ConnectionObjectSetInitialInactivityWatchdogTimerValue(connection_object);
   ConnectionObjectSetInitialInactivityWatchdogTimerValue(connection_object);
 
 
   if(connection_object->is_large_forward_open == true) {
   if(connection_object->is_large_forward_open == true) {
     ConnectionObjectSetOToTNetworkConnectionParameters(connection_object,
     ConnectionObjectSetOToTNetworkConnectionParameters(connection_object,
-                                                       GetDintFromMessage(
+                                                       GetDwordFromMessage(
                                                          message) );
                                                          message) );
   } else {
   } else {
     ConnectionObjectSetOToTNetworkConnectionParameters(connection_object,
     ConnectionObjectSetOToTNetworkConnectionParameters(connection_object,
@@ -173,13 +173,13 @@ void ConnectionObjectInitializeFromMessage(const CipOctet **message,
   }
   }
 
 
   ConnectionObjectSetTToORequestedPacketInterval(connection_object,
   ConnectionObjectSetTToORequestedPacketInterval(connection_object,
-                                                 GetDintFromMessage(message) );
+                                                 GetUdintFromMessage(message) );
 
 
   ConnectionObjectSetExpectedPacketRate(connection_object);
   ConnectionObjectSetExpectedPacketRate(connection_object);
 
 
   if(connection_object->is_large_forward_open == true) {
   if(connection_object->is_large_forward_open == true) {
     ConnectionObjectSetTToONetworkConnectionParameters(connection_object,
     ConnectionObjectSetTToONetworkConnectionParameters(connection_object,
-                                                       GetDintFromMessage(
+                                                       GetDwordFromMessage(
                                                          message) );
                                                          message) );
   } else {
   } else {
     ConnectionObjectSetTToONetworkConnectionParameters(connection_object,
     ConnectionObjectSetTToONetworkConnectionParameters(connection_object,

+ 2 - 2
source/src/cip/cipepath.c

@@ -295,7 +295,7 @@ CipDword CipEpathGetLogicalValue(const EipUint8 **message) {
       break;
       break;
     case kLogicalSegmentLogicalFormatThirtyTwoBit:
     case kLogicalSegmentLogicalFormatThirtyTwoBit:
       (*message) += 1; /* Pad byte needs to be skipped */
       (*message) += 1; /* Pad byte needs to be skipped */
-      data = GetDintFromMessage(message);
+      data = GetDwordFromMessage(message);
       break;
       break;
     default:
     default:
       OPENER_ASSERT(false);/* shall not happen! */
       OPENER_ASSERT(false);/* shall not happen! */
@@ -492,7 +492,7 @@ CipUdint GetPathNetworkSegmentProductionInhibitTimeInMicroseconds(
   OPENER_ASSERT(2 == *(cip_path + 1) );
   OPENER_ASSERT(2 == *(cip_path + 1) );
 
 
   const unsigned char *message_runner = cip_path + 2;
   const unsigned char *message_runner = cip_path + 2;
-  return GetDintFromMessage(&message_runner);
+  return GetUdintFromMessage(&message_runner);
 }
 }
 
 
 /*** Network Segment ***/
 /*** Network Segment ***/

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

@@ -882,7 +882,7 @@ EipStatus HandleReceivedIoConnectionData(CipConnectionObject *connection_object,
   if(data_length > 0) {
   if(data_length > 0) {
     /* we have no heartbeat connection */
     /* we have no heartbeat connection */
 #ifdef OPENER_CONSUMED_DATA_HAS_RUN_IDLE_HEADER
 #ifdef OPENER_CONSUMED_DATA_HAS_RUN_IDLE_HEADER
-    EipUint32 nRunIdleBuf = GetDintFromMessage( &(data) );
+    EipUint32 nRunIdleBuf = GetUdintFromMessage( &(data) );
     OPENER_TRACE_INFO("Run/Idle handler: 0x%x\n", nRunIdleBuf);
     OPENER_TRACE_INFO("Run/Idle handler: 0x%x\n", nRunIdleBuf);
     const uint32_t kRunBitMask = 0x0001;
     const uint32_t kRunBitMask = 0x0001;
     if( (kRunBitMask & nRunIdleBuf) == 1 ) {
     if( (kRunBitMask & nRunIdleBuf) == 1 ) {

+ 3 - 3
source/src/enet_encap/cpf.c

@@ -244,12 +244,12 @@ EipStatus CreateCommonPacketFormatStructure(const EipUint8 *data,
     length_count += 4;
     length_count += 4;
     if(common_packet_format_data->address_item.length >= 4) {
     if(common_packet_format_data->address_item.length >= 4) {
       common_packet_format_data->address_item.data.connection_identifier =
       common_packet_format_data->address_item.data.connection_identifier =
-        GetDintFromMessage(&data);
+        GetUdintFromMessage(&data);
       length_count += 4;
       length_count += 4;
     }
     }
     if(common_packet_format_data->address_item.length == 8) {
     if(common_packet_format_data->address_item.length == 8) {
       common_packet_format_data->address_item.data.sequence_number =
       common_packet_format_data->address_item.data.sequence_number =
-        GetDintFromMessage(&data);
+        GetUdintFromMessage(&data);
       length_count += 4;
       length_count += 4;
     }
     }
   }
   }
@@ -278,7 +278,7 @@ EipStatus CreateCommonPacketFormatStructure(const EipUint8 *data,
         common_packet_format_data->address_info_item[j].sin_port =
         common_packet_format_data->address_info_item[j].sin_port =
           GetIntFromMessage(&data);
           GetIntFromMessage(&data);
         common_packet_format_data->address_info_item[j].sin_addr =
         common_packet_format_data->address_info_item[j].sin_addr =
-          GetDintFromMessage(&data);
+          GetUdintFromMessage(&data);
         for(size_t i = 0; i < 8; i++) {
         for(size_t i = 0; i < 8; i++) {
           common_packet_format_data->address_info_item[j].nasin_zero[i] = *data;
           common_packet_format_data->address_info_item[j].nasin_zero[i] = *data;
           data++;
           data++;

+ 3 - 3
source/src/enet_encap/encap.c

@@ -729,13 +729,13 @@ EipInt16 CreateEncapsulationStructure(const EipUint8 *receive_buffer,
   encapsulation_data->communication_buffer_start = (EipUint8 *) receive_buffer;
   encapsulation_data->communication_buffer_start = (EipUint8 *) receive_buffer;
   encapsulation_data->command_code = GetUintFromMessage(&receive_buffer);
   encapsulation_data->command_code = GetUintFromMessage(&receive_buffer);
   encapsulation_data->data_length = GetUintFromMessage(&receive_buffer);
   encapsulation_data->data_length = GetUintFromMessage(&receive_buffer);
-  encapsulation_data->session_handle = GetDintFromMessage(&receive_buffer);
-  encapsulation_data->status = GetDintFromMessage(&receive_buffer);
+  encapsulation_data->session_handle = GetUdintFromMessage(&receive_buffer);
+  encapsulation_data->status = GetUdintFromMessage(&receive_buffer);
 
 
   memcpy(encapsulation_data->sender_context, receive_buffer,
   memcpy(encapsulation_data->sender_context, receive_buffer,
          kSenderContextSize);
          kSenderContextSize);
   receive_buffer += kSenderContextSize;
   receive_buffer += kSenderContextSize;
-  encapsulation_data->options = GetDintFromMessage(&receive_buffer);
+  encapsulation_data->options = GetUdintFromMessage(&receive_buffer);
   encapsulation_data->current_communication_buffer_position =
   encapsulation_data->current_communication_buffer_position =
     (EipUint8 *) receive_buffer;
     (EipUint8 *) receive_buffer;
   return (receive_buffer_length - ENCAPSULATION_HEADER_LENGTH -
   return (receive_buffer_length - ENCAPSULATION_HEADER_LENGTH -

+ 1 - 1
source/src/enet_encap/endianconv.c

@@ -80,7 +80,7 @@ CipWord GetWordFromMessage(const CipOctet **const buffer_address) {
  *   @param buffer pointer where data should be reed.
  *   @param buffer pointer where data should be reed.
  *   @return EIP_UNÍT32 value
  *   @return EIP_UNÍT32 value
  */
  */
-EipUint32 GetDintFromMessage(const EipUint8 **const buffer) {
+CipDint GetDintFromMessage(const EipUint8 **const buffer) {
   const unsigned char *p = (unsigned char *) *buffer;
   const unsigned char *p = (unsigned char *) *buffer;
   EipUint32 data = p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
   EipUint32 data = p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
   *buffer += 4;
   *buffer += 4;

+ 1 - 1
source/src/enet_encap/endianconv.h

@@ -48,7 +48,7 @@ CipWord GetWordFromMessage(const CipOctet **const buffer_address);
  * @param buffer pointer to the network buffer array. This pointer will be incremented by 4!
  * @param buffer pointer to the network buffer array. This pointer will be incremented by 4!
  * @return Extracted 32 bit integer value
  * @return Extracted 32 bit integer value
  */
  */
-EipUint32 GetDintFromMessage(const EipUint8 **const buffer);
+CipDint GetDintFromMessage(const EipUint8 **const buffer);
 
 
 CipUdint GetUdintFromMessage(const CipOctet **const buffer_address);
 CipUdint GetUdintFromMessage(const CipOctet **const buffer_address);