فهرست منبع

Fixing structure and linter errors partially

Signed-off-by: Martin Melik Merkumians <martin.melik@gmail.com>
Martin Melik Merkumians 1 ماه پیش
والد
کامیت
ba30823541
63فایلهای تغییر یافته به همراه386 افزوده شده و 403 حذف شده
  1. 1 1
      source/src/CMakeLists.txt
  2. 1 1
      source/src/api/opener_api.h
  3. 7 7
      source/src/cip/appcontype.c
  4. 4 4
      source/src/cip/appcontype.h
  5. 5 5
      source/src/cip/cipassembly.c
  6. 5 5
      source/src/cip/cipassembly.h
  7. 2 2
      source/src/cip/cipclass3connection.c
  8. 6 6
      source/src/cip/cipclass3connection.h
  9. 21 20
      source/src/cip/cipcommon.c
  10. 5 5
      source/src/cip/cipcommon.h
  11. 18 18
      source/src/cip/cipconnectionmanager.c
  12. 7 7
      source/src/cip/cipconnectionmanager.h
  13. 1 1
      source/src/cip/cipconnectionobject.c
  14. 10 10
      source/src/cip/cipconnectionobject.h
  15. 5 5
      source/src/cip/cipdlr.c
  16. 5 5
      source/src/cip/cipdlr.h
  17. 1 1
      source/src/cip/cipelectronickey.c
  18. 4 4
      source/src/cip/cipelectronickey.h
  19. 4 4
      source/src/cip/cipepath.c
  20. 5 5
      source/src/cip/cipepath.h
  21. 3 3
      source/src/cip/ciperror.h
  22. 5 5
      source/src/cip/cipethernetlink.c
  23. 5 5
      source/src/cip/cipethernetlink.h
  24. 8 8
      source/src/cip/cipidentity.c
  25. 5 5
      source/src/cip/cipidentity.h
  26. 12 12
      source/src/cip/cipioconnection.c
  27. 6 6
      source/src/cip/cipioconnection.h
  28. 7 7
      source/src/cip/cipmessagerouter.c
  29. 5 5
      source/src/cip/cipmessagerouter.h
  30. 9 9
      source/src/cip/cipqos.c
  31. 6 6
      source/src/cip/cipqos.h
  32. 3 3
      source/src/cip/cipstring.c
  33. 5 5
      source/src/cip/cipstring.h
  34. 5 5
      source/src/cip/cipstringi.c
  35. 1 1
      source/src/cip/cipstringi.h
  36. 11 11
      source/src/cip/ciptcpipinterface.c
  37. 5 5
      source/src/cip/ciptcpipinterface.h
  38. 4 3
      source/src/cip/ciptypes.c
  39. 138 157
      source/src/cip/ciptypes.h
  40. 1 1
      source/src/core/trace.h
  41. 1 1
      source/src/core/typedefs.h
  42. 1 1
      source/src/enet_encap/cpf.h
  43. 1 1
      source/src/enet_encap/encap.h
  44. 1 1
      source/src/enet_encap/endianconv.h
  45. 1 1
      source/src/ports/MINGW/sample_application/ethlinkcbs.h
  46. 1 1
      source/src/ports/MINGW/sample_application/opener_user_conf.h
  47. 1 1
      source/src/ports/POSIX/sample_application/ethlinkcbs.h
  48. 1 1
      source/src/ports/POSIX/sample_application/opener_user_conf.h
  49. 1 1
      source/src/ports/STM32/sample_application/ethlinkcbs.h
  50. 1 1
      source/src/ports/STM32/sample_application/opener_user_conf.h
  51. 1 1
      source/src/ports/WIN32/sample_application/ethlinkcbs.h
  52. 1 1
      source/src/ports/WIN32/sample_application/opener_user_conf.h
  53. 2 2
      source/src/ports/generic_networkhandler.h
  54. 1 1
      source/src/ports/networkhandler.h
  55. 1 1
      source/src/ports/nvdata/conffile.h
  56. 1 1
      source/src/ports/nvdata/nvdata.h
  57. 1 1
      source/src/ports/nvdata/nvqos.h
  58. 1 1
      source/src/ports/nvdata/nvtcpip.h
  59. 2 2
      source/src/ports/socket_timer.c
  60. 1 1
      source/src/ports/socket_timer.h
  61. 1 1
      source/tests/callback_mock.cpp
  62. 1 1
      source/tests/cip/cipcommontests.cpp
  63. 1 1
      source/tests/cip/cipstringtests.cpp

+ 1 - 1
source/src/CMakeLists.txt

@@ -1,9 +1,9 @@
 #######################################
 # Add subdirectories                  #
 #######################################
-add_subdirectory( enet_encap )
 add_subdirectory( cip )
 add_subdirectory( cip_objects )
+add_subdirectory( enet_encap )
 add_subdirectory( ports )
 add_subdirectory( utils )
 

+ 1 - 1
source/src/opener_api.h → source/src/api/opener_api.h

@@ -11,7 +11,7 @@
 
 #include "ciperror.h"
 #include "ciptypes.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 #if defined(STM32) /** STM32 target -> uses a struct for the network interface \
                     */

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

@@ -4,16 +4,16 @@
  *
  ******************************************************************************/
 
-#include "appcontype.h"
+#include "cip/appcontype.h"
 
+#include <assert.h>
 #include <string.h>
 
-#include "assert.h"
-#include "cipconnectionmanager.h"
-#include "cipconnectionobject.h"
-#include "cipepath.h"
-#include "opener_api.h"
-#include "trace.h"
+#include "api/opener_api.h"
+#include "cip/cipconnectionmanager.h"
+#include "cip/cipconnectionobject.h"
+#include "cip/cipepath.h"
+#include "core/trace.h"
 
 /** @brief Exclusive Owner connection data */
 typedef struct {

+ 4 - 4
source/src/cip/appcontype.h

@@ -3,10 +3,10 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef SOURCE_SRC_CIP_APPCONTYPE_H_
-#define SOURCE_SRC_CIP_APPCONTYPE_H_
+#ifndef CIP_APPCONTYPE_H_
+#define CIP_APPCONTYPE_H_
 
-#include "cipconnectionmanager.h"
+#include "cip/cipconnectionmanager.h"
 
 void InitializeIoConnectionData(void);
 
@@ -73,4 +73,4 @@ void CloseAllConnections(void);
  */
 bool ConnectionWithSameConfigPointExists(const EipUint32 config_point);
 
-#endif  // SOURCE_SRC_CIP_APPCONTYPE_H_
+#endif  // CIP_APPCONTYPE_H_

+ 5 - 5
source/src/cip/cipassembly.c

@@ -4,15 +4,15 @@
  *
  ******************************************************************************/
 
-#include "cipassembly.h"
+#include "cip/cipassembly.h"
 
 #include <stdbool.h>
 #include <string.h>
 
-#include "cipcommon.h"
-#include "cipconnectionmanager.h"
-#include "opener_api.h"
-#include "trace.h"
+#include "api/opener_api.h"
+#include "cip/cipcommon.h"
+#include "cip/cipconnectionmanager.h"
+#include "core/trace.h"
 
 /** @brief Retrieve the given data according to CIP encoding from the
  *              message buffer.

+ 5 - 5
source/src/cip/cipassembly.h

@@ -3,11 +3,11 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef SOURCE_SRC_CIP_CIPASSEMBLY_H_
-#define SOURCE_SRC_CIP_CIPASSEMBLY_H_
+#ifndef CIP_CIPASSEMBLY_H_
+#define CIP_CIPASSEMBLY_H_
 
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 /** @brief Assembly class code */
 static const CipUint kCipAssemblyClassCode = 0x04U;
@@ -58,4 +58,4 @@ EipStatus NotifyAssemblyConnectedDataReceived(CipInstance* const instance,
                                               const EipUint8* const data,
                                               const size_t data_length);
 
-#endif  // SOURCE_SRC_CIP_CIPASSEMBLY_H_
+#endif  // CIP_CIPASSEMBLY_H_

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

@@ -4,11 +4,11 @@
  *
  ******************************************************************************/
 
-#include "cipclass3connection.h"
+#include "cip/cipclass3connection.h"
 
 #include <string.h>
 
-#include "encap.h"
+#include "enet_encap/encap.h"
 
 /**** Global variables ****/
 extern CipConnectionObject

+ 6 - 6
source/src/cip/cipclass3connection.h

@@ -4,8 +4,8 @@
  *
  ******************************************************************************/
 
-#ifndef OPENER_CIPCLASS3CONNECTION_H_
-#define OPENER_CIPCLASS3CONNECTION_H_
+#ifndef CIP_CIPCLASS3CONNECTION_H_
+#define CIP_CIPCLASS3CONNECTION_H_
 
 /** @file cipclass3connection.h
  *  @brief CIP Class 3 connection
@@ -28,9 +28,9 @@
  * @enddot
  */
 
-#include "cipconnectionmanager.h"
-#include "cipconnectionobject.h"
-#include "opener_api.h"
+#include "api/opener_api.h"
+#include "cip/cipconnectionmanager.h"
+#include "cip/cipconnectionobject.h"
 
 typedef EipStatus (*CipConnectionStateHandler)(
     CipConnectionObject* RESTRICT const connection_object,
@@ -62,4 +62,4 @@ CipError EstablishClass3Connection(
  */
 void InitializeClass3ConnectionData(void);
 
-#endif /* OPENER_CIPCLASS3CONNECTION_H_ */
+#endif /* CIP_CIPCLASS3CONNECTION_H_ */

+ 21 - 20
source/src/cip/cipcommon.c

@@ -3,33 +3,34 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#include "cipcommon.h"
+#include "cip/cipcommon.h"
 
 #include <stdio.h>
 #include <string.h>
 
-#include "cipassembly.h"
-#include "cipconnectionmanager.h"
-#include "ciperror.h"
-#include "cipethernetlink.h"
-#include "cipidentity.h"
-#include "cipmessagerouter.h"
-#include "ciptcpipinterface.h"
-#include "encap.h"
-#include "endianconv.h"
-#include "opener_api.h"
+#include "api/opener_api.h"
+#include "cip/cipassembly.h"
+#include "cip/cipconnectionmanager.h"
+#include "cip/ciperror.h"
+#include "cip/cipethernetlink.h"
+#include "cip/cipidentity.h"
+#include "cip/cipmessagerouter.h"
+#include "cip/ciptcpipinterface.h"
+#include "enet_encap/encap.h"
+#include "enet_encap/endianconv.h"
 #include "opener_user_conf.h"
 #if defined(OPENER_IS_DLR_DEVICE) && 0 != OPENER_IS_DLR_DEVICE
-#include "cipdlr.h"
+#include "cip/cipdlr.h"
 #endif
-#include "appcontype.h"
-#include "cipepath.h"
-#include "cipqos.h"
-#include "cipstring.h"
-#include "ciptypes.h"
-#include "cpf.h"
-#include "stdlib.h"
-#include "trace.h"
+#include <stdlib.h>
+
+#include "cip/appcontype.h"
+#include "cip/cipepath.h"
+#include "cip/cipqos.h"
+#include "cip/cipstring.h"
+#include "cip/ciptypes.h"
+#include "core/trace.h"
+#include "enet_encap/cpf.h"
 
 #if defined(CIP_FILE_OBJECT) && 0 != CIP_FILE_OBJECT
 #include "OpENerFileObject/cipfile.h"

+ 5 - 5
source/src/cip/cipcommon.h

@@ -3,15 +3,15 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef OPENER_CIPCOMMON_H_
-#define OPENER_CIPCOMMON_H_
+#ifndef CIP_CIPCOMMON_H_
+#define CIP_CIPCOMMON_H_
 
 /** @file cipcommon.h
  * Common CIP object interface
  */
 
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 static const EipUint16 kCipUintZero =
     0; /**< Zero value for returning the UINT standard value */
@@ -224,4 +224,4 @@ EipStatus CipResetService(
     const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session);
 
-#endif /* OPENER_CIPCOMMON_H_ */
+#endif /* CIP_CIPCOMMON_H_ */

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

@@ -8,26 +8,26 @@
 #include <stdbool.h>
 #include <string.h>
 
-#include "appcontype.h"
-#include "cipassembly.h"
-#include "cipclass3connection.h"
-#include "cipcommon.h"
-#include "cipconnectionobject.h"
-#include "cipelectronickey.h"
-#include "cipepath.h"
-#include "ciperror.h"
-#include "cipidentity.h"
-#include "cipioconnection.h"
-#include "cipmessagerouter.h"
-#include "cipqos.h"
-#include "cpf.h"
-#include "encap.h"
-#include "endianconv.h"
-#include "generic_networkhandler.h"
+#include "cip/appcontype.h"
+#include "cip/cipassembly.h"
+#include "cip/cipclass3connection.h"
+#include "cip/cipcommon.h"
+#include "cip/cipconnectionobject.h"
+#include "cip/cipelectronickey.h"
+#include "cip/cipepath.h"
+#include "cip/ciperror.h"
+#include "cip/cipidentity.h"
+#include "cip/cipioconnection.h"
+#include "cip/cipmessagerouter.h"
+#include "cip/cipqos.h"
+#include "core/trace.h"
+#include "enet_encap/cpf.h"
+#include "enet_encap/encap.h"
+#include "enet_encap/endianconv.h"
 #include "opener_api.h"
 #include "opener_user_conf.h"
-#include "trace.h"
-#include "xorshiftrandom.h"
+#include "ports/generic_networkhandler.h"
+#include "utils/xorshiftrandom.h"
 
 const size_t g_kForwardOpenHeaderLength =
     36; /**< the length in bytes of the forward open command specific data till

+ 7 - 7
source/src/cip/cipconnectionmanager.h

@@ -3,14 +3,14 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef OPENER_CIPCONNECTIONMANAGER_H_
-#define OPENER_CIPCONNECTIONMANAGER_H_
+#ifndef CIP_CIPCONNECTIONMANAGER_H_
+#define CIP_CIPCONNECTIONMANAGER_H_
 
-#include "cipconnectionobject.h"
-#include "ciptypes.h"
-#include "opener_api.h"
+#include "api/opener_api.h"
+#include "cip/cipconnectionobject.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 #include "opener_user_conf.h"
-#include "typedefs.h"
 
 /**
  * @brief Connection Type constants of the Forward Open service request
@@ -308,4 +308,4 @@ void CheckForTimedOutConnectionsAndCloseTCPConnections(
     const CipConnectionObject* const connection_object,
     CloseSessionFunction CloseSessions);
 
-#endif /* OPENER_CIPCONNECTIONMANAGER_H_ */
+#endif /* CIP_CIPCONNECTIONMANAGER_H_ */

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

@@ -10,8 +10,8 @@
 #include <string.h>
 
 #include "cip/cipconnectionmanager.h"
+#include "core/trace.h"
 #include "enet_encap/endianconv.h"
-#include "src/trace.h"
 
 #define CIP_CONNECTION_OBJECT_STATE_NON_EXISTENT 0U
 #define CIP_CONNECTION_OBJECT_STATE_CONFIGURING 1U

+ 10 - 10
source/src/cip/cipconnectionobject.h

@@ -4,16 +4,16 @@
  *
  ******************************************************************************/
 
-#ifndef SRC_CIP_CIPCONNECTIONOBJECT_H_
-#define SRC_CIP_CIPCONNECTIONOBJECT_H_
-
-#include "cipelectronickey.h"
-#include "cipepath.h"
-#include "ciptypes.h"
-#include "doublylinkedlist.h"
-#include "opener_api.h"
+#ifndef CIP_CIPCONNECTIONOBJECT_H_
+#define CIP_CIPCONNECTIONOBJECT_H_
+
+#include "api/opener_api.h"
+#include "cip/cipelectronickey.h"
+#include "cip/cipepath.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 #include "opener_user_conf.h"
-#include "typedefs.h"
+#include "utils/doublylinkedlist.h"
 
 #define CIP_CONNECTION_OBJECT_CODE 0x05
 
@@ -516,4 +516,4 @@ bool CipConnectionObjectOriginatorHasSameIP(
     const CipConnectionObject* const connection_object,
     const struct sockaddr* const originator_address);
 
-#endif /* SRC_CIP_CIPCONNECTIONOBJECT_H_ */
+#endif /* CIP_CIPCONNECTIONOBJECT_H_ */

+ 5 - 5
source/src/cip/cipdlr.c

@@ -42,14 +42,14 @@
 /* ********************************************************************
  * include files
  */
-#include "cipdlr.h"
+#include "cip/cipdlr.h"
 
 #include <string.h>
 
-#include "cipcommon.h"
-#include "endianconv.h"
-#include "opener_api.h"
-#include "trace.h"
+#include "api/opener_api.h"
+#include "cip/cipcommon.h"
+#include "core/trace.h"
+#include "enet_encap/endianconv.h"
 
 /* ********************************************************************
  * defines

+ 5 - 5
source/src/cip/cipdlr.h

@@ -11,11 +11,11 @@
  *
  */
 
-#ifndef OPENER_CIPDLR_H_
-#define OPENER_CIPDLR_H_
+#ifndef CIP_CIPDLR_H_
+#define CIP_CIPDLR_H_
 
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 /** @brief DLR object class code */
 static const CipUint kCipDlrClassCode = 0x47U;
@@ -78,4 +78,4 @@ extern CipDlrObject g_dlr; /**< declaration of DLR object instance 1 data */
  */
 EipStatus CipDlrInit(void);
 
-#endif /* of OPENER_CIPDLR_H_ */
+#endif /* of CIP_CIPDLR_H_ */

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

@@ -4,7 +4,7 @@
  *
  ******************************************************************************/
 
-#include "cipelectronickey.h"
+#include "cip/cipelectronickey.h"
 
 #include <stdlib.h>
 

+ 4 - 4
source/src/cip/cipelectronickey.h

@@ -4,12 +4,12 @@
  *
  ******************************************************************************/
 
-#ifndef SRC_CIP_CIPELECTRONICKEY_H_
-#define SRC_CIP_CIPELECTRONICKEY_H_
+#ifndef CIP_CIPELECTRONICKEY_H_
+#define CIP_CIPELECTRONICKEY_H_
 
 #include <stdbool.h>
 
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 /** @brief CIP Electronic Key Segment struct
  *
@@ -149,4 +149,4 @@ void ElectronicKeyFormat4SetMinorRevision(
 CipUsint ElectronicKeyFormat4GetMinorRevision(
     const ElectronicKeyFormat4* const electronic_key);
 
-#endif /* SRC_CIP_CIPELECTRONICKEY_H_ */
+#endif /* CIP_CIPELECTRONICKEY_H_ */

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

@@ -4,15 +4,15 @@
  *
  ******************************************************************************/
 
-#include "cipepath.h"
+#include "cip/cipepath.h"
 
 #include <assert.h>
 #include <stdbool.h>
 #include <stdlib.h>
 
-#include "cipelectronickey.h"
-#include "endianconv.h"
-#include "trace.h"
+#include "cip/cipelectronickey.h"
+#include "core/trace.h"
+#include "enet_encap/endianconv.h"
 
 const unsigned int kPortSegmentExtendedPort =
     15; /**< Reserved port segment port value, indicating the use of the

+ 5 - 5
source/src/cip/cipepath.h

@@ -4,13 +4,13 @@
  *
  ******************************************************************************/
 
-#ifndef SRC_CIP_CIPEPATH_H_
-#define SRC_CIP_CIPEPATH_H_
+#ifndef CIP_CIPEPATH_H_
+#define CIP_CIPEPATH_H_
 
 #include <stdbool.h>
 
-#include "cipelectronickey.h"
-#include "ciptypes.h"
+#include "cip/cipelectronickey.h"
+#include "cip/ciptypes.h"
 
 #define SEGMENT_TYPE_PORT_SEGMENT             \
   0x00 /**< Message value of the Port segment \
@@ -452,4 +452,4 @@ bool CipEpathEqual(const CipOctet* const path1,
                    const CipOctet* const path2,
                    const CipUint path2_length);
 
-#endif /* SRC_CIP_CIPEPATH_H_ */
+#endif /* CIP_CIPEPATH_H_ */

+ 3 - 3
source/src/cip/ciperror.h

@@ -3,8 +3,8 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef OPENER_CIPERROR_H_
-#define OPENER_CIPERROR_H_
+#ifndef CIP_CIPERROR_H_
+#define CIP_CIPERROR_H_
 
 typedef enum {
   kCipErrorSuccess =
@@ -148,4 +148,4 @@ typedef enum {
   /* 2F - CF Reserved by CIP for future extensions D0 - FF Reserved for Object
      Class and service errors*/
 } CipError;
-#endif /* OPENER_CIPERROR_H_ */
+#endif /* CIP_CIPERROR_H_ */

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

@@ -48,15 +48,15 @@
  *
  */
 
-#include "cipethernetlink.h"
+#include "cip/cipethernetlink.h"
 
 #include <string.h>
 
-#include "cipcommon.h"
-#include "endianconv.h"
-#include "opener_api.h"
+#include "api/opener_api.h"
+#include "cip/cipcommon.h"
+#include "core/trace.h"
+#include "enet_encap/endianconv.h"
 #include "opener_user_conf.h"
-#include "trace.h"
 
 #if OPENER_ETHLINK_INSTANCE_CNT > 1
 /* If we have more than 1 Ethernet Link instance then the interface label

+ 5 - 5
source/src/cip/cipethernetlink.h

@@ -3,14 +3,14 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef OPENER_CIPETHERNETLINK_H_
-#define OPENER_CIPETHERNETLINK_H_
+#ifndef CIP_CIPETHERNETLINK_H_
+#define CIP_CIPETHERNETLINK_H_
 /** @file
  *  @brief Declare public interface of the CIP Ethernet Link Object
  */
 
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 /** @brief This Ethernet Link class code as #define is still needed for a static
  *  initialization. */
@@ -197,4 +197,4 @@ void CipEthernetLinkSetMac(EipUint8* p_physical_address);
 
 extern CipEthernetLinkObject g_ethernet_link[];
 
-#endif /* OPENER_CIPETHERNETLINK_H_*/
+#endif /* CIP_CIPETHERNETLINK_H_*/

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

@@ -25,18 +25,18 @@
  * --------------------
  */
 
-#include "cipidentity.h"
+#include "cip/cipidentity.h"
 
 #include <string.h>
 
-#include "cipcommon.h"
-#include "ciperror.h"
-#include "cipmessagerouter.h"
-#include "cipstring.h"
-#include "endianconv.h"
-#include "opener_api.h"
+#include "api/opener_api.h"
+#include "cip/cipcommon.h"
+#include "cip/ciperror.h"
+#include "cip/cipmessagerouter.h"
+#include "cip/cipstring.h"
+#include "core/trace.h"
+#include "enet_encap/endianconv.h"
 #include "opener_user_conf.h"
-#include "trace.h"
 
 /** @brief The device's configuration data for the Identity Object */
 #include "devicedata.h"

+ 5 - 5
source/src/cip/cipidentity.h

@@ -3,11 +3,11 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef OPENER_CIPIDENTITY_H_
-#define OPENER_CIPIDENTITY_H_
+#ifndef CIP_CIPIDENTITY_H_
+#define CIP_CIPIDENTITY_H_
 
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 /** @brief Identity class code */
 static const CipUint kCipIdentityClassCode = 0x01U;
@@ -94,4 +94,4 @@ void CipIdentityClearStatusFlags(const CipWord status_flags);
 void CipIdentitySetExtendedDeviceStatus(
     CipIdentityExtendedStatus extended_status);
 
-#endif /* OPENER_CIPIDENTITY_H_ */
+#endif /* CIP_CIPIDENTITY_H_ */

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

@@ -4,22 +4,22 @@
  *
  ******************************************************************************/
 
-#include "cipioconnection.h"
+#include "cip/cipioconnection.h"
 
 #include <stdbool.h>
 #include <string.h>
 
-#include "appcontype.h"
-#include "cipassembly.h"
-#include "cipcommon.h"
-#include "cipconnectionmanager.h"
-#include "cipidentity.h"
-#include "ciptcpipinterface.h"
-#include "cpf.h"
-#include "endianconv.h"
-#include "generic_networkhandler.h"
-#include "opener_error.h"
-#include "trace.h"
+#include "cip/appcontype.h"
+#include "cip/cipassembly.h"
+#include "cip/cipcommon.h"
+#include "cip/cipconnectionmanager.h"
+#include "cip/cipidentity.h"
+#include "cip/ciptcpipinterface.h"
+#include "core/trace.h"
+#include "enet_encap/cpf.h"
+#include "enet_encap/endianconv.h"
+#include "ports/generic_networkhandler.h"
+#include "ports/opener_error.h"
 
 /* producing multicast connection have to consider the rules that apply for
  * application connection types.

+ 6 - 6
source/src/cip/cipioconnection.h

@@ -37,12 +37,12 @@
  *
  */
 
-#ifndef OPENER_CIPIOCONNECTION_H_
-#define OPENER_CIPIOCONNECTION_H_
+#ifndef CIP_CIPIOCONNECTION_H_
+#define CIP_CIPIOCONNECTION_H_
 
-#include "cipconnectionmanager.h"
-#include "cipconnectionobject.h"
-#include "opener_api.h"
+#include "api/opener_api.h"
+#include "cip/cipconnectionmanager.h"
+#include "cip/cipconnectionobject.h"
 
 /** @brief Setup all data in order to establish an IO connection
  *
@@ -81,4 +81,4 @@ void CloseCommunicationChannelsAndRemoveFromActiveConnectionsList(
 extern EipUint8* g_config_data_buffer;
 extern unsigned int g_config_data_length;
 
-#endif /* OPENER_CIPIOCONNECTION_H_ */
+#endif /* CIP_CIPIOCONNECTION_H_ */

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

@@ -3,14 +3,14 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#include "cipmessagerouter.h"
+#include "cip/cipmessagerouter.h"
 
-#include "cipcommon.h"
-#include "ciperror.h"
-#include "endianconv.h"
-#include "enipmessage.h"
-#include "opener_api.h"
-#include "trace.h"
+#include "api/opener_api.h"
+#include "cip/cipcommon.h"
+#include "cip/ciperror.h"
+#include "core/trace.h"
+#include "enet_encap/endianconv.h"
+#include "enet_encap/enipmessage.h"
 
 CipMessageRouterRequest g_message_router_request;
 

+ 5 - 5
source/src/cip/cipmessagerouter.h

@@ -3,11 +3,11 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef OPENER_CIPMESSAGEROUTER_H_
-#define OPENER_CIPMESSAGEROUTER_H_
+#ifndef CIP_CIPMESSAGEROUTER_H_
+#define CIP_CIPMESSAGEROUTER_H_
 
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 /** @brief Message Router class code */
 static const CipUint kCipMessageRouterClassCode = 0x02U;
@@ -52,4 +52,4 @@ EipStatus NotifyMessageRouter(EipUint8* data,
  */
 EipStatus RegisterCipClass(CipClass* cip_class);
 
-#endif /* OPENER_CIPMESSAGEROUTER_H_ */
+#endif /* CIP_CIPMESSAGEROUTER_H_ */

+ 9 - 9
source/src/cip/cipqos.c

@@ -4,16 +4,16 @@
  *
  ******************************************************************************/
 
-#include "cipqos.h"
-
-#include "cipcommon.h"
-#include "ciperror.h"
-#include "cipethernetlink.h"
-#include "cipmessagerouter.h"
-#include "endianconv.h"
-#include "opener_api.h"
+#include "cip/cipqos.h"
+
+#include "api/opener_api.h"
+#include "cip/cipcommon.h"
+#include "cip/ciperror.h"
+#include "cip/cipethernetlink.h"
+#include "cip/cipmessagerouter.h"
+#include "core/trace.h"
+#include "enet_encap/endianconv.h"
 #include "opener_user_conf.h"
-#include "trace.h"
 
 #define DEFAULT_DSCP_EVENT 59U
 #define DEFAULT_DSCP_GENERAL 47U

+ 6 - 6
source/src/cip/cipqos.h

@@ -4,17 +4,17 @@
  *
  ******************************************************************************/
 
-#ifndef OPENER_CIPQOS_H_
-#define OPENER_CIPQOS_H_
+#ifndef CIP_CIPQOS_H_
+#define CIP_CIPQOS_H_
 
 /** @file cipqos.h
  *  @brief Public interface of the QoS Object
  *
  */
 
-#include "cipconnectionmanager.h"
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/cipconnectionmanager.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 /** @brief QoS Object class code */
 static const CipUint kCipQoSClassCode = 0x48U;
@@ -67,4 +67,4 @@ void CipQosUpdateUsedSetQosValues(void);
  */
 void CipQosResetAttributesToDefaultValues(void);
 
-#endif /* OPENER_CIPQOS_H_*/
+#endif /* CIP_CIPQOS_H_*/

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

@@ -9,13 +9,13 @@
  *
  * Some functions to create CIP string types from C strings or data buffers.
  */
-#include "cipstring.h"
+#include "cip/cipstring.h"
 
 #include <stdlib.h>
 #include <string.h>
 
-#include "opener_api.h"
-#include "trace.h"
+#include "api/opener_api.h"
+#include "core/trace.h"
 
 CipStringN* ClearCipStringN(CipStringN* const cip_string) {
   if (NULL != cip_string) {

+ 5 - 5
source/src/cip/cipstring.h

@@ -10,11 +10,11 @@
  * Some functions to create CIP string types from C strings or data buffers.
  */
 
-#ifndef OPENER_CIPSTRING_H_
-#define OPENER_CIPSTRING_H_
+#ifndef CIP_CIPSTRING_H_
+#define CIP_CIPSTRING_H_
 
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 CipStringN* SetCipStringNByData(CipStringN* const cip_string,
                                 CipUint str_len,
@@ -189,4 +189,4 @@ int GetCstrFromCipShortString(CipShortString* const string,
                               char* buf,
                               size_t len);
 
-#endif /* of OPENER_CIPSTRING_H_ */
+#endif /* of CIP_CIPSTRING_H_ */

+ 5 - 5
source/src/cip/cipstringi.c

@@ -4,14 +4,14 @@
  *
  ******************************************************************************/
 
-#include "cipstringi.h"
+#include "cip/cipstringi.h"
 
 #include <string.h>
 
-#include "cipstring.h"
-#include "endianconv.h"
-#include "opener_api.h"
-#include "trace.h"
+#include "api/opener_api.h"
+#include "cip/cipstring.h"
+#include "core/trace.h"
+#include "enet_encap/endianconv.h"
 
 void CipStringIDelete(CipStringI* const string) {
   for (size_t i = 0; i < string->number_of_strings; ++i) {

+ 1 - 1
source/src/cip/cipstringi.h

@@ -4,7 +4,7 @@
  *
  ******************************************************************************/
 
-#include "ciptypes.h"
+#include "cip/ciptypes.h"
 
 void CipStringIDelete(CipStringI* const string);
 

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

@@ -3,21 +3,21 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#include "ciptcpipinterface.h"
+#include "cip/ciptcpipinterface.h"
 
 #include <string.h>
 
-#include "cipassembly.h"
-#include "cipcommon.h"
-#include "cipconnectionobject.h"
-#include "ciperror.h"
-#include "cipethernetlink.h"
-#include "cipmessagerouter.h"
-#include "cipstring.h"
-#include "endianconv.h"
-#include "opener_api.h"
+#include "api/opener_api.h"
+#include "cip/cipassembly.h"
+#include "cip/cipcommon.h"
+#include "cip/cipconnectionobject.h"
+#include "cip/ciperror.h"
+#include "cip/cipethernetlink.h"
+#include "cip/cipmessagerouter.h"
+#include "cip/cipstring.h"
+#include "core/trace.h"
+#include "enet_encap/endianconv.h"
 #include "opener_user_conf.h"
-#include "trace.h"
 
 /* Define constants to initialize the config_capability attribute (#2). These
  *   are needed as defines because we use them for static initialization. */

+ 5 - 5
source/src/cip/ciptcpipinterface.h

@@ -3,16 +3,16 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef OPENER_CIPTCPIPINTERFACE_H_
-#define OPENER_CIPTCPIPINTERFACE_H_
+#ifndef CIP_CIPTCPIPINTERFACE_H_
+#define CIP_CIPTCPIPINTERFACE_H_
 
 /** @file ciptcpipinterface.h
  * @brief Public interface of the TCP/IP Interface Object
  *
  */
 
-#include "ciptypes.h"
-#include "typedefs.h"
+#include "cip/ciptypes.h"
+#include "core/typedefs.h"
 
 /** @brief TCP/IP Interface class code */
 static const CipUint kCipTcpIpInterfaceClassCode = 0xF5U;
@@ -111,4 +111,4 @@ void CipTcpIpCalculateMulticastIp(CipTcpIpObject* const tcpip);
  */
 EipUint16 GetEncapsulationInactivityTimeout(CipInstance* instance);
 
-#endif /* OPENER_CIPTCPIPINTERFACE_H_ */
+#endif /* CIP_CIPTCPIPINTERFACE_H_ */

+ 4 - 3
source/src/cip/ciptypes.c

@@ -3,9 +3,10 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#include <ciptypes.h>
-#include <endianconv.h>
-#include <trace.h>
+#include <cip/ciptypes.h>
+#include <enet_encap/endianconv.h>
+
+#include "core/trace.h"
 
 const CipInstanceNum kCipInstanceNumMax = UINT16_MAX;
 

+ 138 - 157
source/src/cip/ciptypes.h

@@ -3,62 +3,62 @@
  * All rights reserved.
  *
  ******************************************************************************/
-#ifndef OPENER_CIPTYPES_H_
-#define OPENER_CIPTYPES_H_
+#ifndef CIP_CIPTYPES_H_
+#define CIP_CIPTYPES_H_
 
-#include "enipmessage.h"
-#include "networkhandler.h"
-#include "opener_user_conf.h"
-#include "typedefs.h"
+#include "api/opener_user_conf.h"
+#include "core/typedefs.h"
+#include "enet_encap/enipmessage.h"
+#include "ports/networkhandler.h"
 
 /** @brief Enum containing the encoding values for CIP data types for CIP
  * Messages */
 typedef enum cip_data_types {
-  kCipAny         = 0x00, /**< data type that can not be directly encoded */
-  kCipBool        = 0xC1, /**< boolean data type */
-  kCipSint        = 0xC2, /**< 8-bit signed integer */
-  kCipInt         = 0xC3, /**< 16-bit signed integer */
-  kCipDint        = 0xC4, /**< 32-bit signed integer */
-  kCipLint        = 0xC5, /**< 64-bit signed integer */
-  kCipUsint       = 0xC6, /**< 8-bit unsigned integer */
-  kCipUint        = 0xC7, /**< 16-bit unsigned integer */
-  kCipUdint       = 0xC8, /**< 32-bit unsigned integer */
-  kCipUlint       = 0xC9, /**< 64-bit unsigned integer */
-  kCipReal        = 0xCA, /**< Single precision floating point */
-  kCipLreal       = 0xCB, /**< Double precision floating point*/
-  kCipStime       = 0xCC, /**< Synchronous time information*, type of DINT */
-  kCipDate        = 0xCD, /**< Date only*/
-  kCipTimeOfDay   = 0xCE, /**< Time of day */
-  kCipDateAndTime = 0xCF, /**< Date and time of day */
-  kCipString      = 0xD0, /**< Character string, 1 byte per character */
-  kCipByte        = 0xD1, /**< 8-bit bit string */
-  kCipWord        = 0xD2, /**< 16-bit bit string */
-  kCipDword       = 0xD3, /**< 32-bit bit string */
-  kCipLword       = 0xD4, /**< 64-bit bit string */
-  kCipString2     = 0xD5, /**< Character string, 2 byte per character */
+  kCipAny         = 0x00,  ///< data type that can not be directly encoded
+  kCipBool        = 0xC1,  ///< boolean data type
+  kCipSint        = 0xC2,  ///< 8-bit signed integer
+  kCipInt         = 0xC3,  ///< 16-bit signed integer
+  kCipDint        = 0xC4,  ///< 32-bit signed integer
+  kCipLint        = 0xC5,  ///< 64-bit signed integer
+  kCipUsint       = 0xC6,  ///< 8-bit unsigned integer
+  kCipUint        = 0xC7,  ///< 16-bit unsigned integer
+  kCipUdint       = 0xC8,  ///< 32-bit unsigned integer
+  kCipUlint       = 0xC9,  ///< 64-bit unsigned integer
+  kCipReal        = 0xCA,  ///< Single precision floating point
+  kCipLreal       = 0xCB,  ///< Double precision floating point
+  kCipStime       = 0xCC,  ///< Synchronous time information*, type of DINT
+  kCipDate        = 0xCD,  ///< Date only
+  kCipTimeOfDay   = 0xCE,  ///< Time of day
+  kCipDateAndTime = 0xCF,  ///< Date and time of day
+  kCipString      = 0xD0,  ///< Character string, 1 byte per character
+  kCipByte        = 0xD1,  ///< 8-bit bit string
+  kCipWord        = 0xD2,  ///< 16-bit bit string
+  kCipDword       = 0xD3,  ///< 32-bit bit string
+  kCipLword       = 0xD4,  ///< 64-bit bit string
+  kCipString2     = 0xD5,  ///< Character string, 2 byte per character
   kCipFtime =
-      0xD6, /**< Duration in micro-seconds, high resolution; range of DINT */
+      0xD6,  ///< Duration in micro-seconds, high resolution; range of DINT
   kCipLtime =
-      0xD7, /**< Duration in micro-seconds, high resolution, range of LINT */
-  kCipItime       = 0xD8, /**< Duration in milli-seconds, short; range of INT*/
-  kCipStringN     = 0xD9, /**< Character string, N byte per character */
-  kCipShortString = 0xDA, /**< Character string, 1 byte per character, 1 byte
-                             length indicator */
-  kCipTime    = 0xDB,     /**< Duration in milli-seconds; range of DINT */
-  kCipEpath   = 0xDC,     /**< CIP path segments*/
-  kCipEngUnit = 0xDD,     /**< Engineering Units, range of UINT*/
+      0xD7,  ///< Duration in micro-seconds, high resolution, range of LINT
+  kCipItime       = 0xD8,  ///< Duration in milli-seconds, short; range of INT
+  kCipStringN     = 0xD9,  ///< Character string, N byte per character
+  kCipShortString = 0xDA,  ///< Character string, 1 byte per character, 1 byte
+                           ///< length indicator
+  kCipTime    = 0xDB,      ///< Duration in milli-seconds; range of DINT
+  kCipEpath   = 0xDC,      ///< CIP path segments
+  kCipEngUnit = 0xDD,      ///< Engineering Units, range of UINT
   /* definition of some CIP structs */
   /* need to be validated in IEC 61131-3 subclause 2.3.3 */
   /* TODO: Check these codes */
-  kCipUsintUsint = 0xA0, /**< Used for CIP Identity attribute 4 Revision*/
+  kCipUsintUsint = 0xA0,  ///< Used for CIP Identity attribute 4 Revision
   kCipUdintUdintUdintUdintUdintString =
-      0xA1, /**< TCP/IP attribute 5 - IP address, subnet mask, gateway, IP name
-               server 1, IP name server 2, domain name*/
-  kCip6Usint     = 0xA2, /**< Struct for MAC Address (six USINTs)*/
-  kCipMemberList = 0xA3, /**< */
-  kCipByteArray  = 0xA4, /**< */
-  kInternalUint6 = 0xF0, /**< bogus hack, for port class attribute 9, TODO
-                            figure out the right way to handle it */
+      0xA1,  ///< TCP/IP attribute 5 - IP address, subnet mask, gateway, IP name
+             ///< server 1, IP name server 2, domain name
+  kCip6Usint     = 0xA2,  ///< Struct for MAC Address (six USINTs)
+  kCipMemberList = 0xA3,  ///< self-defined code for Member List
+  kCipByteArray  = 0xA4,  ///< seld-defined code for Byte Array
+  kInternalUint6 = 0xF0,  ///< bogus hack, for port class attribute 9 figure out
+                          ///< the right way to handle it
   kCipStringI
 } CipDataType;
 
@@ -103,37 +103,36 @@ typedef enum {
   /* End CIP common services */
 
   /* Start CIP object-specific services */
-  kEthLinkGetAndClear =
-      0x4C, /**< Ethernet Link object's Get_And_Clear service */
-  kForwardOpen          = 0x54,
-  kLargeForwardOpen     = 0x5B,
-  kForwardClose         = 0x4E,
-  kUnconnectedSend      = 0x52,
-  kGetConnectionOwner   = 0x5A,
-  kGetConnectionData    = 0x56,
+  kEthLinkGetAndClear = 0x4C,  ///< Ethernet Link object's Get_And_Clear service
+  kForwardOpen        = 0x54,
+  kLargeForwardOpen   = 0x5B,
+  kForwardClose       = 0x4E,
+  kUnconnectedSend    = 0x52,
+  kGetConnectionOwner = 0x5A,
+  kGetConnectionData  = 0x56,
   kSearchConnectionData = 0x57
   /* End CIP object-specific services */
 } CIPServiceCode;
 
 /** @brief Definition of Get and Set Flags for CIP Attributes */
-typedef enum {                          /* TODO: Rework */
-               kNotSetOrGetable = 0x00, /**< Neither set-able nor get-able */
-               kGetableAll = 0x01, /**< Get-able, also part of Get Attribute All
-                                      service */
-               kGetableSingle = 0x02, /**< Get-able via Get Attribute */
-               kSetable       = 0x04, /**< Set-able via Set Attribute */
+typedef enum {                           /* TODO: Rework */
+               kNotSetOrGetable = 0x00,  ///< Neither set-able nor get-able
+               kGetableAll =
+                   0x01,  ///< Get-able, also part of Get Attribute All service
+               kGetableSingle = 0x02,  ///< Get-able via Get Attribute
+               kSetable       = 0x04,  ///< Set-able via Set Attribute
                /* combined for convenience */
-               kSetAndGetAble       = 0x07, /**< both set and get-able */
-               kGetableSingleAndAll = 0x03, /**< both single and all */
+               kSetAndGetAble       = 0x07,  ///< both set and get-able
+               kGetableSingleAndAll = 0x03,  ///< both single and all
                /* Flags to control the usage of callbacks per attribute from the
                   Get* and Set* services */
-               kGetableAllDummy = 0x08, /**< Get-able but a dummy Attribute */
-               kPreGetFunc      = 0x10, /**< enable pre get callback */
-               kPostGetFunc     = 0x20, /**< enable post get callback */
-               kPreSetFunc      = 0x40, /**< enable pre set callback */
-               kPostSetFunc     = 0x80, /**< enable post set callback */
-               kNvDataFunc = 0x80, /**< enable Non Volatile data callback, is
-                                      the same as @ref kPostSetFunc */
+               kGetableAllDummy = 0x08,  ///< Get-able but a dummy Attribute
+               kPreGetFunc      = 0x10,  ///< enable pre get callback
+               kPostGetFunc     = 0x20,  ///< enable post get callback
+               kPreSetFunc      = 0x40,  ///< enable pre set callback
+               kPostSetFunc     = 0x80,  ///< enable post set callback
+               kNvDataFunc = 0x80,  ///< enable Non Volatile data callback, is
+                                    ///< the same as @ref kPostSetFunc
 } CIPAttributeFlag;
 
 typedef enum {
@@ -146,41 +145,41 @@ typedef enum {
  *
  */
 typedef struct {
-  EipUint16 length; /**< Length of the Byte Array */
-  EipByte* data;    /**< Pointer to the data */
+  EipUint16 length;  ///< Length of the Byte Array
+  EipByte* data;     ///< Pointer to the data
 } CipByteArray;
 
 /** @brief CIP Short String
  *
  */
 typedef struct {
-  EipUint8 length; /**< Length of the String (8 bit value) */
-  EipByte* string; /**< Pointer to the string data */
+  EipUint8 length;  ///< Length of the String (8 bit value)
+  EipByte* string;  ///< Pointer to the string data
 } CipShortString;
 
 /** @brief CIP String
  *
  */
 typedef struct {
-  EipUint16 length; /**< Length of the String (16 bit value) */
-  CipByte* string;  /**< Pointer to the string data */
+  EipUint16 length;  ///< Length of the String (16 bit value)
+  CipByte* string;   ///< Pointer to the string data
 } CipString;
 
 /** @brief CIP String2
  *
  */
 typedef struct {
-  EipUint16 length; /**< Length of the String (16 bit value) */
-  CipWord* string;  /**< Pointer to the string data */
+  EipUint16 length;  ///< Length of the String (16 bit value)
+  CipWord* string;   ///< Pointer to the string data
 } CipString2;
 
 /** @brief CIP String with variable symbol size
  *
  */
 typedef struct {
-  EipUint16 size;   /**< Amount of bytes per symbol */
-  EipUint16 length; /**< Length of the String (16 bit value) */
-  EipByte* string;  /**< Pointer to the string data */
+  EipUint16 size;    ///< Amount of bytes per symbol
+  EipUint16 length;  ///< Length of the String (16 bit value)
+  EipByte* string;   ///< Pointer to the string data
 } CipStringN;
 
 /** @brief STRINGI definition
@@ -211,9 +210,9 @@ typedef struct cip_type_string_i_struct {
   CipUsint language_char_1;
   CipUsint language_char_2;
   CipUsint language_char_3;
-  CipUint char_string_struct; /**< EPath Either 0xD0, 0xD5, 0xD9, or 0xDA */
-  CipUint character_set;      /**< Character set of the string */
-  CipOctet* string;           /**< Pointer to the string data */
+  CipUint char_string_struct;  ///< EPath Either 0xD0, 0xD5, 0xD9, or 0xDA
+  CipUint character_set;       ///< Character set of the string
+  CipOctet* string;            ///< Pointer to the string data
 } CipStringIStruct;
 
 /** @brief Highest CIP instance number.
@@ -230,12 +229,12 @@ extern const CipInstanceNum kCipInstanceNumMax;
  *
  */
 typedef struct {
-  EipUint8 path_size; /**< Path size in 16 bit words (path_size * 16 bit) */
-  EipUint16 class_id; /**< Class ID of the linked object */
+  EipUint8 path_size;  ///< Path size in 16 bit words (path_size * 16 bit)
+  EipUint16 class_id;  ///< Class ID of the linked object
   CipInstanceNum
-      instance_number; /**< Requested Instance Number of the linked object */
+      instance_number;  ///< Requested Instance Number of the linked object
   EipUint16
-      attribute_number; /**< Requested Attribute Number of the linked object */
+      attribute_number;  ///< Requested Attribute Number of the linked object
 } CipEpath;
 
 typedef enum connection_point_type {
@@ -251,8 +250,8 @@ typedef enum connection_point_type {
  *
  */
 typedef struct {
-  EipUint8 path_size; /**< Path size in 16 bit words (path_size * 16 bit) */
-  EipUint32 class_id; /**< Class ID of the linked object */
+  EipUint8 path_size;  ///< Path size in 16 bit words (path_size * 16 bit)
+  EipUint32 class_id;  ///< Class ID of the linked object
   EipUint32 connection_point[kConnectionPointTypeMaxValue];
   EipUint8 data_segment;
   EipUint8* segment_data;
@@ -274,9 +273,9 @@ typedef struct {
   const CipOctet* data;
 } CipMessageRouterRequest;
 
-#define MAX_SIZE_OF_ADD_STATUS                                                \
-  2 /* for now we support extended status codes up to 2 16bit values there is \
-       mostly only one 16bit value used */
+/// for now we support extended status codes up to 2 16bit values there is
+/// mostly only one 16bit value used
+#define MAX_SIZE_OF_ADD_STATUS 2
 
 typedef struct enip_message ENIPMessage;
 
@@ -284,18 +283,18 @@ typedef struct enip_message ENIPMessage;
  *
  */
 typedef struct {
-  CipUsint reply_service;  /**< Reply service code, the requested service code +
-                              0x80 */
-  CipOctet reserved;       /**< Reserved; Shall be zero */
-  CipUsint general_status; /**< One of the General Status codes listed in CIP
-                              Specification Volume 1, Appendix B */
-  CipUsint size_of_additional_status; /**< Number of additional 16 bit words in
-                                         Additional Status Array */
+  CipUsint
+      reply_service;  ///< Reply service code, the requested service code 0x80
+  CipOctet reserved;  ///< Reserved; Shall be zero
+  CipUsint general_status;  ///< One of the General Status codes listed in CIP
+                            ///< Specification Volume 1, Appendix B
+  CipUsint size_of_additional_status;  ///< Number of additional 16 bit words in
+                                       ///< Additional Status Array
   EipUint16 additional_status
-      [MAX_SIZE_OF_ADD_STATUS]; /**< Array of 16 bit words; Additional status;
-                                   If SizeOfAdditionalStatus is 0. there is no
-                                   Additional Status */
-  ENIPMessage message;          /* The constructed message */
+      [MAX_SIZE_OF_ADD_STATUS];  ///< Array of 16 bit words; Additional status;
+                                 ///< If SizeOfAdditionalStatus is 0. there is
+                                 ///< no Additional Status
+  ENIPMessage message;           ///< The constructed message
 } CipMessageRouterResponse;
 
 /** @brief self-describing data encoding for CIP types */
@@ -311,14 +310,13 @@ typedef int (*CipAttributeDecodeFromMessage)(
 /** @brief Structure to describe a single CIP attribute of an object
  */
 typedef struct {
-  EipUint16 attribute_number; /**< The attribute number of this attribute. */
-  EipUint8 type;              /**< The @ref CipDataType of this attribute. */
-  CipAttributeEncodeInMessage encode; /**< Self-describing its data encoding */
-  CipAttributeDecodeFromMessage
-      decode;                       /**< Self-describing its data decoding */
-  CIPAttributeFlag attribute_flags; /**< See @ref CIPAttributeFlag declaration
-                                       for valid values. */
-  void* data;
+  EipUint16 attribute_number;  ///< The attribute number of this attribute.
+  EipUint8 type;               ///< The @ref CipDataType of this attribute.
+  CipAttributeEncodeInMessage encode;    ///< Self-describing its data encoding
+  CipAttributeDecodeFromMessage decode;  ///< Self-describing its data decoding
+  CIPAttributeFlag attribute_flags;  ///< See @ref CIPAttributeFlag declaration
+                                     ///< for valid values.
+  void* data;                        ///< Pointer to the attribute's data.
 } CipAttributeStruct;
 
 /** @brief Type definition of one instance of an Ethernet/IP object
@@ -328,13 +326,13 @@ typedef struct {
  */
 typedef struct cip_instance {
   CipInstanceNum
-      instance_number; /**< this instance's number (unique within the class) */
-  CipAttributeStruct* attributes; /**< pointer to an array of attributes which
-                                     is unique to this instance */
-  struct cip_class* cip_class;    /**< class the instance belongs to */
-  struct cip_instance* next; /**< next instance, all instances of a class live
-                                in a linked list */
-  void* data;                /**< pointer to instance data struct */
+      instance_number;  ///< this instance's number (unique within the class)
+  CipAttributeStruct* attributes;  ///< pointer to an array of attributes which
+                                   ///< is unique to this instance
+  struct cip_class* cip_class;     ///< class the instance belongs to
+  struct cip_instance*
+      next;  ///< next instance, all instances of a class live in a linked list
+  void* data;  ///< pointer to instance data struct
 } CipInstance;
 
 /** @ingroup CIP_API
@@ -374,26 +372,26 @@ typedef EipStatus (*CipCallback)(
 
 /** @brief Type definition of CipClass that is a subclass of CipInstance */
 typedef struct cip_class {
-  CipInstance class_instance; /**< This is the instance that contains the
-                                 class attributes of this class. */
+  CipInstance class_instance;  ///< This is the instance that contains the class
+                               ///< attributes of this class.
   /* the rest of these are specific to the Class class only. */
-  CipUdint class_code;    /**< class code */
-  EipUint16 revision;     /**< class revision*/
-  EipUint16 max_instance; /**< largest instance number existing in the class */
-  EipUint16 number_of_instances;  /**< number of instances in the class (not
-                                     including instance 0) */
-  EipUint16 number_of_attributes; /**< number of attributes of each instance */
-  EipUint16 highest_attribute_number; /**< highest defined attribute number
-                                         (attribute numbers are not necessarily
-                                         consecutive) */
-  uint8_t* get_single_bit_mask;       /**< bit mask for GetAttributeSingle */
-  uint8_t* set_bit_mask;              /**< bit mask for SetAttributeSingle */
-  uint8_t* get_all_bit_mask;          /**< bit mask for GetAttributeAll */
-
-  EipUint16 number_of_services;        /**< number of services supported */
-  CipInstance* instances;              /**< pointer to the list of instances */
-  struct cip_service_struct* services; /**< pointer to the array of services */
-  char* class_name;                    /**< class name */
+  CipUdint class_code;     ///< class code
+  EipUint16 revision;      ///< class revision
+  EipUint16 max_instance;  ///< largest instance number existing in the class
+  EipUint16 number_of_instances;   ///< number of instances in the class (not
+                                   ///< including instance 0)
+  EipUint16 number_of_attributes;  ///< number of attributes of each instance
+  EipUint16 highest_attribute_number;  ///< highest defined attribute number
+                                       ///< (attribute numbers are not
+                                       ///< necessarily consecutive)
+  uint8_t* get_single_bit_mask;        ///< bit mask for GetAttributeSingle
+  uint8_t* set_bit_mask;               ///< bit mask for SetAttributeSingle
+  uint8_t* get_all_bit_mask;           ///< bit mask for GetAttributeAll
+
+  EipUint16 number_of_services;         ///< number of services supported
+  CipInstance* instances;               ///< pointer to the list of instances
+  struct cip_service_struct* services;  ///< pointer to the array of services
+  char* class_name;                     ///< class name
   /** Is called in GetAttributeSingle* before the response is assembled from
    * the object's attributes */
   CipGetSetCallback PreGetCallback;
@@ -418,7 +416,6 @@ typedef struct cip_class {
   CipCallback PreResetCallback;
   /** Is called in Reset service. */
   CipCallback PostResetCallback;
-
 } CipClass;
 
 /** @ingroup CIP_API
@@ -451,9 +448,9 @@ typedef EipStatus (*CipServiceFunction)(
 
 /** @brief Service descriptor. These are stored in an array */
 typedef struct cip_service_struct {
-  EipUint8 service_number;             /**< service number*/
-  CipServiceFunction service_function; /**< pointer to a function call*/
-  char* name;                          /**< name of the service */
+  EipUint8 service_number;              ///< service number
+  CipServiceFunction service_function;  ///< pointer to a function call
+  char* name;                           ///< name of the service
 } CipServiceStruct;
 
 /**
@@ -492,20 +489,4 @@ typedef struct {
   CipBool* conn_open_bits;
 } CipConnectionManagerConnectionEntryList;
 
-/* these are used for creating the getAttributeAll masks
-   TODO there might be a way simplifying this using __VARARGS__ in #define */
-#define MASK1(a) (1 << (a))
-#define MASK2(a, b) (1 << (a) | 1 << (b))
-#define MASK3(a, b, c) (1 << (a) | 1 << (b) | 1 << (c))
-#define MASK4(a, b, c, d) (1 << (a) | 1 << (b) | 1 << (c) | 1 << (d))
-#define MASK5(a, b, c, d, e) \
-  (1 << (a) | 1 << (b) | 1 << (c) | 1 << (d) | 1 << (e))
-#define MASK6(a, b, c, d, e, f) \
-  (1 << (a) | 1 << (b) | 1 << (c) | 1 << (d) | 1 << (e) | 1 << (f))
-#define MASK7(a, b, c, d, e, f, g) \
-  (1 << (a) | 1 << (b) | 1 << (c) | 1 << (d) | 1 << (e) | 1 << (f) | 1 << (g))
-#define MASK8(a, b, c, d, e, f, g, h)                                \
-  (1 << (a) | 1 << (b) | 1 << (c) | 1 << (d) | 1 << (e) | 1 << (f) | \
-   1 << (g) | 1 << (h))
-
-#endif /* OPENER_CIPTYPES_H_ */
+#endif  // CIP_CIPTYPES_H_

+ 1 - 1
source/src/trace.h → source/src/core/trace.h

@@ -6,7 +6,7 @@
 #ifndef OPENER_TRACE_H_
 #define OPENER_TRACE_H_
 
-/** @file trace.h
+/** @file "core/trace.h"
  * @brief Tracing infrastructure for OpENer
  */
 

+ 1 - 1
source/src/typedefs.h → source/src/core/typedefs.h

@@ -12,7 +12,7 @@
 
 #include "platform_network_includes.h"
 
-/** @file typedefs.h
+/** @file "core/typedefs.h"
    Do not use interface types for internal variables, such as "int i;", which is
    commonly used for loop counters or counting things.
 

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

@@ -7,8 +7,8 @@
 #define OPENER_CPF_H_
 
 #include "ciptypes.h"
+#include "core/typedefs.h"
 #include "encap.h"
-#include "typedefs.h"
 
 /** @ingroup ENCAP
  * @brief CPF is Common Packet Format

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

@@ -7,8 +7,8 @@
 #define OPENER_ENCAP_H_
 
 #include "cipconnectionobject.h"
+#include "core/typedefs.h"
 #include "generic_networkhandler.h"
-#include "typedefs.h"
 
 /** @file encap.h
  * @brief This file contains the public interface of the encapsulation layer

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

@@ -7,7 +7,7 @@
 #define OPENER_ENDIANCONV_H_
 
 #include "ciptypes.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 /** @file endianconv.h
  * @brief Responsible for Endianess conversion

+ 1 - 1
source/src/ports/MINGW/sample_application/ethlinkcbs.h

@@ -17,7 +17,7 @@
 /*                               INCLUDES                                    */
 /*---------------------------------------------------------------------------*/
 #include "ciptypes.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 /*---------------------------------------------------------------------------*/
 /*                             PROTOTYPES                                    */

+ 1 - 1
source/src/ports/MINGW/sample_application/opener_user_conf.h

@@ -22,7 +22,7 @@
  *    - inet_addr
  */
 
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 #ifdef OPENER_UNIT_TEST
 #include "test_assert.h"

+ 1 - 1
source/src/ports/POSIX/sample_application/ethlinkcbs.h

@@ -17,7 +17,7 @@
 /*                               INCLUDES                                    */
 /*---------------------------------------------------------------------------*/
 #include "ciptypes.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 /*---------------------------------------------------------------------------*/
 /*                             PROTOTYPES                                    */

+ 1 - 1
source/src/ports/POSIX/sample_application/opener_user_conf.h

@@ -27,7 +27,7 @@
 #include <sys/select.h>
 #include <sys/socket.h>
 
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 /** @brief Set this define if you have a CIP File capable device
  *

+ 1 - 1
source/src/ports/STM32/sample_application/ethlinkcbs.h

@@ -17,7 +17,7 @@
 /*                               INCLUDES                                    */
 /*---------------------------------------------------------------------------*/
 #include "ciptypes.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 /*---------------------------------------------------------------------------*/
 /*                             PROTOTYPES                                    */

+ 1 - 1
source/src/ports/STM32/sample_application/opener_user_conf.h

@@ -26,13 +26,13 @@
 #undef O_NONBLOCK /* in _default_fcntl.h defined as 0x4000, but lwip defines 1 \
                      in sockets.h */
 #include "FreeRTOS.h"
+#include "core/typedefs.h"
 #include "lwip/api.h"
 #include "lwip/apps/fs.h"
 #include "lwip/arch.h"
 #include "lwip/opt.h"
 #include "lwip/sockets.h"
 #include "task.h"
-#include "typedefs.h"
 
 /** @brief Set this define if you have a CIP File capable device
  *

+ 1 - 1
source/src/ports/WIN32/sample_application/ethlinkcbs.h

@@ -17,7 +17,7 @@
 /*                               INCLUDES                                    */
 /*---------------------------------------------------------------------------*/
 #include "ciptypes.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 /*---------------------------------------------------------------------------*/
 /*                             PROTOTYPES                                    */

+ 1 - 1
source/src/ports/WIN32/sample_application/opener_user_conf.h

@@ -26,7 +26,7 @@
 #include <ws2tcpip.h>
 typedef unsigned short in_port_t;
 
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 #ifdef OPENER_UNIT_TEST
 #include "test_assert.h"

+ 2 - 2
source/src/ports/generic_networkhandler.h

@@ -26,13 +26,13 @@
 #include "lwip/errno.h"
 #endif /* STM32 target */
 
+#include "api/opener_api.h"
 #include "appcontype.h"
 #include "cipconnectionmanager.h"
+#include "core/typedefs.h"
 #include "endianconv.h"
 #include "networkhandler.h"
-#include "opener_api.h"
 #include "socket_timer.h"
-#include "typedefs.h"
 
 /*The port to be used per default for I/O messages on UDP.*/
 extern const uint16_t kOpenerEipIoUdpPort;

+ 1 - 1
source/src/ports/networkhandler.h

@@ -6,7 +6,7 @@
 #ifndef OPENER_NETWORKHANDLER_H_
 #define OPENER_NETWORKHANDLER_H_
 
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 #define OPENER_SOCKET_WOULD_BLOCK EWOULDBLOCK
 

+ 1 - 1
source/src/ports/nvdata/conffile.h

@@ -14,7 +14,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 FILE* ConfFileOpen(const bool write, const char* const p_name);
 

+ 1 - 1
source/src/ports/nvdata/nvdata.h

@@ -14,7 +14,7 @@
 #define NVDATA_H_
 
 #include "ciptypes.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 EipStatus NvdataLoad(void);
 

+ 1 - 1
source/src/ports/nvdata/nvqos.h

@@ -12,7 +12,7 @@
 #define _NVQOS_H_
 
 #include "cipqos.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 int NvQosLoad(CipQosObject* p_qos);
 

+ 1 - 1
source/src/ports/nvdata/nvtcpip.h

@@ -12,7 +12,7 @@
 #define _NVTCPIP_H_
 
 #include "ciptcpipinterface.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
 
 int NvTcpipLoad(CipTcpIpObject* p_tcp_ip);
 

+ 2 - 2
source/src/ports/socket_timer.c

@@ -4,9 +4,9 @@
  *
  ******************************************************************************/
 
-#include "socket_timer.h"
+#include "ports/socket_timer.h"
 
-#include "trace.h"
+#include "core/trace.h"
 
 void SocketTimerSetSocket(SocketTimer* const socket_timer, const int socket) {
   socket_timer->socket = socket;

+ 1 - 1
source/src/ports/socket_timer.h

@@ -7,7 +7,7 @@
 #ifndef SRC_PORTS_SOCKET_TIMER_H_
 #define SRC_PORTS_SOCKET_TIMER_H_
 
-#include "typedefs.h"
+#include "core/" core / typedefs.h ""
 
 /** @brief Data structure to store last usage times for sockets
  *

+ 1 - 1
source/tests/callback_mock.cpp

@@ -6,7 +6,7 @@
 
 #include "CppUTestExt/MockSupport.h"
 extern "C" {
-#include "opener_api.h"
+#include "api/opener_api.h"
 }
 
 EipStatus ApplicationInitialization(void) {

+ 1 - 1
source/tests/cip/cipcommontests.cpp

@@ -12,8 +12,8 @@
 
 extern "C" {
 
+#include "api/opener_api.h"
 #include "cipstring.h"
-#include "opener_api.h"
 }
 
 ENIPMessage message; /**< Test variable holds ENIP message*/

+ 1 - 1
source/tests/cip/cipstringtests.cpp

@@ -11,8 +11,8 @@
 
 extern "C" {
 
+#include "api/opener_api.h"
 #include "cipstring.h"
-#include "opener_api.h"
 }
 
 TEST_GROUP(CipString){void setup(){mock().disable();