Sfoglia il codice sorgente

merged bug fixes from 1.2.x branch

Alois Zoitl 13 anni fa
parent
commit
9528c639be

+ 79 - 83
src/cip/appcontype.c

@@ -24,8 +24,7 @@ typedef struct
   unsigned int m_unOutputAssembly; /*< the O-to-T point for the connection */
   unsigned int m_unInputAssembly; /*< the T-to-O point for the connection */
   unsigned int m_unConfigAssembly; /*< the config point for the connection */
-  S_CIP_ConnectionObject
-      m_astConnectionData[OPENER_CIP_NUM_INPUT_ONLY_CONNS_PER_CON_PATH]; /*< the connection data */
+  S_CIP_ConnectionObject m_astConnectionData[OPENER_CIP_NUM_INPUT_ONLY_CONNS_PER_CON_PATH]; /*< the connection data */
 } S_InputOnlyConnection;
 
 typedef struct
@@ -33,18 +32,14 @@ typedef struct
   unsigned int m_unOutputAssembly; /*< the O-to-T point for the connection */
   unsigned int m_unInputAssembly; /*< the T-to-O point for the connection */
   unsigned int m_unConfigAssembly; /*< the config point for the connection */
-  S_CIP_ConnectionObject
-      m_astConnectionData[OPENER_CIP_NUM_LISTEN_ONLY_CONNS_PER_CON_PATH]; /*< the connection data */
+  S_CIP_ConnectionObject m_astConnectionData[OPENER_CIP_NUM_LISTEN_ONLY_CONNS_PER_CON_PATH]; /*< the connection data */
 } S_ListenOnlyConnection;
 
-S_ExclusiveOwnerConnection
-    g_astExlusiveOwnerConnections[OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS];
+S_ExclusiveOwnerConnection g_astExlusiveOwnerConnections[OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS];
 
-S_InputOnlyConnection
-    g_astInputOnlyConnections[OPENER_CIP_NUM_INPUT_ONLY_CONNS];
+S_InputOnlyConnection g_astInputOnlyConnections[OPENER_CIP_NUM_INPUT_ONLY_CONNS];
 
-S_ListenOnlyConnection
-    g_astListenOnlyConnections[OPENER_CIP_NUM_LISTEN_ONLY_CONNS];
+S_ListenOnlyConnection g_astListenOnlyConnections[OPENER_CIP_NUM_LISTEN_ONLY_CONNS];
 
 S_CIP_ConnectionObject *
 getExclusiveOwnerConnection(S_CIP_ConnectionObject * pa_pstConnData,
@@ -63,12 +58,12 @@ configureExclusiveOwnerConnectionPoint(unsigned int pa_unConnNum,
 {
   if (OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS > pa_unConnNum)
     {
-      g_astExlusiveOwnerConnections[pa_unConnNum].m_unOutputAssembly
-          = pa_unOutputAssembly;
-      g_astExlusiveOwnerConnections[pa_unConnNum].m_unInputAssembly
-          = pa_unInputAssembly;
-      g_astExlusiveOwnerConnections[pa_unConnNum].m_unConfigAssembly
-          = pa_unConfigAssembly;
+      g_astExlusiveOwnerConnections[pa_unConnNum].m_unOutputAssembly =
+          pa_unOutputAssembly;
+      g_astExlusiveOwnerConnections[pa_unConnNum].m_unInputAssembly =
+          pa_unInputAssembly;
+      g_astExlusiveOwnerConnections[pa_unConnNum].m_unConfigAssembly =
+          pa_unConfigAssembly;
     }
 }
 
@@ -79,12 +74,12 @@ configureInputOnlyConnectionPoint(unsigned int pa_unConnNum,
 {
   if (OPENER_CIP_NUM_INPUT_ONLY_CONNS > pa_unConnNum)
     {
-      g_astInputOnlyConnections[pa_unConnNum].m_unOutputAssembly
-          = pa_unOutputAssembly;
-      g_astInputOnlyConnections[pa_unConnNum].m_unInputAssembly
-          = pa_unInputAssembly;
-      g_astInputOnlyConnections[pa_unConnNum].m_unConfigAssembly
-          = pa_unConfigAssembly;
+      g_astInputOnlyConnections[pa_unConnNum].m_unOutputAssembly =
+          pa_unOutputAssembly;
+      g_astInputOnlyConnections[pa_unConnNum].m_unInputAssembly =
+          pa_unInputAssembly;
+      g_astInputOnlyConnections[pa_unConnNum].m_unConfigAssembly =
+          pa_unConfigAssembly;
     }
 }
 
@@ -95,12 +90,12 @@ configureListenOnlyConnectionPoint(unsigned int pa_unConnNum,
 {
   if (OPENER_CIP_NUM_LISTEN_ONLY_CONNS > pa_unConnNum)
     {
-      g_astListenOnlyConnections[pa_unConnNum].m_unOutputAssembly
-          = pa_unOutputAssembly;
-      g_astListenOnlyConnections[pa_unConnNum].m_unInputAssembly
-          = pa_unInputAssembly;
-      g_astListenOnlyConnections[pa_unConnNum].m_unConfigAssembly
-          = pa_unConfigAssembly;
+      g_astListenOnlyConnections[pa_unConnNum].m_unOutputAssembly =
+          pa_unOutputAssembly;
+      g_astListenOnlyConnections[pa_unConnNum].m_unInputAssembly =
+          pa_unInputAssembly;
+      g_astListenOnlyConnections[pa_unConnNum].m_unConfigAssembly =
+          pa_unConfigAssembly;
     }
 }
 
@@ -117,8 +112,8 @@ getIOConnectionForConnectionData(S_CIP_ConnectionObject *pa_pstConnData,
       if (0 == *pa_pnExtendedError)
         {
           /* we found no connection and don't have an error so try input only next */
-          pstRetVal
-              = getInputOnlyConnection(pa_pstConnData, pa_pnExtendedError);
+          pstRetVal = getInputOnlyConnection(pa_pstConnData,
+              pa_pnExtendedError);
           if (NULL == pstRetVal)
             {
               if (0 == *pa_pnExtendedError)
@@ -130,12 +125,12 @@ getIOConnectionForConnectionData(S_CIP_ConnectionObject *pa_pstConnData,
                     {
                       /* no application connection type was found that suits the given data */
                       /* TODO check error code VS */
-                      *pa_pnExtendedError
-                          = CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
+                      *pa_pnExtendedError =
+                          CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
                     }
                   else
                     {
-                    pa_pstConnData->m_eInstanceType = enConnTypeIOListenOnly;
+                      pa_pstConnData->m_eInstanceType = enConnTypeIOListenOnly;
                     }
                 }
             }
@@ -167,25 +162,18 @@ getExclusiveOwnerConnection(S_CIP_ConnectionObject * pa_pstConnData,
 
   for (i = 0; i < OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS; i++)
     {
-      if (g_astExlusiveOwnerConnections[i].m_unOutputAssembly
+      if ((g_astExlusiveOwnerConnections[i].m_unOutputAssembly
           == pa_pstConnData->ConnectionPath.ConnectionPoint[0])
-        { /* we have the same output assembly */
-          if (g_astExlusiveOwnerConnections[i].m_unInputAssembly
-              != pa_pstConnData->ConnectionPath.ConnectionPoint[1])
-            {
-              *pa_pnExtendedError
-                  = CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
-              break;
-            }
-          if (g_astExlusiveOwnerConnections[i].m_unConfigAssembly
-              != pa_pstConnData->ConnectionPath.ConnectionPoint[2])
-            {
-              *pa_pnExtendedError
-                  = CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
-              break;
-            }
-          if (g_astExlusiveOwnerConnections[i].m_stConnectionData.State
-              != CONN_STATE_NONEXISTENT)
+          && (g_astExlusiveOwnerConnections[i].m_unInputAssembly
+              == pa_pstConnData->ConnectionPath.ConnectionPoint[1])
+          && (g_astExlusiveOwnerConnections[i].m_unConfigAssembly
+              == pa_pstConnData->ConnectionPath.ConnectionPoint[2]))
+        {
+
+          /* check if on other connection point with the same output assembly is currently connected */
+          if (NULL
+              != getConnectedOutputAssembly(
+                  pa_pstConnData->ConnectionPath.ConnectionPoint[0]))
             {
               *pa_pnExtendedError = CIP_CON_MGR_ERROR_OWNERSHIP_CONFLICT;
               break;
@@ -212,15 +200,15 @@ getInputOnlyConnection(S_CIP_ConnectionObject * pa_pstConnData,
           if (g_astInputOnlyConnections[i].m_unInputAssembly
               != pa_pstConnData->ConnectionPath.ConnectionPoint[1])
             {
-              *pa_pnExtendedError
-                  = CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
+              *pa_pnExtendedError =
+                  CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
               break;
             }
           if (g_astInputOnlyConnections[i].m_unConfigAssembly
               != pa_pstConnData->ConnectionPath.ConnectionPoint[2])
             {
-              *pa_pnExtendedError
-                  = CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
+              *pa_pnExtendedError =
+                  CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
               break;
             }
 
@@ -263,23 +251,24 @@ getListenOnlyConnection(S_CIP_ConnectionObject * pa_pstConnData,
           if (g_astListenOnlyConnections[i].m_unInputAssembly
               != pa_pstConnData->ConnectionPath.ConnectionPoint[1])
             {
-              *pa_pnExtendedError
-                  = CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
+              *pa_pnExtendedError =
+                  CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
               break;
             }
           if (g_astListenOnlyConnections[i].m_unConfigAssembly
               != pa_pstConnData->ConnectionPath.ConnectionPoint[2])
             {
-              *pa_pnExtendedError
-                  = CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
+              *pa_pnExtendedError =
+                  CIP_CON_MGR_INVALID_PRODUCED_OR_CONSUMED_APPLICATION_PATH;
               break;
             }
 
-          if (NULL == getExistingProdMulticastConnection(
-              pa_pstConnData->ConnectionPath.ConnectionPoint[1]))
+          if (NULL
+              == getExistingProdMulticastConnection(
+                  pa_pstConnData->ConnectionPath.ConnectionPoint[1]))
             {
-              *pa_pnExtendedError
-                  = CIP_CON_MGR_NON_LISTEN_ONLY_CONNECTION_NOT_OPENED;
+              *pa_pnExtendedError =
+                  CIP_CON_MGR_NON_LISTEN_ONLY_CONNECTION_NOT_OPENED;
               break;
             }
 
@@ -311,8 +300,8 @@ getExistingProdMulticastConnection(EIP_UINT32 pa_unInputPoint)
           if ((pa_unInputPoint == pstRunner->ConnectionPath.ConnectionPoint[1])
               && (CIP_MULTICAST_CONNECTION
                   == (pstRunner->T_to_O_NetworkConnectionParameter
-                      & CIP_MULTICAST_CONNECTION)) && (EIP_INVALID_SOCKET
-              != pstRunner->sockfd[PRODUCING]))
+                      & CIP_MULTICAST_CONNECTION))
+              && (EIP_INVALID_SOCKET != pstRunner->sockfd[PRODUCING]))
             {
               /* we have a connection that produces the same input assembly,
                * is a multicast producer and manages the connection.
@@ -338,8 +327,8 @@ getNextNonCtrlMasterCon(EIP_UINT32 pa_unInputPoint)
           if ((pa_unInputPoint == pstRunner->ConnectionPath.ConnectionPoint[1])
               && (CIP_MULTICAST_CONNECTION
                   == (pstRunner->T_to_O_NetworkConnectionParameter
-                      & CIP_MULTICAST_CONNECTION)) && (EIP_INVALID_SOCKET
-              == pstRunner->sockfd[PRODUCING]))
+                      & CIP_MULTICAST_CONNECTION))
+              && (EIP_INVALID_SOCKET == pstRunner->sockfd[PRODUCING]))
             {
               /* we have a connection that produces the same input assembly,
                * is a multicast producer and does not manages the connection.
@@ -361,13 +350,12 @@ closeAllConnsForInputWithSameType(EIP_UINT32 pa_unInputPoint,
 
   while (NULL != pstRunner)
     {
-      if ((pa_eInstanceType == pstRunner->m_eInstanceType) && (pa_unInputPoint
-          == pstRunner->ConnectionPath.ConnectionPoint[1]))
+      if ((pa_eInstanceType == pstRunner->m_eInstanceType)
+          && (pa_unInputPoint == pstRunner->ConnectionPath.ConnectionPoint[1]))
         {
           pstToDelete = pstRunner;
           pstRunner = pstRunner->m_pstNext;
-          IApp_IOConnectionEvent(
-              pstToDelete->ConnectionPath.ConnectionPoint[0],
+          IApp_IOConnectionEvent(pstToDelete->ConnectionPath.ConnectionPoint[0],
               pstToDelete->ConnectionPath.ConnectionPoint[1], enClosed);
 
           //FIXME check if this is ok
@@ -381,16 +369,19 @@ closeAllConnsForInputWithSameType(EIP_UINT32 pa_unInputPoint,
     }
 }
 
-void closeAllConnections(void){
+void
+closeAllConnections(void)
+{
   S_CIP_ConnectionObject *pstRunner = g_pstActiveConnectionList;
-  while (NULL != pstRunner){
+  while (NULL != pstRunner)
+    {
       //FIXME check if m_pfCloseFunc would be suitable
-    closeConnection(pstRunner);
-    /* Close connection will remove the connection from the list therefore we
-     * need to get again the start until there is no connection left
-     */
-    pstRunner = g_pstActiveConnectionList;
-  }
+      closeConnection(pstRunner);
+      /* Close connection will remove the connection from the list therefore we
+       * need to get again the start until there is no connection left
+       */
+      pstRunner = g_pstActiveConnectionList;
+    }
 
 }
 
@@ -410,8 +401,13 @@ connectionWithSameConfigPointExists(EIP_UINT32 pa_unConfigPoint)
   return (NULL != pstRunner);
 }
 
-void initializeIOConnectionData(){
-  memset(g_astExlusiveOwnerConnections, 0, OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS * sizeof(S_ExclusiveOwnerConnection));
-  memset(g_astInputOnlyConnections, 0, OPENER_CIP_NUM_INPUT_ONLY_CONNS * sizeof(S_InputOnlyConnection));
-  memset(g_astListenOnlyConnections, 0, OPENER_CIP_NUM_LISTEN_ONLY_CONNS * sizeof(S_ListenOnlyConnection));
+void
+initializeIOConnectionData()
+{
+  memset(g_astExlusiveOwnerConnections, 0,
+      OPENER_CIP_NUM_EXLUSIVE_OWNER_CONNS * sizeof(S_ExclusiveOwnerConnection));
+  memset(g_astInputOnlyConnections, 0,
+      OPENER_CIP_NUM_INPUT_ONLY_CONNS * sizeof(S_InputOnlyConnection));
+  memset(g_astListenOnlyConnections, 0,
+      OPENER_CIP_NUM_LISTEN_ONLY_CONNS * sizeof(S_ListenOnlyConnection));
 }

+ 2 - 2
src/cip/cipcommon.c

@@ -189,7 +189,7 @@ createCIPClass(EIP_UINT32 pa_nClassID, int pa_nNr_of_ClassAttributes,
   S_CIP_Class *pt2Class; /* pointer to the class struct */
   S_CIP_Class *pt2MetaClass; /* pointer to the metaclass struct */
 
-  OPENER_TRACE_INFO("creating class '%s' with id: 0x%lx\n", pa_acName, pa_nClassID);
+  OPENER_TRACE_INFO("creating class '%s' with id: 0x%"PRIX32"\n", pa_acName, pa_nClassID);
 
   pt2Class = getCIPClass(pa_nClassID); /* check if an class with the ClassID already exists */
   OPENER_ASSERT(NULL == pt2Class);
@@ -320,7 +320,7 @@ insertAttribute(S_CIP_Instance * pa_pInstance, EIP_UINT16 pa_nAttributeNr,
       p++;
     }
 
-  OPENER_TRACE_ERR("Tried to insert to many attributes into class: %lu, instance %lu\n", pa_pInstance->pstClass->m_stSuper.nInstanceNr, pa_pInstance->nInstanceNr );
+  OPENER_TRACE_ERR("Tried to insert to many attributes into class: %"PRIu32", instance %"PRIu32"\n", pa_pInstance->pstClass->m_stSuper.nInstanceNr, pa_pInstance->nInstanceNr );
   OPENER_ASSERT(0);
   /* trying to insert too many attributes*/
 }

+ 25 - 7
src/cip/cipconnectionmanager.c

@@ -328,7 +328,7 @@ ForwardOpen(S_CIP_Instance *pa_pstInstance, S_CIP_MR_Request *pa_MRRequest,
   g_stDummyConnectionObject.ConnectionTimeoutMultiplier = *pa_MRRequest->Data++;
   pa_MRRequest->Data += 3; /* reserved */
   /* the requested packet interval parameter needs to be a multiple of TIMERTICK from the header file */
-  OPENER_TRACE_INFO("ForwardOpen: ConConnID %lu, ProdConnID %lu, ConnSerNo %u\n",
+  OPENER_TRACE_INFO("ForwardOpen: ConConnID %"PRIu32", ProdConnID %"PRIu32", ConnSerNo %u\n",
       g_stDummyConnectionObject.CIPConsumedConnectionID,
       g_stDummyConnectionObject.CIPProducedConnectionID,
       g_stDummyConnectionObject.ConnectionSerialNumber);
@@ -766,6 +766,23 @@ getConnectedObject(EIP_UINT32 ConnectionID)
   return NULL;
 }
 
+S_CIP_ConnectionObject *
+getConnectedOutputAssembly(EIP_UINT32 pa_unOutputAssemblyId)
+{
+  S_CIP_ConnectionObject *pstRunner = g_pstActiveConnectionList;
+
+  while (NULL != pstRunner)
+    {
+      if (pstRunner->State == CONN_STATE_ESTABLISHED)
+        {
+          if (pstRunner->ConnectionPath.ConnectionPoint[0] == pa_unOutputAssemblyId)
+            return pstRunner;
+        }
+      pstRunner = pstRunner->m_pstNext;
+    }
+    return NULL;
+}
+
 S_CIP_ConnectionObject *
 checkForExistingConnection(S_CIP_ConnectionObject *pa_pstConnObj)
 {
@@ -944,7 +961,7 @@ parseConnectionPath(S_CIP_ConnectionObject *pa_pstConnObj,
           pstClass = getCIPClass(pa_pstConnObj->ConnectionPath.ClassID);
           if (0 == pstClass)
             {
-              OPENER_TRACE_ERR("classid %lx not found\n",
+              OPENER_TRACE_ERR("classid %"PRIx32" not found\n",
                   pa_pstConnObj->ConnectionPath.ClassID);
               if (pa_pstConnObj->ConnectionPath.ClassID >= 0xC8) /*reserved range of class ids */
 
@@ -958,7 +975,7 @@ parseConnectionPath(S_CIP_ConnectionObject *pa_pstConnObj,
                       CIP_CON_MGR_ERROR_INVALID_CONNECTION_POINT;
                 }
               return CIP_ERROR_CONNECTION_FAILURE;
-            }OPENER_TRACE_INFO("classid %lx (%s)\n",
+            }OPENER_TRACE_INFO("classid %"PRIx32" (%s)\n",
               pa_pstConnObj->ConnectionPath.ClassID, pstClass->acName);
         }
       else
@@ -972,7 +989,7 @@ parseConnectionPath(S_CIP_ConnectionObject *pa_pstConnObj,
         { /* store the configuration ID for later checking in the application connection types */
           pa_pstConnObj->ConnectionPath.ConnectionPoint[2] =
               GETPADDEDLOGICALPATH(&pnMsg);
-          OPENER_TRACE_INFO("Configuration instance id %ld\n", pa_pstConnObj->ConnectionPath.ConnectionPoint[2]);
+          OPENER_TRACE_INFO("Configuration instance id %"PRId32"\n", pa_pstConnObj->ConnectionPath.ConnectionPoint[2]);
           if (NULL
               == getCIPInstance(pstClass,
                   pa_pstConnObj->ConnectionPath.ConnectionPoint[2]))
@@ -1056,7 +1073,7 @@ parseConnectionPath(S_CIP_ConnectionObject *pa_pstConnObj,
                 { /* InstanceNR */
                   pa_pstConnObj->ConnectionPath.ConnectionPoint[i] =
                       GETPADDEDLOGICALPATH(&pnMsg);
-                  OPENER_TRACE_INFO("connection point %lu\n",
+                  OPENER_TRACE_INFO("connection point %"PRIu32"\n",
                       pa_pstConnObj->ConnectionPath.ConnectionPoint[i]);
                   if (0
                       == getCIPInstance(pstClass,
@@ -1218,11 +1235,12 @@ addConnectableObject(EIP_UINT32 pa_nClassId, TConnOpenFunc pa_pfOpenFunc)
         {
           g_astConnMgmList[i].m_nClassID = pa_nClassId;
           g_astConnMgmList[i].m_pfOpenFunc = pa_pfOpenFunc;
-          return EIP_OK;
+          nRetVal = EIP_OK;
+          break;
         }
     }
 
-  return EIP_ERROR;
+  return nRetVal;
 }
 
 TConnMgmHandling *

+ 11 - 2
src/cip/cipconnectionmanager.h

@@ -202,8 +202,7 @@ EIP_STATUS
 Connection_Manager_Init(EIP_UINT16 pa_nUniqueConnID);
 
 /*!  Get a connected object dependent on requested ConnectionID.
- *   The returned connection may not be in established state. The user has to check
- *   this!   
+ *
  *   @param ConnectionID  requested ConnectionID of opened connection
  *   @return pointer to connected Object
  *           0 .. connection not present in device
@@ -211,6 +210,16 @@ Connection_Manager_Init(EIP_UINT16 pa_nUniqueConnID);
 S_CIP_ConnectionObject *
 getConnectedObject(EIP_UINT32 ConnectionID);
 
+/*!  Get a connection object for a given output assembly.
+ *
+ *   @param pa_unOutputAssemblyId requested output assembly of requested connection
+ *   @return pointer to connected Object
+ *           0 .. connection not present in device
+ */
+S_CIP_ConnectionObject *
+getConnectedOutputAssembly(EIP_UINT32 pa_unOutputAssemblyId);
+
+
 /*! Copy the given connection data from pa_pstSrc to pa_pstDst
  */
 void

+ 3 - 3
src/cip/ciptcpipinterface.c

@@ -74,7 +74,7 @@ configureDomainName(const char *pa_acDomainName)
   Interface_Configuration.DomainName.Length = strlen(pa_acDomainName);
   if (Interface_Configuration.DomainName.Length)
     {
-      Interface_Configuration.DomainName.String = (EIP_INT8 *) IApp_CipCalloc(
+      Interface_Configuration.DomainName.String = (EIP_BYTE *) IApp_CipCalloc(
           Interface_Configuration.DomainName.Length + 1, sizeof(EIP_INT8));
       strcpy(Interface_Configuration.DomainName.String, pa_acDomainName);
     }
@@ -97,8 +97,8 @@ configureHostName(const char *pa_acHostName)
   Hostname.Length = strlen(pa_acHostName);
   if (Hostname.Length)
     {
-      Hostname.String = (EIP_INT8 *) IApp_CipCalloc(Hostname.Length + 1,
-          sizeof(EIP_INT8));
+      Hostname.String = (EIP_BYTE *) IApp_CipCalloc(Hostname.Length + 1,
+          sizeof(EIP_BYTE));
       strcpy(Hostname.String, pa_acHostName);
     }
   else

+ 2 - 2
src/cip/ciptypes.h

@@ -95,13 +95,13 @@ typedef struct
 typedef struct
 {
   EIP_UINT8 Length;
-  EIP_INT8 *String;
+  EIP_BYTE *String;
 } S_CIP_Short_String;
 
 typedef struct
 {
   EIP_INT16 Length;
-  EIP_INT8 *String;
+  EIP_BYTE *String;
 } S_CIP_String;
 
 typedef struct

+ 1 - 1
src/enet_encap/encap.c

@@ -150,7 +150,7 @@ encapInit(void)
   g_stInterfaceInformation.EncapsulationProtocolVersion = 1;
   g_stInterfaceInformation.CapabilityFlags = SUPPORT_CIP_TCP
       | SUPPORT_CIP_UDP_CLASS_0_OR_1;
-  strcpy((char *) g_stInterfaceInformation.NameofService, "communications");
+  strcpy((char *) g_stInterfaceInformation.NameofService, "Communications");
 }
 
 int

+ 10 - 9
src/typedefs.h

@@ -7,6 +7,7 @@
 #define TYPEDEFS_H_
 
 #include <opener_user_conf.h>
+#include <inttypes.h>
 #include <stddef.h>
 
 /*
@@ -22,20 +23,20 @@
  for data buffers can occasionally blow up in your face rather nastily.
  */
 
-#define EIP_BYTE 	unsigned char
-#define EIP_INT8 	char
-#define EIP_INT16	short
-#define EIP_INT32	long
-#define EIP_UINT8	unsigned char
-#define EIP_UINT16	unsigned short
-#define EIP_UINT32	unsigned long
+#define EIP_BYTE 	uint8_t
+#define EIP_INT8 	int8_t
+#define EIP_INT16	int16_t
+#define EIP_INT32	int32_t
+#define EIP_UINT8	uint8_t
+#define EIP_UINT16	uint16_t
+#define EIP_UINT32	uint32_t
 #define EIP_FLOAT	float
 #define EIP_DFLOAT	double
 #define EIP_BOOL8	bool
 
 #ifdef OPENER_SUPPORT_64BIT_DATATYPES
-#define EIP_INT64       long long
-#define EIP_UINT64       unsigned long long
+#define EIP_INT64       int64_t
+#define EIP_UINT64      uint64_t
 #endif
 
 /*! Constant identifying if a socket descriptor is invalid