Răsfoiți Sursa

Fix undefined cast behavior and cpplint violations in cipconnectionobject.c

Signed-off-by: Martin Melik Merkumians <martin.melik@gmail.com>
Martin Melik Merkumians 1 lună în urmă
părinte
comite
2b8898b802
100 a modificat fișierele cu 2031 adăugiri și 2013 ștergeri
  1. 1 1
      .clang-format
  2. 29 0
      .cppcheck-config
  3. 1 1
      .github/workflows/WORKFLOWS.md
  4. 1 1
      AUTHORS
  5. 0 1
      ChangeLog.txt
  6. 1 1
      bin/mingw/setup_mingw.bat
  7. 1 1
      bin/posix/setup_posix.sh
  8. 1 1
      bin/posix/setup_posix_fuzz_afl.sh
  9. 0 1
      data/opener_sample_app.eds
  10. 1 1
      fuzz/scripts/send_testcase.py
  11. 31 32
      license.txt
  12. 0 1
      source/buildsupport/MINGW/OpENer_PLATFORM_INCLUDES.cmake
  13. 4 4
      source/buildsupport/OpENer_CIP_Object_generator.cmake
  14. 1 1
      source/buildsupport/OpENer_function_checks.cmake
  15. 0 1
      source/buildsupport/Toolchain/Toolchain-EABI-ARM-Generic.cmake
  16. 0 1
      source/buildsupport/WIN32/OpENer_PLATFORM_INCLUDES.cmake
  17. 22 22
      source/doc/STM32/LwIP_HTTP_Server_Netconn_RTOS_OpENer.patch
  18. 8 8
      source/doc/coding_rules/src/opener_coding_rules.tex
  19. 63 63
      source/opener.doxyfile.in
  20. 5 5
      source/src/cip/appcontype.h
  21. 31 31
      source/src/cip/cipassembly.c
  22. 2 2
      source/src/cip/cipassembly.h
  23. 8 8
      source/src/cip/cipclass3connection.c
  24. 4 4
      source/src/cip/cipclass3connection.h
  25. 228 228
      source/src/cip/cipcommon.c
  26. 44 44
      source/src/cip/cipcommon.h
  27. 182 182
      source/src/cip/cipconnectionmanager.c
  28. 7 7
      source/src/cip/cipconnectionmanager.h
  29. 109 109
      source/src/cip/cipconnectionobject.c
  30. 78 78
      source/src/cip/cipconnectionobject.h
  31. 14 14
      source/src/cip/cipdlr.c
  32. 19 19
      source/src/cip/cipelectronickey.c
  33. 21 21
      source/src/cip/cipelectronickey.h
  34. 33 33
      source/src/cip/cipepath.c
  35. 29 29
      source/src/cip/cipepath.h
  36. 34 34
      source/src/cip/cipethernetlink.c
  37. 1 1
      source/src/cip/cipethernetlink.h
  38. 26 26
      source/src/cip/cipidentity.c
  39. 71 72
      source/src/cip/cipioconnection.c
  40. 5 5
      source/src/cip/cipioconnection.h
  41. 46 46
      source/src/cip/cipmessagerouter.c
  42. 4 4
      source/src/cip/cipmessagerouter.h
  43. 15 15
      source/src/cip/cipqos.c
  44. 34 34
      source/src/cip/cipstring.c
  45. 26 26
      source/src/cip/cipstring.h
  46. 61 61
      source/src/cip/cipstringi.c
  47. 6 6
      source/src/cip/cipstringi.h
  48. 43 45
      source/src/cip/ciptcpipinterface.c
  49. 2 2
      source/src/cip/ciptcpipinterface.h
  50. 2 2
      source/src/cip/ciptypes.c
  51. 38 38
      source/src/cip/ciptypes.h
  52. 57 57
      source/src/enet_encap/cpf.c
  53. 14 14
      source/src/enet_encap/cpf.h
  54. 78 78
      source/src/enet_encap/encap.c
  55. 23 23
      source/src/enet_encap/encap.h
  56. 31 31
      source/src/enet_encap/endianconv.c
  57. 19 19
      source/src/enet_encap/endianconv.h
  58. 143 143
      source/src/opener_api.h
  59. 0 1
      source/src/ports/CMakeLists.txt
  60. 1 1
      source/src/ports/MINGW/main.c
  61. 23 23
      source/src/ports/MINGW/networkconfig.c
  62. 3 3
      source/src/ports/MINGW/opener_error.c
  63. 1 1
      source/src/ports/MINGW/platform_network_includes.h
  64. 6 6
      source/src/ports/MINGW/sample_application/ethlinkcbs.c
  65. 4 4
      source/src/ports/MINGW/sample_application/ethlinkcbs.h
  66. 7 7
      source/src/ports/MINGW/sample_application/sampleapplication.c
  67. 4 4
      source/src/ports/POSIX/main.c
  68. 25 25
      source/src/ports/POSIX/networkconfig.c
  69. 1 1
      source/src/ports/POSIX/networkhandler.c
  70. 3 3
      source/src/ports/POSIX/opener_error.c
  71. 6 6
      source/src/ports/POSIX/sample_application/ethlinkcbs.c
  72. 4 4
      source/src/ports/POSIX/sample_application/ethlinkcbs.h
  73. 7 7
      source/src/ports/POSIX/sample_application/sampleapplication.c
  74. 7 7
      source/src/ports/STM32/networkconfig.c
  75. 1 1
      source/src/ports/STM32/networkhandler.c
  76. 4 4
      source/src/ports/STM32/opener.c
  77. 1 1
      source/src/ports/STM32/opener.h
  78. 3 3
      source/src/ports/STM32/opener_error.c
  79. 6 6
      source/src/ports/STM32/sample_application/ethlinkcbs.c
  80. 4 4
      source/src/ports/STM32/sample_application/ethlinkcbs.h
  81. 7 7
      source/src/ports/STM32/sample_application/sampleapplication.c
  82. 1 1
      source/src/ports/WIN32/main.c
  83. 24 24
      source/src/ports/WIN32/networkconfig.c
  84. 3 3
      source/src/ports/WIN32/opener_error.c
  85. 1 1
      source/src/ports/WIN32/platform_network_includes.h
  86. 6 6
      source/src/ports/WIN32/sample_application/ethlinkcbs.c
  87. 4 4
      source/src/ports/WIN32/sample_application/ethlinkcbs.h
  88. 7 7
      source/src/ports/WIN32/sample_application/sampleapplication.c
  89. 3 3
      source/src/ports/devicedata.h.in
  90. 64 64
      source/src/ports/generic_networkhandler.c
  91. 0 1
      source/src/ports/nvdata/CMakeLists.txt
  92. 8 8
      source/src/ports/nvdata/conffile.c
  93. 2 2
      source/src/ports/nvdata/conffile.h
  94. 4 4
      source/src/ports/nvdata/nvdata.c
  95. 4 4
      source/src/ports/nvdata/nvdata.h
  96. 4 4
      source/src/ports/nvdata/nvqos.c
  97. 2 2
      source/src/ports/nvdata/nvqos.h
  98. 4 4
      source/src/ports/nvdata/nvtcpip.c
  99. 2 2
      source/src/ports/nvdata/nvtcpip.h
  100. 2 2
      source/src/ports/opener_error.h

+ 1 - 1
.clang-format

@@ -71,4 +71,4 @@ BreakBeforeBraces: Attach
 IndentAccessModifiers: false
 AccessModifierOffset: -1
 
-DisableFormat: false
+DisableFormat: false

+ 29 - 0
.cppcheck-config

@@ -0,0 +1,29 @@
+# cppcheck configuration for OpENer
+#
+# This file documents the cppcheck settings used in the project.
+# cppcheck does not have a native config file format, but these settings
+# are applied via command-line arguments in:
+#   - .pre-commit-config.yaml (for pre-commit hook)
+#   - .mega-linter.yml (for CI/CD)
+#
+# Settings:
+# --------
+# Standard Analysis:
+#   --enable=all              Enable all checks
+#   --inconclusive            Include inconclusive warnings
+#   --force                   Force checking of all configurations
+#   --inline-suppr            Enable inline suppressions (// cppcheck-suppress)
+#   --suppress=missingIncludeSystem   Suppress system header warnings
+#   --suppress=normalCheckLevelMaxBranches  Suppress informational messages
+#
+# Exhaustive Analysis (CI only):
+#   --check-level=exhaustive  Enable all checks
+#   --enable=warning,style,performance,portability
+#   --std=c99                 Use C99 standard
+#   --platform=unix64         Target 64-bit POSIX platform
+#
+# References:
+#   - Pre-commit hook: .pre-commit-config.yaml (lines 28-36)
+#   - CI standard checks: .github/workflows/ci.yml (line 41)
+#   - CI exhaustive checks: .github/workflows/exhaustive-analysis.yml (lines 50-54)
+#   - MegaLinter config: .mega-linter.yml (line 13)

+ 1 - 1
.github/workflows/WORKFLOWS.md

@@ -178,4 +178,4 @@ gh run download <run-id>
 
 ---
 
-*Last updated: December 2025*
+*Last updated: December 2025*

+ 1 - 1
AUTHORS

@@ -1,4 +1,4 @@
 Kurt Schweiger
 Rene Smodic
 Alois Zoitl
-Jonathan Engdahl
+Jonathan Engdahl

+ 0 - 1
ChangeLog.txt

@@ -387,4 +387,3 @@
 
 	* : initial import
 	* :
-

+ 1 - 1
bin/mingw/setup_mingw.bat

@@ -1 +1 @@
-cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="C:/Program Files (x86)/OpENer" -DOpENer_PLATFORM:STRING="MINGW"  ../../source
+cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="C:/Program Files (x86)/OpENer" -DOpENer_PLATFORM:STRING="MINGW"  ../../source

+ 1 - 1
bin/posix/setup_posix.sh

@@ -1,2 +1,2 @@
+#!/bin/bash
 cmake -DCMAKE_C_COMPILER=gcc -DOpENer_PLATFORM:STRING="POSIX" -DCMAKE_BUILD_TYPE:STRING="" -DBUILD_SHARED_LIBS:BOOL=OFF ../../source
-

+ 1 - 1
bin/posix/setup_posix_fuzz_afl.sh

@@ -1,2 +1,2 @@
+#!/bin/bash
 cmake -DCMAKE_C_COMPILER=afl-clang-fast -DUSE_FUZZ_AFL=ON -DOpENer_PLATFORM:STRING="POSIX" -DCMAKE_BUILD_TYPE:STRING="" -DBUILD_SHARED_LIBS:BOOL=OFF ../../source
-

+ 0 - 1
data/opener_sample_app.eds

@@ -356,4 +356,3 @@ $ EZ-EDS Version 3.23.1.20171205 Generated Electronic Data Sheet
         MaxInst = 1;
         Number_Of_Static_Instances = 1;
         Max_Number_Of_Dynamic_Instances = 0;
-

+ 1 - 1
fuzz/scripts/send_testcase.py

@@ -35,4 +35,4 @@ testcase += ENIP_SESSION_CONTEXT 	# session context
 testcase += testcase_data[20:]		# options and payload
 print("[-] Sending testcase of {} bytes".format(len(testcase)))
 s.send(testcase)
-s.close()
+s.close()

+ 31 - 32
license.txt

@@ -1,55 +1,54 @@
-                    SOFTWARE DISTRIBUTION LICENSE FOR THE 
-                     ETHERNET/IP(TM) COMMUNICATION STACK 
-                         (ADAPTED BSD STYLE LICENSE)   
+                    SOFTWARE DISTRIBUTION LICENSE FOR THE
+                     ETHERNET/IP(TM) COMMUNICATION STACK
+                         (ADAPTED BSD STYLE LICENSE)
 
 Copyright (c) 2009, Rockwell Automation, Inc. ALL RIGHTS RESERVED.
 EtherNet/IP is a trademark of ODVA, Inc.
 
-Redistribution of the Communications Stack Software for EtherNet/IP and use in 
-source and binary forms, with or without modification, are permitted provided 
+Redistribution of the Communications Stack Software for EtherNet/IP and use in
+source and binary forms, with or without modification, are permitted provided
 that the following conditions are met:
 
-Redistributions of source code must retain the above copyright and trademark 
-notices, this list of conditions and the following disclaimer in the 
+Redistributions of source code must retain the above copyright and trademark
+notices, this list of conditions and the following disclaimer in the
 documentation and/or other materials provided with the distribution.
 
 Redistributions in binary form must reproduce the above copyright notice, this
-list of conditions and the following disclaimer in the documentation and/or 
+list of conditions and the following disclaimer in the documentation and/or
 other materials provided with the distribution.
 
-Neither the name of Rockwell Automation, ODVA, nor the names of its 
-contributors may be used to endorse or promote products derived from this 
+Neither the name of Rockwell Automation, ODVA, nor the names of its
+contributors may be used to endorse or promote products derived from this
 software without specific prior written permission from the respective owners.
 
 The Communications Stack Software for EtherNet/IP, or any portion thereof, with
 or without modifications, may be incorporated into products for sale.  However,
-the software does not, by itself, convey any right to make, have made, use, 
-import, offer to sell, sell, lease, market, or otherwise distribute or dispose 
-of any products that implement this software, which products might be covered 
-by valid patents or copyrights of ODVA, Inc., its members or other licensors 
-nor does this software result in any license to use the EtherNet/IP mark owned 
-by ODVA. To make, have made, use, import, offer to sell, sell, lease, market, 
-or otherwise distribute or dispose of any products that implement this software, 
-and to use the EtherNet/IP mark, one must obtain the necessary license from 
-ODVA through its Terms of Usage Agreement for the EtherNet/IP technology, 
-available through the ODVA web site at www.odva.org. This license requirement 
-applies equally (a) to devices that completely implement ODVA's Final 
-Specification for EtherNet/IP (“Network Devices”), (b) to components of such 
-Network Devices to the extent they implement portions of the Final 
+the software does not, by itself, convey any right to make, have made, use,
+import, offer to sell, sell, lease, market, or otherwise distribute or dispose
+of any products that implement this software, which products might be covered
+by valid patents or copyrights of ODVA, Inc., its members or other licensors
+nor does this software result in any license to use the EtherNet/IP mark owned
+by ODVA. To make, have made, use, import, offer to sell, sell, lease, market,
+or otherwise distribute or dispose of any products that implement this software,
+and to use the EtherNet/IP mark, one must obtain the necessary license from
+ODVA through its Terms of Usage Agreement for the EtherNet/IP technology,
+available through the ODVA web site at www.odva.org. This license requirement
+applies equally (a) to devices that completely implement ODVA's Final
+Specification for EtherNet/IP (“Network Devices”), (b) to components of such
+Network Devices to the extent they implement portions of the Final
 Specification for EtherNet/IP, and (c) to enabling technology products, such as
-any other EtherNet/IP or other network protocol stack designed for use in 
-Network Devices to the extent they implement portions of the Final 
+any other EtherNet/IP or other network protocol stack designed for use in
+Network Devices to the extent they implement portions of the Final
 Specification for EtherNet/IP. Persons or entities who are not already licensed
 for the EtherNet/IP technology must contact ODVA for a Terms of Usage Agreement.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-

+ 0 - 1
source/buildsupport/MINGW/OpENer_PLATFORM_INCLUDES.cmake

@@ -2,4 +2,3 @@ macro(opener_platform_spec)
   include_directories(${PORTS_SRC_DIR}/${OpENer_PLATFORM} ${PORTS_SRC_DIR}/${OpENer_PLATFORM}/sample_application )
   set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRESTRICT=__restrict -DWIN32 -D_WIN32_WINNT=_WIN32_WINNT_VISTA" )
 endmacro(opener_platform_spec)
-

+ 4 - 4
source/buildsupport/OpENer_CIP_Object_generator.cmake

@@ -19,11 +19,11 @@ FOREACH(CIP_OBJECT ${CIP_OBJECT_LIST})
 ENDFOREACH(CIP_OBJECT)
 
 file(WRITE ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists_new.txt ${WRITE_FILE})
-  
-execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists_new.txt ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists.txt RESULT_VARIABLE test_not_successful OUTPUT_QUIET ERROR_QUIET )  
+
+execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists_new.txt ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists.txt RESULT_VARIABLE test_not_successful OUTPUT_QUIET ERROR_QUIET )
 
 IF(test_not_successful)
   file(REMOVE ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists.txt)
   file(RENAME ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists_new.txt ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists.txt)
-ENDIF( test_not_successful)  
-file(REMOVE ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists_new.txt) 
+ENDIF( test_not_successful)
+file(REMOVE ${CMAKE_BINARY_DIR}/cip_objects/CMakeLists_new.txt)

+ 1 - 1
source/buildsupport/OpENer_function_checks.cmake

@@ -8,5 +8,5 @@ check_function_exists( srand HAVE_SRAND )
 check_function_exists( rand HAVE_RAND )
 
 if( (NOT(HAVE_SRAND)) OR (NOT(HAVE_RAND)) )
-  
+
 endif( (NOT(HAVE_SRAND)) OR (NOT(HAVE_RAND)) )

+ 0 - 1
source/buildsupport/Toolchain/Toolchain-EABI-ARM-Generic.cmake

@@ -67,4 +67,3 @@ endif ()
 string(REGEX REPLACE ";" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
 
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "")
-

+ 0 - 1
source/buildsupport/WIN32/OpENer_PLATFORM_INCLUDES.cmake

@@ -2,4 +2,3 @@ macro(opener_platform_spec)
   include_directories(${PORTS_SRC_DIR}/${OpENer_PLATFORM} ${PORTS_SRC_DIR}/${OpENer_PLATFORM}/sample_application )
   set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRESTRICT=__restrict -DWIN32" )
 endmacro(opener_platform_spec)
-

+ 22 - 22
source/doc/STM32/LwIP_HTTP_Server_Netconn_RTOS_OpENer.patch

@@ -10,22 +10,22 @@ index ef9dbfa..6a8c593 100644
 +/* MEMP_NUM_NETCONN: the number of struct netconns.
 +   (only needed if you use the sequential API, like api_lib.c) */
 +#define MEMP_NUM_NETCONN        12
- 
+
  /* ---------- Pbuf options ---------- */
  /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
 @@ -94,6 +96,8 @@ a lot of data that needs to be copied, this should be set high. */
  /* ---------- ICMP options ---------- */
  #define LWIP_ICMP                       1
- 
+
 +/* ---------- IGMP options ---------- */
 +#define LWIP_IGMP               1
- 
+
  /* ---------- DHCP options ---------- */
  #define LWIP_DHCP               1
 @@ -113,6 +117,9 @@ a lot of data that needs to be copied, this should be set high. */
   */
  #define LWIP_NETIF_LINK_CALLBACK        1
- 
+
 +/* ---------- Netif options ---------- */
 +#define LWIP_NETIF_HOSTNAME             1
 +
@@ -42,7 +42,7 @@ index ef9dbfa..6a8c593 100644
 + * SO_REUSE==1: Enable SO_REUSEADDR option.
 + */
 +#define SO_REUSE                        1
- 
+
  /*
     ------------------------------------
 diff --git a/Inc/main.h b/Inc/main.h
@@ -50,13 +50,13 @@ index 36ca85f..fb7961c 100644
 --- a/Inc/main.h
 +++ b/Inc/main.h
 @@ -31,7 +31,7 @@
- 
+
  /* Exported types ------------------------------------------------------------*/
- /* Exported constants --------------------------------------------------------*/ 
+ /* Exported constants --------------------------------------------------------*/
 -#define USE_DHCP       /* enable DHCP, if disabled static address is used*/
 +//#define USE_DHCP      // not used, replaced by LWIP_DHCP
  #define USE_LCD
- 
+
  /*Static IP ADDRESS*/
 diff --git a/SW4STM32/syscalls.c b/SW4STM32/syscalls.c
 index fa8687f..6a84edb 100644
@@ -68,13 +68,13 @@ index fa8687f..6a84edb 100644
  #include <sys/wait.h>
 -
 +#include <stm32f7xx_hal.h>
- 
- 
+
+
  #define FreeRTOS
 @@ -99,6 +99,15 @@ void _exit (int status)
  	while (1) {}
  }
- 
+
 +#if REDIRECT_PRINTF_TO_SWV_ITM
 +__attribute__((weak)) int _write(int file, char *ptr, int len) {
 +  int DataIdx;
@@ -92,7 +92,7 @@ index fa8687f..6a84edb 100644
  	return len;
  }
 +#endif	// standard output
- 
+
  int _close(int file)
  {
 diff --git a/Src/app_ethernet.c b/Src/app_ethernet.c
@@ -102,7 +102,7 @@ index e3278ac..aab6265 100644
 @@ -28,6 +28,9 @@
  #include "lcd_log.h"
  #endif
- 
+
 +// for OpENer
 +#include "opener.h"
 +
@@ -142,31 +142,31 @@ index c25dbd0..e3dda6c 100644
 +++ b/Src/main.c
 @@ -71,6 +71,11 @@ int main(void)
    /* Configure the system clock to 200 MHz */
-   SystemClock_Config(); 
-   
+   SystemClock_Config();
+
 +  /* For single step debug, e.g. timers with interrupts need to be stopped in Halt */
 +  HAL_DBGMCU_EnableDBGStandbyMode();
 +  HAL_DBGMCU_EnableDBGStopMode();
 +  __HAL_DBGMCU_FREEZE_TIM6();
-+  
++
    /* Initialize LCD and LEDs */
    BSP_Config();
- 
+
 @@ -139,6 +144,8 @@ static void Netif_Config(void)
- 
+
    /*  Registers the default network interface. */
    netif_set_default(&gnetif);
 +  /*  Define the hostname, is also used by OpENer */
 +  netif_set_hostname(&gnetif,"STM32");
- 
+
    ethernet_link_status_updated(&gnetif);
- 
+
 @@ -180,7 +187,7 @@ static void BSP_Config(void)
    LCD_LOG_Init();
-   
+
    /* Show Header and Footer texts */
 -  LCD_LOG_SetHeader((uint8_t *)"Webserver Application Netconn API");
 +  LCD_LOG_SetHeader((uint8_t *)"Webserver Application Netconn API & OpENer");
    LCD_LOG_SetFooter((uint8_t *)"STM32746G-DISCO board");
-   
+
    LCD_UsrLog ((char *)"  State: Ethernet Initialization ...\n");

+ 8 - 8
source/doc/coding_rules/src/opener_coding_rules.tex

@@ -2,7 +2,7 @@
 \usepackage[latin1]{inputenc}
 \usepackage[T1]{fontenc}
 
-\usepackage{a4wide} 
+\usepackage{a4wide}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%   important definitions at the beginning
@@ -60,7 +60,7 @@ This document describes the coding rules, which has to be used in the OpENer pro
 As the OpENer code style aims to be as close as possible to the established Google C++ code style, please file an issue if anything in this guide contradicts the Google C++ code style.
 
 \section{Comments}
-A sufficient amount of comments has to be written. There are never too many comments, whereas invalid comments are worse than none --- thus invalid comments have to be removed from the source code. Comments have to be written in English. 
+A sufficient amount of comments has to be written. There are never too many comments, whereas invalid comments are worse than none --- thus invalid comments have to be removed from the source code. Comments have to be written in English.
 
 
 Comments for function, structure, \ldots~ definitions have to follow the conventions of \emph{Doxygen} to allow the automated generation of documentation for the source code. Hereby Java-style Doxygen comments shall be used. Doxygen comments shall therefore start with slash and two starts, and use the @ symbol to indicate Doxygen keywords. For enums, variables, and strucutres inline documentation with \emph{/**<} shall be used. Autobrief behavior shall not be assumed for Doxygen comments. See the example below.
@@ -87,13 +87,13 @@ Every source-file must contain a fileheader as follows:
 \begin{lstlisting}[frame=trbl]{}
 /*******************************************************************************
  * Copyright (c) 2009, Rockwell Automation, Inc.
- * All rights reserved. 
+ * All rights reserved.
  *
  * Contributors:
  *     <date>: <author>, <author email> - changes
  ******************************************************************************/
 \end{lstlisting}
-Each author needs to explain his changes in the code. 
+Each author needs to explain his changes in the code.
 \subsection{Revision History}
 %To track changes in the source files every new file version must contain it's version information in the following form:
 %\begin{center}
@@ -112,9 +112,9 @@ The following Keywords should be used in the source code to mark special comment
 \section{Datatypes}
 \Fref{tab:datatypes} contains the definitions of important standard datatypes. This is done to ensure a machine independant defintion of the bit-width of the standard data types. For \emph{OpENer}-development these definitions are in the file: \verb|src/typedefs.h|
 
-\begin{table}[h] 
+\begin{table}[h]
 \caption{Data types used in OpENer} \label{tab:datatypes}
-	\centering 
+	\centering
 		\begin{tabular}{lll}
 			defined data type	& bit-width / description & used C-datatype \\
 			\hline
@@ -130,7 +130,7 @@ The following Keywords should be used in the source code to mark special comment
 			EipFloat	&	single precission IEEE float (32 bit) &	float	 \\
 			EipDfloat	&	double precission IEEE float (64 bit) &	double	\\
 			EipBool8	&	byte variable as boolean value	&	unit8\_t	 \\
-			
+
 			CipOctet & unspecified type & uint8\_t \\
 			CipBool & byte variable as boolean value & uint8\_t \\
 			CipByte & 8 bit unsigned & uint8\_t \\
@@ -149,7 +149,7 @@ The following Keywords should be used in the source code to mark special comment
 			CipUlint & 64 bit unsigned & uint64\_t \\
 			CipLword & 64 bit unsigned & uint64\_t
 		\end{tabular}
-\end{table} 
+\end{table}
 
 These data types shall only be used when the bit size is important for the correct operation of the code, whereby Eip-prefixed data types shall be used for communication functions, and Cip-prefixed data types shall be used for CIP related functions and objects. If not we advice to use the type \verb|int| or \verb|unsigned int| for most variables, as this is the most efficient data type and can lead on some platforms (e.g., ARM) even to smaller code size.
 

+ 63 - 63
source/opener.doxyfile.in

@@ -44,14 +44,14 @@ PROJECT_NUMBER         = @OpENer_Device_Major_Version@.@OpENer_Device_Minor_Vers
 # for a project that appears at the top of each page and should give viewer a
 # quick idea about the purpose of the project. Keep the description short.
 
-PROJECT_BRIEF          = 
+PROJECT_BRIEF          =
 
 # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
 # in the documentation. The maximum height of the logo should not exceed 55
 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
 # the logo to the output directory.
 
-PROJECT_LOGO           = 
+PROJECT_LOGO           =
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
 # into which the generated documentation will be written. If a relative path is
@@ -118,7 +118,7 @@ REPEAT_BRIEF           = YES
 # the entity):The $name class, The $name widget, The $name file, is, provides,
 # specifies, contains, represents, a, an and the.
 
-ABBREVIATE_BRIEF       = 
+ABBREVIATE_BRIEF       =
 
 # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
 # doxygen will generate a detailed section even if there is only a brief
@@ -161,7 +161,7 @@ STRIP_FROM_PATH        = @OpENer_SOURCE_DIR@/../..
 # specify the list of include paths that are normally passed to the compiler
 # using the -I flag.
 
-STRIP_FROM_INC_PATH    = 
+STRIP_FROM_INC_PATH    =
 
 # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
 # less readable) file names. This can be useful is your file systems doesn't
@@ -228,13 +228,13 @@ TAB_SIZE               = 8
 # "Side Effects:". You can put \n's in the value part of an alias to insert
 # newlines.
 
-ALIASES                = 
+ALIASES                =
 
 # This tag can be used to specify a number of word-keyword mappings (TCL only).
 # A mapping has the form "name=value". For example adding "class=itcl::class"
 # will allow you to use the command class in the itcl::class meaning.
 
-TCL_SUBST              = 
+TCL_SUBST              =
 
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
 # only. Doxygen will then generate output that is more tailored for C. For
@@ -281,7 +281,7 @@ OPTIMIZE_OUTPUT_VHDL   = NO
 # Note that for custom extensions you also need to set FILE_PATTERNS otherwise
 # the files are not read by doxygen.
 
-EXTENSION_MAPPING      = 
+EXTENSION_MAPPING      =
 
 # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
 # according to the Markdown format, which allows for more readable
@@ -622,7 +622,7 @@ GENERATE_DEPRECATEDLIST= YES
 # sections, marked by \if <section_label> ... \endif and \cond <section_label>
 # ... \endcond blocks.
 
-ENABLED_SECTIONS       = 
+ENABLED_SECTIONS       =
 
 # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
 # initial value of a variable or macro / define can have for it to appear in the
@@ -664,7 +664,7 @@ SHOW_NAMESPACES        = YES
 # by doxygen. Whatever the program writes to standard output is used as the file
 # version. For an example see the documentation.
 
-FILE_VERSION_FILTER    = 
+FILE_VERSION_FILTER    =
 
 # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
 # by doxygen. The layout file controls the global structure of the generated
@@ -677,7 +677,7 @@ FILE_VERSION_FILTER    =
 # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
 # tag is left empty.
 
-LAYOUT_FILE            = 
+LAYOUT_FILE            =
 
 # The CITE_BIB_FILES tag can be used to specify one or more bib files containing
 # the reference definitions. This must be a list of .bib files. The .bib
@@ -746,7 +746,7 @@ WARN_FORMAT            = "$file:$line: $text"
 # messages should be written. If left blank the output is written to standard
 # error (stderr).
 
-WARN_LOGFILE           = 
+WARN_LOGFILE           =
 
 #---------------------------------------------------------------------------
 # Configuration options related to the input files
@@ -778,7 +778,7 @@ INPUT_ENCODING         = UTF-8
 # *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
 # *.qsf, *.as and *.js.
 
-FILE_PATTERNS          = 
+FILE_PATTERNS          =
 
 # The RECURSIVE tag can be used to specify whether or not subdirectories should
 # be searched for input files as well.
@@ -820,7 +820,7 @@ EXCLUDE_PATTERNS       = */.deps @OpENer_EXCLUDE_PATTERNS@
 # Note that the wildcards are matched against the file with absolute path, so to
 # exclude all test directories use the pattern */test/*
 
-EXCLUDE_SYMBOLS        = 
+EXCLUDE_SYMBOLS        =
 
 # The EXAMPLE_PATH tag can be used to specify one or more files or directories
 # that contain example code fragments that are included (see the \include
@@ -833,7 +833,7 @@ EXAMPLE_PATH           = @OpENer_SOURCE_DIR@
 # *.h) to filter out the source-files in the directories. If left blank all
 # files are included.
 
-EXAMPLE_PATTERNS       = 
+EXAMPLE_PATTERNS       =
 
 # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
 # searched for input files to be used with the \include or \dontinclude commands
@@ -846,7 +846,7 @@ EXAMPLE_RECURSIVE      = NO
 # that contain images that are to be included in the documentation (see the
 # \image command).
 
-IMAGE_PATH             = 
+IMAGE_PATH             =
 
 # The INPUT_FILTER tag can be used to specify a program that doxygen should
 # invoke to filter for each input file. Doxygen will invoke the filter program
@@ -863,7 +863,7 @@ IMAGE_PATH             =
 # code is scanned, but not when the output code is generated. If lines are added
 # or removed, the anchors will not be placed correctly.
 
-INPUT_FILTER           = 
+INPUT_FILTER           =
 
 # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
 # basis. Doxygen will compare the file name with each pattern and apply the
@@ -872,7 +872,7 @@ INPUT_FILTER           =
 # filters are used. If the FILTER_PATTERNS tag is empty or if none of the
 # patterns match the file name, INPUT_FILTER is applied.
 
-FILTER_PATTERNS        = 
+FILTER_PATTERNS        =
 
 # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
 # INPUT_FILTER) will also be used to filter the input files that are used for
@@ -887,14 +887,14 @@ FILTER_SOURCE_FILES    = NO
 # *.ext= (so without naming a filter).
 # This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
 
-FILTER_SOURCE_PATTERNS = 
+FILTER_SOURCE_PATTERNS =
 
 # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
 # is part of the input, its contents will be placed on the main page
 # (index.html). This can be useful if you have a project on for instance GitHub
 # and want to reuse the introduction page also for the doxygen output.
 
-USE_MDFILE_AS_MAINPAGE = 
+USE_MDFILE_AS_MAINPAGE =
 
 #---------------------------------------------------------------------------
 # Configuration options related to source browsing
@@ -999,7 +999,7 @@ CLANG_ASSISTED_PARSING = NO
 # specified with INPUT and INCLUDE_PATH.
 # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
 
-CLANG_OPTIONS          = 
+CLANG_OPTIONS          =
 
 #---------------------------------------------------------------------------
 # Configuration options related to the alphabetical class index
@@ -1025,7 +1025,7 @@ COLS_IN_ALPHA_INDEX    = 5
 # while generating the index headers.
 # This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
 
-IGNORE_PREFIX          = 
+IGNORE_PREFIX          =
 
 #---------------------------------------------------------------------------
 # Configuration options related to the HTML output
@@ -1069,7 +1069,7 @@ HTML_FILE_EXTENSION    = .html
 # of the possible markers and block names see the documentation.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
-HTML_HEADER            = 
+HTML_HEADER            =
 
 # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
 # generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1079,7 +1079,7 @@ HTML_HEADER            =
 # that doxygen normally uses.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
-HTML_FOOTER            = 
+HTML_FOOTER            =
 
 # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
 # sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1091,7 +1091,7 @@ HTML_FOOTER            =
 # obsolete.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
-HTML_STYLESHEET        = 
+HTML_STYLESHEET        =
 
 # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
 # cascading style sheets that are included after the standard style sheets
@@ -1104,7 +1104,7 @@ HTML_STYLESHEET        =
 # list). For an example see the documentation.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
-HTML_EXTRA_STYLESHEET  = 
+HTML_EXTRA_STYLESHEET  =
 
 # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
 # other source files which should be copied to the HTML output directory. Note
@@ -1114,7 +1114,7 @@ HTML_EXTRA_STYLESHEET  =
 # files will be copied as-is; there are no commands or markers available.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
-HTML_EXTRA_FILES       = 
+HTML_EXTRA_FILES       =
 
 # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
 # will adjust the colors in the style sheet and background images according to
@@ -1242,7 +1242,7 @@ GENERATE_HTMLHELP      = NO
 # written to the html output directory.
 # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
-CHM_FILE               = 
+CHM_FILE               =
 
 # The HHC_LOCATION tag can be used to specify the location (absolute path
 # including file name) of the HTML help compiler (hhc.exe). If non-empty,
@@ -1250,7 +1250,7 @@ CHM_FILE               =
 # The file has to be specified with full path.
 # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
-HHC_LOCATION           = 
+HHC_LOCATION           =
 
 # The GENERATE_CHI flag controls if a separate .chi index file is generated
 # (YES) or that it should be included in the master .chm file (NO).
@@ -1263,7 +1263,7 @@ GENERATE_CHI           = NO
 # and project file content.
 # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
-CHM_INDEX_ENCODING     = 
+CHM_INDEX_ENCODING     =
 
 # The BINARY_TOC flag controls whether a binary table of contents is generated
 # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
@@ -1294,7 +1294,7 @@ GENERATE_QHP           = NO
 # the HTML output folder.
 # This tag requires that the tag GENERATE_QHP is set to YES.
 
-QCH_FILE               = 
+QCH_FILE               =
 
 # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
 # Project output. For more information please see Qt Help Project / Namespace
@@ -1319,7 +1319,7 @@ QHP_VIRTUAL_FOLDER     = doc
 # filters).
 # This tag requires that the tag GENERATE_QHP is set to YES.
 
-QHP_CUST_FILTER_NAME   = 
+QHP_CUST_FILTER_NAME   =
 
 # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
 # custom filter to add. For more information please see Qt Help Project / Custom
@@ -1327,21 +1327,21 @@ QHP_CUST_FILTER_NAME   =
 # filters).
 # This tag requires that the tag GENERATE_QHP is set to YES.
 
-QHP_CUST_FILTER_ATTRS  = 
+QHP_CUST_FILTER_ATTRS  =
 
 # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
 # project's filter section matches. Qt Help Project / Filter Attributes (see:
 # http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
 # This tag requires that the tag GENERATE_QHP is set to YES.
 
-QHP_SECT_FILTER_ATTRS  = 
+QHP_SECT_FILTER_ATTRS  =
 
 # The QHG_LOCATION tag can be used to specify the location of Qt's
 # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
 # generated .qhp file.
 # This tag requires that the tag GENERATE_QHP is set to YES.
 
-QHG_LOCATION           = 
+QHG_LOCATION           =
 
 # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
 # generated, together with the HTML files, they form an Eclipse help plugin. To
@@ -1474,7 +1474,7 @@ MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
 # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
 # This tag requires that the tag USE_MATHJAX is set to YES.
 
-MATHJAX_EXTENSIONS     = 
+MATHJAX_EXTENSIONS     =
 
 # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
 # of code that will be used on startup of the MathJax code. See the MathJax site
@@ -1482,7 +1482,7 @@ MATHJAX_EXTENSIONS     =
 # example see the documentation.
 # This tag requires that the tag USE_MATHJAX is set to YES.
 
-MATHJAX_CODEFILE       = 
+MATHJAX_CODEFILE       =
 
 # When the SEARCHENGINE tag is enabled doxygen will generate a search box for
 # the HTML output. The underlying search engine uses javascript and DHTML and
@@ -1542,7 +1542,7 @@ EXTERNAL_SEARCH        = NO
 # Searching" for details.
 # This tag requires that the tag SEARCHENGINE is set to YES.
 
-SEARCHENGINE_URL       = 
+SEARCHENGINE_URL       =
 
 # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
 # search data is written to a file for indexing by an external tool. With the
@@ -1558,7 +1558,7 @@ SEARCHDATA_FILE        = searchdata.xml
 # projects and redirect the results back to the right project.
 # This tag requires that the tag SEARCHENGINE is set to YES.
 
-EXTERNAL_SEARCH_ID     = 
+EXTERNAL_SEARCH_ID     =
 
 # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
 # projects other than the one defined by this configuration file, but that are
@@ -1568,7 +1568,7 @@ EXTERNAL_SEARCH_ID     =
 # EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
 # This tag requires that the tag SEARCHENGINE is set to YES.
 
-EXTRA_SEARCH_MAPPINGS  = 
+EXTRA_SEARCH_MAPPINGS  =
 
 #---------------------------------------------------------------------------
 # Configuration options related to the LaTeX output
@@ -1629,7 +1629,7 @@ PAPER_TYPE             = a4wide
 # If left blank no extra packages will be included.
 # This tag requires that the tag GENERATE_LATEX is set to YES.
 
-EXTRA_PACKAGES         = 
+EXTRA_PACKAGES         =
 
 # The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
 # generated LaTeX document. The header should contain everything until the first
@@ -1645,7 +1645,7 @@ EXTRA_PACKAGES         =
 # to HTML_HEADER.
 # This tag requires that the tag GENERATE_LATEX is set to YES.
 
-LATEX_HEADER           = 
+LATEX_HEADER           =
 
 # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
 # generated LaTeX document. The footer should contain everything after the last
@@ -1656,7 +1656,7 @@ LATEX_HEADER           =
 # Note: Only use a user-defined footer if you know what you are doing!
 # This tag requires that the tag GENERATE_LATEX is set to YES.
 
-LATEX_FOOTER           = 
+LATEX_FOOTER           =
 
 # The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
 # LaTeX style sheets that are included after the standard style sheets created
@@ -1667,7 +1667,7 @@ LATEX_FOOTER           =
 # list).
 # This tag requires that the tag GENERATE_LATEX is set to YES.
 
-LATEX_EXTRA_STYLESHEET = 
+LATEX_EXTRA_STYLESHEET =
 
 # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
 # other source files which should be copied to the LATEX_OUTPUT output
@@ -1675,7 +1675,7 @@ LATEX_EXTRA_STYLESHEET =
 # markers available.
 # This tag requires that the tag GENERATE_LATEX is set to YES.
 
-LATEX_EXTRA_FILES      = 
+LATEX_EXTRA_FILES      =
 
 # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
 # prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
@@ -1775,14 +1775,14 @@ RTF_HYPERLINKS         = NO
 # default style sheet that doxygen normally uses.
 # This tag requires that the tag GENERATE_RTF is set to YES.
 
-RTF_STYLESHEET_FILE    = 
+RTF_STYLESHEET_FILE    =
 
 # Set optional variables used in the generation of an RTF document. Syntax is
 # similar to doxygen's config file. A template extensions file can be generated
 # using doxygen -e rtf extensionFile.
 # This tag requires that the tag GENERATE_RTF is set to YES.
 
-RTF_EXTENSIONS_FILE    = 
+RTF_EXTENSIONS_FILE    =
 
 # If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
 # with syntax highlighting in the RTF output.
@@ -1827,7 +1827,7 @@ MAN_EXTENSION          = .3
 # MAN_EXTENSION with the initial . removed.
 # This tag requires that the tag GENERATE_MAN is set to YES.
 
-MAN_SUBDIR             = 
+MAN_SUBDIR             =
 
 # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
 # will generate one additional man file for each entity documented in the real
@@ -1940,7 +1940,7 @@ PERLMOD_PRETTY         = YES
 # overwrite each other's variables.
 # This tag requires that the tag GENERATE_PERLMOD is set to YES.
 
-PERLMOD_MAKEVAR_PREFIX = 
+PERLMOD_MAKEVAR_PREFIX =
 
 #---------------------------------------------------------------------------
 # Configuration options related to the preprocessor
@@ -1981,7 +1981,7 @@ SEARCH_INCLUDES        = YES
 # preprocessor.
 # This tag requires that the tag SEARCH_INCLUDES is set to YES.
 
-INCLUDE_PATH           = 
+INCLUDE_PATH           =
 
 # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
 # patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -1989,7 +1989,7 @@ INCLUDE_PATH           =
 # used.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-INCLUDE_FILE_PATTERNS  = 
+INCLUDE_FILE_PATTERNS  =
 
 # The PREDEFINED tag can be used to specify one or more macro names that are
 # defined before the preprocessor is started (similar to the -D option of e.g.
@@ -1999,7 +1999,7 @@ INCLUDE_FILE_PATTERNS  =
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED             = 
+PREDEFINED             =
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The
@@ -2008,7 +2008,7 @@ PREDEFINED             =
 # definition found in the source code.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_AS_DEFINED      = 
+EXPAND_AS_DEFINED      =
 
 # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
 # remove all references to function-like macros that are alone on a line, have
@@ -2037,13 +2037,13 @@ SKIP_FUNCTION_MACROS   = YES
 # the path). If a tag file is not located in the directory in which doxygen is
 # run, you must also specify the path to the tagfile here.
 
-TAGFILES               = 
+TAGFILES               =
 
 # When a file name is specified after GENERATE_TAGFILE, doxygen will create a
 # tag file that is based on the input files it reads. See section "Linking to
 # external documentation" for more information about the usage of tag files.
 
-GENERATE_TAGFILE       = 
+GENERATE_TAGFILE       =
 
 # If the ALLEXTERNALS tag is set to YES, all external class will be listed in
 # the class index. If set to NO, only the inherited external classes will be
@@ -2092,14 +2092,14 @@ CLASS_DIAGRAMS         = NO
 # the mscgen tool resides. If left empty the tool is assumed to be found in the
 # default search path.
 
-MSCGEN_PATH            = 
+MSCGEN_PATH            =
 
 # You can include diagrams made with dia in doxygen documentation. Doxygen will
 # then run dia to produce the diagram and insert it in the documentation. The
 # DIA_PATH tag allows you to specify the directory where the dia binary resides.
 # If left empty dia is assumed to be found in the default search path.
 
-DIA_PATH               = 
+DIA_PATH               =
 
 # If set to YES the inheritance and collaboration graphs will hide inheritance
 # and usage relations if the target is undocumented or is not a class.
@@ -2148,7 +2148,7 @@ DOT_FONTSIZE           = 10
 # the path where dot can find it using this tag.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_FONTPATH           = 
+DOT_FONTPATH           =
 
 # If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
 # each documented class showing the direct and indirect inheritance relations.
@@ -2286,26 +2286,26 @@ INTERACTIVE_SVG        = YES
 # found. If left blank, it is assumed the dot tool can be found in the path.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_PATH               = 
+DOT_PATH               =
 
 # The DOTFILE_DIRS tag can be used to specify one or more directories that
 # contain dot files that are included in the documentation (see the \dotfile
 # command).
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOTFILE_DIRS           = 
+DOTFILE_DIRS           =
 
 # The MSCFILE_DIRS tag can be used to specify one or more directories that
 # contain msc files that are included in the documentation (see the \mscfile
 # command).
 
-MSCFILE_DIRS           = 
+MSCFILE_DIRS           =
 
 # The DIAFILE_DIRS tag can be used to specify one or more directories that
 # contain dia files that are included in the documentation (see the \diafile
 # command).
 
-DIAFILE_DIRS           = 
+DIAFILE_DIRS           =
 
 # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
 # path where java can find the plantuml.jar file. If left blank, it is assumed
@@ -2313,12 +2313,12 @@ DIAFILE_DIRS           =
 # generate a warning when it encounters a \startuml command in this case and
 # will not generate output for the diagram.
 
-PLANTUML_JAR_PATH      = 
+PLANTUML_JAR_PATH      =
 
 # When using plantuml, the specified paths are searched for files specified by
 # the !include statement in a plantuml block.
 
-PLANTUML_INCLUDE_PATH  = 
+PLANTUML_INCLUDE_PATH  =
 
 # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
 # that will be shown in the graph. If the number of nodes in a graph becomes

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

@@ -23,9 +23,9 @@ void InitializeIoConnectionData(void);
  * the connection data given in connection_object.
  *        - on error: NULL
  */
-CipConnectionObject *GetIoConnectionForConnectionData(
-    CipConnectionObject *const RESTRICT connection_object,
-    EipUint16 *const extended_error);
+CipConnectionObject* GetIoConnectionForConnectionData(
+    CipConnectionObject* const RESTRICT connection_object,
+    EipUint16* const extended_error);
 
 /** @brief Check if there exists already an exclusive owner or listen only
  * connection which produces the input assembly.
@@ -34,7 +34,7 @@ CipConnectionObject *GetIoConnectionForConnectionData(
  *  @param  input_point     the Input point to be produced
  *  @return   a pointer to the found connection; NULL if nothing found
  */
-CipConnectionObject *GetExistingProducerIoConnection(
+CipConnectionObject* GetExistingProducerIoConnection(
     const bool multicast_only, const EipUint32 input_point);
 
 /** @brief check if there exists an producing multicast exclusive owner or
@@ -45,7 +45,7 @@ CipConnectionObject *GetExistingProducerIoConnection(
  * @return if a connection could be found the pointer to this connection
  *      otherwise NULL.
  */
-CipConnectionObject *GetNextNonControlMasterConnection(
+CipConnectionObject* GetNextNonControlMasterConnection(
     const EipUint32 input_point);
 
 /** @brief Close all connection producing the same input and have the same type

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

@@ -29,16 +29,16 @@
  *          -1 .. error
  */
 int DecodeCipAssemblyAttribute3(
-    void *const data,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response);
+    void* const data,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response);
 
-static EipStatus AssemblyPreGetCallback(CipInstance *const instance,
-                                        CipAttributeStruct *const attribute,
+static EipStatus AssemblyPreGetCallback(CipInstance* const instance,
+                                        CipAttributeStruct* const attribute,
                                         CipByte service);
 
-static EipStatus AssemblyPostSetCallback(CipInstance *const instance,
-                                         CipAttributeStruct *const attribute,
+static EipStatus AssemblyPostSetCallback(CipInstance* const instance,
+                                         CipAttributeStruct* const attribute,
                                          CipByte service);
 
 /** @brief Constructor for the assembly object class
@@ -46,9 +46,9 @@ static EipStatus AssemblyPostSetCallback(CipInstance *const instance,
  *  Creates an initializes Assembly class or object instances
  *  @return Pointer to the created Assembly object
  */
-CipClass *CreateAssemblyClass(void) {
+CipClass* CreateAssemblyClass(void) {
   /* create the CIP Assembly object with zero instances */
-  CipClass *assembly_class = CreateCipClass(
+  CipClass* assembly_class = CreateCipClass(
       kCipAssemblyClassCode,
       0,          /* # class attributes*/
       7,          /* # highest class attribute number*/
@@ -86,12 +86,12 @@ EipStatus CipAssemblyInitialize(void) {
 }
 
 void ShutdownAssemblies(void) {
-  const CipClass *const assembly_class = GetCipClass(kCipAssemblyClassCode);
+  const CipClass* const assembly_class = GetCipClass(kCipAssemblyClassCode);
 
   if (NULL != assembly_class) {
-    const CipInstance *instance = assembly_class->instances;
+    const CipInstance* instance = assembly_class->instances;
     while (NULL != instance) {
-      const CipAttributeStruct *const attribute = GetCipAttribute(instance, 3);
+      const CipAttributeStruct* const attribute = GetCipAttribute(instance, 3);
       if (NULL != attribute) {
         CipFree(attribute->data);
       }
@@ -100,10 +100,10 @@ void ShutdownAssemblies(void) {
   }
 }
 
-CipInstance *CreateAssemblyObject(const CipInstanceNum instance_id,
-                                  EipByte *const data,
+CipInstance* CreateAssemblyObject(const CipInstanceNum instance_id,
+                                  EipByte* const data,
                                   const EipUint16 data_length) {
-  CipClass *assembly_class = GetCipClass(kCipAssemblyClassCode);
+  CipClass* assembly_class = GetCipClass(kCipAssemblyClassCode);
   if (NULL == assembly_class) {
     assembly_class = CreateAssemblyClass();
   }
@@ -112,12 +112,12 @@ CipInstance *CreateAssemblyObject(const CipInstanceNum instance_id,
     return NULL;
   }
 
-  CipInstance *const instance = AddCipInstance(
+  CipInstance* const instance = AddCipInstance(
       assembly_class,
       instance_id); /* add instances (always succeeds (or asserts))*/
 
-  CipByteArray *const assembly_byte_array =
-      (CipByteArray *)CipCalloc(1, sizeof(CipByteArray));
+  CipByteArray* const assembly_byte_array =
+      (CipByteArray*)CipCalloc(1, sizeof(CipByteArray));
   if (assembly_byte_array == NULL) {
     return NULL; /*TODO remove assembly instance in case of error*/
   }
@@ -145,14 +145,14 @@ CipInstance *CreateAssemblyObject(const CipInstanceNum instance_id,
   return instance;
 }
 
-EipStatus NotifyAssemblyConnectedDataReceived(CipInstance *const instance,
-                                              const EipUint8 *const data,
+EipStatus NotifyAssemblyConnectedDataReceived(CipInstance* const instance,
+                                              const EipUint8* const data,
                                               const size_t data_length) {
   /* empty path (path size = 0) need to be checked and taken care of in future
    */
   /* copy received data to Attribute 3 */
-  const CipByteArray *const assembly_byte_array =
-      (CipByteArray *)instance->attributes->data;
+  const CipByteArray* const assembly_byte_array =
+      (CipByteArray*)instance->attributes->data;
   if (assembly_byte_array->length != data_length) {
     OPENER_TRACE_ERR("wrong amount of data arrived for assembly object\n");
     return kEipStatusError; /*TODO question should we notify the application
@@ -166,16 +166,16 @@ EipStatus NotifyAssemblyConnectedDataReceived(CipInstance *const instance,
 }
 
 int DecodeCipAssemblyAttribute3(
-    void *const data,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response) {
-  CipInstance *const instance =
+    void* const data,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response) {
+  CipInstance* const instance =
       GetCipInstance(GetCipClass(message_router_request->request_path.class_id),
                      message_router_request->request_path.instance_number);
 
   int number_of_decoded_bytes = -1;
   OPENER_TRACE_INFO(" -> set Assembly attribute byte array\r\n");
-  CipByteArray *cip_byte_array = (CipByteArray *)data;
+  CipByteArray* cip_byte_array = (CipByteArray*)data;
 
   if (message_router_request->request_data_size < cip_byte_array->length) {
     OPENER_TRACE_INFO("DecodeCipByteArray: not enough data received.\n");
@@ -212,8 +212,8 @@ int DecodeCipAssemblyAttribute3(
   return number_of_decoded_bytes;
 }
 
-static EipStatus AssemblyPreGetCallback(CipInstance *const instance,
-                                        CipAttributeStruct *const attribute,
+static EipStatus AssemblyPreGetCallback(CipInstance* const instance,
+                                        CipAttributeStruct* const attribute,
                                         CipByte service) {
   int rc;
   (void)attribute;
@@ -224,8 +224,8 @@ static EipStatus AssemblyPreGetCallback(CipInstance *const instance,
   return rc;
 }
 
-static EipStatus AssemblyPostSetCallback(CipInstance *const instance,
-                                         CipAttributeStruct *const attribute,
+static EipStatus AssemblyPostSetCallback(CipInstance* const instance,
+                                         CipAttributeStruct* const attribute,
                                          CipByte service) {
   int rc;
   (void)attribute;

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

@@ -54,8 +54,8 @@ void ShutdownAssemblies(void);
  *     - kEipStatusOk the received data was okay
  *     - kEipStatusError the received data was wrong
  */
-EipStatus NotifyAssemblyConnectedDataReceived(CipInstance *const instance,
-                                              const EipUint8 *const data,
+EipStatus NotifyAssemblyConnectedDataReceived(CipInstance* const instance,
+                                              const EipUint8* const data,
                                               const size_t data_length);
 
 #endif  // SOURCE_SRC_CIP_CIPASSEMBLY_H_

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

@@ -14,9 +14,9 @@
 extern CipConnectionObject
     explicit_connection_object_pool[OPENER_CIP_NUM_EXPLICIT_CONNS];
 
-CipConnectionObject *GetFreeExplicitConnection(void);
+CipConnectionObject* GetFreeExplicitConnection(void);
 
-void Class3ConnectionTimeoutHandler(CipConnectionObject *connection_object) {
+void Class3ConnectionTimeoutHandler(CipConnectionObject* connection_object) {
   CheckForTimedOutConnectionsAndCloseTCPConnections(
       connection_object, CloseSessionBySessionHandle);
   CloseConnection(connection_object);
@@ -24,11 +24,11 @@ void Class3ConnectionTimeoutHandler(CipConnectionObject *connection_object) {
 
 /**** Implementation ****/
 CipError EstablishClass3Connection(
-    CipConnectionObject *RESTRICT const connection_object,
-    EipUint16 *const extended_error) {
+    CipConnectionObject* RESTRICT const connection_object,
+    EipUint16* const extended_error) {
   CipError cip_error = kCipErrorSuccess;
 
-  CipConnectionObject *explicit_connection = GetFreeExplicitConnection();
+  CipConnectionObject* explicit_connection = GetFreeExplicitConnection();
 
   if (NULL == explicit_connection) {
     cip_error = kCipErrorConnectionFailure;
@@ -57,7 +57,7 @@ CipError EstablishClass3Connection(
  *
  * @return Free explicit connection slot, or NULL if no slot is free
  */
-CipConnectionObject *GetFreeExplicitConnection(void) {
+CipConnectionObject* GetFreeExplicitConnection(void) {
   for (size_t i = 0; i < OPENER_CIP_NUM_EXPLICIT_CONNS; ++i) {
     if (ConnectionObjectGetState(&(explicit_connection_object_pool[i])) ==
         kConnectionObjectStateNonExistent) {
@@ -74,7 +74,7 @@ void InitializeClass3ConnectionData(void) {
 }
 
 EipStatus CipClass3ConnectionObjectStateEstablishedHandler(
-    CipConnectionObject *RESTRICT const connection_object,
+    CipConnectionObject* RESTRICT const connection_object,
     ConnectionObjectState new_state) {
   switch (new_state) {
     case kConnectionObjectStateNonExistent:
@@ -87,7 +87,7 @@ EipStatus CipClass3ConnectionObjectStateEstablishedHandler(
 }
 
 EipStatus CipClass3ConnectionObjectStateNonExistentHandler(
-    CipConnectionObject *RESTRICT const connection_object,
+    CipConnectionObject* RESTRICT const connection_object,
     ConnectionObjectState new_state) {
   switch (new_state) {
     case kConnectionObjectStateEstablished:

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

@@ -33,11 +33,11 @@
 #include "opener_api.h"
 
 typedef EipStatus (*CipConnectionStateHandler)(
-    CipConnectionObject *RESTRICT const connection_object,
+    CipConnectionObject* RESTRICT const connection_object,
     ConnectionObjectState new_state);
 
 EipStatus CipClass3ConnectionObjectStateEstablishedHandler(
-    CipConnectionObject *RESTRICT const connection_object,
+    CipConnectionObject* RESTRICT const connection_object,
     ConnectionObjectState new_state);
 
 /** @brief Check if Class3 connection is available and if yes setup all data.
@@ -52,8 +52,8 @@ EipStatus CipClass3ConnectionObjectStateEstablishedHandler(
  *    - On an error the general status code to be put into the response
  */
 CipError EstablishClass3Connection(
-    CipConnectionObject *RESTRICT const connection_object,
-    EipUint16 *const extended_error);
+    CipConnectionObject* RESTRICT const connection_object,
+    EipUint16* const extended_error);
 
 /** @brief Initializes the explicit connections mechanism
  *

Fișier diff suprimat deoarece este prea mare
+ 228 - 228
source/src/cip/cipcommon.c


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

@@ -30,10 +30,10 @@ static const EipUint16 kCipUintZero =
  *     - kEipStatusOk ... no reply to send back
  *     - kEipStatusError ... error
  */
-EipStatus NotifyClass(const CipClass *const RESTRICT cip_class,
-                      CipMessageRouterRequest *const message_router_request,
-                      CipMessageRouterResponse *const message_router_response,
-                      const struct sockaddr *originator_address,
+EipStatus NotifyClass(const CipClass* const RESTRICT cip_class,
+                      CipMessageRouterRequest* const message_router_request,
+                      CipMessageRouterResponse* const message_router_response,
+                      const struct sockaddr* originator_address,
                       const CipSessionHandle encapsulation_session);
 
 /** @brief Get largest instance_number present in class instances
@@ -41,11 +41,11 @@ EipStatus NotifyClass(const CipClass *const RESTRICT cip_class,
  * @param cip_class class to be considered
  * @return largest instance_number in class instances
  */
-CipUint GetMaxInstanceNumber(CipClass *RESTRICT const cip_class);
+CipUint GetMaxInstanceNumber(CipClass* RESTRICT const cip_class);
 
 void GenerateGetAttributeSingleHeader(
-    const CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response);
+    const CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response);
 
 /** @brief Generic implementation of the GetAttributeSingle CIP service
  *
@@ -61,15 +61,15 @@ void GenerateGetAttributeSingleHeader(
  *          -1 .. requested attribute not available
  */
 EipStatus GetAttributeSingle(
-    CipInstance *RESTRICT const instance,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* RESTRICT const instance,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response,
+    const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session);
 
 void GenerateSetAttributeSingleHeader(
-    const CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response);
+    const CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response);
 
 /** @brief Generic implementation of the SetAttributeSingle CIP service
  *
@@ -86,10 +86,10 @@ void GenerateSetAttributeSingleHeader(
  *          -1 .. requested attribute not set
  */
 EipStatus SetAttributeSingle(
-    CipInstance *RESTRICT const instance,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* RESTRICT const instance,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response,
+    const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session);
 
 /** @brief Generic implementation of the GetAttributeAll CIP service
@@ -104,10 +104,10 @@ EipStatus SetAttributeSingle(
  * @return length of data stream >0 .. success
  *              0 .. no reply to send
  */
-EipStatus GetAttributeAll(CipInstance *instance,
-                          CipMessageRouterRequest *message_router_request,
-                          CipMessageRouterResponse *message_router_response,
-                          const struct sockaddr *originator_address,
+EipStatus GetAttributeAll(CipInstance* instance,
+                          CipMessageRouterRequest* message_router_request,
+                          CipMessageRouterResponse* message_router_response,
+                          const struct sockaddr* originator_address,
                           const CipSessionHandle encapsulation_session);
 
 /** @brief Generic implementation of the GetAttributeList CIP service
@@ -123,10 +123,10 @@ EipStatus GetAttributeAll(CipInstance *instance,
  * @return length of data stream >0 .. success
  *              0 .. no reply to send
  */
-EipStatus GetAttributeList(CipInstance *instance,
-                           CipMessageRouterRequest *message_router_request,
-                           CipMessageRouterResponse *message_router_response,
-                           const struct sockaddr *originator_address,
+EipStatus GetAttributeList(CipInstance* instance,
+                           CipMessageRouterRequest* message_router_request,
+                           CipMessageRouterResponse* message_router_response,
+                           const struct sockaddr* originator_address,
                            const CipSessionHandle encapsulation_session);
 
 /** @brief Generic implementation of the SetAttributeList CIP service
@@ -142,10 +142,10 @@ EipStatus GetAttributeList(CipInstance *instance,
  * @return length of data stream >0 .. success
  *              0 .. no reply to send
  */
-EipStatus SetAttributeList(CipInstance *instance,
-                           CipMessageRouterRequest *message_router_request,
-                           CipMessageRouterResponse *message_router_response,
-                           const struct sockaddr *originator_address,
+EipStatus SetAttributeList(CipInstance* instance,
+                           CipMessageRouterRequest* message_router_request,
+                           CipMessageRouterResponse* message_router_response,
+                           const struct sockaddr* originator_address,
                            const CipSessionHandle encapsulation_session);
 
 /** @brief Decodes padded EPath
@@ -157,9 +157,9 @@ EipStatus SetAttributeList(CipInstance *instance,
  *          @link EipStatus kEipStatusError @endlink if the path
  *          could not be parsed.
  */
-EipStatus DecodePaddedEPath(CipEpath *epath,
-                            const EipUint8 **message,
-                            size_t *const bytes_decoded);
+EipStatus DecodePaddedEPath(CipEpath* epath,
+                            const EipUint8** message,
+                            size_t* const bytes_decoded);
 
 /** @brief Generic implementation of the CIP Create service
  *
@@ -175,10 +175,10 @@ EipStatus DecodePaddedEPath(CipEpath *epath,
  *          -1 .. requested instance not created
  */
 EipStatus CipCreateService(
-    CipInstance *RESTRICT const instance,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* RESTRICT const instance,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response,
+    const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session);
 
 /** @brief Generic implementation of the CIP Delete service
@@ -196,10 +196,10 @@ EipStatus CipCreateService(
  *          -1 .. requested instance not deleted
  */
 EipStatus CipDeleteService(
-    CipInstance *RESTRICT const instance,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* RESTRICT const instance,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response,
+    const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session);
 
 /** @brief Generic implementation of the CIP Reset service
@@ -218,10 +218,10 @@ EipStatus CipDeleteService(
  *          -1 .. requested instance not reseted
  */
 EipStatus CipResetService(
-    CipInstance *RESTRICT const instance,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* RESTRICT const instance,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response,
+    const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session);
 
 #endif /* OPENER_CIPCOMMON_H_ */

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

@@ -58,50 +58,50 @@ CipConnectionObject g_dummy_connection_object;
 EipUint32 g_incarnation_id;
 
 /* private functions */
-EipStatus ForwardOpen(CipInstance *instance,
-                      CipMessageRouterRequest *message_router_request,
-                      CipMessageRouterResponse *message_router_response,
-                      const struct sockaddr *originator_address,
+EipStatus ForwardOpen(CipInstance* instance,
+                      CipMessageRouterRequest* message_router_request,
+                      CipMessageRouterResponse* message_router_response,
+                      const struct sockaddr* originator_address,
                       const CipSessionHandle encapsulation_session);
 
-EipStatus LargeForwardOpen(CipInstance *instance,
-                           CipMessageRouterRequest *message_router_request,
-                           CipMessageRouterResponse *message_router_response,
-                           const struct sockaddr *originator_address,
+EipStatus LargeForwardOpen(CipInstance* instance,
+                           CipMessageRouterRequest* message_router_request,
+                           CipMessageRouterResponse* message_router_response,
+                           const struct sockaddr* originator_address,
                            const CipSessionHandle encapsulation_session);
 
-EipStatus ForwardClose(CipInstance *instance,
-                       CipMessageRouterRequest *message_router_request,
-                       CipMessageRouterResponse *message_router_response,
-                       const struct sockaddr *originator_address,
+EipStatus ForwardClose(CipInstance* instance,
+                       CipMessageRouterRequest* message_router_request,
+                       CipMessageRouterResponse* message_router_response,
+                       const struct sockaddr* originator_address,
                        const CipSessionHandle encapsulation_session);
 
-EipStatus GetConnectionOwner(CipInstance *instance,
-                             CipMessageRouterRequest *message_router_request,
-                             CipMessageRouterResponse *message_router_response,
-                             const struct sockaddr *originator_address,
+EipStatus GetConnectionOwner(CipInstance* instance,
+                             CipMessageRouterRequest* message_router_request,
+                             CipMessageRouterResponse* message_router_response,
+                             const struct sockaddr* originator_address,
                              const CipSessionHandle encapsulation_session);
 
-EipStatus GetConnectionData(CipInstance *instance,
-                            CipMessageRouterRequest *message_router_request,
-                            CipMessageRouterResponse *message_router_response,
-                            const struct sockaddr *originator_address,
+EipStatus GetConnectionData(CipInstance* instance,
+                            CipMessageRouterRequest* message_router_request,
+                            CipMessageRouterResponse* message_router_response,
+                            const struct sockaddr* originator_address,
                             const CipUdint encapsulation_session);
 
 EipStatus SearchConnectionData(
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response,
+    const struct sockaddr* originator_address,
     const CipUdint encapsulation_session);
 
 void AssembleConnectionDataResponseMessage(
-    CipMessageRouterResponse *message_router_response,
-    CipConnectionObject *connection_object);
+    CipMessageRouterResponse* message_router_response,
+    CipConnectionObject* connection_object);
 
 EipStatus AssembleForwardOpenResponse(
-    CipConnectionObject *connection_object,
-    CipMessageRouterResponse *message_router_response,
+    CipConnectionObject* connection_object,
+    CipMessageRouterResponse* message_router_response,
     EipUint8 general_status,
     EipUint16 extended_status);
 
@@ -109,8 +109,8 @@ EipStatus AssembleForwardCloseResponse(
     EipUint16 connection_serial_number,
     EipUint16 originatior_vendor_id,
     EipUint32 originator_serial_number,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response,
     EipUint16 extended_error_code);
 
 /** @brief check if the data given in the connection object match with an
@@ -125,8 +125,8 @@ EipStatus AssembleForwardCloseResponse(
  *    - NULL if no equal established connection exists
  *    - pointer to the equal connection object
  */
-CipConnectionObject *CheckForExistingConnection(
-    const CipConnectionObject *const connection_object);
+CipConnectionObject* CheckForExistingConnection(
+    const CipConnectionObject* const connection_object);
 
 /** @brief Compare the electronic key received with a forward open request with
  * the device's data.
@@ -140,8 +140,8 @@ CipConnectionObject *CheckForExistingConnection(
  *    - On an error the general status code to be put into the response
  */
 EipStatus CheckElectronicKeyData(EipUint8 key_format,
-                                 void *key_data,
-                                 EipUint16 *extended_status);
+                                 void* key_data,
+                                 EipUint16* extended_status);
 
 /** @brief Parse the connection path of a forward open request
  *
@@ -156,24 +156,24 @@ EipStatus CheckElectronicKeyData(EipUint8 key_format,
  *    - kEipStatusOk ... on success
  *    - On an error the general status code to be put into the response
  */
-EipUint8 ParseConnectionPath(CipConnectionObject *connection_object,
-                             CipMessageRouterRequest *message_router_request,
-                             EipUint16 *extended_error);
+EipUint8 ParseConnectionPath(CipConnectionObject* connection_object,
+                             CipMessageRouterRequest* message_router_request,
+                             EipUint16* extended_error);
 
-ConnectionManagementHandling *GetConnectionManagementEntry(
+ConnectionManagementHandling* GetConnectionManagementEntry(
     const EipUint32 class_id);
 
 void InitializeConnectionManagerData(void);
 
 void AddNullAddressItem(
-    CipCommonPacketFormatData *common_data_packet_format_data);
+    CipCommonPacketFormatData* common_data_packet_format_data);
 
 /** @brief gets the padded logical path TODO: enhance documentation
  * @param logical_path_segment TheLogical Path Segment
  *
  * @return The padded logical path
  */
-unsigned int GetPaddedLogicalPath(const EipUint8 **logical_path_segment) {
+unsigned int GetPaddedLogicalPath(const EipUint8** logical_path_segment) {
   unsigned int padded_logical_path = *(*logical_path_segment)++;
 
   if ((padded_logical_path & 3) == 0) {
@@ -213,57 +213,57 @@ CipUdint GetConnectionId(void) {
   return (g_incarnation_id | (connection_id & 0x0000FFFF));
 }
 
-void InitializeConnectionManager(CipClass *class) {
-  CipClass *meta_class = class->class_instance.cip_class;
+void InitializeConnectionManager(CipClass* class) {
+  CipClass* meta_class = class->class_instance.cip_class;
 
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   1,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&class->revision,
+                  (void*)&class->revision,
                   kGetableSingleAndAll); /* revision */
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   2,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&class->number_of_instances,
+                  (void*)&class->number_of_instances,
                   kGetableSingleAndAll); /* largest instance number */
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   3,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&class->number_of_instances,
+                  (void*)&class->number_of_instances,
                   kGetableSingle); /* number of instances currently existing*/
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   4,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&kCipUintZero,
+                  (void*)&kCipUintZero,
                   kNotSetOrGetable); /* optional attribute list - default = 0 */
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   5,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&kCipUintZero,
+                  (void*)&kCipUintZero,
                   kNotSetOrGetable); /* optional service list - default = 0 */
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   6,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&meta_class->highest_attribute_number,
+                  (void*)&meta_class->highest_attribute_number,
                   kGetableSingleAndAll); /* max class attribute number*/
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   7,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&class->highest_attribute_number,
+                  (void*)&class->highest_attribute_number,
                   kGetableSingleAndAll); /* max instance attribute number*/
 
   InsertService(meta_class,
@@ -279,7 +279,7 @@ void InitializeConnectionManager(CipClass *class) {
 EipStatus ConnectionManagerInit(EipUint16 unique_connection_id) {
   InitializeConnectionManagerData();
 
-  CipClass *connection_manager = CreateCipClass(
+  CipClass* connection_manager = CreateCipClass(
       kCipConnectionManagerClassCode, /* class code */
       0,                              /* # of class attributes */
       7,                              /* # highest class attribute number*/
@@ -330,9 +330,9 @@ EipStatus ConnectionManagerInit(EipUint16 unique_connection_id) {
   return kEipStatusOk;
 }
 
-EipStatus HandleReceivedConnectedData(const EipUint8 *const data,
+EipStatus HandleReceivedConnectedData(const EipUint8* const data,
                                       int data_length,
-                                      struct sockaddr_in *from_address) {
+                                      struct sockaddr_in* from_address) {
   if ((CreateCommonPacketFormatStructure(
           data, data_length, &g_common_packet_format_data_item)) ==
       kEipStatusError) {
@@ -350,7 +350,7 @@ EipStatus HandleReceivedConnectedData(const EipUint8 *const data,
       if (g_common_packet_format_data_item.data_item.type_id ==
           kCipItemIdConnectedDataItem) { /* connected data item received */
 
-        CipConnectionObject *connection_object =
+        CipConnectionObject* connection_object =
             GetConnectedObject(g_common_packet_format_data_item.address_item
                                    .data.connection_identifier);
         if (connection_object == NULL) {
@@ -400,10 +400,10 @@ EipStatus HandleReceivedConnectedData(const EipUint8 *const data,
  *
  */
 typedef EipStatus (*HandleForwardOpenRequestFunction)(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response);
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response);
 
 /** @brief Handles a Null Non Matching Forward Open Request
  *
@@ -413,16 +413,16 @@ typedef EipStatus (*HandleForwardOpenRequestFunction)(
  * kConnectionManagerExtendedStatusCodeNullForwardOpenNotSupported
  */
 EipStatus HandleNullNonMatchingForwardOpenRequest(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response);
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response);
 
 EipStatus HandleNullNonMatchingForwardOpenRequest(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response) {
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response) {
   /* Suppress unused parameter compiler warning. */
   (void)instance;
   (void)message_router_request;
@@ -444,16 +444,16 @@ EipStatus HandleNullNonMatchingForwardOpenRequest(
  * kConnectionManagerExtendedStatusCodeNullForwardOpenNotSupported
  */
 EipStatus HandleNullMatchingForwardOpenRequest(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response);
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response);
 
 EipStatus HandleNullMatchingForwardOpenRequest(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response) {
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response) {
   /* Suppress unused parameter compiler warning. */
   (void)instance;
   (void)message_router_request;
@@ -473,16 +473,16 @@ EipStatus HandleNullMatchingForwardOpenRequest(
  * kConnectionManagerExtendedStatusCodeErrorConnectionInUseOrDuplicateForwardOpen
  */
 EipStatus HandleNonNullMatchingForwardOpenRequest(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response);
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response);
 
 EipStatus HandleNonNullMatchingForwardOpenRequest(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response) {
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response) {
   /* Suppress unused parameter compiler warning. */
   (void)instance;
   (void)message_router_request;
@@ -500,16 +500,16 @@ EipStatus HandleNonNullMatchingForwardOpenRequest(
  * Non-Null, Non-Matching request - Establish a new connection
  */
 EipStatus HandleNonNullNonMatchingForwardOpenRequest(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response);
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response);
 
 EipStatus HandleNonNullNonMatchingForwardOpenRequest(
-    CipConnectionObject *connection_object,
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response) {
+    CipConnectionObject* connection_object,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response) {
   /* Suppress unused parameter compiler warning. */
   (void)connection_object;
   (void)instance;
@@ -538,7 +538,7 @@ EipStatus HandleNonNullNonMatchingForwardOpenRequest(
 
   /*parsing is now finished all data is available and check now establish the
    * connection */
-  ConnectionManagementHandling *connection_management_entry =
+  ConnectionManagementHandling* connection_management_entry =
       GetConnectionManagementEntry(/* Gets correct open connection function for
                                       the targeted object */
                                    g_dummy_connection_object.configuration_path
@@ -588,10 +588,10 @@ static const HandleForwardOpenRequestFunction
         {HandleNullNonMatchingForwardOpenRequest,
          HandleNullMatchingForwardOpenRequest}};
 
-EipStatus ForwardOpenRoutine(CipInstance *instance,
-                             CipMessageRouterRequest *message_router_request,
-                             CipMessageRouterResponse *message_router_response,
-                             const struct sockaddr *originator_address,
+EipStatus ForwardOpenRoutine(CipInstance* instance,
+                             CipMessageRouterRequest* message_router_request,
+                             CipMessageRouterResponse* message_router_response,
+                             const struct sockaddr* originator_address,
                              const CipSessionHandle encapsulation_session);
 
 /** @brief Check if resources for new connection available, generate ForwardOpen
@@ -599,10 +599,10 @@ EipStatus ForwardOpenRoutine(CipInstance *instance,
  *
  * Large Forward Open service calls Forward Open service
  */
-EipStatus LargeForwardOpen(CipInstance *instance,
-                           CipMessageRouterRequest *message_router_request,
-                           CipMessageRouterResponse *message_router_response,
-                           const struct sockaddr *originator_address,
+EipStatus LargeForwardOpen(CipInstance* instance,
+                           CipMessageRouterRequest* message_router_request,
+                           CipMessageRouterResponse* message_router_response,
+                           const struct sockaddr* originator_address,
                            const CipSessionHandle encapsulation_session) {
   g_dummy_connection_object.is_large_forward_open = true;
   return ForwardOpenRoutine(instance,
@@ -638,10 +638,10 @@ EipStatus LargeForwardOpen(CipInstance *instance,
  *      @return >0 .. success, 0 .. no reply to send back
  *              -1 .. error
  */
-EipStatus ForwardOpen(CipInstance *instance,
-                      CipMessageRouterRequest *message_router_request,
-                      CipMessageRouterResponse *message_router_response,
-                      const struct sockaddr *originator_address,
+EipStatus ForwardOpen(CipInstance* instance,
+                      CipMessageRouterRequest* message_router_request,
+                      CipMessageRouterResponse* message_router_response,
+                      const struct sockaddr* originator_address,
                       const CipSessionHandle encapsulation_session) {
   g_dummy_connection_object.is_large_forward_open = false;
   return ForwardOpenRoutine(instance,
@@ -650,10 +650,10 @@ EipStatus ForwardOpen(CipInstance *instance,
                             originator_address,
                             encapsulation_session);
 }
-EipStatus ForwardOpenRoutine(CipInstance *instance,
-                             CipMessageRouterRequest *message_router_request,
-                             CipMessageRouterResponse *message_router_response,
-                             const struct sockaddr *originator_address,
+EipStatus ForwardOpenRoutine(CipInstance* instance,
+                             CipMessageRouterRequest* message_router_request,
+                             CipMessageRouterResponse* message_router_response,
+                             const struct sockaddr* originator_address,
                              const CipSessionHandle encapsulation_session) {
   (void)instance; /*suppress compiler warning */
 
@@ -697,7 +697,7 @@ EipStatus ForwardOpenRoutine(CipInstance *instance,
     /* for multicast, check if IP is within configured net because we send TTL 1
      */
     CipUdint originator_ip =
-        ((struct sockaddr_in *)originator_address)->sin_addr.s_addr;
+        ((struct sockaddr_in*)originator_address)->sin_addr.s_addr;
     CipUdint interface_ip   = g_network_status.ip_address;
     CipUdint interface_mask = g_network_status.network_mask;
     if ((originator_ip & interface_mask) != (interface_ip & interface_mask)) {
@@ -739,10 +739,10 @@ EipStatus ForwardOpenRoutine(CipInstance *instance,
                           message_router_response);
 }
 
-EipStatus ForwardClose(CipInstance *instance,
-                       CipMessageRouterRequest *message_router_request,
-                       CipMessageRouterResponse *message_router_response,
-                       const struct sockaddr *originator_address,
+EipStatus ForwardClose(CipInstance* instance,
+                       CipMessageRouterRequest* message_router_request,
+                       CipMessageRouterResponse* message_router_response,
+                       const struct sockaddr* originator_address,
                        const CipSessionHandle encapsulation_session) {
   /*Suppress compiler warning*/
   (void)instance;
@@ -770,12 +770,12 @@ EipStatus ForwardClose(CipInstance *instance,
 
   OPENER_TRACE_INFO("ForwardClose: ConnSerNo %d\n", connection_serial_number);
 
-  DoublyLinkedListNode *node = connection_list.first;
+  DoublyLinkedListNode* node = connection_list.first;
 
   while (NULL != node) {
     /* this check should not be necessary as only established connections should
      * be in the active connection list */
-    CipConnectionObject *connection_object = node->data;
+    CipConnectionObject* connection_object = node->data;
     if ((kConnectionObjectStateEstablished ==
          ConnectionObjectGetState(connection_object)) ||
         (kConnectionObjectStateTimedOut ==
@@ -787,7 +787,7 @@ EipStatus ForwardClose(CipInstance *instance,
            originator_serial_number)) {
         /* found the corresponding connection object -> close it */
         OPENER_ASSERT(NULL != connection_object->connection_close_function);
-        if (((struct sockaddr_in *)originator_address)->sin_addr.s_addr ==
+        if (((struct sockaddr_in*)originator_address)->sin_addr.s_addr ==
             connection_object->originator_address.sin_addr.s_addr) {
           connection_object->connection_close_function(connection_object);
           connection_status = kConnectionManagerExtendedStatusCodeSuccess;
@@ -817,10 +817,10 @@ EipStatus ForwardClose(CipInstance *instance,
 }
 
 /* TODO: Not implemented */
-EipStatus GetConnectionOwner(CipInstance *instance,
-                             CipMessageRouterRequest *message_router_request,
-                             CipMessageRouterResponse *message_router_response,
-                             const struct sockaddr *originator_address,
+EipStatus GetConnectionOwner(CipInstance* instance,
+                             CipMessageRouterRequest* message_router_request,
+                             CipMessageRouterResponse* message_router_response,
+                             const struct sockaddr* originator_address,
                              const CipSessionHandle encapsulation_session) {
   /* suppress compiler warnings */
   (void)instance;
@@ -832,10 +832,10 @@ EipStatus GetConnectionOwner(CipInstance *instance,
   return kEipStatusOk;
 }
 
-EipStatus GetConnectionData(CipInstance *instance,
-                            CipMessageRouterRequest *message_router_request,
-                            CipMessageRouterResponse *message_router_response,
-                            const struct sockaddr *originator_address,
+EipStatus GetConnectionData(CipInstance* instance,
+                            CipMessageRouterRequest* message_router_request,
+                            CipMessageRouterResponse* message_router_response,
+                            const struct sockaddr* originator_address,
                             const CipUdint encapsulation_session) {
   /* Suppress unused parameter compiler warning. */
   (void)instance;
@@ -853,9 +853,9 @@ EipStatus GetConnectionData(CipInstance *instance,
                     Connection_number);
 
   // search connection
-  DoublyLinkedListNode *iterator                = connection_list.first;
-  CipConnectionObject *search_connection_object = NULL;
-  CipConnectionObject *connection_object        = NULL;
+  DoublyLinkedListNode* iterator                = connection_list.first;
+  CipConnectionObject* search_connection_object = NULL;
+  CipConnectionObject* connection_object        = NULL;
 
   while (NULL != iterator) {
     search_connection_object = iterator->data;
@@ -882,10 +882,10 @@ EipStatus GetConnectionData(CipInstance *instance,
 }
 
 EipStatus SearchConnectionData(
-    CipInstance *instance,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* instance,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response,
+    const struct sockaddr* originator_address,
     const CipUdint encapsulation_session) {
   /* Suppress unused parameter compiler warning. */
   (void)instance;
@@ -911,9 +911,9 @@ EipStatus SearchConnectionData(
       Originator_serial_number);
 
   // search connection
-  DoublyLinkedListNode *iterator                = connection_list.first;
-  CipConnectionObject *search_connection_object = NULL;
-  CipConnectionObject *connection_object        = NULL;
+  DoublyLinkedListNode* iterator                = connection_list.first;
+  CipConnectionObject* search_connection_object = NULL;
+  CipConnectionObject* connection_object        = NULL;
 
   while (NULL != iterator) {
     search_connection_object = iterator->data;
@@ -944,8 +944,8 @@ EipStatus SearchConnectionData(
 }
 
 void AssembleConnectionDataResponseMessage(
-    CipMessageRouterResponse *message_router_response,
-    CipConnectionObject *connection_object) {
+    CipMessageRouterResponse* message_router_response,
+    CipConnectionObject* connection_object) {
   // Connection number UINT
   AddIntToMessage(connection_object->connection_number,
                   &message_router_response->message);
@@ -1016,11 +1016,11 @@ EipStatus ManageConnections(MilliSeconds elapsed_time) {
   HandleApplication();
   ManageEncapsulationMessages(elapsed_time);
 
-  DoublyLinkedListNode *node = connection_list.first;
+  DoublyLinkedListNode* node = connection_list.first;
 
   while (NULL != node) {
     // OPENER_TRACE_INFO("Entering Connection Object loop\n");
-    CipConnectionObject *connection_object = node->data;
+    CipConnectionObject* connection_object = node->data;
     if (kConnectionObjectStateEstablished ==
         ConnectionObjectGetState(connection_object)) {
       if ((NULL !=
@@ -1123,12 +1123,12 @@ EipStatus ManageConnections(MilliSeconds elapsed_time) {
  *   kEipStatusError .. error
  */
 EipStatus AssembleForwardOpenResponse(
-    CipConnectionObject *connection_object,
-    CipMessageRouterResponse *message_router_response,
+    CipConnectionObject* connection_object,
+    CipMessageRouterResponse* message_router_response,
     EipUint8 general_status,
     EipUint16 extended_status) {
   /* write reply information in CPF struct dependent of pa_status */
-  CipCommonPacketFormatData *cip_common_packet_format_data =
+  CipCommonPacketFormatData* cip_common_packet_format_data =
       &g_common_packet_format_data_item;
   cip_common_packet_format_data->item_count = 2;
   cip_common_packet_format_data->data_item.type_id =
@@ -1238,7 +1238,7 @@ EipStatus AssembleForwardOpenResponse(
  * Address Item shall be added
  */
 void AddNullAddressItem(
-    CipCommonPacketFormatData *common_data_packet_format_data) {
+    CipCommonPacketFormatData* common_data_packet_format_data) {
   /* Precondition: Null Address Item only valid in unconnected messages */
   assert(common_data_packet_format_data->data_item.type_id ==
          kCipItemIdUnconnectedDataItem);
@@ -1268,11 +1268,11 @@ EipStatus AssembleForwardCloseResponse(
     EipUint16 connection_serial_number,
     EipUint16 originatior_vendor_id,
     EipUint32 originator_serial_number,
-    CipMessageRouterRequest *message_router_request,
-    CipMessageRouterResponse *message_router_response,
+    CipMessageRouterRequest* message_router_request,
+    CipMessageRouterResponse* message_router_response,
     EipUint16 extended_error_code) {
   /* write reply information in CPF struct dependent of pa_status */
-  CipCommonPacketFormatData *common_data_packet_format_data =
+  CipCommonPacketFormatData* common_data_packet_format_data =
       &g_common_packet_format_data_item;
   common_data_packet_format_data->item_count = 2;
   common_data_packet_format_data->data_item.type_id =
@@ -1311,8 +1311,8 @@ EipStatus AssembleForwardCloseResponse(
   return kEipStatusOkSend;
 }
 
-CipConnectionObject *GetConnectedObject(const EipUint32 connection_id) {
-  DoublyLinkedListNode *iterator = connection_list.first;
+CipConnectionObject* GetConnectedObject(const EipUint32 connection_id) {
+  DoublyLinkedListNode* iterator = connection_list.first;
 
   while (NULL != iterator) {
     if (kConnectionObjectStateEstablished ==
@@ -1326,9 +1326,9 @@ CipConnectionObject *GetConnectedObject(const EipUint32 connection_id) {
   return NULL;
 }
 
-CipConnectionObject *GetConnectedOutputAssembly(
+CipConnectionObject* GetConnectedOutputAssembly(
     const EipUint32 output_assembly_id) {
-  DoublyLinkedListNode *iterator = connection_list.first;
+  DoublyLinkedListNode* iterator = connection_list.first;
 
   while (NULL != iterator) {
     if (kConnectionObjectInstanceTypeIOExclusiveOwner ==
@@ -1337,8 +1337,8 @@ CipConnectionObject *GetConnectedOutputAssembly(
              ConnectionObjectGetState(iterator->data) ||
          kConnectionObjectStateTimedOut ==
              ConnectionObjectGetState(iterator->data)) &&
-        output_assembly_id == ((CipConnectionObject *)iterator->data)
-                                  ->produced_path.instance_id) {
+        output_assembly_id ==
+            ((CipConnectionObject*)iterator->data)->produced_path.instance_id) {
       return iterator->data;
     }
     iterator = iterator->next;
@@ -1346,9 +1346,9 @@ CipConnectionObject *GetConnectedOutputAssembly(
   return NULL;
 }
 
-CipConnectionObject *CheckForExistingConnection(
-    const CipConnectionObject *const connection_object) {
-  DoublyLinkedListNode *iterator = connection_list.first;
+CipConnectionObject* CheckForExistingConnection(
+    const CipConnectionObject* const connection_object) {
+  DoublyLinkedListNode* iterator = connection_list.first;
 
   while (NULL != iterator) {
     if (kConnectionObjectStateEstablished ==
@@ -1364,8 +1364,8 @@ CipConnectionObject *CheckForExistingConnection(
 }
 
 EipStatus CheckElectronicKeyData(EipUint8 key_format,
-                                 void *key_data,
-                                 EipUint16 *extended_status) {
+                                 void* key_data,
+                                 EipUint16* extended_status) {
   /* Default return value */
   *extended_status = kConnectionManagerExtendedStatusCodeSuccess;
 
@@ -1441,10 +1441,10 @@ EipStatus CheckElectronicKeyData(EipUint8 key_format,
              : kEipStatusError;
 }
 
-EipUint8 ParseConnectionPath(CipConnectionObject *connection_object,
-                             CipMessageRouterRequest *message_router_request,
-                             EipUint16 *extended_error) {
-  const EipUint8 *message = message_router_request->data;
+EipUint8 ParseConnectionPath(CipConnectionObject* connection_object,
+                             CipMessageRouterRequest* message_router_request,
+                             EipUint16* extended_error) {
+  const EipUint8* message = message_router_request->data;
   const size_t connection_path_size =
       GetUsintFromMessage(&message); /* length in words */
   if (0 == connection_path_size) {
@@ -1455,7 +1455,7 @@ EipUint8 ParseConnectionPath(CipConnectionObject *connection_object,
   size_t remaining_path = connection_path_size;
   OPENER_TRACE_INFO("Received connection path size: %zu \n",
                     connection_path_size);
-  CipClass *class = NULL;
+  CipClass* class = NULL;
 
   CipDword class_id          = 0x0;
   CipInstanceNum instance_id = 0x0;
@@ -1501,7 +1501,7 @@ EipUint8 ParseConnectionPath(CipConnectionObject *connection_object,
             }
             /* Electronic key format 4 found */
             connection_object->electronic_key.key_format = 4;
-            ElectronicKeyFormat4 *electronic_key = ElectronicKeyFormat4New();
+            ElectronicKeyFormat4* electronic_key = ElectronicKeyFormat4New();
             GetElectronicKeyFormat4FromMessage(&message, electronic_key);
             /* logical electronic key found */
             connection_object->electronic_key.key_data = electronic_key;
@@ -1658,7 +1658,7 @@ EipUint8 ParseConnectionPath(CipConnectionObject *connection_object,
       // available path to Invalid */
 
       size_t number_of_encoded_paths             = 0;
-      CipConnectionPathEpath *paths_to_encode[2] = {0};
+      CipConnectionPathEpath* paths_to_encode[2] = {0};
       if (kConnectionObjectConnectionTypeNull ==
           originator_to_target_connection_type) {
         if (kConnectionObjectConnectionTypeNull ==
@@ -1745,7 +1745,7 @@ EipUint8 ParseConnectionPath(CipConnectionObject *connection_object,
                 g_config_data_length =
                     message[1] *
                     2; /*data segments store length 16-bit word wise */
-                g_config_data_buffer = (EipUint8 *)message + 2;
+                g_config_data_buffer = (EipUint8*)message + 2;
                 remaining_path -= (g_config_data_length + 2) / 2;
                 message += (g_config_data_length + 2);
                 break;
@@ -1804,7 +1804,7 @@ EipUint8 ParseConnectionPath(CipConnectionObject *connection_object,
   return kEipStatusOk;
 }
 
-void CloseConnection(CipConnectionObject *RESTRICT connection_object) {
+void CloseConnection(CipConnectionObject* RESTRICT connection_object) {
   OPENER_TRACE_INFO("cipconnectionmanager: CloseConnection, trigger: %d \n",
                     ConnectionObjectGetTransportClassTriggerTransportClass(
                         connection_object));
@@ -1826,14 +1826,14 @@ void CloseConnection(CipConnectionObject *RESTRICT connection_object) {
   ConnectionObjectInitializeEmpty(connection_object);
 }
 
-void AddNewActiveConnection(CipConnectionObject *const connection_object) {
+void AddNewActiveConnection(CipConnectionObject* const connection_object) {
   DoublyLinkedListInsertAtHead(&connection_list, connection_object);
   ConnectionObjectSetState(connection_object,
                            kConnectionObjectStateEstablished);
 }
 
-void RemoveFromActiveConnections(CipConnectionObject *const connection_object) {
-  for (DoublyLinkedListNode *iterator = connection_list.first; iterator != NULL;
+void RemoveFromActiveConnections(CipConnectionObject* const connection_object) {
+  for (DoublyLinkedListNode* iterator = connection_list.first; iterator != NULL;
        iterator                       = iterator->next) {
     if (iterator->data == connection_object) {
       DoublyLinkedListRemoveNode(&connection_list, &iterator);
@@ -1846,10 +1846,10 @@ void RemoveFromActiveConnections(CipConnectionObject *const connection_object) {
 EipBool8 IsConnectedOutputAssembly(const CipInstanceNum instance_number) {
   EipBool8 is_connected = false;
 
-  DoublyLinkedListNode *node = connection_list.first;
+  DoublyLinkedListNode* node = connection_list.first;
 
   while (NULL != node) {
-    CipConnectionObject *connection_object = (CipConnectionObject *)node->data;
+    CipConnectionObject* connection_object = (CipConnectionObject*)node->data;
     CipDword consumed_connection_point =
         connection_object->consumed_path.instance_id;
     if (instance_number == consumed_connection_point &&
@@ -1883,9 +1883,9 @@ EipStatus AddConnectableObject(
   return status;
 }
 
-ConnectionManagementHandling *GetConnectionManagementEntry(
+ConnectionManagementHandling* GetConnectionManagementEntry(
     const EipUint32 class_id) {
-  ConnectionManagementHandling *connection_management_entry = NULL;
+  ConnectionManagementHandling* connection_management_entry = NULL;
 
   for (unsigned int i = 0; i < g_kNumberOfConnectableObjects; ++i) {
     if (class_id == g_connection_management_list[i].class_id) {
@@ -1900,9 +1900,9 @@ EipStatus TriggerConnections(unsigned int output_assembly,
                              unsigned int input_assembly) {
   EipStatus status = kEipStatusError;
 
-  DoublyLinkedListNode *node = connection_list.first;
+  DoublyLinkedListNode* node = connection_list.first;
   while (NULL != node) {
-    CipConnectionObject *connection_object = node->data;
+    CipConnectionObject* connection_object = node->data;
     if ((output_assembly == connection_object->consumed_path.instance_id) &&
         (input_assembly == connection_object->produced_path.instance_id)) {
       if (kConnectionObjectTransportClassTriggerProductionTriggerApplicationObject ==
@@ -1921,12 +1921,12 @@ EipStatus TriggerConnections(unsigned int output_assembly,
 }
 
 void CheckForTimedOutConnectionsAndCloseTCPConnections(
-    const CipConnectionObject *const connection_object,
+    const CipConnectionObject* const connection_object,
     CloseSessionFunction CloseSessions) {
-  DoublyLinkedListNode *search_node   = connection_list.first;
+  DoublyLinkedListNode* search_node   = connection_list.first;
   bool non_timed_out_connection_found = false;
   while (NULL != search_node) {
-    CipConnectionObject *search_connection = search_node->data;
+    CipConnectionObject* search_connection = search_node->data;
     if (ConnectionObjectEqualOriginator(connection_object, search_connection) &&
         connection_object != search_connection &&
         kConnectionObjectStateTimedOut !=

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

@@ -257,7 +257,7 @@ EipStatus ConnectionManagerInit(EipUint16 unique_connection_id);
  *   @return pointer to connected Object
  *           NULL .. connection not present in device
  */
-CipConnectionObject *GetConnectedObject(const EipUint32 connection_id);
+CipConnectionObject* GetConnectedObject(const EipUint32 connection_id);
 
 /**  Get a connection object for a given output assembly.
  *
@@ -266,7 +266,7 @@ CipConnectionObject *GetConnectedObject(const EipUint32 connection_id);
  *   @return pointer to connected Object
  *           0 .. connection not present in device
  */
-CipConnectionObject *GetConnectedOutputAssembly(
+CipConnectionObject* GetConnectedOutputAssembly(
     const EipUint32 output_assembly_id);
 
 /** @brief Close the given connection
@@ -276,7 +276,7 @@ CipConnectionObject *GetConnectedOutputAssembly(
  * @param connection_object pointer to the connection object structure to be
  * closed
  */
-void CloseConnection(CipConnectionObject *RESTRICT connection_object);
+void CloseConnection(CipConnectionObject* RESTRICT connection_object);
 
 /* TODO: Missing documentation */
 EipBool8 IsConnectedOutputAssembly(const CipInstanceNum instance_number);
@@ -290,22 +290,22 @@ EipBool8 IsConnectedOutputAssembly(const CipInstanceNum instance_number);
  *
  * @param connection_object pointer to the connection object to be added.
  */
-void AddNewActiveConnection(CipConnectionObject *const connection_object);
+void AddNewActiveConnection(CipConnectionObject* const connection_object);
 
 /** @brief Removes connection from the list of active connections
  *
  * @param connection_object Connection object to be removed from the active
  * connection list
  */
-void RemoveFromActiveConnections(CipConnectionObject *const connection_object);
+void RemoveFromActiveConnections(CipConnectionObject* const connection_object);
 
 CipUdint GetConnectionId(void);
 
 typedef void (*CloseSessionFunction)(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void CheckForTimedOutConnectionsAndCloseTCPConnections(
-    const CipConnectionObject *const connection_object,
+    const CipConnectionObject* const connection_object,
     CloseSessionFunction CloseSessions);
 
 #endif /* OPENER_CIPCONNECTIONMANAGER_H_ */

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

@@ -4,14 +4,14 @@
  *
  ******************************************************************************/
 
-#include "cipconnectionobject.h"
+#include "cip/cipconnectionobject.h"
 
+#include <stdlib.h>
 #include <string.h>
 
-#include "cipconnectionmanager.h"
-#include "endianconv.h"
-#include "stdlib.h"
-#include "trace.h"
+#include "cip/cipconnectionmanager.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
@@ -58,7 +58,7 @@ DoublyLinkedList connection_list;
 CipConnectionObject
     explicit_connection_object_pool[OPENER_CIP_NUM_EXPLICIT_CONNS];
 
-DoublyLinkedListNode *CipConnectionObjectListArrayAllocator() {
+DoublyLinkedListNode* CipConnectionObjectListArrayAllocator() {
   enum {
     kNodesAmount =
         OPENER_CIP_NUM_EXPLICIT_CONNS + OPENER_CIP_NUM_INPUT_ONLY_CONNS +
@@ -74,7 +74,7 @@ DoublyLinkedListNode *CipConnectionObjectListArrayAllocator() {
   return NULL;
 }
 
-void CipConnectionObjectListArrayFree(DoublyLinkedListNode **node) {
+void CipConnectionObjectListArrayFree(DoublyLinkedListNode** node) {
   if (NULL != node) {
     if (NULL != *node) {
       memset(*node, 0, sizeof(DoublyLinkedListNode));
@@ -89,14 +89,14 @@ void CipConnectionObjectListArrayFree(DoublyLinkedListNode **node) {
 
 /* Private methods declaration */
 uint64_t ConnectionObjectCalculateRegularInactivityWatchdogTimerValue(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetInitialInactivityWatchdogTimerValue(
-    CipConnectionObject *const connection_object);
+    CipConnectionObject* const connection_object);
 /* End private methods declaration */
 
 void ConnectionObjectInitializeEmpty(
-    CipConnectionObject *const connection_object) {
+    CipConnectionObject* const connection_object) {
   memset(connection_object, 0, sizeof(*connection_object));
   ConnectionObjectSetState(connection_object,
                            kConnectionObjectStateNonExistent);
@@ -104,7 +104,7 @@ void ConnectionObjectInitializeEmpty(
   connection_object->socket[1] = kEipInvalidSocket;
 }
 
-CipConnectionObject *CipConnectionObjectCreate(const CipOctet *message) {
+CipConnectionObject* CipConnectionObjectCreate(const CipOctet* message) {
   /* Suppress unused parameter compiler warning. */
   (void)message;
 
@@ -113,7 +113,7 @@ CipConnectionObject *CipConnectionObjectCreate(const CipOctet *message) {
 }
 
 void ConnectionObjectInitializeFromMessage(
-    const CipOctet **message, CipConnectionObject *const connection_object) {
+    const CipOctet** message, CipConnectionObject* const connection_object) {
   /* For unconnected send - can be ignored by targets, and is ignored here */
   CipByte priority_timetick = GetByteFromMessage(message);
   CipUsint timeout_ticks    = GetUsintFromMessage(message);
@@ -188,7 +188,7 @@ void ConnectionObjectInitializeFromMessage(
 }
 
 ConnectionObjectState ConnectionObjectGetState(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   ConnectionObjectState new_state = kConnectionObjectStateInvalid;
   switch (connection_object->state) {
     case CIP_CONNECTION_OBJECT_STATE_NON_EXISTENT:
@@ -219,7 +219,7 @@ ConnectionObjectState ConnectionObjectGetState(
   return new_state;
 }
 
-void ConnectionObjectSetState(CipConnectionObject *const connection_object,
+void ConnectionObjectSetState(CipConnectionObject* const connection_object,
                               const ConnectionObjectState state) {
   switch (state) {
     case kConnectionObjectStateNonExistent:
@@ -251,7 +251,7 @@ void ConnectionObjectSetState(CipConnectionObject *const connection_object,
 }
 
 ConnectionObjectInstanceType ConnectionObjectGetInstanceType(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->instance_type;
   //  switch (connection_object->instance_type) {
   //    case CIP_CONNECTION_OBJECT_INSTANCE_TYPE_EXPLICIT_MESSAGING:
@@ -269,13 +269,13 @@ ConnectionObjectInstanceType ConnectionObjectGetInstanceType(
 }
 
 void ConnectionObjectSetInstanceType(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const ConnectionObjectInstanceType instance_type) {
   connection_object->instance_type = (CipUsint)instance_type;
 }
 
 CipUsint ConnectionObjectGetInstanceTypeForAttribute(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   CipUsint instance_type = kConnectionObjectInstanceTypeInvalid;
   switch (connection_object->instance_type) {
     case kConnectionObjectInstanceTypeExplicitMessaging:
@@ -299,7 +299,7 @@ CipUsint ConnectionObjectGetInstanceTypeForAttribute(
 }
 
 bool ConnectionObjectIsTypeNonLOIOConnection(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   switch (connection_object->instance_type) {
     case kConnectionObjectInstanceTypeIO:
     case kConnectionObjectInstanceTypeIOExclusiveOwner:
@@ -311,7 +311,7 @@ bool ConnectionObjectIsTypeNonLOIOConnection(
 }
 
 bool ConnectionObjectIsTypeIOConnection(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   switch (connection_object->instance_type) {
     case kConnectionObjectInstanceTypeIO:
     case kConnectionObjectInstanceTypeIOExclusiveOwner:
@@ -325,7 +325,7 @@ bool ConnectionObjectIsTypeIOConnection(
 
 ConnectionObjectTransportClassTriggerDirection
 ConnectionObjectGetTransportClassTriggerDirection(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   const CipByte TransportClassTriggerDirectionMask = 0x80;
   return (connection_object->transport_class_trigger &
           TransportClassTriggerDirectionMask) ==
@@ -336,7 +336,7 @@ ConnectionObjectGetTransportClassTriggerDirection(
 
 ConnectionObjectTransportClassTriggerProductionTrigger
 ConnectionObjectGetTransportClassTriggerProductionTrigger(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   const CipByte kTransportClassTriggerProductionTriggerMask = 0x70;
 
   ConnectionObjectTransportClassTriggerProductionTrigger production_trigger =
@@ -365,7 +365,7 @@ ConnectionObjectGetTransportClassTriggerProductionTrigger(
 
 ConnectionObjectTransportClassTriggerTransportClass
 ConnectionObjectGetTransportClassTriggerTransportClass(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   const CipByte kTransportClassTriggerTransportClassMask = 0x0F;
 
   ConnectionObjectTransportClassTriggerTransportClass transport_class_trigger =
@@ -396,89 +396,89 @@ ConnectionObjectGetTransportClassTriggerTransportClass(
 }
 
 CipUint ConnectionObjectGetProducedConnectionSize(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->produced_connection_size;
 }
 
 void ConnectionObjectSetProducedConnectionSize(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint produced_connection_size) {
   connection_object->produced_connection_size = produced_connection_size;
 }
 
 CipUint ConnectionObjectGetConsumedConnectionSize(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->consumed_connection_size;
 }
 
 void ConnectionObjectSetConsumedConnectionSize(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint consumed_connection_size) {
   connection_object->consumed_connection_size = consumed_connection_size;
 }
 
 CipUint ConnectionObjectGetExpectedPacketRate(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->expected_packet_rate;
 }
 
 CipUint ConnectionObjectGetRequestedPacketInterval(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   CipUdint remainder_to_resolution =
       (connection_object->t_to_o_requested_packet_interval) %
-      (kOpenerTimerTickInMilliSeconds * 1000);
-  if (0 == remainder_to_resolution) { /* Value can be represented in multiples
-                                         of the timer resolution */
+      (kOpenerTimerTickInMilliSeconds * 1000UL);
+  if (0 == remainder_to_resolution) {
+    // Value can be represented in multiples of the timer resolution
     return (CipUint)(connection_object->t_to_o_requested_packet_interval /
-                     1000);
+                     1000UL);
   } else {
     return (CipUint)(connection_object->t_to_o_requested_packet_interval /
-                         1000 -
-                     remainder_to_resolution / 1000);
+                         1000UL -
+                     remainder_to_resolution / 1000UL);
   }
 }
 
 void ConnectionObjectSetExpectedPacketRate(
-    CipConnectionObject *const connection_object) {
+    CipConnectionObject* const connection_object) {
   CipUdint remainder_to_resolution =
       (connection_object->t_to_o_requested_packet_interval) %
-      (kOpenerTimerTickInMilliSeconds * 1000);
-  if (0 == remainder_to_resolution) { /* Value can be represented in multiples
-                                         of the timer resolution */
+      ((CipUdint)kOpenerTimerTickInMilliSeconds * 1000UL);
+  if (0 == remainder_to_resolution) {
+    // Value can be represented in multiples of the timer resolution
     connection_object->expected_packet_rate =
-        connection_object->t_to_o_requested_packet_interval / 1000;
+        connection_object->t_to_o_requested_packet_interval / 1000UL;
   } else {
     connection_object->expected_packet_rate =
-        connection_object->t_to_o_requested_packet_interval / 1000 +
+        connection_object->t_to_o_requested_packet_interval / 1000UL +
         ((CipUdint)kOpenerTimerTickInMilliSeconds -
-         remainder_to_resolution / 1000);
+         remainder_to_resolution / 1000UL);
   }
 }
 
 CipUdint ConnectionObjectGetCipProducedConnectionID(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->cip_produced_connection_id;
 }
 
 void ConnectionObjectSetCipProducedConnectionID(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUdint cip_produced_connection_id) {
   connection_object->cip_produced_connection_id = cip_produced_connection_id;
 }
 
 CipUdint ConnectionObjectGetCipConsumedConnectionID(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->cip_consumed_connection_id;
 }
 
 void ConnectionObjectSetCipConsumedConnectionID(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUdint cip_consumed_connection_id) {
   connection_object->cip_consumed_connection_id = cip_consumed_connection_id;
 }
 
 ConnectionObjectWatchdogTimeoutAction ConnectionObjectGetWatchdogTimeoutAction(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   ConnectionObjectWatchdogTimeoutAction timeout_action =
       kConnectionObjectWatchdogTimeoutActionInvalid;
   switch (connection_object->watchdog_timeout_action) {
@@ -503,7 +503,7 @@ ConnectionObjectWatchdogTimeoutAction ConnectionObjectGetWatchdogTimeoutAction(
 }
 
 void ConnectionObjectSetWatchdogTimeoutAction(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUsint watchdog_timeout_action) {
   switch (watchdog_timeout_action) {
     case CIP_CONNECTION_OBJECT_WATCHDOG_TIMEOUT_ACTION_TRANSITION_TO_TIMED_OUT:
@@ -530,36 +530,36 @@ void ConnectionObjectSetWatchdogTimeoutAction(
 }
 
 CipUint ConnectionObjectGetProducedConnectionPathLength(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->produced_connection_path_length;
 }
 
 void ConnectionObjectSetProducedConnectionPathLength(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint produced_connection_path_length) {
   connection_object->produced_connection_path_length =
       produced_connection_path_length;
 }
 
 CipUint ConnectionObjectGetConsumedConnectionPathLength(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->consumed_connection_path_length;
 }
 
 void ConnectionObjectSetConsumedConnectionPathLength(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint consumed_connection_path_length) {
   connection_object->consumed_connection_path_length =
       consumed_connection_path_length;
 }
 
 CipUint ConnectionObjectGetProductionInhibitTime(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->production_inhibit_time;
 }
 
 void ConnectionObjectSetProductionInhibitTime(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint production_inhibit_time) {
   connection_object->production_inhibit_time = production_inhibit_time;
 }
@@ -567,7 +567,7 @@ void ConnectionObjectSetProductionInhibitTime(
 /*setup the preconsumption timer: max(ConnectionTimeoutMultiplier *
  * ExpectedPacketRate, 10s) */
 void ConnectionObjectSetInitialInactivityWatchdogTimerValue(
-    CipConnectionObject *const connection_object) {
+    CipConnectionObject* const connection_object) {
   const uint64_t kMinimumInitialTimeoutValue = 10000;
   const uint64_t calculated_timeout_value =
       ConnectionObjectCalculateRegularInactivityWatchdogTimerValue(
@@ -579,73 +579,74 @@ void ConnectionObjectSetInitialInactivityWatchdogTimerValue(
 }
 
 void ConnectionObjectResetInactivityWatchdogTimerValue(
-    CipConnectionObject *const connection_object) {
+    CipConnectionObject* const connection_object) {
   connection_object->inactivity_watchdog_timer =
       ConnectionObjectCalculateRegularInactivityWatchdogTimerValue(
           connection_object);
 }
 
 void ConnectionObjectResetLastPackageInactivityTimerValue(
-    CipConnectionObject *const connection_object) {
+    CipConnectionObject* const connection_object) {
   connection_object->last_package_watchdog_timer =
       ConnectionObjectCalculateRegularInactivityWatchdogTimerValue(
           connection_object);
 }
 
 uint64_t ConnectionObjectCalculateRegularInactivityWatchdogTimerValue(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return (((uint64_t)(connection_object->o_to_t_requested_packet_interval) /
            (uint64_t)1000)
           << (2 + connection_object->connection_timeout_multiplier));
 }
 
 CipUint ConnectionObjectGetConnectionSerialNumber(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->connection_serial_number;
 }
 
 void ConnectionObjectSetConnectionSerialNumber(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipUint connection_serial_number) {
   connection_object->connection_serial_number = connection_serial_number;
 }
 
 CipUint ConnectionObjectGetOriginatorVendorId(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->originator_vendor_id;
 }
 
 void ConnectionObjectSetOriginatorVendorId(
-    CipConnectionObject *connection_object, const CipUint vendor_id) {
+    CipConnectionObject* connection_object, const CipUint vendor_id) {
   connection_object->originator_vendor_id = vendor_id;
 }
 
 CipUdint ConnectionObjectGetOriginatorSerialNumber(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->originator_serial_number;
 }
 
 void ConnectionObjectSetOriginatorSerialNumber(
-    CipConnectionObject *connection_object, CipUdint originator_serial_number) {
+    CipConnectionObject* connection_object, CipUdint originator_serial_number) {
   connection_object->originator_serial_number = originator_serial_number;
 }
 
 CipUdint ConnectionObjectGetConnectionlNumber(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->connection_number;
 }
 
 void ConnectionObjectSetConnectionNumber(
-    CipConnectionObject *connection_object) {
+    CipConnectionObject* connection_object) {
   connection_object->connection_number = GenerateRandomConnectionNumber();
 }
 
 CipUint GenerateRandomConnectionNumber(void) {
-  CipUint rand_num = (CipUint)rand();  // TODO: update to random.c functions
+  CipUint rand_num =
+      (CipUint)rand();  // TODO(opener): update to random.c functions
 
   // search for existing connection_numbers
-  DoublyLinkedListNode *iterator                = connection_list.first;
-  CipConnectionObject *search_connection_object = NULL;
+  DoublyLinkedListNode* iterator                = connection_list.first;
+  CipConnectionObject* search_connection_object = NULL;
 
   while (NULL != iterator) {
     search_connection_object = iterator->data;
@@ -660,50 +661,50 @@ CipUint GenerateRandomConnectionNumber(void) {
 }
 
 CipUsint ConnectionObjectGetConnectionTimeoutMultiplier(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->connection_timeout_multiplier;
 }
 
 void ConnectionObjectSetConnectionTimeoutMultiplier(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUsint connection_timeout_multiplier) {
   connection_object->connection_timeout_multiplier =
       connection_timeout_multiplier;
 }
 
 CipUdint ConnectionObjectGetOToTRequestedPacketInterval(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->o_to_t_requested_packet_interval;
 }
 
 void ConnectionObjectSetOToTRequestedPacketInterval(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipUdint requested_packet_interval) {
   connection_object->o_to_t_requested_packet_interval =
       requested_packet_interval;
 }
 
 CipUdint ConnectionObjectGetTToORequestedPacketInterval(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return connection_object->t_to_o_requested_packet_interval;
 }
 
 void ConnectionObjectSetTToORequestedPacketInterval(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipUdint requested_packet_interval) {
   connection_object->t_to_o_requested_packet_interval =
       requested_packet_interval;
 }
 
 void ConnectionObjectSetTToONetworkConnectionParameters(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipDword connection_parameters) {
   connection_object->t_to_o_network_connection_parameters =
       connection_parameters;
 }
 
 void ConnectionObjectSetOToTNetworkConnectionParameters(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipDword connection_parameters) {
   connection_object->o_to_t_network_connection_parameters =
       connection_parameters;
@@ -712,21 +713,21 @@ void ConnectionObjectSetOToTNetworkConnectionParameters(
 bool ConnectionObjectIsRedundantOwner(const CipDword connection_parameters,
                                       const CipBool is_lfo) {
   if (is_lfo) {
-    return (connection_parameters & (1 << 31));
+    return (connection_parameters & (UINT32_C(1) << 31));
   } else {
-    return (connection_parameters & (1 << 15));
+    return (connection_parameters & (UINT32_C(1) << 15));
   }
 }
 
 bool ConnectionObjectIsOToTRedundantOwner(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectIsRedundantOwner(
       connection_object->o_to_t_network_connection_parameters,
       connection_object->is_large_forward_open);
 }
 
 bool ConnectionObjectIsTToORedundantOwner(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectIsRedundantOwner(
       connection_object->t_to_o_network_connection_parameters,
       connection_object->is_large_forward_open);
@@ -736,9 +737,9 @@ ConnectionObjectConnectionType ConnectionObjectGetConnectionType(
     const CipDword connection_parameters, const CipBool is_lfo) {
   CipUsint connection_type;
   if (is_lfo) {
-    connection_type = (connection_parameters & (3 << 29)) >> 29;
+    connection_type = (connection_parameters & (UINT32_C(3) << 29)) >> 29;
   } else {
-    connection_type = (connection_parameters & (3 << 13)) >> 13;
+    connection_type = (connection_parameters & (UINT32_C(3) << 13)) >> 13;
   }
 
   switch (connection_type) {
@@ -754,14 +755,14 @@ ConnectionObjectConnectionType ConnectionObjectGetConnectionType(
 }
 
 ConnectionObjectConnectionType ConnectionObjectGetOToTConnectionType(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectGetConnectionType(
       connection_object->o_to_t_network_connection_parameters,
       connection_object->is_large_forward_open);
 }
 
 ConnectionObjectConnectionType ConnectionObjectGetTToOConnectionType(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectGetConnectionType(
       connection_object->t_to_o_network_connection_parameters,
       connection_object->is_large_forward_open);
@@ -771,9 +772,9 @@ ConnectionObjectPriority ConnectionObjectGetPriority(
     const CipDword connection_parameters, const CipBool is_lfo) {
   CipUsint priority;
   if (is_lfo) {
-    priority = (connection_parameters & (3 << 26)) >> 26;
+    priority = (connection_parameters & (UINT32_C(3) << 26)) >> 26;
   } else {
-    priority = (connection_parameters & (3 << 10)) >> 10;
+    priority = (connection_parameters & (UINT32_C(3) << 10)) >> 10;
   }
 
   ConnectionObjectPriority result;
@@ -799,14 +800,14 @@ ConnectionObjectPriority ConnectionObjectGetPriority(
 }
 
 ConnectionObjectPriority ConnectionObjectGetOToTPriority(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectGetPriority(
       connection_object->o_to_t_network_connection_parameters,
       connection_object->is_large_forward_open);
 }
 
 ConnectionObjectPriority ConnectionObjectGetTToOPriority(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectGetPriority(
       connection_object->t_to_o_network_connection_parameters,
       connection_object->is_large_forward_open);
@@ -816,9 +817,9 @@ ConnectionObjectConnectionSizeType ConnectionObjectGetConnectionSizeType(
     const CipDword connection_parameters, const CipBool is_lfo) {
   bool connection_size_type;
   if (is_lfo) {
-    connection_size_type = (connection_parameters & (1 << 25));
+    connection_size_type = (connection_parameters & (UINT32_C(1) << 25));
   } else {
-    connection_size_type = (connection_parameters & (1 << 9));
+    connection_size_type = (connection_parameters & (UINT32_C(1) << 9));
   }
 
   if (connection_size_type) {
@@ -829,14 +830,14 @@ ConnectionObjectConnectionSizeType ConnectionObjectGetConnectionSizeType(
 }
 
 ConnectionObjectConnectionSizeType ConnectionObjectGetOToTConnectionSizeType(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectGetConnectionSizeType(
       connection_object->o_to_t_network_connection_parameters,
       connection_object->is_large_forward_open);
 }
 
 ConnectionObjectConnectionSizeType ConnectionObjectGetTToOConnectionSizeType(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectGetConnectionSizeType(
       connection_object->t_to_o_network_connection_parameters,
       connection_object->is_large_forward_open);
@@ -856,27 +857,27 @@ size_t ConnectionObjectGetConnectionSize(const CipDword connection_parameters,
 }
 
 size_t ConnectionObjectGetOToTConnectionSize(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectGetConnectionSize(
       connection_object->o_to_t_network_connection_parameters,
       connection_object->is_large_forward_open);
 }
 
 size_t ConnectionObjectGetTToOConnectionSize(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   return ConnectionObjectGetConnectionSize(
       connection_object->t_to_o_network_connection_parameters,
       connection_object->is_large_forward_open);
 }
 
 void ConnectionObjectDeepCopy(
-    CipConnectionObject *RESTRICT destination,
-    const CipConnectionObject *RESTRICT const source) {
+    CipConnectionObject* RESTRICT destination,
+    const CipConnectionObject* RESTRICT const source) {
   memcpy(destination, source, sizeof(CipConnectionObject));
 }
 
 void ConnectionObjectResetSequenceCounts(
-    CipConnectionObject *const connection_object) {
+    CipConnectionObject* const connection_object) {
   connection_object->eip_level_sequence_count_producing      = 0;
   connection_object->sequence_count_producing                = 0;
   connection_object->eip_level_sequence_count_consuming      = 0;
@@ -885,13 +886,13 @@ void ConnectionObjectResetSequenceCounts(
 }
 
 void ConnectionObjectResetProductionInhibitTimer(
-    CipConnectionObject *const connection_object) {
+    CipConnectionObject* const connection_object) {
   connection_object->production_inhibit_timer =
       connection_object->production_inhibit_time;
 }
 
 void ConnectionObjectGeneralConfiguration(
-    CipConnectionObject *const connection_object) {
+    CipConnectionObject* const connection_object) {
   connection_object->socket[0] = kEipInvalidSocket;
   connection_object->socket[1] = kEipInvalidSocket;
 
@@ -916,17 +917,16 @@ void ConnectionObjectGeneralConfiguration(
   ConnectionObjectResetSequenceCounts(connection_object);
 
   ConnectionObjectSetWatchdogTimeoutAction(
-      connection_object,
-      kConnectionObjectWatchdogTimeoutActionInvalid); /* Correct value not know
-                                                         at this point */
+      connection_object, kConnectionObjectWatchdogTimeoutActionInvalid);
+  // Correct value not known at this point
 
   ConnectionObjectResetProductionInhibitTimer(connection_object);
 
   connection_object->transmission_trigger_timer = 0;
 }
 
-bool ConnectionObjectEqualOriginator(const CipConnectionObject *const object1,
-                                     const CipConnectionObject *const object2) {
+bool ConnectionObjectEqualOriginator(const CipConnectionObject* const object1,
+                                     const CipConnectionObject* const object2) {
   if ((object1->originator_vendor_id == object2->originator_vendor_id) &&
       (object1->originator_serial_number ==
        object2->originator_serial_number)) {
@@ -935,8 +935,8 @@ bool ConnectionObjectEqualOriginator(const CipConnectionObject *const object1,
   return false;
 }
 
-bool EqualConnectionTriad(const CipConnectionObject *const object1,
-                          const CipConnectionObject *const object2) {
+bool EqualConnectionTriad(const CipConnectionObject* const object1,
+                          const CipConnectionObject* const object2) {
   if ((object1->connection_serial_number ==
        object2->connection_serial_number) &&
       (object1->originator_vendor_id == object2->originator_vendor_id) &&
@@ -948,8 +948,8 @@ bool EqualConnectionTriad(const CipConnectionObject *const object1,
 }
 
 bool CipConnectionObjectOriginatorHasSameIP(
-    const CipConnectionObject *const connection_object,
-    const struct sockaddr *const originator_address) {
-  return ((struct sockaddr_in *)originator_address)->sin_addr.s_addr ==
+    const CipConnectionObject* const connection_object,
+    const struct sockaddr* const originator_address) {
+  return ((struct sockaddr_in*)originator_address)->sin_addr.s_addr ==
          connection_object->originator_address.sin_addr.s_addr;
 }

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

@@ -154,7 +154,7 @@ typedef enum {
 typedef struct cip_connection_object CipConnectionObject;
 
 typedef EipStatus (*CipConnectionStateHandler)(
-    CipConnectionObject *RESTRICT const connection_object,
+    CipConnectionObject* RESTRICT const connection_object,
     ConnectionObjectState new_state);
 
 struct cip_connection_object {
@@ -173,10 +173,10 @@ struct cip_connection_object {
   CipUdint cip_consumed_connection_id;     /*< Attribute 11 */
   CipUsint watchdog_timeout_action;        /*< Attribute 12 */
   CipUint produced_connection_path_length; /*< Attribute 13 */
-  CipOctet *produced_connection_path;      /*< Attribute 14 */
+  CipOctet* produced_connection_path;      /*< Attribute 14 */
   CipConnectionPathEpath produced_path;
   CipUint consumed_connection_path_length; /*< Attribute 15 */
-  CipOctet *consumed_connection_path;      /*< Attribute 16 */
+  CipOctet* consumed_connection_path;      /*< Attribute 16 */
   CipConnectionPathEpath consumed_path;
   CipUint production_inhibit_time;        /*< Attribute 17 */
   CipUsint connection_timeout_multiplier; /*< Attribute 18 */
@@ -188,8 +188,8 @@ struct cip_connection_object {
 
   CipConnectionPathEpath configuration_path;
 
-  CipInstance *producing_instance;
-  CipInstance *consuming_instance;
+  CipInstance* producing_instance;
+  CipInstance* consuming_instance;
 
   CipUint requested_produced_connection_size;
   CipUint requested_consumed_connection_size;
@@ -267,72 +267,72 @@ struct cip_connection_object {
 /** @brief Extern declaration of the global connection list */
 extern DoublyLinkedList connection_list;
 
-DoublyLinkedListNode *CipConnectionObjectListArrayAllocator();
-void CipConnectionObjectListArrayFree(DoublyLinkedListNode **node);
+DoublyLinkedListNode* CipConnectionObjectListArrayAllocator();
+void CipConnectionObjectListArrayFree(DoublyLinkedListNode** node);
 
 /** @brief Array allocator
  *
  */
-CipConnectionObject *CipConnectionObjectCreate(const CipOctet *message);
+CipConnectionObject* CipConnectionObjectCreate(const CipOctet* message);
 
 /** @brief Array deallocator
  *
  */
-void CipConnectionObjectDelete(CipConnectionObject **connection_object);
+void CipConnectionObjectDelete(CipConnectionObject** connection_object);
 
 void ConnectionObjectInitializeEmpty(
-    CipConnectionObject *const connection_object);
+    CipConnectionObject* const connection_object);
 
 void ConnectionObjectInitializeFromMessage(
-    const CipOctet **message, CipConnectionObject *const connection_object);
+    const CipOctet** message, CipConnectionObject* const connection_object);
 
 ConnectionObjectState ConnectionObjectGetState(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
-void ConnectionObjectSetState(CipConnectionObject *const connection_object,
+void ConnectionObjectSetState(CipConnectionObject* const connection_object,
                               const ConnectionObjectState state);
 
 ConnectionObjectInstanceType ConnectionObjectGetInstanceType(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetInstanceType(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const ConnectionObjectInstanceType instance_type);
 
 CipUsint ConnectionObjectGetInstanceTypeForAttribute(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectTransportClassTriggerDirection
 ConnectionObjectGetTransportClassTriggerDirection(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectTransportClassTriggerProductionTrigger
 ConnectionObjectGetTransportClassTriggerProductionTrigger(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectTransportClassTriggerTransportClass
 ConnectionObjectGetTransportClassTriggerTransportClass(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 CipUint ConnectionObjectGetProducedConnectionSize(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetProducedConnectionSize(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint produced_connection_size);
 
 CipUint ConnectionObjectGetConsumedConnectionSize(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetConsumedConnectionSize(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint consumed_connection_size);
 
 CipUint ConnectionObjectGetExpectedPacketRate(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 CipUint ConnectionObjectGetRequestedPacketInterval(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 /**
  * @brief Sets the expected packet rate according to the rules of the CIP
@@ -343,153 +343,153 @@ CipUint ConnectionObjectGetRequestedPacketInterval(
  * to the next serviceable increment, relative to the timer resolution
  */
 void ConnectionObjectSetExpectedPacketRate(
-    CipConnectionObject *const connection_object);
+    CipConnectionObject* const connection_object);
 
 CipUdint ConnectionObjectGetCipProducedConnectionID(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetCipProducedConnectionID(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUdint cip_produced_connection_id);
 
 CipUdint ConnectionObjectGetCipConsumedConnectionID(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetCipConsumedConnectionID(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUdint cip_consumed_connection_id);
 
 ConnectionObjectWatchdogTimeoutAction ConnectionObjectGetWatchdogTimeoutAction(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetWatchdogTimeoutAction(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUsint watchdog_timeout_action);
 
 CipUint ConnectionObjectGetProducedConnectionPathLength(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetProducedConnectionPathLength(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint produced_connection_path_length);
 
 CipUint ConnectionObjectGetConsumedConnectionPathLength(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetConsumedConnectionPathLength(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint consumed_connection_path_length);
 
 CipUint ConnectionObjectGetProductionInhibitTime(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetProductionInhibitTime(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUint production_inhibit_time);
 
 CipUsint ConnectionObjectGetConnectionTimeoutMultiplier(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetConnectionTimeoutMultiplier(
-    CipConnectionObject *const connection_object,
+    CipConnectionObject* const connection_object,
     const CipUsint connection_timeout_multiplier);
 
 void ConnectionObjectResetInactivityWatchdogTimerValue(
-    CipConnectionObject *const connection_object);
+    CipConnectionObject* const connection_object);
 
 void ConnectionObjectResetLastPackageInactivityTimerValue(
-    CipConnectionObject *const connection_object);
+    CipConnectionObject* const connection_object);
 
 CipUint ConnectionObjectGetConnectionSerialNumber(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetConnectionSerialNumber(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipUint connection_serial_number);
 
 CipUint ConnectionObjectGetOriginatorVendorId(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetOriginatorVendorId(
-    CipConnectionObject *connection_object, const CipUint vendor_id);
+    CipConnectionObject* connection_object, const CipUint vendor_id);
 
 CipUdint ConnectionObjectGetOriginatorSerialNumber(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetOriginatorSerialNumber(
-    CipConnectionObject *connection_object, CipUdint originator_serial_number);
+    CipConnectionObject* connection_object, CipUdint originator_serial_number);
 
-void ConnectionObjectGetConnectionNumber(CipConnectionObject *connection_object,
+void ConnectionObjectGetConnectionNumber(CipConnectionObject* connection_object,
                                          const CipUint connection_number);
 
 void ConnectionObjectSetConnectionNumber(
-    CipConnectionObject *connection_object);
+    CipConnectionObject* connection_object);
 
 CipUint GenerateRandomConnectionNumber(void);
 
 CipUdint ConnectionObjectGetOToTRequestedPacketInterval(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetOToTRequestedPacketInterval(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipUdint requested_packet_interval);
 
 bool ConnectionObjectIsOToTRedundantOwner(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectConnectionType ConnectionObjectGetOToTConnectionType(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectPriority ConnectionObjectGetOToTPriority(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectConnectionSizeType ConnectionObjectGetOToTConnectionSizeType(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 size_t ConnectionObjectGetOToTConnectionSize(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 /* T to O */
 CipUdint ConnectionObjectGetTToORequestedPacketInterval(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void ConnectionObjectSetTToORequestedPacketInterval(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipUdint requested_packet_interval);
 
 void ConnectionObjectSetTToONetworkConnectionParameters(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipDword connection_parameters);
 
 void ConnectionObjectSetOToTNetworkConnectionParameters(
-    CipConnectionObject *connection_object,
+    CipConnectionObject* connection_object,
     const CipDword connection_parameters);
 
 bool ConnectionObjectIsTToORedundantOwner(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectConnectionType ConnectionObjectGetTToOConnectionType(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectPriority ConnectionObjectGetTToOPriority(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 ConnectionObjectConnectionSizeType ConnectionObjectGetTToOConnectionSizeType(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 size_t ConnectionObjectGetTToOConnectionSize(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 /** @brief Copy the given connection data from source to destination
  *
  * @param destination Destination of the copy operation
  * @param source Source of the copy operation
  */
-void ConnectionObjectDeepCopy(CipConnectionObject *RESTRICT destination,
-                              const CipConnectionObject *RESTRICT const source);
+void ConnectionObjectDeepCopy(CipConnectionObject* RESTRICT destination,
+                              const CipConnectionObject* RESTRICT const source);
 
 void ConnectionObjectResetProductionInhibitTimer(
-    CipConnectionObject *const connection_object);
+    CipConnectionObject* const connection_object);
 
 /** @brief Generate the ConnectionIDs and set the general configuration
  * parameter in the given connection object.
@@ -498,22 +498,22 @@ void ConnectionObjectResetProductionInhibitTimer(
  * up.
  */
 void ConnectionObjectGeneralConfiguration(
-    CipConnectionObject *const connection_object);
+    CipConnectionObject* const connection_object);
 
 bool ConnectionObjectIsTypeNonLOIOConnection(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 bool ConnectionObjectIsTypeIOConnection(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
-bool ConnectionObjectEqualOriginator(const CipConnectionObject *const object1,
-                                     const CipConnectionObject *const object2);
+bool ConnectionObjectEqualOriginator(const CipConnectionObject* const object1,
+                                     const CipConnectionObject* const object2);
 
-bool EqualConnectionTriad(const CipConnectionObject *const object1,
-                          const CipConnectionObject *const object2);
+bool EqualConnectionTriad(const CipConnectionObject* const object1,
+                          const CipConnectionObject* const object2);
 
 bool CipConnectionObjectOriginatorHasSameIP(
-    const CipConnectionObject *const connection_object,
-    const struct sockaddr *const originator_address);
+    const CipConnectionObject* const connection_object,
+    const struct sockaddr* const originator_address);
 
 #endif /* SRC_CIP_CIPCONNECTIONOBJECT_H_ */

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

@@ -92,8 +92,8 @@ CipDlrObject g_dlr; /**< definition of DLR object instance 1 data */
 /* ********************************************************************
  * local functions
  */
-static void EncodeCipRingSupervisorConfig(const void *const data,
-                                          ENIPMessage *const outgoing_message) {
+static void EncodeCipRingSupervisorConfig(const void* const data,
+                                          ENIPMessage* const outgoing_message) {
   /* Suppress unused parameter compiler warning. */
   (void)data;
 
@@ -102,9 +102,9 @@ static void EncodeCipRingSupervisorConfig(const void *const data,
       0, kRingSupStructSize, outgoing_message);
 }
 
-static void EncodeCipNodeAddress(const void *const data,
-                                 ENIPMessage *const outgoing_message) {
-  CipNodeAddress *node_address = (CipNodeAddress *)data;
+static void EncodeCipNodeAddress(const void* const data,
+                                 ENIPMessage* const outgoing_message) {
+  CipNodeAddress* node_address = (CipNodeAddress*)data;
   EncodeCipUdint(&node_address->device_ip, outgoing_message);
   EncodeCipEthernetLinkPhyisicalAddress(&node_address->device_mac,
                                         outgoing_message);
@@ -114,7 +114,7 @@ static void EncodeCipNodeAddress(const void *const data,
  * public functions
  */
 EipStatus CipDlrInit(void) {
-  CipClass *dlr_class = NULL;
+  CipClass* dlr_class = NULL;
 
   dlr_class = CreateCipClass(kCipDlrClassCode,
                              0,     /* # class attributes */
@@ -140,7 +140,7 @@ EipStatus CipDlrInit(void) {
       dlr_class, kGetAttributeAll, GetAttributeAll, "GetAttributeAll");
 
   /* Bind attributes to the instance */
-  CipInstance *dlr_instance = GetCipInstance(dlr_class, 1u);
+  CipInstance* dlr_instance = GetCipInstance(dlr_class, 1u);
 
   InsertAttribute(dlr_instance,
                   1,
@@ -161,42 +161,42 @@ EipStatus CipDlrInit(void) {
                   kCipUsint,
                   EncodeCipUsint,
                   NULL,
-                  (void *)&s_0xFF_default,
+                  (void*)&s_0xFF_default,
                   kGetableAll);
   InsertAttribute(dlr_instance,
                   4,
                   kCipAny,
                   EncodeCipRingSupervisorConfig,
                   NULL,
-                  (void *)&s_0x00000000_default,
+                  (void*)&s_0x00000000_default,
                   kGetableAllDummy);
   InsertAttribute(dlr_instance,
                   5,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&s_0x0000_default,
+                  (void*)&s_0x0000_default,
                   kGetableAll);
   InsertAttribute(dlr_instance,
                   6,
                   kCipAny,
                   EncodeCipNodeAddress,
                   NULL,
-                  (void *)&s_zero_node,
+                  (void*)&s_zero_node,
                   kGetableAll);
   InsertAttribute(dlr_instance,
                   7,
                   kCipAny,
                   EncodeCipNodeAddress,
                   NULL,
-                  (void *)&s_zero_node,
+                  (void*)&s_zero_node,
                   kGetableAll);
   InsertAttribute(dlr_instance,
                   8,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&s_0xFFFF_default,
+                  (void*)&s_0xFFFF_default,
                   kGetableAll);
   /* Attribute #9 is not implemented and also NOT part of the GetAttributesAll
    *  response. Therefore it is not added here! */
@@ -212,7 +212,7 @@ EipStatus CipDlrInit(void) {
                   kCipUsint,
                   EncodeCipUsint,
                   NULL,
-                  (void *)&s_0x00_default,
+                  (void*)&s_0x00_default,
                   kGetableAll);
   InsertAttribute(dlr_instance,
                   12,

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

@@ -8,22 +8,22 @@
 
 #include <stdlib.h>
 
-void ElectronicKeySetKeyFormat(CipElectronicKey *const electronic_key,
+void ElectronicKeySetKeyFormat(CipElectronicKey* const electronic_key,
                                const CipUsint key_format) {
   electronic_key->key_format = key_format;
 }
 
 CipUint ElectronicKeyGetKeyFormat(
-    const CipElectronicKey *const electronic_key) {
+    const CipElectronicKey* const electronic_key) {
   return electronic_key->key_format;
 }
 
-void ElectronicKeySetKeyData(CipElectronicKey *const electronic_key,
-                             void *key_data) {
+void ElectronicKeySetKeyData(CipElectronicKey* const electronic_key,
+                             void* key_data) {
   electronic_key->key_data = key_data;
 }
 
-void *ElectronicKeyGetKeyData(const CipElectronicKey *const electronic_key) {
+void* ElectronicKeyGetKeyData(const CipElectronicKey* const electronic_key) {
   return electronic_key->key_data;
 }
 
@@ -37,59 +37,59 @@ typedef struct electronic_key_format_4 {
 
 const size_t kElectronicKeyFormat4Size = sizeof(ElectronicKeyFormat4);
 
-ElectronicKeyFormat4 *ElectronicKeyFormat4New() {
-  return (ElectronicKeyFormat4 *)calloc(1, sizeof(ElectronicKeyFormat4));
+ElectronicKeyFormat4* ElectronicKeyFormat4New() {
+  return (ElectronicKeyFormat4*)calloc(1, sizeof(ElectronicKeyFormat4));
 }
 
-void ElectronicKeyFormat4Delete(ElectronicKeyFormat4 **electronic_key) {
+void ElectronicKeyFormat4Delete(ElectronicKeyFormat4** electronic_key) {
   free(*electronic_key);
   *electronic_key = NULL;
 }
 
-void ElectronicKeyFormat4SetVendorId(ElectronicKeyFormat4 *const electronic_key,
+void ElectronicKeyFormat4SetVendorId(ElectronicKeyFormat4* const electronic_key,
                                      const CipUint vendor_id) {
   electronic_key->vendor_id = vendor_id;
 }
 
 CipUint ElectronicKeyFormat4GetVendorId(
-    const ElectronicKeyFormat4 *const electronic_key) {
+    const ElectronicKeyFormat4* const electronic_key) {
   return electronic_key->vendor_id;
 }
 
 void ElectronicKeyFormat4SetDeviceType(
-    ElectronicKeyFormat4 *const electronic_key, const CipUint device_type) {
+    ElectronicKeyFormat4* const electronic_key, const CipUint device_type) {
   electronic_key->device_type = device_type;
 }
 
 CipUint ElectronicKeyFormat4GetDeviceType(
-    const ElectronicKeyFormat4 *const electronic_key) {
+    const ElectronicKeyFormat4* const electronic_key) {
   return electronic_key->device_type;
 }
 
 void ElectronicKeyFormat4SetProductCode(
-    ElectronicKeyFormat4 *const electronic_key, const CipUint product_code) {
+    ElectronicKeyFormat4* const electronic_key, const CipUint product_code) {
   electronic_key->product_code = product_code;
 }
 
 CipUint ElectronicKeyFormat4GetProductCode(
-    const ElectronicKeyFormat4 *const electronic_key) {
+    const ElectronicKeyFormat4* const electronic_key) {
   return electronic_key->product_code;
 }
 
 void ElectronicKeyFormat4SetMajorRevisionCompatibility(
-    ElectronicKeyFormat4 *const electronic_key,
+    ElectronicKeyFormat4* const electronic_key,
     const CipByte major_revision_compatibility) {
   electronic_key->major_revision_compatibility = major_revision_compatibility;
 }
 
 CipByte ElectronicKeyFormat4GetMajorRevision(
-    const ElectronicKeyFormat4 *const electronic_key) {
+    const ElectronicKeyFormat4* const electronic_key) {
   const CipByte kMajorRevisionMask = 0x7F;
   return (electronic_key->major_revision_compatibility & kMajorRevisionMask);
 }
 
 bool ElectronicKeyFormat4GetMajorRevisionCompatibility(
-    const ElectronicKeyFormat4 *const electronic_key) {
+    const ElectronicKeyFormat4* const electronic_key) {
   const CipByte kCompatibilityMask = 0x80;
   if (kCompatibilityMask ==
       (electronic_key->major_revision_compatibility & kCompatibilityMask)) {
@@ -99,11 +99,11 @@ bool ElectronicKeyFormat4GetMajorRevisionCompatibility(
 }
 
 void ElectronicKeyFormat4SetMinorRevision(
-    ElectronicKeyFormat4 *const electronic_key, const CipUsint minor_revision) {
+    ElectronicKeyFormat4* const electronic_key, const CipUsint minor_revision) {
   electronic_key->minor_revision = minor_revision;
 }
 
 CipUsint ElectronicKeyFormat4GetMinorRevision(
-    const ElectronicKeyFormat4 *const electronic_key) {
+    const ElectronicKeyFormat4* const electronic_key) {
   return electronic_key->minor_revision;
 }

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

@@ -17,25 +17,25 @@
 typedef struct {
   CipUsint key_format; /**< Key Format 0-3 reserved, 4 = see Key Format Table,
                           5-255 = Reserved */
-  void *key_data;      /**< Depends on key format used, usually Key Format 4 as
+  void* key_data;      /**< Depends on key format used, usually Key Format 4 as
                                specified in CIP Specification, Volume 1*/
 } CipElectronicKey;
 
-void ElectronicKeySetSegmentType(CipElectronicKey *const electronic_key,
+void ElectronicKeySetSegmentType(CipElectronicKey* const electronic_key,
                                  const CipUsint segment_type);
 
 CipUsint ElectronicKeyGetSegmentType(
-    const CipElectronicKey *const electronic_key);
+    const CipElectronicKey* const electronic_key);
 
-void ElectronicKeySetKeyFormat(CipElectronicKey *const electronic_key,
+void ElectronicKeySetKeyFormat(CipElectronicKey* const electronic_key,
                                const CipUsint key_format);
 
-CipUint ElectronicKeyGetKeyFormat(const CipElectronicKey *const electronic_key);
+CipUint ElectronicKeyGetKeyFormat(const CipElectronicKey* const electronic_key);
 
-void ElectronicKeySetKeyData(CipElectronicKey *const electronic_key,
-                             void *key_data);
+void ElectronicKeySetKeyData(CipElectronicKey* const electronic_key,
+                             void* key_data);
 
-void *ElectronicKeyGetKeyData(const CipElectronicKey *const electronic_key);
+void* ElectronicKeyGetKeyData(const CipElectronicKey* const electronic_key);
 
 /** @brief Declaration of the electronic key format 4 data struct for the class
  *
@@ -48,20 +48,20 @@ extern const size_t kElectronicKeyFormat4Size;
  *
  *	@return A new unset electronic key
  */
-ElectronicKeyFormat4 *ElectronicKeyFormat4New();
+ElectronicKeyFormat4* ElectronicKeyFormat4New();
 
 /** @brief Destructor for the electroic key format 4 class
  *
  *  Safe destructor/free, nulls the pointer after freeing it
  *  @param electronic_key A format 4 electronic key
  */
-void ElectronicKeyFormat4Delete(ElectronicKeyFormat4 **electronic_key);
+void ElectronicKeyFormat4Delete(ElectronicKeyFormat4** electronic_key);
 
 /** @brief Sets vendor ID in the electronic key
  *  @param electronic_key The electronic key to be set - will be modified
  *	@param vendor_id The vendor ID to be set into the electronic key
  */
-void ElectronicKeyFormat4SetVendorId(ElectronicKeyFormat4 *const electronic_key,
+void ElectronicKeyFormat4SetVendorId(ElectronicKeyFormat4* const electronic_key,
                                      const CipUint vendor_id);
 
 /** @brief Gets the vendor ID form the electronic key
@@ -71,7 +71,7 @@ void ElectronicKeyFormat4SetVendorId(ElectronicKeyFormat4 *const electronic_key,
  *      @return The vendor ID
  */
 CipUint ElectronicKeyFormat4GetVendorId(
-    const ElectronicKeyFormat4 *const electronic_key);
+    const ElectronicKeyFormat4* const electronic_key);
 
 /** @brief Sets the device type in the electronic key
  *
@@ -80,7 +80,7 @@ CipUint ElectronicKeyFormat4GetVendorId(
  *electronic key
  */
 void ElectronicKeyFormat4SetDeviceType(
-    ElectronicKeyFormat4 *const electronic_key, const CipUint device_type);
+    ElectronicKeyFormat4* const electronic_key, const CipUint device_type);
 
 /** @brief Gets the device type from a format 4 electronic key
  *
@@ -89,7 +89,7 @@ void ElectronicKeyFormat4SetDeviceType(
  *      @return The device type
  */
 CipUint ElectronicKeyFormat4GetDeviceType(
-    const ElectronicKeyFormat4 *const electronic_key);
+    const ElectronicKeyFormat4* const electronic_key);
 
 /** @brief Set product code in the electronic key
  *
@@ -97,7 +97,7 @@ CipUint ElectronicKeyFormat4GetDeviceType(
  *      @param product_code The product code to be inserted
  */
 void ElectronicKeyFormat4SetProductCode(
-    ElectronicKeyFormat4 *const electronic_key, const CipUint product_code);
+    ElectronicKeyFormat4* const electronic_key, const CipUint product_code);
 
 /** @brief Gets the product code from an format 4 electronic key
  *
@@ -105,7 +105,7 @@ void ElectronicKeyFormat4SetProductCode(
  *      @return The product code
  */
 CipUint ElectronicKeyFormat4GetProductCode(
-    const ElectronicKeyFormat4 *const electronic_key);
+    const ElectronicKeyFormat4* const electronic_key);
 
 /** @brief Sets the major revision byte including the compatibility flag
  *
@@ -114,7 +114,7 @@ CipUint ElectronicKeyFormat4GetProductCode(
  *      @param electronic_key The electronic key to be modified
  */
 void ElectronicKeyFormat4SetMajorRevisionCompatibility(
-    ElectronicKeyFormat4 *const electronic_key,
+    ElectronicKeyFormat4* const electronic_key,
     const CipByte major_revision_compatibility);
 
 /** @brief Gets the major revision from an format 4 electronic key
@@ -123,7 +123,7 @@ void ElectronicKeyFormat4SetMajorRevisionCompatibility(
  *      @return The device's major revision
  */
 CipByte ElectronicKeyFormat4GetMajorRevision(
-    const ElectronicKeyFormat4 *const electronic_key);
+    const ElectronicKeyFormat4* const electronic_key);
 
 /** @brief Gets the Compatibility flag from the format 4 electronic key
  *
@@ -131,7 +131,7 @@ CipByte ElectronicKeyFormat4GetMajorRevision(
  *      @return True if compatibility bit is set, false if otherwise
  */
 bool ElectronicKeyFormat4GetMajorRevisionCompatibility(
-    const ElectronicKeyFormat4 *const electronic_key);
+    const ElectronicKeyFormat4* const electronic_key);
 
 /** @brief Sets the devices minor revision in an format 4 electronic key
  *
@@ -139,7 +139,7 @@ bool ElectronicKeyFormat4GetMajorRevisionCompatibility(
  *      @param electronic_key The electronic key to be modified
  */
 void ElectronicKeyFormat4SetMinorRevision(
-    ElectronicKeyFormat4 *const electronic_key, const CipUsint minor_revision);
+    ElectronicKeyFormat4* const electronic_key, const CipUsint minor_revision);
 
 /** @brief Gets the minor revision from an format 4 electronic key
  *
@@ -147,6 +147,6 @@ void ElectronicKeyFormat4SetMinorRevision(
  *      @return The device's minor revision
  */
 CipUsint ElectronicKeyFormat4GetMinorRevision(
-    const ElectronicKeyFormat4 *const electronic_key);
+    const ElectronicKeyFormat4* const electronic_key);
 
 #endif /* SRC_CIP_CIPELECTRONICKEY_H_ */

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

@@ -19,7 +19,7 @@ const unsigned int kPortSegmentExtendedPort =
            extended port field */
 
 /*** Path Segment ***/
-SegmentType GetPathSegmentType(const CipOctet *const cip_path) {
+SegmentType GetPathSegmentType(const CipOctet* const cip_path) {
   const unsigned int kSegmentTypeMask = 0xE0;
   const unsigned int segment_type     = *cip_path & kSegmentTypeMask;
   SegmentType result                  = kSegmentTypeInvalid;
@@ -57,7 +57,7 @@ SegmentType GetPathSegmentType(const CipOctet *const cip_path) {
 }
 
 void SetPathSegmentType(SegmentType segment_type,
-                        unsigned char *const cip_path) {
+                        unsigned char* const cip_path) {
   switch (segment_type) {
     case kSegmentTypePortSegment:
       *cip_path = SEGMENT_TYPE_PORT_SEGMENT;
@@ -93,7 +93,7 @@ void SetPathSegmentType(SegmentType segment_type,
 
 /*** Port Segment ***/
 bool GetPathPortSegmentExtendedLinkAddressSizeBit(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   const unsigned int kExtendedLinkAddressSizeMask = 0x10;
   if (kExtendedLinkAddressSizeMask ==
       (*cip_path & kExtendedLinkAddressSizeMask)) {
@@ -103,7 +103,7 @@ bool GetPathPortSegmentExtendedLinkAddressSizeBit(
 }
 
 unsigned int GetPathPortSegmentPortIdentifier(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   const unsigned int kPortIdentifierMask = 0x0F;
   unsigned int port_identifier           = *cip_path & kPortIdentifierMask;
 
@@ -114,7 +114,7 @@ unsigned int GetPathPortSegmentPortIdentifier(
 }
 
 void SetPathPortSegmentPortIdentifier(const unsigned int port_identifier,
-                                      unsigned char *const cip_path) {
+                                      unsigned char* const cip_path) {
   /* OPENER_ASSERT(
      port_identifier < 16,
      "Port identifier too large for standard port identifier field\n"); */
@@ -123,7 +123,7 @@ void SetPathPortSegmentPortIdentifier(const unsigned int port_identifier,
 }
 
 unsigned int GetPathPortSegmentLinkAddressSize(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   /*  OPENER_ASSERT(false ==
      GetPathPortSegmentExtendedLinkAddressSizeBit(cip_path), "Call to non
      existent extended link address size\n"); */
@@ -132,7 +132,7 @@ unsigned int GetPathPortSegmentLinkAddressSize(
 }
 
 unsigned int GetPathPortSegmentExtendedPortNumber(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   /*  OPENER_ASSERT(kPortSegmentExtendedPort ==
      GetPathPortSegmentPortIdentifier(cip_path), "There is no extended port
      available!\n");*/
@@ -145,7 +145,7 @@ unsigned int GetPathPortSegmentExtendedPortNumber(
 }
 
 void SetPathPortSegmentExtendedPortIdentifier(
-    const unsigned int extended_port_identifier, CipOctet *const cip_path) {
+    const unsigned int extended_port_identifier, CipOctet* const cip_path) {
   SetPathPortSegmentPortIdentifier(kPortSegmentExtendedPort, cip_path);
   const unsigned int kExtendedPortSegmentPosition =
       GetPathPortSegmentExtendedLinkAddressSizeBit(cip_path) == true ? 2 : 1;
@@ -159,7 +159,7 @@ void SetPathPortSegmentExtendedPortIdentifier(
 /*** Logical Segment ***/
 
 LogicalSegmentLogicalType GetPathLogicalSegmentLogicalType(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   OPENER_ASSERT(kSegmentTypeLogicalSegment == GetPathSegmentType(cip_path));
   const unsigned int kLogicalTypeMask = 0x1C;
   const unsigned int logical_type     = (*cip_path) & kLogicalTypeMask;
@@ -197,7 +197,7 @@ LogicalSegmentLogicalType GetPathLogicalSegmentLogicalType(
 }
 
 void SetPathLogicalSegmentLogicalType(LogicalSegmentLogicalType logical_type,
-                                      CipOctet *const cip_path) {
+                                      CipOctet* const cip_path) {
   OPENER_ASSERT(kSegmentTypeLogicalSegment == GetPathSegmentType(cip_path));
   switch (logical_type) {
     case kLogicalSegmentLogicalTypeClassId:
@@ -234,7 +234,7 @@ void SetPathLogicalSegmentLogicalType(LogicalSegmentLogicalType logical_type,
 }
 
 LogicalSegmentLogicalFormat GetPathLogicalSegmentLogicalFormat(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   OPENER_ASSERT(kSegmentTypeLogicalSegment == GetPathSegmentType(cip_path));
   const unsigned int kLogicalFormatMask = 0x03;
   const unsigned int logical_format     = (*cip_path) & kLogicalFormatMask;
@@ -258,9 +258,9 @@ LogicalSegmentLogicalFormat GetPathLogicalSegmentLogicalFormat(
 }
 
 void SetPathLogicalSegmentLogicalFormat(LogicalSegmentLogicalFormat format,
-                                        CipOctet *const cip_path) {
+                                        CipOctet* const cip_path) {
   OPENER_ASSERT(kSegmentTypeLogicalSegment ==
-                GetPathSegmentType((const CipOctet *)cip_path));
+                GetPathSegmentType((const CipOctet*)cip_path));
   switch (format) {
     case kLogicalSegmentLogicalFormatEightBit:
       (*cip_path) |= LOGICAL_SEGMENT_FORMAT_EIGHT_BIT;
@@ -279,7 +279,7 @@ void SetPathLogicalSegmentLogicalFormat(LogicalSegmentLogicalFormat format,
   }
 }
 
-CipDword CipEpathGetLogicalValue(const EipUint8 **message) {
+CipDword CipEpathGetLogicalValue(const EipUint8** message) {
   LogicalSegmentLogicalFormat logical_format =
       GetPathLogicalSegmentLogicalFormat(*message);
   CipDword data = kLogicalSegmentLogicalFormatInvalid;
@@ -306,7 +306,7 @@ CipDword CipEpathGetLogicalValue(const EipUint8 **message) {
 
 void CipEpathSetLogicalValue(const CipDword logical_value,
                              const LogicalSegmentLogicalFormat logical_format,
-                             CipMessageRouterResponse *const message) {
+                             CipMessageRouterResponse* const message) {
   switch (logical_format) {
     case kLogicalSegmentLogicalFormatEightBit:
       OPENER_ASSERT(
@@ -332,7 +332,7 @@ void CipEpathSetLogicalValue(const CipDword logical_value,
 }
 
 LogicalSegmentExtendedLogicalType GetPathLogicalSegmentExtendedLogicalType(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   /*  OPENER_ASSERT(LOGICAL_SEGMENT_TYPE_EXTENDED_kLogicalSegmentLogicalTypeExtendedLogicalMessageValue
      == GetPathLogicalSegmentLogicalType(cip_path), "Trying to extract
      non-existent extended logical type") */
@@ -372,7 +372,7 @@ LogicalSegmentExtendedLogicalType GetPathLogicalSegmentExtendedLogicalType(
 
 LogicalSegmentSpecialTypeLogicalFormat
 GetPathLogicalSegmentSpecialTypeLogicalType(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   /*  OPENER_ASSERT(kSegmentTypeLogicalSegment == GetPathSegmentType(cip_path),
    * "Not a logical segment!\n") */
   OPENER_ASSERT(kSegmentTypeLogicalSegment == GetPathSegmentType(cip_path));
@@ -395,7 +395,7 @@ GetPathLogicalSegmentSpecialTypeLogicalType(
 }
 
 ElectronicKeySegmentFormat GetPathLogicalSegmentElectronicKeyFormat(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   /*  OPENER_ASSERT(kLogicalSegmentSpecialTypeLogicalFormatElectronicKey ==
      GetPathLogicalSegmentSpecialTypeLogicalType(cip_path), "Not an electronic
      key!\n") */
@@ -413,8 +413,8 @@ ElectronicKeySegmentFormat GetPathLogicalSegmentElectronicKeyFormat(
   return result;
 }
 
-void GetElectronicKeyFormat4FromMessage(const CipOctet **const message,
-                                        ElectronicKeyFormat4 *key) {
+void GetElectronicKeyFormat4FromMessage(const CipOctet** const message,
+                                        ElectronicKeyFormat4* key) {
   OPENER_ASSERT(kElectronicKeySegmentFormatKeyFormat4 ==
                 GetPathLogicalSegmentElectronicKeyFormat(*message));
 
@@ -437,7 +437,7 @@ void GetElectronicKeyFormat4FromMessage(const CipOctet **const message,
  *  @return The Network Segment subtype of the EPath
  */
 NetworkSegmentSubtype GetPathNetworkSegmentSubtype(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   OPENER_ASSERT(kSegmentTypeNetworkSegment == GetPathSegmentType(cip_path));
   const unsigned int kSubtypeMask = 0x1F;
   const unsigned int subtype      = (*cip_path) & kSubtypeMask;
@@ -476,7 +476,7 @@ NetworkSegmentSubtype GetPathNetworkSegmentSubtype(
  * @return the Production Inhibit Time in milliseconds ranging from 0 to 255
  */
 CipUsint GetPathNetworkSegmentProductionInhibitTimeInMilliseconds(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   /*  OPENER_ASSERT(kSegmentTypeNetworkSegment ==
      GetPathSegmentType(cip_path),"Not a network segment!\n")
      OPENER_ASSERT(kNetworkSegmentSubtypeProductionInhibitTimeInMilliseconds ==
@@ -496,7 +496,7 @@ CipUsint GetPathNetworkSegmentProductionInhibitTimeInMilliseconds(
  * 4294967295
  */
 CipUdint GetPathNetworkSegmentProductionInhibitTimeInMicroseconds(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   /*  OPENER_ASSERT(kSegmentTypeNetworkSegment ==
      GetPathSegmentType(cip_path),"Not a network segment!\n")
      OPENER_ASSERT(kNetworkSegmentSubtypeProductionInhibitTimeInMicroseconds ==
@@ -509,7 +509,7 @@ CipUdint GetPathNetworkSegmentProductionInhibitTimeInMicroseconds(
                 GetPathNetworkSegmentSubtype(cip_path));
   OPENER_ASSERT(2 == *(cip_path + 1));
 
-  const unsigned char *message_runner = cip_path + 2;
+  const unsigned char* message_runner = cip_path + 2;
   return GetUdintFromMessage(&message_runner);
 }
 
@@ -518,7 +518,7 @@ CipUdint GetPathNetworkSegmentProductionInhibitTimeInMicroseconds(
 /*** Symbolic Segment ***/
 
 SymbolicSegmentFormat GetPathSymbolicSegmentFormat(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   const unsigned int kSymbolicSegmentFormatMask = 0x1F;
   if (SYMBOLIC_SEGMENT_FORMAT_EXTENDED_STRING ==
       (*cip_path & kSymbolicSegmentFormatMask)) {
@@ -528,7 +528,7 @@ SymbolicSegmentFormat GetPathSymbolicSegmentFormat(
 }
 
 unsigned int GetPathSymbolicSegmentASCIIFormatLength(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   const unsigned int kSymbolicSegmentASCIIFormatLength = 0x1F;
   const unsigned int length = *cip_path & kSymbolicSegmentASCIIFormatLength;
   OPENER_ASSERT(0 != length);
@@ -536,7 +536,7 @@ unsigned int GetPathSymbolicSegmentASCIIFormatLength(
 }
 
 SymbolicSegmentExtendedFormat GetPathSymbolicSegmentNumericType(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   const unsigned int kSymbolicSegmentExtendedFormatNumericTypeMask = 0x1F;
   const unsigned int numeric_subtype =
       *(cip_path + 1) & kSymbolicSegmentExtendedFormatNumericTypeMask;
@@ -559,7 +559,7 @@ SymbolicSegmentExtendedFormat GetPathSymbolicSegmentNumericType(
 }
 
 SymbolicSegmentExtendedFormat GetPathSymbolicSegmentExtendedFormat(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   OPENER_ASSERT(kSegmentTypeSymbolicSegment == GetPathSegmentType(cip_path));
   OPENER_ASSERT(kSymbolicSegmentFormatExtendedString ==
                 GetPathSymbolicSegmentFormat(cip_path));
@@ -589,7 +589,7 @@ SymbolicSegmentExtendedFormat GetPathSymbolicSegmentExtendedFormat(
 /*** Data Segment ***/
 
 DataSegmentSubtype GetPathDataSegmentSubtype(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   const unsigned int kDataSegmentSubtypeMask = 0x1F;
   const unsigned int data_subtype = (*cip_path) & kDataSegmentSubtypeMask;
 
@@ -614,7 +614,7 @@ DataSegmentSubtype GetPathDataSegmentSubtype(
  * @return The amount of 16-bit words of data in the EPath
  */
 CipUsint GetPathDataSegmentSimpleDataWordLength(
-    const unsigned char *const cip_path) {
+    const unsigned char* const cip_path) {
   /*  OPENER_ASSERT(kSegmentTypeDataSegment == GetPathSegmentType(cip_path),"Not
      a data segment!\n"); OPENER_ASSERT(kDataSegmentSubtypeSimpleData ==
      GetPathDataSegmentSubtype(cip_path), "Not a simple data segment!\n") */
@@ -622,7 +622,7 @@ CipUsint GetPathDataSegmentSimpleDataWordLength(
   OPENER_ASSERT(kDataSegmentSubtypeSimpleData ==
                 GetPathDataSegmentSubtype(cip_path));
 
-  const unsigned char *message_runner = cip_path + 1;
+  const unsigned char* message_runner = cip_path + 1;
   return GetUsintFromMessage(&message_runner);
 }
 
@@ -694,9 +694,9 @@ LogicalSegmentLogicalFormat CipEpathGetNeededLogicalFormatForValue(
 //   return encoded_path_length += 1;
 // }
 
-bool CipEpathEqual(const CipOctet *const path1,
+bool CipEpathEqual(const CipOctet* const path1,
                    const CipUint path1_length,
-                   const CipOctet *const path2,
+                   const CipOctet* const path2,
                    const CipUint path2_length) {
   if (path1_length != path2_length) {
     return false;

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

@@ -245,7 +245,7 @@ typedef struct connection_path_epath {
  * @param cip_path The start of the EPath message
  * @return The basic segment type
  */
-SegmentType GetPathSegmentType(const CipOctet *const cip_path);
+SegmentType GetPathSegmentType(const CipOctet* const cip_path);
 
 /** @brief Sets the basic segment type of an CIP EPath to be sent
  *
@@ -253,7 +253,7 @@ SegmentType GetPathSegmentType(const CipOctet *const cip_path);
  * @param cip_path A message buffer - Will be written on!
  */
 void SetPathSegmentType(SegmentType segment_type,
-                        unsigned char *const cip_path);
+                        unsigned char* const cip_path);
 
 /*********************************************************
  * Port Segment functions
@@ -266,7 +266,7 @@ void SetPathSegmentType(SegmentType segment_type,
  * @return True if extended link addres size bit set, false otherwise
  */
 bool GetPathPortSegmentExtendedLinkAddressSizeBit(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Only to be used on Port Segments. Returns the Port Identifier
  *
@@ -274,7 +274,7 @@ bool GetPathPortSegmentExtendedLinkAddressSizeBit(
  * @return The Port Identifier
  */
 unsigned int GetPathPortSegmentPortIdentifier(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Sets the Port Identifier form an Port Segment EPath to be sent.
  *
@@ -282,7 +282,7 @@ unsigned int GetPathPortSegmentPortIdentifier(
  * @param cip_path A message buffer - Will be written on!
  */
 void SetPathPortSegmentPortIdentifier(const unsigned int port_identifier,
-                                      unsigned char *const cip_path);
+                                      unsigned char* const cip_path);
 
 /** @brief Only to be used on Port Segments. Gets the Link Address Size
  *
@@ -290,7 +290,7 @@ void SetPathPortSegmentPortIdentifier(const unsigned int port_identifier,
  * @return The Link Address Size
  */
 unsigned int GetPathPortSegmentLinkAddressSize(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Only to be used on Port Segments with Extended Port Number. Gets the
  * Extended Port Number
@@ -299,7 +299,7 @@ unsigned int GetPathPortSegmentLinkAddressSize(
  * @return The Link Address Size
  */
 unsigned int GetPathPortSegmentExtendedPortNumber(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Sets the Extended Port Identifier in a EPath Port Segment message
  *
@@ -308,7 +308,7 @@ unsigned int GetPathPortSegmentExtendedPortNumber(
  * @param cip_path The start for the EPatch message
  */
 void SetPathPortSegmentExtendedPortIdentifier(
-    const unsigned int extended_port_identifier, CipOctet *const cip_path);
+    const unsigned int extended_port_identifier, CipOctet* const cip_path);
 
 /** @brief Gets the Logical Type of an EPath Logical Segment message
  *
@@ -316,10 +316,10 @@ void SetPathPortSegmentExtendedPortIdentifier(
  * @return The logical type of the logical segment
  */
 LogicalSegmentLogicalType GetPathLogicalSegmentLogicalType(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 void SetPathLogicalSegmentLogicalType(LogicalSegmentLogicalType logical_type,
-                                      CipOctet *const cip_path);
+                                      CipOctet* const cip_path);
 
 /** @brief Gets the Logical Format of a Logical Segment EPath message
  *
@@ -327,16 +327,16 @@ void SetPathLogicalSegmentLogicalType(LogicalSegmentLogicalType logical_type,
  * @return The logical format of the logical format
  */
 LogicalSegmentLogicalFormat GetPathLogicalSegmentLogicalFormat(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 void SetPathLogicalSegmentLogicalFormat(LogicalSegmentLogicalFormat format,
-                                        CipOctet *const cip_path);
+                                        CipOctet* const cip_path);
 
-CipDword CipEpathGetLogicalValue(const EipUint8 **message);
+CipDword CipEpathGetLogicalValue(const EipUint8** message);
 
 void CipEpathSetLogicalValue(const CipDword logical_value,
                              const LogicalSegmentLogicalFormat logical_format,
-                             CipMessageRouterResponse *const message);
+                             CipMessageRouterResponse* const message);
 
 /** @brief  Gets the Extended Logical Type of a Logical Segment EPath message
  *
@@ -344,7 +344,7 @@ void CipEpathSetLogicalValue(const CipDword logical_value,
  * @return The extended logical type of the logical segment
  */
 LogicalSegmentExtendedLogicalType GetPathLogicalSegmentExtendedLogicalType(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the Special Type Logical Type of a Logical Segment EPath message
  *
@@ -354,7 +354,7 @@ LogicalSegmentExtendedLogicalType GetPathLogicalSegmentExtendedLogicalType(
  */
 LogicalSegmentSpecialTypeLogicalFormat
 GetPathLogicalSegmentSpecialTypeLogicalType(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the Electronic Key format of a Logical Segment Special Type
  * EPath message
@@ -363,7 +363,7 @@ GetPathLogicalSegmentSpecialTypeLogicalType(
  * @return The Electronic Key Format used in the EPath
  */
 ElectronicKeySegmentFormat GetPathLogicalSegmentElectronicKeyFormat(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the data for an Electronic Key of format 4 from the EPath
  * message
@@ -371,8 +371,8 @@ ElectronicKeySegmentFormat GetPathLogicalSegmentElectronicKeyFormat(
  * @param cip_path The start of the EPath message
  * @param key Writes the data on the user provided data electronic key struct
  */
-void GetElectronicKeyFormat4FromMessage(const CipOctet **const cip_path,
-                                        ElectronicKeyFormat4 *key);
+void GetElectronicKeyFormat4FromMessage(const CipOctet** const cip_path,
+                                        ElectronicKeyFormat4* key);
 
 /** @brief Gets the Network Segment Subtype of a EPatch Network Segement EPath
  * message
@@ -381,7 +381,7 @@ void GetElectronicKeyFormat4FromMessage(const CipOctet **const cip_path,
  * @return Network Segment subtype
  */
 NetworkSegmentSubtype GetPathNetworkSegmentSubtype(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the Production Inhibit Time in Milliseconds
  *
@@ -389,7 +389,7 @@ NetworkSegmentSubtype GetPathNetworkSegmentSubtype(
  * @return The production Inhibit Time in Milliseconds
  */
 CipUsint GetPathNetworkSegmentProductionInhibitTimeInMilliseconds(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the Production Inhibit Time in Microseconds
  *
@@ -397,7 +397,7 @@ CipUsint GetPathNetworkSegmentProductionInhibitTimeInMilliseconds(
  * @return The production Inhibit Time in Microseconds
  */
 CipUdint GetPathNetworkSegmentProductionInhibitTimeInMicroseconds(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the Data Segment subtype of a Data Segment EPath message
  *
@@ -405,7 +405,7 @@ CipUdint GetPathNetworkSegmentProductionInhibitTimeInMicroseconds(
  * @return The Data Segment subtype
  */
 DataSegmentSubtype GetPathDataSegmentSubtype(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the data word length of a Simple Data segment
  *
@@ -413,7 +413,7 @@ DataSegmentSubtype GetPathDataSegmentSubtype(
  * @return The length in words of the Simple Data segment
  */
 CipUsint GetPathDataSegmentSimpleDataWordLength(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the Symbolic Segment Format of the Symbolic Segment EPath
  * message
@@ -422,7 +422,7 @@ CipUsint GetPathDataSegmentSimpleDataWordLength(
  * @return The Symbolic Segment Format
  */
 SymbolicSegmentFormat GetPathSymbolicSegmentFormat(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the Numeric subtype of a Symbolic Segment Extended Format EPath
  * message
@@ -431,7 +431,7 @@ SymbolicSegmentFormat GetPathSymbolicSegmentFormat(
  * @return The Numeric Extended Format subtype
  */
 SymbolicSegmentExtendedFormat GetPathSymbolicSegmentNumericType(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /** @brief Gets the Extended Format subtype of a Symbolic Segment EPath message
  *
@@ -439,7 +439,7 @@ SymbolicSegmentExtendedFormat GetPathSymbolicSegmentNumericType(
  * @return Symbolic Segment Extended Format
  */
 SymbolicSegmentExtendedFormat GetPathSymbolicSegmentExtendedFormat(
-    const unsigned char *const cip_path);
+    const unsigned char* const cip_path);
 
 /* Special purpose encoding and decoding functions */
 // TODO currently not fully implemented
@@ -447,9 +447,9 @@ SymbolicSegmentExtendedFormat GetPathSymbolicSegmentExtendedFormat(
 //   const CipConnectionPathEpath *const connection_epath,
 //   CipOctet **encoded_path);
 
-bool CipEpathEqual(const CipOctet *const path1,
+bool CipEpathEqual(const CipOctet* const path1,
                    const CipUint path1_length,
-                   const CipOctet *const path2,
+                   const CipOctet* const path2,
                    const CipUint path2_length);
 
 #endif /* SRC_CIP_CIPEPATH_H_ */

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

@@ -94,24 +94,24 @@ typedef struct speed_duplex_array_entry {
 
 /* forward declaration of functions to encode certain attribute objects */
 static void EncodeCipEthernetLinkInterfaceCounters(
-    const void *const data, ENIPMessage *const outgoing_message);
+    const void* const data, ENIPMessage* const outgoing_message);
 
 static void EncodeCipEthernetLinkMediaCounters(
-    const void *const data, ENIPMessage *const outgoing_message);
+    const void* const data, ENIPMessage* const outgoing_message);
 
 static void EncodeCipEthernetLinkInterfaceControl(
-    const void *const data, ENIPMessage *const outgoing_message);
+    const void* const data, ENIPMessage* const outgoing_message);
 
 static void EncodeCipEthernetLinkInterfaceCaps(
-    const void *const data, ENIPMessage *const outgoing_message);
+    const void* const data, ENIPMessage* const outgoing_message);
 
 #if defined(OPENER_ETHLINK_CNTRS_ENABLE) && 0 != OPENER_ETHLINK_CNTRS_ENABLE
 /* forward declaration for the GetAndClear service handler function */
 EipStatus GetAndClearEthernetLink(
-    CipInstance *RESTRICT const instance,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* RESTRICT const instance,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response,
+    const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session);
 #endif /* ... && 0 != OPENER_ETHLINK_CNTRS_ENABLE */
 
@@ -127,9 +127,9 @@ EipStatus GetAndClearEthernetLink(
  *          -1 .. error
  */
 int DecodeCipEthernetLinkInterfaceControl(
-    CipEthernetLinkInterfaceControl *const data,
-    const CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response);
+    CipEthernetLinkInterfaceControl* const data,
+    const CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response);
 #endif
 
 /** @brief This is the internal table of possible speed / duplex combinations
@@ -164,12 +164,12 @@ static const CipEthernetLinkSpeedDuplexArrayEntry speed_duplex_table[] = {
 
 #if defined(OPENER_ETHLINK_LABEL_ENABLE) && 0 != OPENER_ETHLINK_LABEL_ENABLE
 static const CipShortString iface_label_table[OPENER_ETHLINK_INSTANCE_CNT] = {
-    {.length = sizeof IFACE_LABEL - 1, .string = (EipByte *)IFACE_LABEL},
+    {.length = sizeof IFACE_LABEL - 1, .string = (EipByte*)IFACE_LABEL},
 #if OPENER_ETHLINK_INSTANCE_CNT > 1
-    {.length = sizeof IFACE_LABEL_1 - 1, .string = (EipByte *)IFACE_LABEL_1},
+    {.length = sizeof IFACE_LABEL_1 - 1, .string = (EipByte*)IFACE_LABEL_1},
 #endif
 #if OPENER_ETHLINK_INSTANCE_CNT > 2
-    {.length = sizeof IFACE_LABEL_2 - 1, .string = (EipByte *)IFACE_LABEL_2},
+    {.length = sizeof IFACE_LABEL_2 - 1, .string = (EipByte*)IFACE_LABEL_2},
 #endif
 };
 #endif /* defined(OPENER_ETHLINK_LABEL_ENABLE) && 0 != \
@@ -196,7 +196,7 @@ static CipEthernetLinkInterfaceControl s_interface_control = {
 CipEthernetLinkObject g_ethernet_link[OPENER_ETHLINK_INSTANCE_CNT];
 
 EipStatus CipEthernetLinkInit(void) {
-  CipClass *ethernet_link_class = CreateCipClass(
+  CipClass* ethernet_link_class = CreateCipClass(
       kCipEthernetLinkClassCode,
       0,
       /* # class attributes*/
@@ -270,7 +270,7 @@ EipStatus CipEthernetLinkInit(void) {
 
     /* bind attributes to the instance */
     for (CipInstanceNum idx = 0; idx < OPENER_ETHLINK_INSTANCE_CNT; ++idx) {
-      CipInstance *ethernet_link_instance =
+      CipInstance* ethernet_link_instance =
           GetCipInstance(ethernet_link_class, (CipInstanceNum)(idx + 1));
 
       InsertAttribute(ethernet_link_instance,
@@ -397,7 +397,7 @@ EipStatus CipEthernetLinkInit(void) {
   return kEipStatusOk;
 }
 
-void CipEthernetLinkSetMac(EipUint8 *p_physical_address) {
+void CipEthernetLinkSetMac(EipUint8* p_physical_address) {
   for (size_t idx = 0; idx < OPENER_ETHLINK_INSTANCE_CNT; ++idx) {
     memcpy(g_ethernet_link[idx].physical_address,
            p_physical_address,
@@ -407,7 +407,7 @@ void CipEthernetLinkSetMac(EipUint8 *p_physical_address) {
 }
 
 static void EncodeCipEthernetLinkInterfaceCounters(
-    const void *const data, ENIPMessage *const outgoing_message) {
+    const void* const data, ENIPMessage* const outgoing_message) {
   /* Suppress unused parameter compiler warning. */
   (void)data;
 
@@ -427,7 +427,7 @@ static void EncodeCipEthernetLinkInterfaceCounters(
 }
 
 static void EncodeCipEthernetLinkMediaCounters(
-    const void *const data, ENIPMessage *const outgoing_message) {
+    const void* const data, ENIPMessage* const outgoing_message) {
   /* Suppress unused parameter compiler warning. */
   (void)data;
 
@@ -447,15 +447,15 @@ static void EncodeCipEthernetLinkMediaCounters(
 }
 
 static void EncodeCipEthernetLinkInterfaceControl(
-    const void *const data, ENIPMessage *const outgoing_message) {
+    const void* const data, ENIPMessage* const outgoing_message) {
 #if defined(OPENER_ETHLINK_IFACE_CTRL_ENABLE) && \
     0 != OPENER_ETHLINK_IFACE_CTRL_ENABLE
-  const CipEthernetLinkInterfaceControl *const interface_control = data;
+  const CipEthernetLinkInterfaceControl* const interface_control = data;
 #else
   /* Suppress unused parameter compiler warning. */
   (void)data;
 
-  CipEthernetLinkInterfaceControl *interface_control = &s_interface_control;
+  CipEthernetLinkInterfaceControl* interface_control = &s_interface_control;
 #endif
   EncodeCipWord(&interface_control->control_bits, outgoing_message);
   EncodeCipUint(&interface_control->forced_interface_speed, outgoing_message);
@@ -463,8 +463,8 @@ static void EncodeCipEthernetLinkInterfaceControl(
 
 #define NELEMENTS(x) ((sizeof(x) / sizeof(x[0])))
 static void EncodeCipEthernetLinkInterfaceCaps(
-    const void *const data, ENIPMessage *const outgoing_message) {
-  const CipEthernetLinkMetaInterfaceCapability *const interface_caps = data;
+    const void* const data, ENIPMessage* const outgoing_message) {
+  const CipEthernetLinkMetaInterfaceCapability* const interface_caps = data;
   EncodeCipDword(&interface_caps->capability_bits, outgoing_message);
   uint16_t selected = interface_caps->speed_duplex_selector;
   CipUsint count    = 0;
@@ -485,12 +485,12 @@ static void EncodeCipEthernetLinkInterfaceCaps(
 
 #if defined(OPENER_ETHLINK_CNTRS_ENABLE) && 0 != OPENER_ETHLINK_CNTRS_ENABLE
 EipStatus GetAndClearEthernetLink(
-    CipInstance *RESTRICT const instance,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* RESTRICT const instance,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response,
+    const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session) {
-  CipAttributeStruct *attribute = GetCipAttribute(
+  CipAttributeStruct* attribute = GetCipAttribute(
       instance, message_router_request->request_path.attribute_number);
 
   message_router_response->data_length = 0;
@@ -538,7 +538,7 @@ EipStatus GetAndClearEthernetLink(
     0 != OPENER_ETHLINK_IFACE_CTRL_ENABLE
 static bool IsIfaceControlAllowed(
     CipInstanceNum instance_id,
-    CipEthernetLinkInterfaceControl const *iface_cntrl) {
+    CipEthernetLinkInterfaceControl const* iface_cntrl) {
   const CipUsint duplex_mode =
       (iface_cntrl->control_bits & kEthLinkIfCntrlForceDuplexFD) ? 1 : 0;
   for (size_t i = 0; i < NELEMENTS(speed_duplex_table); i++) {
@@ -555,10 +555,10 @@ static bool IsIfaceControlAllowed(
 }
 
 int DecodeCipEthernetLinkInterfaceControl(
-    CipEthernetLinkInterfaceControl *const data,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response) {
-  CipInstance *const instance =
+    CipEthernetLinkInterfaceControl* const data,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response) {
+  CipInstance* const instance =
       GetCipInstance(GetCipClass(message_router_request->request_path.class_id),
                      message_router_request->request_path.instance_number);
 

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

@@ -191,7 +191,7 @@ EipStatus CipEthernetLinkInit(void);
  *
  * This function sets the MAC address of all involved Ethernet Link objects.
  */
-void CipEthernetLinkSetMac(EipUint8 *p_physical_address);
+void CipEthernetLinkSetMac(EipUint8* p_physical_address);
 
 /* global object instance(s) */
 

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

@@ -95,7 +95,7 @@ CipUint GetDeviceVendorId(void) {
 }
 
 /* The Doxygen comment is with the function's prototype in opener_api.h. */
-void SetDeviceProductName(const char *product_name) {
+void SetDeviceProductName(const char* product_name) {
   if (!product_name)
     return;
 
@@ -103,7 +103,7 @@ void SetDeviceProductName(const char *product_name) {
 }
 
 /* The Doxygen comment is with the function's prototype in opener_api.h. */
-CipShortString *GetDeviceProductName(void) {
+CipShortString* GetDeviceProductName(void) {
   return &g_identity.product_name;
 }
 
@@ -168,9 +168,9 @@ void CipIdentitySetExtendedDeviceStatus(
  * @returns Currently always kEipOkSend is returned
  */
 EipStatus IdentityObjectPreResetCallback(
-    CipInstance *RESTRICT const instance,
-    const CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response) {
+    CipInstance* RESTRICT const instance,
+    const CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response) {
   (void)instance;
 
   EipStatus eip_status = kEipStatusOkSend;
@@ -208,57 +208,57 @@ EipStatus IdentityObjectPreResetCallback(
   return eip_status;
 }
 
-void InitializeCipIdentity(CipClass *class) {
-  CipClass *meta_class = class->class_instance.cip_class;
+void InitializeCipIdentity(CipClass* class) {
+  CipClass* meta_class = class->class_instance.cip_class;
 
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   1,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&class->revision,
+                  (void*)&class->revision,
                   kGetableSingleAndAll); /* revision */
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   2,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&class->number_of_instances,
+                  (void*)&class->number_of_instances,
                   kGetableSingleAndAll); /*  largest instance number */
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   3,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&class->number_of_instances,
+                  (void*)&class->number_of_instances,
                   kGetableSingle); /* number of instances currently existing*/
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   4,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&kCipUintZero,
+                  (void*)&kCipUintZero,
                   kNotSetOrGetable); /* optional attribute list - default = 0 */
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   5,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&kCipUintZero,
+                  (void*)&kCipUintZero,
                   kNotSetOrGetable); /* optional service list - default = 0 */
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   6,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&meta_class->highest_attribute_number,
+                  (void*)&meta_class->highest_attribute_number,
                   kGetableSingleAndAll); /* max class attribute number*/
-  InsertAttribute((CipInstance *)class,
+  InsertAttribute((CipInstance*)class,
                   7,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&class->highest_attribute_number,
+                  (void*)&class->highest_attribute_number,
                   kGetableSingleAndAll); /* max instance attribute number*/
 
   InsertService(meta_class,
@@ -274,15 +274,15 @@ void InitializeCipIdentity(CipClass *class) {
   class->PreResetCallback = &IdentityObjectPreResetCallback;
 }
 
-void EncodeRevision(const void *const data,
-                    ENIPMessage *const outgoing_message) {
-  CipRevision *revision = (CipRevision *)data;
+void EncodeRevision(const void* const data,
+                    ENIPMessage* const outgoing_message) {
+  CipRevision* revision = (CipRevision*)data;
   AddSintToMessage(revision->major_revision, outgoing_message);
   AddSintToMessage(revision->minor_revision, outgoing_message);
 }
 
 EipStatus CipIdentityInit() {
-  CipClass *class = CreateCipClass(
+  CipClass* class = CreateCipClass(
       kCipIdentityClassCode,
       0,          /* # of non-default class attributes */
       7,          /* # highest class attribute number*/
@@ -303,7 +303,7 @@ EipStatus CipIdentityInit() {
   if (g_identity.product_name.length == 0)
     SetDeviceProductName(OPENER_DEVICE_NAME);
 
-  CipInstance *instance = GetCipInstance(class, 1);
+  CipInstance* instance = GetCipInstance(class, 1);
   InsertAttribute(instance,
                   1,
                   kCipUint,

+ 71 - 72
source/src/cip/cipioconnection.c

@@ -25,30 +25,30 @@
  * application connection types.
  */
 EipStatus OpenProducingMulticastConnection(
-    CipConnectionObject *connection_object,
-    CipCommonPacketFormatData *common_packet_format_data);
+    CipConnectionObject* connection_object,
+    CipCommonPacketFormatData* common_packet_format_data);
 
 EipStatus OpenMulticastConnection(
     UdpCommuncationDirection direction,
-    CipConnectionObject *connection_object,
-    CipCommonPacketFormatData *common_packet_format_data);
+    CipConnectionObject* connection_object,
+    CipCommonPacketFormatData* common_packet_format_data);
 
 EipStatus OpenConsumingPointToPointConnection(
-    CipConnectionObject *const connection_object,
-    CipCommonPacketFormatData *const common_packet_format_data);
+    CipConnectionObject* const connection_object,
+    CipCommonPacketFormatData* const common_packet_format_data);
 
 CipError OpenProducingPointToPointConnection(
-    CipConnectionObject *connection_object,
-    CipCommonPacketFormatData *common_packet_format_data);
+    CipConnectionObject* connection_object,
+    CipCommonPacketFormatData* common_packet_format_data);
 
-EipUint16 HandleConfigData(CipConnectionObject *connection_object);
+EipUint16 HandleConfigData(CipConnectionObject* connection_object);
 
 /* Regularly close the IO connection. If it is an exclusive owner or input only
  * connection and in charge of the connection a new owner will be searched
  */
-void CloseIoConnection(CipConnectionObject *RESTRICT connection_object);
+void CloseIoConnection(CipConnectionObject* RESTRICT connection_object);
 
-void HandleIoConnectionTimeOut(CipConnectionObject *connection_object);
+void HandleIoConnectionTimeOut(CipConnectionObject* connection_object);
 
 /** @brief  Send the data from the produced CIP Object of the connection via the
  * socket of the connection object on UDP.
@@ -56,14 +56,14 @@ void HandleIoConnectionTimeOut(CipConnectionObject *connection_object);
  *      @return status  EIP_OK .. success
  *                     EIP_ERROR .. error
  */
-EipStatus SendConnectedData(CipConnectionObject *connection_object);
+EipStatus SendConnectedData(CipConnectionObject* connection_object);
 
-EipStatus HandleReceivedIoConnectionData(CipConnectionObject *connection_object,
-                                         const EipUint8 *data,
+EipStatus HandleReceivedIoConnectionData(CipConnectionObject* connection_object,
+                                         const EipUint8* data,
                                          EipUint16 data_length);
 
 /**** Global variables ****/
-EipUint8 *g_config_data_buffer = NULL; /**< buffers for the config data coming
+EipUint8* g_config_data_buffer = NULL; /**< buffers for the config data coming
                                           with a forward open request. */
 unsigned int g_config_data_length =
     0; /**< length of g_config_data_buffer. Initialized with 0 */
@@ -100,7 +100,7 @@ bool CipRunIdleHeaderGetT2O(void) {
 }
 
 EipUint16 ProcessProductionInhibitTime(
-    CipConnectionObject *io_connection_object) {
+    CipConnectionObject* io_connection_object) {
   if (kConnectionObjectTransportClassTriggerProductionTriggerCyclic ==
       ConnectionObjectGetTransportClassTriggerProductionTrigger(
           io_connection_object)) {
@@ -127,7 +127,7 @@ EipUint16 ProcessProductionInhibitTime(
   return kConnectionManagerExtendedStatusCodeSuccess;
 }
 
-void SetIoConnectionCallbacks(CipConnectionObject *const io_connection_object) {
+void SetIoConnectionCallbacks(CipConnectionObject* const io_connection_object) {
   io_connection_object->connection_close_function   = CloseIoConnection;
   io_connection_object->connection_timeout_function = HandleIoConnectionTimeOut;
   io_connection_object->connection_send_data_function = SendConnectedData;
@@ -136,10 +136,10 @@ void SetIoConnectionCallbacks(CipConnectionObject *const io_connection_object) {
 }
 
 EipUint16 SetupIoConnectionOriginatorToTargetConnectionPoint(
-    CipConnectionObject *const io_connection_object,
-    CipConnectionObject *const RESTRICT connection_object) {
-  CipClass *const assembly_class = GetCipClass(kCipAssemblyClassCode);
-  CipInstance *instance          = NULL;
+    CipConnectionObject* const io_connection_object,
+    CipConnectionObject* const RESTRICT connection_object) {
+  CipClass* const assembly_class = GetCipClass(kCipAssemblyClassCode);
+  CipInstance* instance          = NULL;
   if (NULL !=
       (instance = GetCipInstance(
            assembly_class, io_connection_object->consumed_path.instance_id))) {
@@ -157,10 +157,10 @@ EipUint16 SetupIoConnectionOriginatorToTargetConnectionPoint(
     int diff_size = 0;
 
     /* an assembly object should always have a data attribute. */
-    CipAttributeStruct *attribute =
+    CipAttributeStruct* attribute =
         GetCipAttribute(instance, kAssemblyObjectInstanceAttributeIdData);
     OPENER_ASSERT(attribute != NULL);
-    bool is_heartbeat = (((CipByteArray *)attribute->data)->length == 0);
+    bool is_heartbeat = (((CipByteArray*)attribute->data)->length == 0);
     if (kConnectionObjectTransportClassTriggerTransportClass1 ==
         ConnectionObjectGetTransportClassTriggerTransportClass(
             io_connection_object)) {
@@ -175,10 +175,10 @@ EipUint16 SetupIoConnectionOriginatorToTargetConnectionPoint(
       diff_size += 4;
     }
 
-    if (((CipByteArray *)attribute->data)->length != data_size) {
+    if (((CipByteArray*)attribute->data)->length != data_size) {
       /*wrong connection size */
       connection_object->correct_originator_to_target_size =
-          ((CipByteArray *)attribute->data)->length + diff_size;
+          ((CipByteArray*)attribute->data)->length + diff_size;
       return kConnectionManagerExtendedStatusCodeErrorInvalidOToTConnectionSize;
     }
   } else {
@@ -188,13 +188,13 @@ EipUint16 SetupIoConnectionOriginatorToTargetConnectionPoint(
 }
 
 EipUint16 SetupIoConnectionTargetToOriginatorConnectionPoint(
-    CipConnectionObject *const io_connection_object,
-    CipConnectionObject *const RESTRICT connection_object) {
-  DoublyLinkedListNode *node = connection_list.first;
+    CipConnectionObject* const io_connection_object,
+    CipConnectionObject* const RESTRICT connection_object) {
+  DoublyLinkedListNode* node = connection_list.first;
   while (NULL != node &&
          kConnectionObjectConnectionTypeMulticast ==
              ConnectionObjectGetTToOConnectionType(io_connection_object)) {
-    CipConnectionObject *iterator = node->data;
+    CipConnectionObject* iterator = node->data;
     if (io_connection_object->produced_path.instance_id ==
         iterator->produced_path.instance_id) {
       // Check parameters
@@ -234,8 +234,8 @@ EipUint16 SetupIoConnectionTargetToOriginatorConnectionPoint(
   }
 
   /*setup producer side*/
-  CipClass *const assembly_class = GetCipClass(kCipAssemblyClassCode);
-  CipInstance *instance          = NULL;
+  CipClass* const assembly_class = GetCipClass(kCipAssemblyClassCode);
+  CipInstance* instance          = NULL;
   if (NULL !=
       (instance = GetCipInstance(
            assembly_class, io_connection_object->produced_path.instance_id))) {
@@ -245,10 +245,10 @@ EipUint16 SetupIoConnectionTargetToOriginatorConnectionPoint(
     /* an assembly object should always have a data attribute. */
     io_connection_object->produced_path.attribute_id_or_connection_point =
         kAssemblyObjectInstanceAttributeIdData;
-    CipAttributeStruct *attribute =
+    CipAttributeStruct* attribute =
         GetCipAttribute(instance, kAssemblyObjectInstanceAttributeIdData);
     OPENER_ASSERT(attribute != NULL);
-    bool is_heartbeat = (((CipByteArray *)attribute->data)->length == 0);
+    bool is_heartbeat = (((CipByteArray*)attribute->data)->length == 0);
     if (kConnectionObjectTransportClassTriggerTransportClass1 ==
         ConnectionObjectGetTransportClassTriggerTransportClass(
             io_connection_object)) {
@@ -261,10 +261,10 @@ EipUint16 SetupIoConnectionTargetToOriginatorConnectionPoint(
       data_size -= 4; /* remove the 4 bytes needed for run/idle header */
       diff_size += 4;
     }
-    if (((CipByteArray *)attribute->data)->length != data_size) {
+    if (((CipByteArray*)attribute->data)->length != data_size) {
       /*wrong connection size*/
       connection_object->correct_target_to_originator_size =
-          ((CipByteArray *)attribute->data)->length + diff_size;
+          ((CipByteArray*)attribute->data)->length + diff_size;
       return kConnectionManagerExtendedStatusCodeErrorInvalidTToOConnectionSize;
     }
   } else {
@@ -287,11 +287,11 @@ EipUint16 SetupIoConnectionTargetToOriginatorConnectionPoint(
  *    - On an error the general status code to be put into the response
  */
 CipError EstablishIoConnection(
-    CipConnectionObject *RESTRICT const connection_object,
-    EipUint16 *const extended_error) {
+    CipConnectionObject* RESTRICT const connection_object,
+    EipUint16* const extended_error) {
   CipError cip_error = kCipErrorSuccess;
 
-  CipConnectionObject *io_connection_object =
+  CipConnectionObject* io_connection_object =
       GetIoConnectionForConnectionData(connection_object, extended_error);
   if (NULL == io_connection_object) {
     return kCipErrorConnectionFailure;
@@ -365,13 +365,13 @@ CipError EstablishIoConnection(
   return cip_error;
 }
 
-static SocketAddressInfoItem *AllocateSocketAddressInfoItem(
-    CipCommonPacketFormatData *const common_packet_format_data, CipUint type) {
+static SocketAddressInfoItem* AllocateSocketAddressInfoItem(
+    CipCommonPacketFormatData* const common_packet_format_data, CipUint type) {
   const int address_info_item_size =
       sizeof(common_packet_format_data->address_info_item) /
       sizeof(common_packet_format_data->address_info_item[0]);
 
-  SocketAddressInfoItem *s = common_packet_format_data->address_info_item;
+  SocketAddressInfoItem* s = common_packet_format_data->address_info_item;
 
   for (int i = 0; i < address_info_item_size; i++) {
     if ((s->type_id == 0) || (s->type_id == type)) {
@@ -390,9 +390,9 @@ static SocketAddressInfoItem *AllocateSocketAddressInfoItem(
  * @return kEipStatusOk on success, otherwise kEipStatusError
  */
 EipStatus OpenConsumingPointToPointConnection(
-    CipConnectionObject *const connection_object,
-    CipCommonPacketFormatData *const common_packet_format_data) {
-  SocketAddressInfoItem *sock_addr_info = AllocateSocketAddressInfoItem(
+    CipConnectionObject* const connection_object,
+    CipCommonPacketFormatData* const common_packet_format_data) {
+  SocketAddressInfoItem* sock_addr_info = AllocateSocketAddressInfoItem(
       common_packet_format_data, kCipItemIdSocketAddressInfoOriginatorToTarget);
 
   if (NULL == sock_addr_info) {
@@ -433,8 +433,8 @@ EipStatus OpenConsumingPointToPointConnection(
 }
 
 CipError OpenProducingPointToPointConnection(
-    CipConnectionObject *connection_object,
-    CipCommonPacketFormatData *common_packet_format_data) {
+    CipConnectionObject* connection_object,
+    CipCommonPacketFormatData* common_packet_format_data) {
   /* the default port to be used if no port information is part of the forward
    * open request */
   in_port_t port = htons(kOpenerEipIoUdpPort);
@@ -468,14 +468,14 @@ CipError OpenProducingPointToPointConnection(
 }
 
 EipStatus OpenProducingMulticastConnection(
-    CipConnectionObject *connection_object,
-    CipCommonPacketFormatData *common_packet_format_data) {
+    CipConnectionObject* connection_object,
+    CipCommonPacketFormatData* common_packet_format_data) {
   /* Here we look for existing multi-cast IO connections only. */
-  CipConnectionObject *existing_connection_object =
+  CipConnectionObject* existing_connection_object =
       GetExistingProducerIoConnection(
           true, connection_object->produced_path.instance_id);
 
-  SocketAddressInfoItem *sock_addr_info = AllocateSocketAddressInfoItem(
+  SocketAddressInfoItem* sock_addr_info = AllocateSocketAddressInfoItem(
       common_packet_format_data, kCipItemIdSocketAddressInfoTargetToOriginator);
 
   if (NULL == sock_addr_info) {
@@ -542,8 +542,8 @@ EipStatus OpenProducingMulticastConnection(
  */
 EipStatus OpenMulticastConnection(
     UdpCommuncationDirection direction,
-    CipConnectionObject *connection_object,
-    CipCommonPacketFormatData *common_packet_format_data) {
+    CipConnectionObject* connection_object,
+    CipCommonPacketFormatData* common_packet_format_data) {
   int j = -1;
 
   int address_info_item_which_contains_o_to_t = -1;
@@ -647,10 +647,10 @@ EipStatus OpenMulticastConnection(
   return kEipStatusOk;
 }
 
-EipUint16 HandleConfigData(CipConnectionObject *connection_object) {
-  CipClass *const assembly_class      = GetCipClass(kCipAssemblyClassCode);
+EipUint16 HandleConfigData(CipConnectionObject* connection_object) {
+  CipClass* const assembly_class      = GetCipClass(kCipAssemblyClassCode);
   EipUint16 connection_manager_status = 0;
-  CipInstance *config_instance        = GetCipInstance(
+  CipInstance* config_instance        = GetCipInstance(
       assembly_class, connection_object->configuration_path.instance_id);
 
   if (0 != g_config_data_length) {
@@ -659,10 +659,9 @@ EipUint16 HandleConfigData(CipConnectionObject *connection_object) {
             connection_object->configuration_path.instance_id)) {
       /* there is a connected connection with the same config point
        * we have to have the same data as already present in the config point*/
-      CipAttributeStruct *attribute_three = GetCipAttribute(config_instance, 3);
+      CipAttributeStruct* attribute_three = GetCipAttribute(config_instance, 3);
       OPENER_ASSERT(NULL != attribute_three);
-      CipByteArray *attribute_three_data =
-          (CipByteArray *)attribute_three->data;
+      CipByteArray* attribute_three_data = (CipByteArray*)attribute_three->data;
       OPENER_ASSERT(NULL != attribute_three_data);
       if (attribute_three_data->length != g_config_data_length) {
         connection_manager_status =
@@ -699,8 +698,8 @@ EipUint16 HandleConfigData(CipConnectionObject *connection_object) {
  * Returns POSIX OK (0) on successful transfer, otherwise non-zero to
  * trigger closing of connections and sockets associated with object.
  */
-static int transfer_master_connection(CipConnectionObject *connection_object) {
-  CipConnectionObject *active;
+static int transfer_master_connection(CipConnectionObject* connection_object) {
+  CipConnectionObject* active;
 
   active = GetNextNonControlMasterConnection(
       connection_object->produced_path.instance_id);
@@ -728,7 +727,7 @@ static int transfer_master_connection(CipConnectionObject *connection_object) {
 }
 
 /* Always sync any changes with HandleIoConnectionTimeout() */
-void CloseIoConnection(CipConnectionObject *RESTRICT connection_object) {
+void CloseIoConnection(CipConnectionObject* RESTRICT connection_object) {
   ConnectionObjectInstanceType instance_type =
       ConnectionObjectGetInstanceType(connection_object);
   ConnectionObjectConnectionType conn_type =
@@ -765,7 +764,7 @@ void CloseIoConnection(CipConnectionObject *RESTRICT connection_object) {
 }
 
 /* Always sync any changes with CloseIoConnection() */
-void HandleIoConnectionTimeOut(CipConnectionObject *connection_object) {
+void HandleIoConnectionTimeOut(CipConnectionObject* connection_object) {
   ConnectionObjectInstanceType instance_type =
       ConnectionObjectGetInstanceType(connection_object);
   ConnectionObjectConnectionType conn_type =
@@ -819,12 +818,12 @@ void HandleIoConnectionTimeOut(CipConnectionObject *connection_object) {
   ConnectionObjectSetState(connection_object, kConnectionObjectStateTimedOut);
 }
 
-EipStatus SendConnectedData(CipConnectionObject *connection_object) {
+EipStatus SendConnectedData(CipConnectionObject* connection_object) {
   /* TODO think of adding an own send buffer to each connection object in order
    * to preset up the whole message on connection opening and just change the
    * variable data items e.g., sequence number */
 
-  CipCommonPacketFormatData *common_packet_format_data =
+  CipCommonPacketFormatData* common_packet_format_data =
       &g_common_packet_format_data_item;
   /* TODO think on adding a CPF data item to the S_CIP_ConnectionObject in order
    * to remove the code here or even better allocate memory in the connection
@@ -854,8 +853,8 @@ EipStatus SendConnectedData(CipConnectionObject *connection_object) {
 
   common_packet_format_data->data_item.type_id = kCipItemIdConnectedDataItem;
 
-  CipByteArray *producing_instance_attributes =
-      (CipByteArray *)connection_object->producing_instance->attributes->data;
+  CipByteArray* producing_instance_attributes =
+      (CipByteArray*)connection_object->producing_instance->attributes->data;
   common_packet_format_data->data_item.length = 0;
 
   /* notify the application that data will be sent immediately after the call */
@@ -909,8 +908,8 @@ EipStatus SendConnectedData(CipConnectionObject *connection_object) {
   return SendUdpData(&connection_object->remote_address, &outgoing_message);
 }
 
-EipStatus HandleReceivedIoConnectionData(CipConnectionObject *connection_object,
-                                         const EipUint8 *data,
+EipStatus HandleReceivedIoConnectionData(CipConnectionObject* connection_object,
+                                         const EipUint8* data,
                                          EipUint16 data_length) {
   OPENER_TRACE_INFO("Starting data length: %d\n", data_length);
   bool no_new_data = false;
@@ -952,7 +951,7 @@ EipStatus HandleReceivedIoConnectionData(CipConnectionObject *connection_object,
 
     if (NotifyAssemblyConnectedDataReceived(
             connection_object->consuming_instance,
-            (EipUint8 *const)data,
+            (EipUint8* const)data,
             data_length) != 0) {
       return kEipStatusError;
     }
@@ -960,13 +959,13 @@ EipStatus HandleReceivedIoConnectionData(CipConnectionObject *connection_object,
   return kEipStatusOk;
 }
 
-CipError OpenCommunicationChannels(CipConnectionObject *connection_object) {
+CipError OpenCommunicationChannels(CipConnectionObject* connection_object) {
   CipError cip_error = kCipErrorSuccess;
   CreateUdpSocket(); /* open UDP socket for IO messaging*/
 
   /*get pointer to the CPF data, currently we have just one global instance of
    * the struct. This may change in the future*/
-  CipCommonPacketFormatData *common_packet_format_data =
+  CipCommonPacketFormatData* common_packet_format_data =
       &g_common_packet_format_data_item;
 
   ConnectionObjectConnectionType originator_to_target_connection_type =
@@ -1021,7 +1020,7 @@ CipError OpenCommunicationChannels(CipConnectionObject *connection_object) {
 }
 
 void CloseCommunicationChannelsAndRemoveFromActiveConnectionsList(
-    CipConnectionObject *connection_object) {
+    CipConnectionObject* connection_object) {
   if (kEipInvalidSocket !=
       connection_object->socket[kUdpCommuncationDirectionConsuming]) {
     CloseUdpSocket(

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

@@ -56,8 +56,8 @@
  *    - On an error the general status code to be put into the response
  */
 CipError EstablishIoConnection(
-    CipConnectionObject *RESTRICT const connection_object,
-    EipUint16 *const extended_error);
+    CipConnectionObject* RESTRICT const connection_object,
+    EipUint16* const extended_error);
 
 /** @brief Take the data given in the connection object structure and open the
  * necessary communication channels
@@ -68,7 +68,7 @@ CipError EstablishIoConnection(
  *    - EIP_OK ... on success
  *    - On an error the general status code to be put into the response
  */
-CipError OpenCommunicationChannels(CipConnectionObject *connection_object);
+CipError OpenCommunicationChannels(CipConnectionObject* connection_object);
 
 /** @brief close the communication channels of the given connection and remove
  * it from the active connections list.
@@ -76,9 +76,9 @@ CipError OpenCommunicationChannels(CipConnectionObject *connection_object);
  * @param connection_object pointer to the connection object data
  */
 void CloseCommunicationChannelsAndRemoveFromActiveConnectionsList(
-    CipConnectionObject *connection_object);
+    CipConnectionObject* connection_object);
 
-extern EipUint8 *g_config_data_buffer;
+extern EipUint8* g_config_data_buffer;
 extern unsigned int g_config_data_length;
 
 #endif /* OPENER_CIPIOCONNECTION_H_ */

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

@@ -23,19 +23,19 @@ CipMessageRouterRequest g_message_router_request;
  * parameter in the platform config file.
  */
 typedef struct cip_message_router_object {
-  struct cip_message_router_object *next; /**< link */
-  CipClass *cip_class;                    /**< object */
+  struct cip_message_router_object* next; /**< link */
+  CipClass* cip_class;                    /**< object */
 } CipMessageRouterObject;
 
 /** @brief Pointer to first registered object in MessageRouter*/
-CipMessageRouterObject *g_first_object = NULL;
+CipMessageRouterObject* g_first_object = NULL;
 
 /** @brief Register a CIP Class to the message router
  *  @param cip_class Pointer to a class object to be registered.
  *  @return kEipStatusOk on success
  *          kEipStatusError on no memory available to register more objects
  */
-EipStatus RegisterCipClass(CipClass *cip_class);
+EipStatus RegisterCipClass(CipClass* cip_class);
 
 /** @brief Create Message Router Request structure out of the received data.
  *
@@ -47,61 +47,61 @@ EipStatus RegisterCipClass(CipClass *cip_class);
  * @return kEipStatusOk on success. otherwise kEipStatusError
  */
 CipError CreateMessageRouterRequestStructure(
-    const EipUint8 *data,
+    const EipUint8* data,
     EipInt16 data_length,
-    CipMessageRouterRequest *message_router_request);
+    CipMessageRouterRequest* message_router_request);
 
-void InitializeCipMessageRouterClass(CipClass *cip_class) {
-  CipClass *meta_class = cip_class->class_instance.cip_class;
+void InitializeCipMessageRouterClass(CipClass* cip_class) {
+  CipClass* meta_class = cip_class->class_instance.cip_class;
 
-  InsertAttribute((CipInstance *)cip_class,
+  InsertAttribute((CipInstance*)cip_class,
                   1,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&cip_class->revision,
+                  (void*)&cip_class->revision,
                   kGetableSingleAndAll); /* revision */
-  InsertAttribute((CipInstance *)cip_class,
+  InsertAttribute((CipInstance*)cip_class,
                   2,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&cip_class->number_of_instances,
+                  (void*)&cip_class->number_of_instances,
                   kGetableSingle); /*  largest instance number */
-  InsertAttribute((CipInstance *)cip_class,
+  InsertAttribute((CipInstance*)cip_class,
                   3,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&cip_class->number_of_instances,
+                  (void*)&cip_class->number_of_instances,
                   kGetableSingle); /* number of instances currently existing*/
-  InsertAttribute((CipInstance *)cip_class,
+  InsertAttribute((CipInstance*)cip_class,
                   4,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&kCipUintZero,
+                  (void*)&kCipUintZero,
                   kGetableAll); /* optional attribute list - default = 0 */
-  InsertAttribute((CipInstance *)cip_class,
+  InsertAttribute((CipInstance*)cip_class,
                   5,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&kCipUintZero,
+                  (void*)&kCipUintZero,
                   kGetableAll); /* optional service list - default = 0 */
-  InsertAttribute((CipInstance *)cip_class,
+  InsertAttribute((CipInstance*)cip_class,
                   6,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&meta_class->highest_attribute_number,
+                  (void*)&meta_class->highest_attribute_number,
                   kGetableSingleAndAll); /* max class attribute number*/
-  InsertAttribute((CipInstance *)cip_class,
+  InsertAttribute((CipInstance*)cip_class,
                   7,
                   kCipUint,
                   EncodeCipUint,
                   NULL,
-                  (void *)&cip_class->highest_attribute_number,
+                  (void*)&cip_class->highest_attribute_number,
                   kGetableSingleAndAll); /* max instance attribute number*/
 
   InsertService(meta_class,
@@ -115,7 +115,7 @@ void InitializeCipMessageRouterClass(CipClass *cip_class) {
 }
 
 EipStatus CipMessageRouterInit() {
-  CipClass *message_router =
+  CipClass* message_router =
       CreateCipClass(kCipMessageRouterClassCode, /* class code */
                      7,                          /* # of class attributes */
                      7,                /* # highest class attribute number */
@@ -147,8 +147,8 @@ EipStatus CipMessageRouterInit() {
  *  @return Pointer to registered message router object
  *      NULL .. Class not registered
  */
-CipMessageRouterObject *GetRegisteredObject(EipUint32 class_id) {
-  CipMessageRouterObject *object =
+CipMessageRouterObject* GetRegisteredObject(EipUint32 class_id) {
+  CipMessageRouterObject* object =
       g_first_object; /* get pointer to head of class registration list */
 
   while (NULL != object) /* for each entry in list*/
@@ -162,8 +162,8 @@ CipMessageRouterObject *GetRegisteredObject(EipUint32 class_id) {
   return NULL;
 }
 
-CipClass *GetCipClass(const CipUdint class_code) {
-  CipMessageRouterObject *message_router_object =
+CipClass* GetCipClass(const CipUdint class_code) {
+  CipMessageRouterObject* message_router_object =
       GetRegisteredObject(class_code);
 
   if (message_router_object) {
@@ -173,14 +173,14 @@ CipClass *GetCipClass(const CipUdint class_code) {
   }
 }
 
-CipInstance *GetCipInstance(const CipClass *RESTRICT const cip_class,
+CipInstance* GetCipInstance(const CipClass* RESTRICT const cip_class,
                             const CipInstanceNum instance_number) {
   if (instance_number == 0) {
-    return (CipInstance *)cip_class; /* if the instance number is zero, return
-                                        the class object itself*/
+    return (CipInstance*)cip_class; /* if the instance number is zero, return
+                                       the class object itself*/
   }
   /* pointer to linked list of instances from the class object*/
-  for (CipInstance *instance = cip_class->instances; instance;
+  for (CipInstance* instance = cip_class->instances; instance;
        instance              = instance->next) /* follow the list*/
   {
     if (instance->instance_number == instance_number) {
@@ -191,15 +191,15 @@ CipInstance *GetCipInstance(const CipClass *RESTRICT const cip_class,
   return NULL;
 }
 
-EipStatus RegisterCipClass(CipClass *cip_class) {
-  CipMessageRouterObject **message_router_object = &g_first_object;
+EipStatus RegisterCipClass(CipClass* cip_class) {
+  CipMessageRouterObject** message_router_object = &g_first_object;
 
   while (*message_router_object) {
     message_router_object =
         &(*message_router_object)->next; /* follow the list until p points to an
                                             empty link (list end)*/
   }
-  *message_router_object = (CipMessageRouterObject *)CipCalloc(
+  *message_router_object = (CipMessageRouterObject*)CipCalloc(
       1, sizeof(CipMessageRouterObject)); /* create a new node at the end of the
                                              list*/
   if (*message_router_object == 0) {
@@ -211,10 +211,10 @@ EipStatus RegisterCipClass(CipClass *cip_class) {
   return kEipStatusOk;
 }
 
-EipStatus NotifyMessageRouter(EipUint8 *data,
+EipStatus NotifyMessageRouter(EipUint8* data,
                               int data_length,
-                              CipMessageRouterResponse *message_router_response,
-                              const struct sockaddr *const originator_address,
+                              CipMessageRouterResponse* message_router_response,
+                              const struct sockaddr* const originator_address,
                               const CipSessionHandle encapsulation_session) {
   EipStatus eip_status = kEipStatusOkSend;
   CipError status      = kCipErrorSuccess;
@@ -234,7 +234,7 @@ EipStatus NotifyMessageRouter(EipUint8 *data,
         (0x80 | g_message_router_request.service);
   } else {
     /* forward request to appropriate Object if it is registered*/
-    CipMessageRouterObject *registered_object =
+    CipMessageRouterObject* registered_object =
         GetRegisteredObject(g_message_router_request.request_path.class_id);
     if (registered_object == 0) {
       OPENER_TRACE_ERR(
@@ -286,9 +286,9 @@ EipStatus NotifyMessageRouter(EipUint8 *data,
 }
 
 CipError CreateMessageRouterRequestStructure(
-    const EipUint8 *data,
+    const EipUint8* data,
     EipInt16 data_length,
-    CipMessageRouterRequest *message_router_request) {
+    CipMessageRouterRequest* message_router_request) {
   message_router_request->service = *data;
   data++;
   data_length--;
@@ -311,11 +311,11 @@ CipError CreateMessageRouterRequestStructure(
 }
 
 void DeleteAllClasses(void) {
-  CipMessageRouterObject *message_router_object =
+  CipMessageRouterObject* message_router_object =
       g_first_object; /* get pointer to head of class registration list */
-  CipMessageRouterObject *message_router_object_to_delete = NULL;
-  CipInstance *instance                                   = NULL;
-  CipInstance *instance_to_delete                         = NULL;
+  CipMessageRouterObject* message_router_object_to_delete = NULL;
+  CipInstance* instance                                   = NULL;
+  CipInstance* instance_to_delete                         = NULL;
 
   while (NULL != message_router_object) {
     message_router_object_to_delete = message_router_object;
@@ -334,7 +334,7 @@ void DeleteAllClasses(void) {
     }
 
     /* free meta class data*/
-    CipClass *meta_class =
+    CipClass* meta_class =
         message_router_object_to_delete->cip_class->class_instance.cip_class;
     CipFree(meta_class->class_name);
     CipFree(meta_class->services);
@@ -344,7 +344,7 @@ void DeleteAllClasses(void) {
     CipFree(meta_class);
 
     /* free class data*/
-    CipClass *cip_class = message_router_object_to_delete->cip_class;
+    CipClass* cip_class = message_router_object_to_delete->cip_class;
     CipFree(cip_class->class_name);
     CipFree(cip_class->get_single_bit_mask);
     CipFree(cip_class->set_bit_mask);

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

@@ -36,10 +36,10 @@ void DeleteAllClasses(void);
  *  @return  kEipStatusError on fault
  *           kEipStatusOk on success
  */
-EipStatus NotifyMessageRouter(EipUint8 *data,
+EipStatus NotifyMessageRouter(EipUint8* data,
                               int data_length,
-                              CipMessageRouterResponse *message_router_response,
-                              const struct sockaddr *const originator_address,
+                              CipMessageRouterResponse* message_router_response,
+                              const struct sockaddr* const originator_address,
                               const CipSessionHandle encapsulation_session);
 
 /*! Register a class at the message router.
@@ -50,6 +50,6 @@ EipStatus NotifyMessageRouter(EipUint8 *data,
  *  @param cip_class CIP class to be registered
  *  @return kEipStatusOk on success
  */
-EipStatus RegisterCipClass(CipClass *cip_class);
+EipStatus RegisterCipClass(CipClass* cip_class);
 
 #endif /* OPENER_CIPMESSAGEROUTER_H_ */

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

@@ -67,17 +67,17 @@ static CipQosDscpValues s_active_dscp = {.event        = DEFAULT_DSCP_EVENT,
  *          -1 .. error
  */
 int DecodeCipQoSAttribute(
-    void *const data,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response) {
-  const EipUint8 **const cip_message = &(message_router_request->data);
+    void* const data,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response) {
+  const EipUint8** const cip_message = &(message_router_request->data);
 
   int number_of_decoded_bytes = -1;
 
   if (NULL != cip_message) {
     CipUsint attribute_value_received = GetUsintFromMessage(cip_message);
     if (attribute_value_received < 64U) {
-      *(CipUsint *)data = attribute_value_received;  // write value to attribute
+      *(CipUsint*)data = attribute_value_received;  // write value to attribute
 
       message_router_response->general_status = kCipErrorSuccess;
       number_of_decoded_bytes                 = 1;
@@ -117,7 +117,7 @@ CipUsint CipQosGetDscpPriority(ConnectionObjectPriority priority) {
 }
 
 EipStatus CipQoSInit() {
-  CipClass *qos_class = NULL;
+  CipClass* qos_class = NULL;
 
   if ((qos_class =
            CreateCipClass(kCipQoSClassCode,
@@ -135,7 +135,7 @@ EipStatus CipQoSInit() {
     return kEipStatusError;
   }
 
-  CipInstance *instance = GetCipInstance(
+  CipInstance* instance = GetCipInstance(
       qos_class,
       1); /* bind attributes to the instance #1 that was created above */
 
@@ -144,56 +144,56 @@ EipStatus CipQoSInit() {
                   kCipUsint,
                   EncodeCipUsint,
                   NULL,
-                  (void *)&g_qos.q_frames_enable,
+                  (void*)&g_qos.q_frames_enable,
                   kNotSetOrGetable);
   InsertAttribute(instance,
                   2,
                   kCipUsint,
                   EncodeCipUsint,
                   NULL,
-                  (void *)&g_qos.dscp.event,
+                  (void*)&g_qos.dscp.event,
                   kNotSetOrGetable);
   InsertAttribute(instance,
                   3,
                   kCipUsint,
                   EncodeCipUsint,
                   NULL,
-                  (void *)&g_qos.dscp.general,
+                  (void*)&g_qos.dscp.general,
                   kNotSetOrGetable);
   InsertAttribute(instance,
                   4,
                   kCipUsint,
                   EncodeCipUsint,
                   DecodeCipQoSAttribute,
-                  (void *)&g_qos.dscp.urgent,
+                  (void*)&g_qos.dscp.urgent,
                   kGetableSingle | kSetable | kNvDataFunc);
   InsertAttribute(instance,
                   5,
                   kCipUsint,
                   EncodeCipUsint,
                   DecodeCipQoSAttribute,
-                  (void *)&g_qos.dscp.scheduled,
+                  (void*)&g_qos.dscp.scheduled,
                   kGetableSingle | kSetable | kNvDataFunc);
   InsertAttribute(instance,
                   6,
                   kCipUsint,
                   EncodeCipUsint,
                   DecodeCipQoSAttribute,
-                  (void *)&g_qos.dscp.high,
+                  (void*)&g_qos.dscp.high,
                   kGetableSingle | kSetable | kNvDataFunc);
   InsertAttribute(instance,
                   7,
                   kCipUsint,
                   EncodeCipUsint,
                   DecodeCipQoSAttribute,
-                  (void *)&g_qos.dscp.low,
+                  (void*)&g_qos.dscp.low,
                   kGetableSingle | kSetable | kNvDataFunc);
   InsertAttribute(instance,
                   8,
                   kCipUsint,
                   EncodeCipUsint,
                   DecodeCipQoSAttribute,
-                  (void *)&g_qos.dscp.explicit_msg,
+                  (void*)&g_qos.dscp.explicit_msg,
                   kGetableSingle | kSetable | kNvDataFunc);
 
   InsertService(qos_class,

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

@@ -17,7 +17,7 @@
 #include "opener_api.h"
 #include "trace.h"
 
-CipStringN *ClearCipStringN(CipStringN *const cip_string) {
+CipStringN* ClearCipStringN(CipStringN* const cip_string) {
   if (NULL != cip_string) {
     if (NULL != cip_string->string) {
       CipFree(cip_string->string);
@@ -31,7 +31,7 @@ CipStringN *ClearCipStringN(CipStringN *const cip_string) {
   return cip_string;
 }
 
-void FreeCipStringN(CipStringN *const cip_string) {
+void FreeCipStringN(CipStringN* const cip_string) {
   if (NULL != cip_string) {
     ClearCipStringN(cip_string);
     CipFree(cip_string);
@@ -50,11 +50,11 @@ void FreeCipStringN(CipStringN *const cip_string) {
  *
  * @return The CipStringN address
  */
-CipStringN *SetCipStringNByData(CipStringN *const cip_string,
+CipStringN* SetCipStringNByData(CipStringN* const cip_string,
                                 CipUint str_len,
                                 CipUint size,
-                                const CipOctet *const data) {
-  CipStringN *result = cip_string;
+                                const CipOctet* const data) {
+  CipStringN* result = cip_string;
 
   (void)ClearCipStringN(cip_string);
 
@@ -77,8 +77,8 @@ CipStringN *SetCipStringNByData(CipStringN *const cip_string,
   return result;
 }
 
-CipStringN *SetCipStringNByCstr(CipStringN *const cip_string,
-                                const char *const string,
+CipStringN* SetCipStringNByCstr(CipStringN* const cip_string,
+                                const char* const string,
                                 const CipUint symbol_size) {
   if (0 != strlen(string) % symbol_size) {
     OPENER_TRACE_ERR("Not enough octets for %d width StringN\n", symbol_size);
@@ -89,10 +89,10 @@ CipStringN *SetCipStringNByCstr(CipStringN *const cip_string,
   return SetCipStringNByData(cip_string,
                              (CipUint)strlen(string) / symbol_size,
                              symbol_size,
-                             (const CipOctet *)string);
+                             (const CipOctet*)string);
 }
 
-void FreeCipString2(CipString2 *const cip_string) {
+void FreeCipString2(CipString2* const cip_string) {
   if (NULL != cip_string) {
     ClearCipString2(cip_string);
     CipFree(cip_string);
@@ -108,7 +108,7 @@ void FreeCipString2(CipString2 *const cip_string) {
  * @return Freed CipString2 structure
  *
  */
-CipString2 *ClearCipString2(CipString2 *const cip_string) {
+CipString2* ClearCipString2(CipString2* const cip_string) {
   if (NULL != cip_string) {
     if (NULL != cip_string->string) {
       CipFree(cip_string->string);
@@ -121,10 +121,10 @@ CipString2 *ClearCipString2(CipString2 *const cip_string) {
   return cip_string;
 }
 
-CipString2 *SetCipString2ByData(CipString2 *const cip_string,
+CipString2* SetCipString2ByData(CipString2* const cip_string,
                                 CipUint str_len,
-                                const CipOctet *const data) {
-  CipString2 *result = cip_string;
+                                const CipOctet* const data) {
+  CipString2* result = cip_string;
 
   (void)ClearCipString2(cip_string);
 
@@ -141,13 +141,13 @@ CipString2 *SetCipString2ByData(CipString2 *const cip_string,
   return result;
 }
 
-CipString2 *SetCipString2ByCstr(CipString2 *const cip_string,
-                                const char *const string) {
+CipString2* SetCipString2ByCstr(CipString2* const cip_string,
+                                const char* const string) {
   return SetCipString2ByData(
-      cip_string, (CipUint)strlen(string) / 2, (const CipOctet *)string);
+      cip_string, (CipUint)strlen(string) / 2, (const CipOctet*)string);
 }
 
-CipString *ClearCipString(CipString *const cip_string) {
+CipString* ClearCipString(CipString* const cip_string) {
   if (NULL != cip_string) {
     if (NULL != cip_string->string) {
       CipFree(cip_string->string);
@@ -160,7 +160,7 @@ CipString *ClearCipString(CipString *const cip_string) {
   return cip_string;
 }
 
-void FreeCipString(CipString *const cip_string) {
+void FreeCipString(CipString* const cip_string) {
   if (NULL != cip_string) {
     ClearCipString(cip_string);
     CipFree(cip_string);
@@ -169,10 +169,10 @@ void FreeCipString(CipString *const cip_string) {
   }
 }
 
-CipString *SetCipStringByData(CipString *const cip_string,
+CipString* SetCipStringByData(CipString* const cip_string,
                               CipUint str_len,
-                              const CipOctet *const data) {
-  CipString *result = cip_string;
+                              const CipOctet* const data) {
+  CipString* result = cip_string;
 
   (void)ClearCipString(cip_string);
 
@@ -189,13 +189,13 @@ CipString *SetCipStringByData(CipString *const cip_string,
   return result;
 }
 
-CipString *SetCipStringByCstr(CipString *const cip_string,
-                              const char *const string) {
+CipString* SetCipStringByCstr(CipString* const cip_string,
+                              const char* const string) {
   return SetCipStringByData(
-      cip_string, (CipUint)strlen(string), (const CipOctet *)string);
+      cip_string, (CipUint)strlen(string), (const CipOctet*)string);
 }
 
-CipShortString *ClearCipShortString(CipShortString *const cip_string) {
+CipShortString* ClearCipShortString(CipShortString* const cip_string) {
   if (NULL != cip_string) {
     if (NULL != cip_string->string) {
       CipFree(cip_string->string);
@@ -215,7 +215,7 @@ CipShortString *ClearCipShortString(CipShortString *const cip_string) {
  * @return Freed CipShortString structure
  *
  */
-void FreeCipShortString(CipShortString *const cip_string) {
+void FreeCipShortString(CipShortString* const cip_string) {
   if (NULL != cip_string) {
     ClearCipShortString(cip_string);
     CipFree(cip_string);
@@ -233,10 +233,10 @@ void FreeCipShortString(CipShortString *const cip_string) {
  *
  * @return The CipShortString address
  */
-CipShortString *SetCipShortStringByData(CipShortString *const cip_string,
+CipShortString* SetCipShortStringByData(CipShortString* const cip_string,
                                         const CipUsint str_len,
-                                        const CipOctet *const data) {
-  CipShortString *result = cip_string;
+                                        const CipOctet* const data) {
+  CipShortString* result = cip_string;
 
   (void)ClearCipShortString(cip_string);
 
@@ -262,15 +262,15 @@ CipShortString *SetCipShortStringByData(CipShortString *const cip_string,
  * @return Target CipShortString
  *
  */
-CipShortString *SetCipShortStringByCstr(CipShortString *const cip_string,
-                                        const char *const string) {
+CipShortString* SetCipShortStringByCstr(CipShortString* const cip_string,
+                                        const char* const string) {
   return SetCipShortStringByData(
-      cip_string, (CipUsint)strlen(string), (const CipOctet *)string);
+      cip_string, (CipUsint)strlen(string), (const CipOctet*)string);
 }
 
 /* Ensures buf is NUL terminated, provided initial validation is successful */
-int GetCstrFromCipShortString(CipShortString *const string,
-                              char *buf,
+int GetCstrFromCipShortString(CipShortString* const string,
+                              char* buf,
                               size_t len) {
   size_t num;
   int rc = 0;

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

@@ -16,10 +16,10 @@
 #include "ciptypes.h"
 #include "typedefs.h"
 
-CipStringN *SetCipStringNByData(CipStringN *const cip_string,
+CipStringN* SetCipStringNByData(CipStringN* const cip_string,
                                 CipUint str_len,
                                 CipUint size,
-                                const CipOctet *const data);
+                                const CipOctet* const data);
 
 /** @brief Copies the content of C-string to a CipStringN under the expectation,
  * that each C-String element is a StringN octet
@@ -31,8 +31,8 @@ CipStringN *SetCipStringNByData(CipStringN *const cip_string,
  * @return Target CipStringN
  *
  */
-CipStringN *SetCipStringNByCstr(CipStringN *const cip_string,
-                                const char *const string,
+CipStringN* SetCipStringNByCstr(CipStringN* const cip_string,
+                                const char* const string,
                                 const CipUint symbol_size);
 
 /** @brief Clears the internal structure of a CipStringN
@@ -42,14 +42,14 @@ CipStringN *SetCipStringNByCstr(CipStringN *const cip_string,
  * @return Returns the address of the cleared CipStringN
  *
  */
-CipStringN *ClearCipStringN(CipStringN *const cip_string);
+CipStringN* ClearCipStringN(CipStringN* const cip_string);
 
 /** @brief Frees the memory of a CipStringN
  *
  * @param cip_string The CipStringN to be freed
  *
  */
-void FreeCipStringN(CipStringN *const cip_string);
+void FreeCipStringN(CipStringN* const cip_string);
 
 /** @brief Sets length and data for a CipString2 based on an octet stream and
  * symbol length
@@ -60,9 +60,9 @@ void FreeCipStringN(CipStringN *const cip_string);
  *
  * @return The CipString2 address
  */
-CipString2 *SetCipString2ByData(CipString2 *const cip_string,
+CipString2* SetCipString2ByData(CipString2* const cip_string,
                                 CipUint str_len,
-                                const CipOctet *const data);
+                                const CipOctet* const data);
 
 /** @brief Copies the content of C-string to a CipString2 under the expectation,
  * that each C-String element is a CipString2 octet
@@ -73,8 +73,8 @@ CipString2 *SetCipString2ByData(CipString2 *const cip_string,
  * @return Target CipString2
  *
  */
-CipString2 *SetCipString2ByCstr(CipString2 *const cip_string,
-                                const char *const string);
+CipString2* SetCipString2ByCstr(CipString2* const cip_string,
+                                const char* const string);
 
 /** @brief Clears the internal structure of a CipString2
  *
@@ -83,7 +83,7 @@ CipString2 *SetCipString2ByCstr(CipString2 *const cip_string,
  * @return Returns the address of the cleared CipString2
  *
  */
-CipString2 *ClearCipString2(CipString2 *const cip_string);
+CipString2* ClearCipString2(CipString2* const cip_string);
 
 /** @brief Frees a CipString2 structure
  *
@@ -92,7 +92,7 @@ CipString2 *ClearCipString2(CipString2 *const cip_string);
  * @return Freed CipString2 structure
  *
  */
-void FreeCipString2(CipString2 *const cip_string);
+void FreeCipString2(CipString2* const cip_string);
 
 /** @brief Clears the internal CipString structure
  *
@@ -101,14 +101,14 @@ void FreeCipString2(CipString2 *const cip_string);
  * @return Cleared CipString structure
  *
  */
-CipString *ClearCipString(CipString *const cip_string);
+CipString* ClearCipString(CipString* const cip_string);
 
 /** @brief Frees a CipString structure
  *
  * @param cip_string The CipString structure to be freed
  *
  */
-void FreeCipString(CipString *const cip_string);
+void FreeCipString(CipString* const cip_string);
 
 /** @brief Sets length and data for a CipString based on an octet stream and
  * symbol length
@@ -119,9 +119,9 @@ void FreeCipString(CipString *const cip_string);
  *
  * @return The CipString address
  */
-CipString *SetCipStringByData(CipString *const cip_string,
+CipString* SetCipStringByData(CipString* const cip_string,
                               CipUint str_len,
-                              const CipOctet *const data);
+                              const CipOctet* const data);
 
 /** @brief Copies the content of C-string to a CipString under the expectation,
  * that each C-String element is a CipString octet
@@ -132,8 +132,8 @@ CipString *SetCipStringByData(CipString *const cip_string,
  * @return Target CipString
  *
  */
-CipString *SetCipStringByCstr(CipString *const cip_string,
-                              const char *const string);
+CipString* SetCipStringByCstr(CipString* const cip_string,
+                              const char* const string);
 
 /** @brief Clears the internal CipShortString structure
  *
@@ -142,14 +142,14 @@ CipString *SetCipStringByCstr(CipString *const cip_string,
  * @return Cleared CipShortString structure
  *
  */
-CipShortString *ClearCipShortString(CipShortString *const cip_string);
+CipShortString* ClearCipShortString(CipShortString* const cip_string);
 
 /** @brief Frees a CipShortString structure
  *
  * @param cip_string The CipShortString structure to be freed
  *
  */
-void FreeCipShortString(CipShortString *const cip_string);
+void FreeCipShortString(CipShortString* const cip_string);
 
 /** @brief Sets length and data for a CipShortString based on an octet stream
  * and symbol length
@@ -160,9 +160,9 @@ void FreeCipShortString(CipShortString *const cip_string);
  *
  * @return The CipShortString address
  */
-CipShortString *SetCipShortStringByData(CipShortString *const cip_string,
+CipShortString* SetCipShortStringByData(CipShortString* const cip_string,
                                         const CipUsint str_len,
-                                        const CipOctet *const data);
+                                        const CipOctet* const data);
 
 /** @brief Copies the content of C-string to a CipShortString under the
  * expectation, that each C-String element is a CipShortString octet
@@ -173,8 +173,8 @@ CipShortString *SetCipShortStringByData(CipShortString *const cip_string,
  * @return Target CipShortString
  *
  */
-CipShortString *SetCipShortStringByCstr(CipShortString *const cip_string,
-                                        const char *const string);
+CipShortString* SetCipShortStringByCstr(CipShortString* const cip_string,
+                                        const char* const string);
 
 /** @brief Returns a NUL terminated C-string from a CipShortString
  *
@@ -185,8 +185,8 @@ CipShortString *SetCipShortStringByCstr(CipShortString *const cip_string,
  * @return POSIX OK(0) if the complete string fit in @param buf, otherwise
  * non-zero.
  */
-int GetCstrFromCipShortString(CipShortString *const string,
-                              char *buf,
+int GetCstrFromCipShortString(CipShortString* const string,
+                              char* buf,
                               size_t len);
 
 #endif /* of OPENER_CIPSTRING_H_ */

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

@@ -13,7 +13,7 @@
 #include "opener_api.h"
 #include "trace.h"
 
-void CipStringIDelete(CipStringI *const string) {
+void CipStringIDelete(CipStringI* const string) {
   for (size_t i = 0; i < string->number_of_strings; ++i) {
     string->array_of_string_i_structs[i].language_char_1 = '\0';
     string->array_of_string_i_structs[i].language_char_2 = '\0';
@@ -22,19 +22,19 @@ void CipStringIDelete(CipStringI *const string) {
     switch (string->array_of_string_i_structs[i].char_string_struct) {
       case kCipShortString:
         ClearCipShortString(
-            (CipShortString *)&string->array_of_string_i_structs[i].string);
+            (CipShortString*)&string->array_of_string_i_structs[i].string);
         break;
       case kCipString:
         ClearCipString(
-            (CipString *)&string->array_of_string_i_structs[i].string);
+            (CipString*)&string->array_of_string_i_structs[i].string);
         break;
       case kCipString2:
         ClearCipString2(
-            (CipString2 *)&string->array_of_string_i_structs[i].string);
+            (CipString2*)&string->array_of_string_i_structs[i].string);
         break;
       case kCipStringN:
         ClearCipStringN(
-            (CipStringN *)&string->array_of_string_i_structs[i].string);
+            (CipStringN*)&string->array_of_string_i_structs[i].string);
         break;
       default:
         OPENER_TRACE_ERR("CIP File: No valid String type received!\n");
@@ -46,22 +46,22 @@ void CipStringIDelete(CipStringI *const string) {
   string->array_of_string_i_structs = NULL;
 }
 
-bool CipStringIsAnyStringEmpty(const CipStringI *const string) {
+bool CipStringIsAnyStringEmpty(const CipStringI* const string) {
   for (size_t i = 0; i < string->number_of_strings; ++i) {
     size_t length           = 0;
-    void *pointer_to_string = string->array_of_string_i_structs[i].string;
+    void* pointer_to_string = string->array_of_string_i_structs[i].string;
     switch (string->array_of_string_i_structs[i].char_string_struct) {
       case kCipShortString:
-        length = ((CipShortString *)pointer_to_string)->length;
+        length = ((CipShortString*)pointer_to_string)->length;
         break;
       case kCipString:
-        length = ((CipString *)pointer_to_string)->length;
+        length = ((CipString*)pointer_to_string)->length;
         break;
       case kCipString2:
-        length = ((CipString2 *)pointer_to_string)->length;
+        length = ((CipString2*)pointer_to_string)->length;
         break;
       case kCipStringN:
-        length = ((CipStringN *)pointer_to_string)->length;
+        length = ((CipStringN*)pointer_to_string)->length;
         break;
       default:
         OPENER_TRACE_ERR("CIP File: No valid String type received!\n");
@@ -73,7 +73,7 @@ bool CipStringIsAnyStringEmpty(const CipStringI *const string) {
   return false;
 }
 
-void *CipStringICreateStringStructure(CipStringIStruct *const to) {
+void* CipStringICreateStringStructure(CipStringIStruct* const to) {
   switch (to->char_string_struct) {
     case kCipShortString:
       return to->string = CipCalloc(1, sizeof(CipShortString));
@@ -89,12 +89,12 @@ void *CipStringICreateStringStructure(CipStringIStruct *const to) {
   return NULL;
 }
 
-void CipStringIDeepCopyInternalString(CipStringIStruct *const to,
-                                      const CipStringIStruct *const from) {
+void CipStringIDeepCopyInternalString(CipStringIStruct* const to,
+                                      const CipStringIStruct* const from) {
   switch (to->char_string_struct) {
     case kCipShortString: {
-      CipShortString *toString   = (CipShortString *)to->string;
-      CipShortString *fromString = (CipShortString *)from->string;
+      CipShortString* toString   = (CipShortString*)to->string;
+      CipShortString* fromString = (CipShortString*)from->string;
       toString->length           = fromString->length;
       toString->string = CipCalloc(toString->length, sizeof(CipOctet));
       memcpy(toString->string,
@@ -102,8 +102,8 @@ void CipStringIDeepCopyInternalString(CipStringIStruct *const to,
              sizeof(CipOctet) * toString->length);
     } break;
     case kCipString: {
-      CipString *toString   = (CipString *)to->string;
-      CipString *fromString = (CipString *)from->string;
+      CipString* toString   = (CipString*)to->string;
+      CipString* fromString = (CipString*)from->string;
       toString->length      = fromString->length;
       toString->string      = CipCalloc(toString->length, sizeof(CipOctet));
       memcpy(toString->string,
@@ -111,8 +111,8 @@ void CipStringIDeepCopyInternalString(CipStringIStruct *const to,
              sizeof(CipOctet) * toString->length);
     } break;
     case kCipString2: {
-      CipString2 *toString   = (CipString2 *)to->string;
-      CipString2 *fromString = (CipString2 *)from->string;
+      CipString2* toString   = (CipString2*)to->string;
+      CipString2* fromString = (CipString2*)from->string;
       toString->length       = fromString->length;
       toString->string = CipCalloc(toString->length, 2 * sizeof(CipOctet));
       memcpy(toString->string,
@@ -120,8 +120,8 @@ void CipStringIDeepCopyInternalString(CipStringIStruct *const to,
              2 * sizeof(CipOctet) * toString->length);
     } break;
     case kCipStringN: {
-      CipStringN *toString   = (CipStringN *)to->string;
-      CipStringN *fromString = (CipStringN *)from->string;
+      CipStringN* toString   = (CipStringN*)to->string;
+      CipStringN* fromString = (CipStringN*)from->string;
       toString->length       = fromString->length;
       toString->size         = fromString->size;
       toString->string =
@@ -135,13 +135,13 @@ void CipStringIDeepCopyInternalString(CipStringIStruct *const to,
   }
 }
 
-void CipStringICopy(CipStringI *const to, const CipStringI *const from) {
+void CipStringICopy(CipStringI* const to, const CipStringI* const from) {
   to->number_of_strings = from->number_of_strings;
   to->array_of_string_i_structs =
       CipCalloc(to->number_of_strings, sizeof(CipStringIStruct));
   for (size_t i = 0; i < to->number_of_strings; ++i) {
-    CipStringIStruct *const toStruct   = to->array_of_string_i_structs + i;
-    CipStringIStruct *const fromStruct = from->array_of_string_i_structs + i;
+    CipStringIStruct* const toStruct   = to->array_of_string_i_structs + i;
+    CipStringIStruct* const fromStruct = from->array_of_string_i_structs + i;
     toStruct->language_char_1          = fromStruct->language_char_1;
     toStruct->language_char_2          = fromStruct->language_char_2;
     toStruct->language_char_3          = fromStruct->language_char_3;
@@ -153,9 +153,9 @@ void CipStringICopy(CipStringI *const to, const CipStringI *const from) {
 }
 
 void CipStringIDecodeFromMessage(
-    CipStringI *data_to,
-    CipMessageRouterRequest *const message_router_request) {
-  CipStringI *target_stringI = data_to;
+    CipStringI* data_to,
+    CipMessageRouterRequest* const message_router_request) {
+  CipStringI* target_stringI = data_to;
 
   target_stringI->number_of_strings =
       GetUsintFromMessage(&message_router_request->data);
@@ -179,9 +179,9 @@ void CipStringIDecodeFromMessage(
       case kCipShortString: {
         target_stringI->array_of_string_i_structs[i].string =
             CipCalloc(1, sizeof(CipShortString));
-        CipShortString *short_string =
-            (CipShortString *)(target_stringI->array_of_string_i_structs[i]
-                                   .string);
+        CipShortString* short_string =
+            (CipShortString*)(target_stringI->array_of_string_i_structs[i]
+                                  .string);
         CipUsint length = GetUsintFromMessage(&message_router_request->data);
         SetCipShortStringByData(
             short_string, length, message_router_request->data);
@@ -191,8 +191,8 @@ void CipStringIDecodeFromMessage(
       case kCipString: {
         target_stringI->array_of_string_i_structs[i].string =
             CipCalloc(1, sizeof(CipString));
-        CipString *const string =
-            (CipString *const)target_stringI->array_of_string_i_structs[i]
+        CipString* const string =
+            (CipString* const)target_stringI->array_of_string_i_structs[i]
                 .string;
         CipUint length = GetUintFromMessage(&message_router_request->data);
         SetCipStringByData(string, length, message_router_request->data);
@@ -201,8 +201,8 @@ void CipStringIDecodeFromMessage(
       case kCipString2: {
         target_stringI->array_of_string_i_structs[i].string =
             CipCalloc(1, sizeof(CipString2));
-        CipString2 *const string =
-            (CipString2 *const)target_stringI->array_of_string_i_structs[i]
+        CipString2* const string =
+            (CipString2* const)target_stringI->array_of_string_i_structs[i]
                 .string;
         CipUint length = GetUintFromMessage(&message_router_request->data);
         SetCipString2ByData(string, length, message_router_request->data);
@@ -214,8 +214,8 @@ void CipStringIDecodeFromMessage(
 
         target_stringI->array_of_string_i_structs[i].string =
             CipCalloc(1, sizeof(CipStringN));
-        CipStringN *const string =
-            (CipStringN *const)target_stringI->array_of_string_i_structs[i]
+        CipStringN* const string =
+            (CipStringN* const)target_stringI->array_of_string_i_structs[i]
                 .string;
         SetCipStringNByData(string, length, size, message_router_request->data);
         message_router_request->data += length * size;
@@ -226,35 +226,35 @@ void CipStringIDecodeFromMessage(
   }  // end for
 }
 
-bool CipStringICompare(const CipStringI *const stringI_1,
-                       const CipStringI *const stringI_2) {
+bool CipStringICompare(const CipStringI* const stringI_1,
+                       const CipStringI* const stringI_2) {
   /*loop through struct 1 strings*/
   for (size_t i = 0; i < stringI_1->number_of_strings; ++i) {
     // String 1
-    void *string_1      = stringI_1->array_of_string_i_structs[i].string;
-    void *string_1_data = NULL;
+    void* string_1      = stringI_1->array_of_string_i_structs[i].string;
+    void* string_1_data = NULL;
     CipUint len_1       = 0;  // size of string-struct in bytes
 
     switch (stringI_1->array_of_string_i_structs[i].char_string_struct) {
       case kCipShortString: {
-        len_1         = ((CipShortString *)string_1)->length;
-        string_1_data = ((CipShortString *)string_1)->string;
+        len_1         = ((CipShortString*)string_1)->length;
+        string_1_data = ((CipShortString*)string_1)->string;
       } break;
       case kCipString: {
-        len_1         = ((CipString *)string_1)->length;
-        string_1_data = ((CipString *)string_1)->string;
+        len_1         = ((CipString*)string_1)->length;
+        string_1_data = ((CipString*)string_1)->string;
       }
 
       break;
       case kCipString2: {
-        len_1         = ((CipString2 *)string_1)->length * 2;
-        string_1_data = ((CipString2 *)string_1)->string;
+        len_1         = ((CipString2*)string_1)->length * 2;
+        string_1_data = ((CipString2*)string_1)->string;
       } break;
       case kCipStringN: {
-        CipUint length = ((CipStringN *)string_1)->length;
-        CipUint size   = ((CipStringN *)string_1)->size;  // bytes per symbol
+        CipUint length = ((CipStringN*)string_1)->length;
+        CipUint size   = ((CipStringN*)string_1)->size;  // bytes per symbol
         len_1          = length * size;
-        string_1_data  = ((CipStringN *)string_1)->string;
+        string_1_data  = ((CipStringN*)string_1)->string;
 
       } break;
       default:
@@ -264,30 +264,30 @@ bool CipStringICompare(const CipStringI *const stringI_1,
     /*loop through struct 2 strings*/
     for (size_t j = 0; j < stringI_2->number_of_strings; ++j) {
       // String 2
-      void *string_2      = stringI_2->array_of_string_i_structs[j].string;
-      void *string_2_data = NULL;
+      void* string_2      = stringI_2->array_of_string_i_structs[j].string;
+      void* string_2_data = NULL;
       CipUint len_2       = 0;  // size of string-struct in bytes
 
       switch (stringI_2->array_of_string_i_structs[j].char_string_struct) {
         case kCipShortString: {
-          len_2         = ((CipShortString *)string_2)->length;
-          string_2_data = ((CipShortString *)string_2)->string;
+          len_2         = ((CipShortString*)string_2)->length;
+          string_2_data = ((CipShortString*)string_2)->string;
         } break;
         case kCipString: {
-          len_2         = ((CipString *)string_2)->length;
-          string_2_data = ((CipString *)string_2)->string;
+          len_2         = ((CipString*)string_2)->length;
+          string_2_data = ((CipString*)string_2)->string;
         }
 
         break;
         case kCipString2: {
-          len_2         = ((CipString2 *)string_2)->length * 2;
-          string_2_data = ((CipString2 *)string_2)->string;
+          len_2         = ((CipString2*)string_2)->length * 2;
+          string_2_data = ((CipString2*)string_2)->string;
         } break;
         case kCipStringN: {
-          CipUint length = ((CipStringN *)string_2)->length;
-          CipUint size   = ((CipStringN *)string_2)->size;  // bytes per symbol
+          CipUint length = ((CipStringN*)string_2)->length;
+          CipUint size   = ((CipStringN*)string_2)->size;  // bytes per symbol
           len_2          = length * size;
-          string_2_data  = ((CipStringN *)string_2)->string;
+          string_2_data  = ((CipStringN*)string_2)->string;
 
         } break;
         default:

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

@@ -6,14 +6,14 @@
 
 #include "ciptypes.h"
 
-void CipStringIDelete(CipStringI *const string);
+void CipStringIDelete(CipStringI* const string);
 
-bool CipStringIsAnyStringEmpty(const CipStringI *const string);
+bool CipStringIsAnyStringEmpty(const CipStringI* const string);
 
-void CipStringICopy(CipStringI *const to, const CipStringI *const from);
+void CipStringICopy(CipStringI* const to, const CipStringI* const from);
 
 void CipStringIDecodeFromMessage(
-    CipStringI *data_to, CipMessageRouterRequest *const message_router_request);
+    CipStringI* data_to, CipMessageRouterRequest* const message_router_request);
 
-bool CipStringICompare(const CipStringI *const stringI_1,
-                       const CipStringI *const stringI_2);
+bool CipStringICompare(const CipStringI* const stringI_1,
+                       const CipStringI* const stringI_2);

+ 43 - 45
source/src/cip/ciptcpipinterface.c

@@ -134,7 +134,7 @@ static bool isalnum_c(const EipByte byte) {
  *  The minimum length of 1 is checked but not the maximum length
  *  that has already been enforced on data reception.
  */
-static bool IsValidNameLabel(const EipByte *label) {
+static bool IsValidNameLabel(const EipByte* label) {
   if (!isalnum_c(*label)) {
     return false;
   }
@@ -158,14 +158,14 @@ static bool IsValidNameLabel(const EipByte *label) {
  *    be converted to punycode (see https://www.punycoder.com/) by
  *    the user in advance.
  */
-static bool IsValidDomain(EipByte *domain) {
+static bool IsValidDomain(EipByte* domain) {
   bool status = true;
 
   OPENER_TRACE_INFO("Enter '%s'->", domain);
   if ('.' == *domain) { /* Forbid leading dot */
     return false;
   }
-  EipByte *dot = (EipByte *)strchr((char *)domain, '.');
+  EipByte* dot = (EipByte*)strchr((char*)domain, '.');
   if (dot) {
     bool rc;
 
@@ -265,7 +265,7 @@ static bool IsNetworkOrBroadcastIp(in_addr_t ip_addr, in_addr_t net_mask) {
  *   - |   -  |  +  |   -  |  - | name_server / name_server_2
  * A configured gateway must be reachable according to the network mask.
  */
-static bool IsValidNetworkConfig(const CipTcpIpInterfaceConfiguration *if_cfg) {
+static bool IsValidNetworkConfig(const CipTcpIpInterfaceConfiguration* if_cfg) {
   if (INADDR_ANY == ntohl(if_cfg->ip_address)) { /* N0 */
     return false;
   }
@@ -300,10 +300,10 @@ static bool IsValidNetworkConfig(const CipTcpIpInterfaceConfiguration *if_cfg) {
 }
 
 static bool IsIOConnectionActive(void) {
-  DoublyLinkedListNode *node = connection_list.first;
+  DoublyLinkedListNode* node = connection_list.first;
 
   while (NULL != node) {
-    CipConnectionObject *connection = node->data;
+    CipConnectionObject* connection = node->data;
     if (ConnectionObjectIsTypeIOConnection(connection) &&
         kConnectionObjectStateTimedOut !=
             ConnectionObjectGetState(connection)) {
@@ -325,10 +325,10 @@ static CipUsint dummy_data_field =
 
 /************** Functions ****************************************/
 
-void EncodeCipTcpIpInterfaceConfiguration(const void *const data,
-                                          ENIPMessage *const outgoing_message) {
-  CipTcpIpInterfaceConfiguration *tcp_ip_network_interface_configuration =
-      (CipTcpIpInterfaceConfiguration *)data;
+void EncodeCipTcpIpInterfaceConfiguration(const void* const data,
+                                          ENIPMessage* const outgoing_message) {
+  CipTcpIpInterfaceConfiguration* tcp_ip_network_interface_configuration =
+      (CipTcpIpInterfaceConfiguration*)data;
   AddDintToMessage(ntohl(tcp_ip_network_interface_configuration->ip_address),
                    outgoing_message);
   AddDintToMessage(ntohl(tcp_ip_network_interface_configuration->network_mask),
@@ -343,8 +343,8 @@ void EncodeCipTcpIpInterfaceConfiguration(const void *const data,
                   outgoing_message);
 }
 
-void EncodeCipTcpIpMulticastConfiguration(const void *const data,
-                                          ENIPMessage *const outgoing_message) {
+void EncodeCipTcpIpMulticastConfiguration(const void* const data,
+                                          ENIPMessage* const outgoing_message) {
   /* Suppress unused parameter compiler warning. */
   (void)data;
 
@@ -360,16 +360,16 @@ void EncodeCipTcpIpMulticastConfiguration(const void *const data,
   EncodeCipUdint(&multicast_address, outgoing_message);
 }
 
-void EncodeSafetyNetworkNumber(const void *const data,
-                               ENIPMessage *const outgoing_message) {
+void EncodeSafetyNetworkNumber(const void* const data,
+                               ENIPMessage* const outgoing_message) {
   /* Suppress unused parameter compiler warning. */
   (void)data;
 
   FillNextNMessageOctetsWithValueAndMoveToNextPosition(0, 6, outgoing_message);
 }
 
-void EncodeCipLastConflictDetected(const void *const data,
-                                   ENIPMessage *const outgoing_message) {
+void EncodeCipLastConflictDetected(const void* const data,
+                                   ENIPMessage* const outgoing_message) {
   /* Suppress unused parameter compiler warning. */
   (void)data;
 
@@ -381,10 +381,10 @@ void EncodeCipLastConflictDetected(const void *const data,
 }
 
 int DecodeTcpIpInterfaceConfigurationControl(/* Attribute 3 */
-                                             void *const data,
-                                             CipMessageRouterRequest
-                                                 *const message_router_request,
-                                             CipMessageRouterResponse *const
+                                             void* const data,
+                                             CipMessageRouterRequest* const
+                                                 message_router_request,
+                                             CipMessageRouterResponse* const
                                                  message_router_response) {
   int number_of_decoded_bytes = -1;
 
@@ -399,7 +399,7 @@ int DecodeTcpIpInterfaceConfigurationControl(/* Attribute 3 */
     configuration_control_received &=
         (kTcpipCfgCtrlMethodMask | kTcpipCfgCtrlDnsEnable);
 
-    *(CipDword *)data                       = configuration_control_received;
+    *(CipDword*)data                        = configuration_control_received;
     number_of_decoded_bytes                 = 4;
     message_router_response->general_status = kCipErrorSuccess;
   }
@@ -411,12 +411,12 @@ int DecodeTcpIpInterfaceConfigurationControl(/* Attribute 3 */
     0 != OPENER_TCPIP_IFACE_CFG_SETTABLE
 
 int DecodeCipTcpIpInterfaceConfiguration(/* Attribute 5 */
-                                         CipTcpIpInterfaceConfiguration *const
+                                         CipTcpIpInterfaceConfiguration* const
                                              data,  // kCipUdintUdintUdintUdintUdintString
-                                         CipMessageRouterRequest
-                                             *const message_router_request,
-                                         CipMessageRouterResponse
-                                             *const message_router_response) {
+                                         CipMessageRouterRequest* const
+                                             message_router_request,
+                                         CipMessageRouterResponse* const
+                                             message_router_response) {
   int number_of_decoded_bytes = -1;
 
   CipTcpIpInterfaceConfiguration if_cfg;
@@ -474,11 +474,11 @@ int DecodeCipTcpIpInterfaceConfiguration(/* Attribute 5 */
 }
 
 int DecodeCipTcpIpInterfaceHostName(/* Attribute 6 */
-                                    CipString *const data,
-                                    CipMessageRouterRequest
-                                        *const message_router_request,
-                                    CipMessageRouterResponse
-                                        *const message_router_response) {
+                                    CipString* const data,
+                                    CipMessageRouterRequest* const
+                                        message_router_request,
+                                    CipMessageRouterResponse* const
+                                        message_router_response) {
   int number_of_decoded_bytes = -1;
 
   CipString tmp_host_name = {.length = 0u, .string = NULL};
@@ -513,13 +513,11 @@ int DecodeCipTcpIpInterfaceHostName(/* Attribute 6 */
           OPENER_TCPIP_IFACE_CFG_SETTABLE*/
 
 int DecodeCipTcpIpInterfaceEncapsulationInactivityTimeout(/* Attribute 13 */
-                                                          void *const data,
-                                                          CipMessageRouterRequest
-                                                              *const
-                                                                  message_router_request,
-                                                          CipMessageRouterResponse
-                                                              *const
-                                                                  message_router_response) {
+                                                          void* const data,
+                                                          CipMessageRouterRequest* const
+                                                              message_router_request,
+                                                          CipMessageRouterResponse* const
+                                                              message_router_response) {
   int number_of_decoded_bytes = -1;
 
   CipUint inactivity_timeout_received =
@@ -528,7 +526,7 @@ int DecodeCipTcpIpInterfaceEncapsulationInactivityTimeout(/* Attribute 13 */
   if (inactivity_timeout_received > 3600) {
     message_router_response->general_status = kCipErrorInvalidAttributeValue;
   } else {
-    *(CipUint *)data                        = inactivity_timeout_received;
+    *(CipUint*)data                         = inactivity_timeout_received;
     message_router_response->general_status = kCipErrorSuccess;
     number_of_decoded_bytes                 = 2;
   }
@@ -537,7 +535,7 @@ int DecodeCipTcpIpInterfaceEncapsulationInactivityTimeout(/* Attribute 13 */
 }
 
 EipStatus CipTcpIpInterfaceInit() {
-  CipClass *tcp_ip_class = NULL;
+  CipClass* tcp_ip_class = NULL;
 
   if ((tcp_ip_class =
            CreateCipClass(kCipTcpIpInterfaceClassCode, /* class code */
@@ -555,7 +553,7 @@ EipStatus CipTcpIpInterfaceInit() {
     return kEipStatusError;
   }
 
-  CipInstance *instance = GetCipInstance(
+  CipInstance* instance = GetCipInstance(
       tcp_ip_class,
       1); /* bind attributes to the instance #1 that was created above */
 
@@ -709,7 +707,7 @@ void ShutdownTcpIpInterface(void) {
  *  according to CIP spec Volume 2,
  *  section 3-5.3 "Multicast Address Allocation for EtherNet/IP"
  */
-void CipTcpIpCalculateMulticastIp(CipTcpIpObject *const tcpip) {
+void CipTcpIpCalculateMulticastIp(CipTcpIpObject* const tcpip) {
   /* Multicast base address according to spec: 239.192.1.0 */
   static const CipUdint cip_mcast_base_addr = 0xEFC00100;
 
@@ -724,10 +722,10 @@ void CipTcpIpCalculateMulticastIp(CipTcpIpObject *const tcpip) {
       htonl(cip_mcast_base_addr + (host_id << 5));
 }
 
-EipUint16 GetEncapsulationInactivityTimeout(CipInstance *instance) {
-  CipAttributeStruct *attribute = GetCipAttribute(instance, 13);
+EipUint16 GetEncapsulationInactivityTimeout(CipInstance* instance) {
+  CipAttributeStruct* attribute = GetCipAttribute(instance, 13);
   OPENER_ASSERT(NULL != attribute);
-  CipUint *data                              = (CipUint *)attribute->data;
+  CipUint* data                              = (CipUint*)attribute->data;
   EipUint16 encapsulation_inactivity_timeout = *data;
   return encapsulation_inactivity_timeout;
 }

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

@@ -103,12 +103,12 @@ void ShutdownTcpIpInterface(void);
  *
  *  @param  tcpip pointer to TCP/IP object
  */
-void CipTcpIpCalculateMulticastIp(CipTcpIpObject *const tcpip);
+void CipTcpIpCalculateMulticastIp(CipTcpIpObject* const tcpip);
 
 /** @brief Public Method to get Encapsulation Inactivity Timeout Value
  *
  *
  */
-EipUint16 GetEncapsulationInactivityTimeout(CipInstance *instance);
+EipUint16 GetEncapsulationInactivityTimeout(CipInstance* instance);
 
 #endif /* OPENER_CIPTCPIPINTERFACE_H_ */

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

@@ -10,7 +10,7 @@
 const CipInstanceNum kCipInstanceNumMax = UINT16_MAX;
 
 /* functions*/
-size_t GetCipDataTypeLength(EipUint8 type, const EipUint8 *data) {
+size_t GetCipDataTypeLength(EipUint8 type, const EipUint8* data) {
   size_t length = 0;
 
   switch (type) {
@@ -79,7 +79,7 @@ size_t GetCipDataTypeLength(EipUint8 type, const EipUint8 *data) {
 
     case kCipByteArray:
       if (NULL != data) {
-        CipByteArray *byte_array = (CipByteArray *)data;
+        CipByteArray* byte_array = (CipByteArray*)data;
         length                   = byte_array->length;
       }
       break;

+ 38 - 38
source/src/cip/ciptypes.h

@@ -67,7 +67,7 @@ typedef enum cip_data_types {
  * @param data use data pointer if data length is variable, else set NULL
  * @return size of CIP data type in bytes
  * */
-size_t GetCipDataTypeLength(EipUint8 type, const EipUint8 *data);
+size_t GetCipDataTypeLength(EipUint8 type, const EipUint8* data);
 
 /** @brief Definition of CIP service codes
  *
@@ -147,7 +147,7 @@ typedef enum {
  */
 typedef struct {
   EipUint16 length; /**< Length of the Byte Array */
-  EipByte *data;    /**< Pointer to the data */
+  EipByte* data;    /**< Pointer to the data */
 } CipByteArray;
 
 /** @brief CIP Short String
@@ -155,7 +155,7 @@ typedef struct {
  */
 typedef struct {
   EipUint8 length; /**< Length of the String (8 bit value) */
-  EipByte *string; /**< Pointer to the string data */
+  EipByte* string; /**< Pointer to the string data */
 } CipShortString;
 
 /** @brief CIP String
@@ -163,7 +163,7 @@ typedef struct {
  */
 typedef struct {
   EipUint16 length; /**< Length of the String (16 bit value) */
-  CipByte *string;  /**< Pointer to the string data */
+  CipByte* string;  /**< Pointer to the string data */
 } CipString;
 
 /** @brief CIP String2
@@ -171,7 +171,7 @@ typedef struct {
  */
 typedef struct {
   EipUint16 length; /**< Length of the String (16 bit value) */
-  CipWord *string;  /**< Pointer to the string data */
+  CipWord* string;  /**< Pointer to the string data */
 } CipString2;
 
 /** @brief CIP String with variable symbol size
@@ -180,7 +180,7 @@ typedef struct {
 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 */
+  EipByte* string;  /**< Pointer to the string data */
 } CipStringN;
 
 /** @brief STRINGI definition
@@ -190,7 +190,7 @@ typedef struct cip_type_string_i_struct CipStringIStruct;
 
 typedef struct cip_string_i {
   CipUsint number_of_strings;
-  CipStringIStruct *array_of_string_i_structs;
+  CipStringIStruct* array_of_string_i_structs;
 } CipStringI;
 
 typedef enum cip_type_string_i_character_set {
@@ -213,7 +213,7 @@ typedef struct cip_type_string_i_struct {
   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 */
+  CipOctet* string;           /**< Pointer to the string data */
 } CipStringIStruct;
 
 /** @brief Highest CIP instance number.
@@ -255,7 +255,7 @@ typedef struct {
   EipUint32 class_id; /**< Class ID of the linked object */
   EipUint32 connection_point[kConnectionPointTypeMaxValue];
   EipUint8 data_segment;
-  EipUint8 *segment_data;
+  EipUint8* segment_data;
 } CipConnectionPath;
 
 /** @brief Struct storing the CIP revision */
@@ -271,7 +271,7 @@ typedef struct {
   CipUsint service;
   CipEpath request_path;
   size_t request_data_size;
-  const CipOctet *data;
+  const CipOctet* data;
 } CipMessageRouterRequest;
 
 #define MAX_SIZE_OF_ADD_STATUS                                                \
@@ -300,13 +300,13 @@ typedef struct {
 
 /** @brief self-describing data encoding for CIP types */
 typedef void (*CipAttributeEncodeInMessage)(
-    const void *const data, ENIPMessage *const outgoing_message);
+    const void* const data, ENIPMessage* const outgoing_message);
 
 /** @brief self-describing data decoding for CIP types */
 typedef int (*CipAttributeDecodeFromMessage)(
-    void *const data,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response);
+    void* const data,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response);
 
 /** @brief Structure to describe a single CIP attribute of an object
  */
@@ -318,7 +318,7 @@ typedef struct {
       decode;                       /**< Self-describing its data decoding */
   CIPAttributeFlag attribute_flags; /**< See @ref CIPAttributeFlag declaration
                                        for valid values. */
-  void *data;
+  void* data;
 } CipAttributeStruct;
 
 /** @brief Type definition of one instance of an Ethernet/IP object
@@ -329,12 +329,12 @@ 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
+  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
+  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 */
+  void* data;                /**< pointer to instance data struct */
 } CipInstance;
 
 /** @ingroup CIP_API
@@ -350,8 +350,8 @@ typedef struct cip_instance {
  *  @param  service   service code of currently executed service
  *  @return           status of kEipStatusOk or kEipStatusError on failure
  */
-typedef EipStatus (*CipGetSetCallback)(CipInstance *const instance,
-                                       CipAttributeStruct *const attribute,
+typedef EipStatus (*CipGetSetCallback)(CipInstance* const instance,
+                                       CipAttributeStruct* const attribute,
                                        CipByte service);
 
 /** @ingroup CIP_API
@@ -368,9 +368,9 @@ typedef EipStatus (*CipGetSetCallback)(CipInstance *const instance,
  *  @return           status of kEipStatusOk or kEipStatusError on failure
  */
 typedef EipStatus (*CipCallback)(
-    CipInstance *const instance,
-    const CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response);
+    CipInstance* const instance,
+    const CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response);
 
 /** @brief Type definition of CipClass that is a subclass of CipInstance */
 typedef struct cip_class {
@@ -386,14 +386,14 @@ typedef struct cip_class {
   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 */
+  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 */
+  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;
@@ -443,17 +443,17 @@ typedef struct cip_class {
  *   should be sent
  */
 typedef EipStatus (*CipServiceFunction)(
-    CipInstance *const instance,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response,
-    const struct sockaddr *originator_address,
+    CipInstance* const instance,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response,
+    const struct sockaddr* originator_address,
     const CipSessionHandle encapsulation_session);
 
 /** @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 */
+  char* name;                          /**< name of the service */
 } CipServiceStruct;
 
 /**
@@ -481,15 +481,15 @@ typedef struct {
   EipUint8 timeout_ticks;
   EipUint16 message_request_size;
   CipMessageRouterRequest message_request;
-  CipMessageRouterResponse *message_response;
+  CipMessageRouterResponse* message_response;
   EipUint8 reserved;
   CipRoutePath route_path;
-  void *data;
+  void* data;
 } CipUnconnectedSendParameter;
 
 typedef struct {
   CipUint num_conn_entries;
-  CipBool *conn_open_bits;
+  CipBool* conn_open_bits;
 } CipConnectionManagerConnectionEntryList;
 
 /* these are used for creating the getAttributeAll masks

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

@@ -32,15 +32,15 @@ CipCommonPacketFormatData
     g_common_packet_format_data_item; /**< CPF global data items */
 
 static void InitializeMessageRouterResponse(
-    CipMessageRouterResponse *const message_router_response) {
+    CipMessageRouterResponse* const message_router_response) {
   memset(message_router_response, 0, sizeof(*message_router_response));
   InitializeENIPMessage(&message_router_response->message);
 }
 
 EipStatus NotifyCommonPacketFormat(
-    const EncapsulationData *const received_data,
-    const struct sockaddr *const originator_address,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const received_data,
+    const struct sockaddr* const originator_address,
+    ENIPMessage* const outgoing_message) {
   EipStatus return_value = kEipStatusError;
   CipMessageRouterResponse message_router_response;
   InitializeMessageRouterResponse(&message_router_response);
@@ -79,7 +79,7 @@ EipStatus NotifyCommonPacketFormat(
           (void)status; /* Suppress unused variable warning. */
 
           /* Save pointer and move to start for Encapusulation Header */
-          CipOctet *buffer = outgoing_message->current_message_position;
+          CipOctet* buffer = outgoing_message->current_message_position;
           outgoing_message->current_message_position =
               outgoing_message->message_buffer;
           GenerateEncapsulationHeader(received_data,
@@ -118,9 +118,9 @@ EipStatus NotifyCommonPacketFormat(
 }
 
 EipStatus NotifyConnectedCommonPacketFormat(
-    const EncapsulationData *const received_data,
-    const struct sockaddr *const originator_address,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const received_data,
+    const struct sockaddr* const originator_address,
+    ENIPMessage* const outgoing_message) {
   EipStatus return_value = CreateCommonPacketFormatStructure(
       received_data->current_communication_buffer_position,
       received_data->data_length,
@@ -136,7 +136,7 @@ EipStatus NotifyConnectedCommonPacketFormat(
                                         otherwise it is no connected message and
                                         should not be here*/
     {                                /* ConnectedAddressItem item */
-      CipConnectionObject *connection_object =
+      CipConnectionObject* connection_object =
           GetConnectedObject(g_common_packet_format_data_item.address_item.data
                                  .connection_identifier);
       if (NULL != connection_object) {
@@ -146,9 +146,9 @@ EipStatus NotifyConnectedCommonPacketFormat(
         /*TODO check connection id  and sequence count */
         if (g_common_packet_format_data_item.data_item.type_id ==
             kCipItemIdConnectedDataItem) { /* connected data item received*/
-          EipUint8 *buffer = g_common_packet_format_data_item.data_item.data;
+          EipUint8* buffer = g_common_packet_format_data_item.data_item.data;
           g_common_packet_format_data_item.address_item.data.sequence_number =
-              GetUintFromMessage((const EipUint8 **const)&buffer);
+              GetUintFromMessage((const EipUint8** const)&buffer);
           OPENER_TRACE_INFO(
               "Class 3 sequence number: %d, last sequence number: %d\n",
               g_common_packet_format_data_item.address_item.data
@@ -203,7 +203,7 @@ EipStatus NotifyConnectedCommonPacketFormat(
                                       outgoing_message);
             (void)status; /* Suppress unused variable warning. */
 
-            CipOctet *pos = outgoing_message->current_message_position;
+            CipOctet* pos = outgoing_message->current_message_position;
             outgoing_message->current_message_position =
                 outgoing_message->message_buffer;
             GenerateEncapsulationHeader(received_data,
@@ -251,9 +251,9 @@ EipStatus NotifyConnectedCommonPacketFormat(
  *             kEipStatusError .. error
  */
 EipStatus CreateCommonPacketFormatStructure(
-    const EipUint8 *data,
+    const EipUint8* data,
     size_t data_length,
-    CipCommonPacketFormatData *common_packet_format_data) {
+    CipCommonPacketFormatData* common_packet_format_data) {
   common_packet_format_data->address_info_item[0].type_id = 0;
   common_packet_format_data->address_info_item[1].type_id = 0;
 
@@ -281,7 +281,7 @@ EipStatus CreateCommonPacketFormatStructure(
   if (common_packet_format_data->item_count >= 2) {
     common_packet_format_data->data_item.type_id = GetUintFromMessage(&data);
     common_packet_format_data->data_item.length  = GetUintFromMessage(&data);
-    common_packet_format_data->data_item.data    = (EipUint8 *)data;
+    common_packet_format_data->data_item.data    = (EipUint8*)data;
     if (data_length >=
         length_count + 4 + common_packet_format_data->data_item.length) {
       data += common_packet_format_data->data_item.length;
@@ -355,7 +355,7 @@ EipStatus CreateCommonPacketFormatStructure(
  * @brief Encodes a Null Address Item into the message frame
  * @param outgoing_message The outgoing message object
  */
-void EncodeNullAddressItem(ENIPMessage *const outgoing_message) {
+void EncodeNullAddressItem(ENIPMessage* const outgoing_message) {
   AddIntToMessage(kCipItemIdNullAddress, outgoing_message);
   /* null address item -> address length set to 0 */
   AddIntToMessage(0, outgoing_message);
@@ -368,8 +368,8 @@ void EncodeNullAddressItem(ENIPMessage *const outgoing_message) {
  * @param outgoing_message The outgoing message object
  */
 void EncodeConnectedAddressItem(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   /* connected data item -> address length set to 4 and copy
    * ConnectionIdentifier */
   AddIntToMessage(kCipItemIdConnectionAddress, outgoing_message);
@@ -387,8 +387,8 @@ void EncodeConnectedAddressItem(
  * @param outgoing_message The outgoing message object
  */
 void EncodeSequencedAddressItem(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   /* sequenced address item -> address length set to 8 and copy
    * ConnectionIdentifier and SequenceNumber */
   AddIntToMessage(kCipItemIdSequencedAddressItem, outgoing_message);
@@ -409,8 +409,8 @@ void EncodeSequencedAddressItem(
  * @param outgoing_message The outgoing message object
  */
 void EncodeItemCount(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   AddIntToMessage(common_packet_format_data_item->item_count,
                   outgoing_message); /* item count */
 }
@@ -423,8 +423,8 @@ void EncodeItemCount(
  * @param outgoing_message The outgoing message object
  */
 void EncodeDataItemType(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   AddIntToMessage(common_packet_format_data_item->data_item.type_id,
                   outgoing_message);
 }
@@ -437,8 +437,8 @@ void EncodeDataItemType(
  * @param outgoing_message The outgoing message object
  */
 void EncodeDataItemLength(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   AddIntToMessage(common_packet_format_data_item->data_item.length,
                   outgoing_message);
 }
@@ -451,8 +451,8 @@ void EncodeDataItemLength(
  * @param outgoing_message The outgoing message object
  */
 void EncodeDataItemData(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   memcpy(outgoing_message->current_message_position,
          common_packet_format_data_item->data_item.data,
          common_packet_format_data_item->data_item.length);
@@ -471,8 +471,8 @@ void EncodeDataItemData(
  */
 
 void EncodeConnectedDataItemLength(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   AddIntToMessage(
       (EipUint16)(message_router_response->message.used_message_length + 4 +
                   2 /* TODO: Magic numbers */
@@ -487,8 +487,8 @@ void EncodeConnectedDataItemLength(
  * @param outgoing_message The outgoing message object
  */
 void EncodeSequenceNumber(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   AddIntToMessage((EipUint16)common_packet_format_data_item->address_item.data
                       .sequence_number,
                   outgoing_message);
@@ -502,8 +502,8 @@ void EncodeSequenceNumber(
  * @param outgoing_message The outgoing message object
  */
 void EncodeReplyService(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   AddSintToMessage(message_router_response->reply_service, outgoing_message);
 }
 
@@ -514,8 +514,8 @@ void EncodeReplyService(
  * @param outgoing_message The outgoing message object
  */
 void EncodeReservedFieldOfLengthByte(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   AddSintToMessage(message_router_response->reserved, outgoing_message);
 }
 
@@ -526,8 +526,8 @@ void EncodeReservedFieldOfLengthByte(
  * @param outgoing_message The outgoing message object
  */
 void EncodeGeneralStatus(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   AddSintToMessage(message_router_response->general_status, outgoing_message);
 }
 
@@ -539,8 +539,8 @@ void EncodeGeneralStatus(
  */
 
 void EncodeExtendedStatusLength(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   AddSintToMessage(message_router_response->size_of_additional_status,
                    outgoing_message);
 }
@@ -552,8 +552,8 @@ void EncodeExtendedStatusLength(
  * @param outgoing_message The outgoing message object
  */
 void EncodeExtendedStatusDataItems(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   for (size_t i = 0; i < message_router_response->size_of_additional_status &&
                      i < MAX_SIZE_OF_ADD_STATUS;
        i++) {
@@ -574,8 +574,8 @@ void EncodeExtendedStatusDataItems(
  */
 
 void EncodeExtendedStatus(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   EncodeExtendedStatusLength(message_router_response, outgoing_message);
   EncodeExtendedStatusDataItems(message_router_response, outgoing_message);
 }
@@ -588,8 +588,8 @@ void EncodeExtendedStatus(
  *
  */
 void EncodeUnconnectedDataItemLength(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   AddIntToMessage(
       (EipUint16)(message_router_response->message.used_message_length +
                   4 /* TODO: Magic number */
@@ -604,8 +604,8 @@ void EncodeUnconnectedDataItemLength(
  * @param outgoing_message The outgoing message object
  */
 void EncodeMessageRouterResponseData(
-    const CipMessageRouterResponse *const message_router_response,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    ENIPMessage* const outgoing_message) {
   memcpy(outgoing_message->current_message_position,
          message_router_response->message.message_buffer,
          message_router_response->message.used_message_length);
@@ -626,8 +626,8 @@ void EncodeMessageRouterResponseData(
  */
 void EncodeSockaddrInfoItemTypeId(
     int item_type,
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   OPENER_ASSERT(item_type == 0 || item_type == 1);
   AddIntToMessage(
       common_packet_format_data_item->address_info_item[item_type].type_id,
@@ -644,17 +644,17 @@ void EncodeSockaddrInfoItemTypeId(
  */
 void EncodeSockaddrInfoLength(
     int item_type,
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   AddIntToMessage(
       common_packet_format_data_item->address_info_item[item_type].length,
       outgoing_message);
 }
 
 EipStatus AssembleLinearMessage(
-    const CipMessageRouterResponse *const message_router_response,
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipMessageRouterResponse* const message_router_response,
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   if (message_router_response) {
     /* add Interface Handle and Timeout = 0 -> only for SendRRData and
      * SendUnitData necessary */
@@ -754,7 +754,7 @@ EipStatus AssembleLinearMessage(
 }
 
 void AssembleIOMessage(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message) {
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message) {
   AssembleLinearMessage(0, common_packet_format_data_item, outgoing_message);
 }

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

@@ -55,7 +55,7 @@ typedef struct {
 typedef struct {
   EipUint16 type_id;
   EipUint16 length;
-  EipUint8 *data;
+  EipUint8* data;
 } DataItem;
 
 /** @brief CPF Sockaddr Item
@@ -97,9 +97,9 @@ typedef struct {
  * status
  */
 EipStatus NotifyCommonPacketFormat(
-    const EncapsulationData *const received_data,
-    const struct sockaddr *const originator_address,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const received_data,
+    const struct sockaddr* const originator_address,
+    ENIPMessage* const outgoing_message);
 
 /** @ingroup ENCAP
  * Parse the CPF data from a received connected explicit message, check
@@ -114,9 +114,9 @@ EipStatus NotifyCommonPacketFormat(
  * status
  */
 EipStatus NotifyConnectedCommonPacketFormat(
-    const EncapsulationData *const received_data,
-    const struct sockaddr *const originator_address,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const received_data,
+    const struct sockaddr* const originator_address,
+    ENIPMessage* const outgoing_message);
 
 /** @ingroup ENCAP
  *  Create CPF structure out of the received data.
@@ -128,9 +128,9 @@ EipStatus NotifyConnectedCommonPacketFormat(
  *             EIP_ERROR .. error
  */
 EipStatus CreateCommonPacketFormatStructure(
-    const EipUint8 *data,
+    const EipUint8* data,
     size_t data_length,
-    CipCommonPacketFormatData *common_packet_format_data);
+    CipCommonPacketFormatData* common_packet_format_data);
 
 /** @ingroup ENCAP
  * Copy data from CPFDataItem into linear memory in message for transmission
@@ -142,8 +142,8 @@ EipStatus CreateCommonPacketFormatStructure(
  *     kEipStatusError .. error
  */
 void AssembleIOMessage(
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const message);
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const message);
 
 /** @ingroup ENCAP
  * @brief Copy data from message_router_response struct and
@@ -159,9 +159,9 @@ void AssembleIOMessage(
  *         kEipStatusError .. error
  */
 EipStatus AssembleLinearMessage(
-    const CipMessageRouterResponse *const message_router_response,
-    const CipCommonPacketFormatData *const common_packet_format_data_item,
-    ENIPMessage *const outgoing_message);
+    const CipMessageRouterResponse* const message_router_response,
+    const CipCommonPacketFormatData* const common_packet_format_data_item,
+    ENIPMessage* const outgoing_message);
 
 /** @ingroup ENCAP
  * @brief Data storage for the any CPF data

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

@@ -92,35 +92,35 @@ DelayedEncapsulationMessage g_delayed_encapsulation_messages
 
 /*** private functions ***/
 void HandleReceivedListIdentityCommandTcp(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message);
 
 void HandleReceivedListIdentityCommandUdp(
     const int socket,
-    const struct sockaddr_in *const from_address,
-    const EncapsulationData *const receive_data);
+    const struct sockaddr_in* const from_address,
+    const EncapsulationData* const receive_data);
 
 EipStatus HandleReceivedUnregisterSessionCommand(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message);
 
 EipStatus HandleReceivedSendUnitDataCommand(
-    const EncapsulationData *const receive_data,
-    const struct sockaddr *const originator_address,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    const struct sockaddr* const originator_address,
+    ENIPMessage* const outgoing_message);
 
 EipStatus HandleReceivedInvalidCommand(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message);
 
 int GetFreeSessionIndex(void);
 
 SessionStatus CheckRegisteredSessions(
-    const EncapsulationData *const receive_data);
+    const EncapsulationData* const receive_data);
 
 void DetermineDelayTime(
-    const EipByte *buffer_start,
-    DelayedEncapsulationMessage *const delayed_message_buffer);
+    const EipByte* buffer_start,
+    DelayedEncapsulationMessage* const delayed_message_buffer);
 
 /*   @brief Initializes session list and interface information. */
 void EncapsulationInit(void) {
@@ -147,17 +147,17 @@ void EncapsulationInit(void) {
   g_service_information.encapsulation_protocol_version = 1;
   g_service_information.capability_flags =
       kCapabilityFlagsCipTcp | kCapabilityFlagsCipUdpClass0or1;
-  snprintf((char *)g_service_information.name_of_service,
+  snprintf((char*)g_service_information.name_of_service,
            sizeof(g_service_information.name_of_service),
            "Communications");
 }
 
 EipStatus HandleReceivedExplictTcpData(int socket,
-                                       EipUint8 *buffer,
+                                       EipUint8* buffer,
                                        size_t length,
-                                       int *number_of_remaining_bytes,
-                                       struct sockaddr *originator_address,
-                                       ENIPMessage *const outgoing_message) {
+                                       int* number_of_remaining_bytes,
+                                       struct sockaddr* originator_address,
+                                       ENIPMessage* const outgoing_message) {
   OPENER_TRACE_INFO("Handles data for TCP socket: %d\n", socket);
   EipStatus return_value               = kEipStatusOk;
   EncapsulationData encapsulation_data = {0};
@@ -248,12 +248,12 @@ EipStatus HandleReceivedExplictTcpData(int socket,
 }
 
 EipStatus HandleReceivedExplictUdpData(const int socket,
-                                       const struct sockaddr_in *from_address,
-                                       const EipUint8 *buffer,
+                                       const struct sockaddr_in* from_address,
+                                       const EipUint8* buffer,
                                        const size_t buffer_length,
-                                       int *number_of_remaining_bytes,
+                                       int* number_of_remaining_bytes,
                                        bool unicast,
-                                       ENIPMessage *const outgoing_message) {
+                                       ENIPMessage* const outgoing_message) {
   EipStatus return_value               = kEipStatusOk;
   EncapsulationData encapsulation_data = {0};
   /* eat the encapsulation header*/
@@ -326,17 +326,17 @@ EipStatus HandleReceivedExplictUdpData(const int socket,
   return return_value;
 }
 
-void SkipEncapsulationHeader(ENIPMessage *const outgoing_message) {
+void SkipEncapsulationHeader(ENIPMessage* const outgoing_message) {
   /* Move pointer over Header, but do not add to size */
   outgoing_message->current_message_position += ENCAPSULATION_HEADER_LENGTH;
 }
 
 void GenerateEncapsulationHeader(
-    const EncapsulationData *const receive_data,
+    const EncapsulationData* const receive_data,
     const size_t command_specific_data_length,
     const CipSessionHandle session_handle,
     const EncapsulationProtocolErrorCode encapsulation_protocol_status,
-    ENIPMessage *const outgoing_message) {
+    ENIPMessage* const outgoing_message) {
   AddIntToMessage(receive_data->command_code, outgoing_message);
   AddIntToMessage(command_specific_data_length, outgoing_message);
   AddDintToMessage(session_handle, outgoing_message);  // Session handle
@@ -354,8 +354,8 @@ void GenerateEncapsulationHeader(
  *  @param outgoing_message The outgoing ENIP message
  */
 void HandleReceivedListServicesCommand(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message) {
   /* Create encapsulation header */
   const size_t kListServicesCommandSpecificDataLength =
       sizeof(CipUint) + sizeof(g_service_information);
@@ -385,8 +385,8 @@ void HandleReceivedListServicesCommand(
 }
 
 void HandleReceivedListInterfacesCommand(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message) {
   /* Encapsulation header */
   const size_t kListInterfacesCommandSpecificDataLength = sizeof(CipUint);
 
@@ -403,17 +403,17 @@ void HandleReceivedListInterfacesCommand(
 }
 
 void HandleReceivedListIdentityCommandTcp(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message) {
   EncapsulateListIdentityResponseMessage(receive_data, outgoing_message);
 }
 
 void HandleReceivedListIdentityCommandUdp(
     const int socket,
-    const struct sockaddr_in *const from_address,
-    const EncapsulationData *const receive_data) {
-  DelayedEncapsulationMessage *delayed_message_buffer = NULL;
-  ENIPMessage *p_outgoing_message                     = NULL;
+    const struct sockaddr_in* const from_address,
+    const EncapsulationData* const receive_data) {
+  DelayedEncapsulationMessage* delayed_message_buffer = NULL;
+  ENIPMessage* p_outgoing_message                     = NULL;
 
   for (size_t i = 0; i < ENCAP_NUMBER_OF_SUPPORTED_DELAYED_ENCAP_MESSAGES;
        i++) {
@@ -447,7 +447,7 @@ CipUint ListIdentityGetCipIdentityItemLength() {
          sizeof(CipUsint);
 }
 
-void EncodeListIdentityCipIdentityItem(ENIPMessage *const outgoing_message) {
+void EncodeListIdentityCipIdentityItem(ENIPMessage* const outgoing_message) {
   /* Item ID*/
   const CipUint kItemIDCipIdentity = 0x0C;
   AddIntToMessage(kItemIDCipIdentity, outgoing_message);
@@ -483,8 +483,8 @@ void EncodeListIdentityCipIdentityItem(ENIPMessage *const outgoing_message) {
 }
 
 void EncapsulateListIdentityResponseMessage(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message) {
   const CipUint kEncapsulationCommandListIdentityLength =
       ListIdentityGetCipIdentityItemLength() + sizeof(CipUint) +
       sizeof(CipUint) + sizeof(CipUint); /* Last element is item count */
@@ -501,11 +501,11 @@ void EncapsulateListIdentityResponseMessage(
 }
 
 void DetermineDelayTime(
-    const EipByte *buffer_start,
-    DelayedEncapsulationMessage *const delayed_message_buffer) {
+    const EipByte* buffer_start,
+    DelayedEncapsulationMessage* const delayed_message_buffer) {
   buffer_start += 12; /* start of the sender context */
   EipUint16 maximum_delay_time =
-      GetUintFromMessage((const EipUint8 **const)&buffer_start);
+      GetUintFromMessage((const EipUint8** const)&buffer_start);
 
   if (0 == maximum_delay_time) {
     maximum_delay_time = kListIdentityDefaultDelayTime;
@@ -519,10 +519,10 @@ void DetermineDelayTime(
 }
 
 void EncapsulateRegisterSessionCommandResponseMessage(
-    const EncapsulationData *const receive_data,
+    const EncapsulationData* const receive_data,
     const CipSessionHandle session_handle,
     const EncapsulationProtocolErrorCode encapsulation_protocol_status,
-    ENIPMessage *const outgoing_message) {
+    ENIPMessage* const outgoing_message) {
   /* Encapsulation header */
   const size_t kListInterfacesCommandSpecificDataLength =
       sizeof(CipUint) + sizeof(CipUint);
@@ -545,18 +545,18 @@ void EncapsulateRegisterSessionCommandResponseMessage(
  */
 void HandleReceivedRegisterSessionCommand(
     int socket,
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message) {
   int session_index               = 0;
   CipSessionHandle session_handle = 0;
   EncapsulationProtocolErrorCode encapsulation_protocol_status =
       kEncapsulationProtocolSuccess;
 
   EipUint16 protocol_version =
-      GetUintFromMessage((const EipUint8 **const)&receive_data
+      GetUintFromMessage((const EipUint8** const)&receive_data
                              ->current_communication_buffer_position);
   EipUint16 option_flag =
-      GetUintFromMessage((const EipUint8 **const)&receive_data
+      GetUintFromMessage((const EipUint8** const)&receive_data
                              ->current_communication_buffer_position);
 
   /* check if requested protocol version is supported and the register session
@@ -587,7 +587,7 @@ void HandleReceivedRegisterSessionCommand(
         encapsulation_protocol_status =
             kEncapsulationProtocolInsufficientMemory;
       } else { /* successful session registered */
-        SocketTimer *socket_timer = SocketTimerArrayGetEmptySocketTimer(
+        SocketTimer* socket_timer = SocketTimerArrayGetEmptySocketTimer(
             g_timestamps, OPENER_NUMBER_OF_SUPPORTED_SESSIONS);
         SocketTimerSetSocket(socket_timer, socket);
         SocketTimerSetLastUpdate(socket_timer, g_actual_time);
@@ -617,8 +617,8 @@ void HandleReceivedRegisterSessionCommand(
  * Close all corresponding TCP connections and delete session handle.
  */
 EipStatus HandleReceivedUnregisterSessionCommand(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message) {
   OPENER_TRACE_INFO("encap.c: Unregister Session Command\n");
   if ((0 < receive_data->session_handle) &&
       (receive_data->session_handle <= OPENER_NUMBER_OF_SUPPORTED_SESSIONS)) {
@@ -646,9 +646,9 @@ EipStatus HandleReceivedUnregisterSessionCommand(
  *  @param outgoing_message The outgoing ENIP message
  */
 EipStatus HandleReceivedSendUnitDataCommand(
-    const EncapsulationData *const receive_data,
-    const struct sockaddr *const originator_address,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    const struct sockaddr* const originator_address,
+    ENIPMessage* const outgoing_message) {
   EipStatus return_value = kEipStatusOkSend;
   /*EipStatus*/ return_value =
       kEipStatusOk; /* TODO: Shouldn't this be kEipStatusOk cause we must not
@@ -659,14 +659,14 @@ EipStatus HandleReceivedSendUnitDataCommand(
      * packets */
     /* don't use the data yet */
     GetDintFromMessage(
-        (const EipUint8 **const)&receive_data
+        (const EipUint8** const)&receive_data
             ->current_communication_buffer_position); /* skip over null
                                                          interface handle*/
     GetIntFromMessage(
-        (const EipUint8 **const)&receive_data
+        (const EipUint8** const)&receive_data
             ->current_communication_buffer_position); /* skip over unused
                                                          timeout value*/
-    ((EncapsulationData *const)receive_data)->data_length -=
+    ((EncapsulationData* const)receive_data)->data_length -=
         6; /* the rest is in CPF format*/
 
     if (kSessionStatusValid ==
@@ -699,9 +699,9 @@ EipStatus HandleReceivedSendUnitDataCommand(
  *                      kEipStatusError .. error
  */
 EipStatus HandleReceivedSendRequestResponseDataCommand(
-    const EncapsulationData *const receive_data,
-    const struct sockaddr *const originator_address,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    const struct sockaddr* const originator_address,
+    ENIPMessage* const outgoing_message) {
   EipStatus return_value = kEipStatusOkSend;
   /* EipStatus*/ return_value =
       kEipStatusOk; /* TODO: Shouldn't this be kEipStatusOk cause we must not
@@ -712,14 +712,14 @@ EipStatus HandleReceivedSendRequestResponseDataCommand(
      * packets */
     /* don't use the data yet */
     GetDintFromMessage(
-        (const EipUint8 **const)&receive_data
+        (const EipUint8** const)&receive_data
             ->current_communication_buffer_position); /* skip over null
                                                          interface handle*/
     GetIntFromMessage(
-        (const EipUint8 **const)&receive_data
+        (const EipUint8** const)&receive_data
             ->current_communication_buffer_position); /* skip over unused
                                                          timeout value*/
-    ((EncapsulationData *const)receive_data)->data_length -=
+    ((EncapsulationData* const)receive_data)->data_length -=
         6; /* the rest is in CPF format*/
 
     if (kSessionStatusValid ==
@@ -744,8 +744,8 @@ EipStatus HandleReceivedSendRequestResponseDataCommand(
 }
 
 EipStatus HandleReceivedInvalidCommand(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message) {
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message) {
   /* Encapsulation header */
   GenerateEncapsulationHeader(receive_data,
                               0,
@@ -781,10 +781,10 @@ int GetFreeSessionIndex(void) {
  *                      <0 .. only fragment of data portion received
  */
 int_fast32_t CreateEncapsulationStructure(
-    const EipUint8 *receive_buffer,
+    const EipUint8* receive_buffer,
     size_t receive_buffer_length,
-    EncapsulationData *const encapsulation_data) {
-  encapsulation_data->communication_buffer_start = (EipUint8 *)receive_buffer;
+    EncapsulationData* const encapsulation_data) {
+  encapsulation_data->communication_buffer_start = (EipUint8*)receive_buffer;
   encapsulation_data->command_code   = GetUintFromMessage(&receive_buffer);
   encapsulation_data->data_length    = GetUintFromMessage(&receive_buffer);
   encapsulation_data->session_handle = GetUdintFromMessage(&receive_buffer);
@@ -795,7 +795,7 @@ int_fast32_t CreateEncapsulationStructure(
   receive_buffer += kSenderContextSize;
   encapsulation_data->options = GetUdintFromMessage(&receive_buffer);
   encapsulation_data->current_communication_buffer_position =
-      (EipUint8 *)receive_buffer;
+      (EipUint8*)receive_buffer;
 
   /* Ensure buffer length fits in an int32 before casting in the return
    * expression. */
@@ -812,7 +812,7 @@ int_fast32_t CreateEncapsulationStructure(
  * received
  */
 SessionStatus CheckRegisteredSessions(
-    const EncapsulationData *const receive_data) {
+    const EncapsulationData* const receive_data) {
   /* Skip the check when fuzzing
    in order to increase our code coverage
    we are simply bypassing all the session checks
@@ -832,7 +832,7 @@ SessionStatus CheckRegisteredSessions(
 }
 
 void CloseSessionBySessionHandle(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   OPENER_TRACE_INFO("encap.c: Close session by handle\n");
   CipSessionHandle session_handle =
       connection_object->associated_encapsulation_session;
@@ -885,12 +885,12 @@ void ManageEncapsulationMessages(const MilliSeconds elapsed_time) {
         /* If delay is reached or passed, send the UDP message */
         sendto(
             g_delayed_encapsulation_messages[i].socket,
-            (char *)g_delayed_encapsulation_messages[i]
+            (char*)g_delayed_encapsulation_messages[i]
                 .outgoing_message.message_buffer,
             g_delayed_encapsulation_messages[i]
                 .outgoing_message.used_message_length,
             0,
-            (struct sockaddr *)&(g_delayed_encapsulation_messages[i].receiver),
+            (struct sockaddr*)&(g_delayed_encapsulation_messages[i].receiver),
             sizeof(struct sockaddr));
         g_delayed_encapsulation_messages[i].socket = kEipInvalidSocket;
       }
@@ -899,16 +899,16 @@ void ManageEncapsulationMessages(const MilliSeconds elapsed_time) {
 }
 
 void CloseEncapsulationSessionBySockAddr(
-    const CipConnectionObject *const connection_object) {
+    const CipConnectionObject* const connection_object) {
   for (size_t i = 0; i < OPENER_NUMBER_OF_SUPPORTED_SESSIONS; ++i) {
     if (kEipInvalidSocket != g_registered_sessions[i]) {
       struct sockaddr_in encapsulation_session_addr = {0};
       socklen_t addrlength = sizeof(encapsulation_session_addr);
       if (getpeername(g_registered_sessions[i],
-                      (struct sockaddr *)&encapsulation_session_addr,
+                      (struct sockaddr*)&encapsulation_session_addr,
                       &addrlength) < 0) { /* got error */
         int error_code      = GetSocketErrorNumber();
-        char *error_message = GetErrorMessage(error_code);
+        char* error_message = GetErrorMessage(error_code);
         OPENER_TRACE_ERR(
             "encap.c: error on getting peer name on closing session: %d - %s\n",
             error_code,
@@ -934,9 +934,9 @@ CipSessionHandle GetSessionFromSocket(const int socket_handle) {
 
 void CloseClass3ConnectionBasedOnSession(
     CipSessionHandle encapsulation_session_handle) {
-  DoublyLinkedListNode *node = connection_list.first;
+  DoublyLinkedListNode* node = connection_list.first;
   while (NULL != node) {
-    CipConnectionObject *connection_object = node->data;
+    CipConnectionObject* connection_object = node->data;
     if (kConnectionObjectTransportClassTriggerTransportClass3 ==
             ConnectionObjectGetTransportClassTriggerTransportClass(
                 connection_object) &&

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

@@ -45,12 +45,12 @@ typedef struct encapsulation_data {
   CipOctet
       sender_context[8]; /**< length of 8, according to the specification */
   CipUdint options;
-  const EipUint8 *communication_buffer_start; /**< Pointer to the communication
+  const EipUint8* communication_buffer_start; /**< Pointer to the communication
                                                  buffer used for this message */
-  const EipUint8
-      *current_communication_buffer_position; /**< The current position in the
-                                                 communication buffer during the
-                                                 decoding process */
+  const EipUint8*
+      current_communication_buffer_position; /**< The current position in the
+                                                communication buffer during the
+                                                decoding process */
 } EncapsulationData;
 
 typedef struct encapsulation_service_information {
@@ -90,10 +90,10 @@ CipSessionHandle GetSessionFromSocket(const int socket_handle);
 void RemoveSession(const int socket);
 
 void CloseSessionBySessionHandle(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void CloseEncapsulationSessionBySockAddr(
-    const CipConnectionObject *const connection_object);
+    const CipConnectionObject* const connection_object);
 
 void CloseClass3ConnectionBasedOnSession(
     CipSessionHandle encapsulation_session_handle);
@@ -103,39 +103,39 @@ void CloseClass3ConnectionBasedOnSession(
 typedef struct enip_message ENIPMessage;
 
 void EncapsulateListIdentityResponseMessage(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message);
 
 int_fast32_t CreateEncapsulationStructure(
-    const EipUint8 *receive_buffer,
+    const EipUint8* receive_buffer,
     size_t receive_buffer_length,
-    EncapsulationData *const encapsulation_data);
+    EncapsulationData* const encapsulation_data);
 
-void SkipEncapsulationHeader(ENIPMessage *const outgoing_message);
+void SkipEncapsulationHeader(ENIPMessage* const outgoing_message);
 
 void GenerateEncapsulationHeader(
-    const EncapsulationData *const receive_data,
+    const EncapsulationData* const receive_data,
     const size_t command_specific_data_length,
     const CipSessionHandle session_handle,
     const EncapsulationProtocolErrorCode encapsulation_protocol_status,
-    ENIPMessage *const outgoing_message);
+    ENIPMessage* const outgoing_message);
 
 void HandleReceivedListServicesCommand(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message);
 
 void HandleReceivedListInterfacesCommand(
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message);
 
 void HandleReceivedRegisterSessionCommand(
     int socket,
-    const EncapsulationData *const receive_data,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    ENIPMessage* const outgoing_message);
 
 EipStatus HandleReceivedSendRequestResponseDataCommand(
-    const EncapsulationData *const receive_data,
-    const struct sockaddr *const originator_address,
-    ENIPMessage *const outgoing_message);
+    const EncapsulationData* const receive_data,
+    const struct sockaddr* const originator_address,
+    ENIPMessage* const outgoing_message);
 
 #endif /* OPENER_ENCAP_H_ */

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

@@ -28,29 +28,29 @@ OpenerEndianess g_opener_platform_endianess = kOpenerEndianessUnknown;
  *   @param buffer pointer where data should be reed.
  *   @return EIP_UINT8 data value
  */
-CipSint GetSintFromMessage(const EipUint8 **const buffer) {
-  const unsigned char *const buffer_address = (unsigned char *)*buffer;
+CipSint GetSintFromMessage(const EipUint8** const buffer) {
+  const unsigned char* const buffer_address = (unsigned char*)*buffer;
   EipUint8 data                             = buffer_address[0];
   *buffer += 1;
   return data;
 }
 
-CipByte GetByteFromMessage(const CipOctet **const buffer_address) {
-  const CipOctet *buffer = *buffer_address;
+CipByte GetByteFromMessage(const CipOctet** const buffer_address) {
+  const CipOctet* buffer = *buffer_address;
   CipByte data           = buffer[0];
   *buffer_address += 1;
   return data;
 }
 
-CipUsint GetUsintFromMessage(const CipOctet **const buffer_address) {
-  const CipOctet *buffer = *buffer_address;
+CipUsint GetUsintFromMessage(const CipOctet** const buffer_address) {
+  const CipOctet* buffer = *buffer_address;
   CipUsint data          = buffer[0];
   *buffer_address += 1;
   return data;
 }
 
-CipBool GetBoolFromMessage(const EipBool8 **const buffer_address) {
-  const EipBool8 *buffer = *buffer_address;
+CipBool GetBoolFromMessage(const EipBool8** const buffer_address) {
+  const EipBool8* buffer = *buffer_address;
   EipBool8 data          = buffer[0];
   *buffer_address += 1;
   return data;
@@ -63,22 +63,22 @@ CipBool GetBoolFromMessage(const EipBool8 **const buffer_address) {
  *   @param buffer pointer where data should be reed.
  *   @return EIP_UINT16 data value
  */
-CipInt GetIntFromMessage(const EipUint8 **const buffer) {
-  const unsigned char *const buffer_address = (unsigned char *)*buffer;
+CipInt GetIntFromMessage(const EipUint8** const buffer) {
+  const unsigned char* const buffer_address = (unsigned char*)*buffer;
   EipUint16 data = buffer_address[0] | buffer_address[1] << 8;
   *buffer += 2;
   return data;
 }
 
-CipUint GetUintFromMessage(const CipOctet **const buffer_address) {
-  const CipOctet *buffer = *buffer_address;
+CipUint GetUintFromMessage(const CipOctet** const buffer_address) {
+  const CipOctet* buffer = *buffer_address;
   EipUint16 data         = buffer[0] | buffer[1] << 8;
   *buffer_address += 2;
   return data;
 }
 
-CipWord GetWordFromMessage(const CipOctet **const buffer_address) {
-  const CipOctet *buffer = *buffer_address;
+CipWord GetWordFromMessage(const CipOctet** const buffer_address) {
+  const CipOctet* buffer = *buffer_address;
   EipUint16 data         = buffer[0] | buffer[1] << 8;
   *buffer_address += 2;
   return data;
@@ -89,23 +89,23 @@ CipWord GetWordFromMessage(const CipOctet **const buffer_address) {
  *   @param buffer pointer where data should be reed.
  *   @return EIP_UNÍT32 value
  */
-CipDint GetDintFromMessage(const EipUint8 **const buffer) {
-  const unsigned char *p = (unsigned char *)*buffer;
+CipDint GetDintFromMessage(const EipUint8** const buffer) {
+  const unsigned char* p = (unsigned char*)*buffer;
   EipUint32 data         = p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
   *buffer += 4;
   return data;
 }
 
-CipUdint GetUdintFromMessage(const CipOctet **const buffer_address) {
-  const CipOctet *buffer = *buffer_address;
+CipUdint GetUdintFromMessage(const CipOctet** const buffer_address) {
+  const CipOctet* buffer = *buffer_address;
   CipUdint data =
       buffer[0] | buffer[1] << 8 | buffer[2] << 16 | buffer[3] << 24;
   *buffer_address += 4;
   return data;
 }
 
-CipUdint GetDwordFromMessage(const CipOctet **const buffer_address) {
-  const CipOctet *buffer = *buffer_address;
+CipUdint GetDwordFromMessage(const CipOctet** const buffer_address) {
+  const CipOctet* buffer = *buffer_address;
   CipDword data =
       buffer[0] | buffer[1] << 8 | buffer[2] << 16 | buffer[3] << 24;
   *buffer_address += 4;
@@ -118,7 +118,7 @@ CipUdint GetDwordFromMessage(const CipOctet **const buffer_address) {
  * @param buffer pointer where data should be written.
  */
 void AddSintToMessage(const EipUint8 data,
-                      ENIPMessage *const outgoing_message) {
+                      ENIPMessage* const outgoing_message) {
   outgoing_message->current_message_position[0] = (unsigned char)data;
   outgoing_message->current_message_position += 1;
   outgoing_message->used_message_length += 1;
@@ -131,7 +131,7 @@ void AddSintToMessage(const EipUint8 data,
  * @param buffer pointer where data should be written.
  */
 void AddIntToMessage(const EipUint16 data,
-                     ENIPMessage *const outgoing_message) {
+                     ENIPMessage* const outgoing_message) {
   outgoing_message->current_message_position[0] = (unsigned char)data;
   outgoing_message->current_message_position[1] = (unsigned char)(data >> 8);
   outgoing_message->current_message_position += 2;
@@ -145,7 +145,7 @@ void AddIntToMessage(const EipUint16 data,
  * @param buffer pointer where data should be written.
  */
 void AddDintToMessage(const EipUint32 data,
-                      ENIPMessage *const outgoing_message) {
+                      ENIPMessage* const outgoing_message) {
   outgoing_message->current_message_position[0] = (unsigned char)data;
   outgoing_message->current_message_position[1] = (unsigned char)(data >> 8);
   outgoing_message->current_message_position[2] = (unsigned char)(data >> 16);
@@ -160,8 +160,8 @@ void AddDintToMessage(const EipUint32 data,
  *   @param pa_buf pointer where data should be reed.
  *   @return EipUint64 value
  */
-EipUint64 GetLintFromMessage(const EipUint8 **const buffer) {
-  const EipUint8 *buffer_address = *buffer;
+EipUint64 GetLintFromMessage(const EipUint8** const buffer) {
+  const EipUint8* buffer_address = *buffer;
   EipUint64 data =
       ((((EipUint64)buffer_address[0]) << 56) & 0xFF00000000000000LL) +
       ((((EipUint64)buffer_address[1]) << 48) & 0x00FF000000000000LL) +
@@ -182,7 +182,7 @@ EipUint64 GetLintFromMessage(const EipUint8 **const buffer) {
  * @param buffer pointer where data should be written.
  */
 void AddLintToMessage(const EipUint64 data,
-                      ENIPMessage *const outgoing_message) {
+                      ENIPMessage* const outgoing_message) {
   outgoing_message->current_message_position[0] = (EipUint8)(data);
   outgoing_message->current_message_position[1] = (EipUint8)(data >> 8);
   outgoing_message->current_message_position[2] = (EipUint8)(data >> 16);
@@ -197,7 +197,7 @@ void AddLintToMessage(const EipUint64 data,
 
 void EncapsulateIpAddress(EipUint16 port,
                           EipUint32 address,
-                          ENIPMessage *const outgoing_message) {
+                          ENIPMessage* const outgoing_message) {
   if (kOpENerEndianessLittle == g_opener_platform_endianess) {
     AddIntToMessage(htons(AF_INET), outgoing_message);
     AddIntToMessage(port, outgoing_message);
@@ -234,7 +234,7 @@ void EncapsulateIpAddress(EipUint16 port,
  */
 void DetermineEndianess() {
   int i               = 1;
-  const char *const p = (char *)&i;
+  const char* const p = (char*)&i;
   if (p[0] == 1) {
     g_opener_platform_endianess = kOpENerEndianessLittle;
   } else {
@@ -253,14 +253,14 @@ int GetEndianess() {
 }
 
 void MoveMessageNOctets(const int amount_of_bytes_moved,
-                        ENIPMessage *const outgoing_message) {
+                        ENIPMessage* const outgoing_message) {
   outgoing_message->current_message_position += amount_of_bytes_moved;
   outgoing_message->used_message_length += amount_of_bytes_moved;
 }
 
 void FillNextNMessageOctetsWith(CipOctet value,
                                 unsigned int amount_of_bytes_written,
-                                ENIPMessage *const outgoing_message) {
+                                ENIPMessage* const outgoing_message) {
   memset(outgoing_message->current_message_position,
          value,
          amount_of_bytes_written);
@@ -269,7 +269,7 @@ void FillNextNMessageOctetsWith(CipOctet value,
 void FillNextNMessageOctetsWithValueAndMoveToNextPosition(
     CipOctet value,
     unsigned int amount_of_filled_bytes,
-    ENIPMessage *const outgoing_message) {
+    ENIPMessage* const outgoing_message) {
   FillNextNMessageOctetsWith(value, amount_of_filled_bytes, outgoing_message);
   MoveMessageNOctets(amount_of_filled_bytes, outgoing_message);
 }

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

@@ -24,13 +24,13 @@ typedef enum {
  *   @param buffer pointer where data should be reed.
  *   @return EIP_UINT8 data value
  */
-CipSint GetSintFromMessage(const EipUint8 **const buffer);
+CipSint GetSintFromMessage(const EipUint8** const buffer);
 
-CipByte GetByteFromMessage(const CipOctet **const buffer_address);
+CipByte GetByteFromMessage(const CipOctet** const buffer_address);
 
-CipUsint GetUsintFromMessage(const CipOctet **const buffer_address);
+CipUsint GetUsintFromMessage(const CipOctet** const buffer_address);
 
-CipBool GetBoolFromMessage(const EipBool8 **const buffer_address);
+CipBool GetBoolFromMessage(const EipBool8** const buffer_address);
 
 /** @ingroup ENCAP
  *
@@ -40,11 +40,11 @@ CipBool GetBoolFromMessage(const EipBool8 **const buffer_address);
  * incremented by 2!
  * @return Extracted 16 bit integer value
  */
-CipInt GetIntFromMessage(const EipUint8 **const buffer);
+CipInt GetIntFromMessage(const EipUint8** const buffer);
 
-CipUint GetUintFromMessage(const CipOctet **const buffer_address);
+CipUint GetUintFromMessage(const CipOctet** const buffer_address);
 
-CipWord GetWordFromMessage(const CipOctet **const buffer_address);
+CipWord GetWordFromMessage(const CipOctet** const buffer_address);
 
 /** @ingroup ENCAP
  *
@@ -53,11 +53,11 @@ CipWord GetWordFromMessage(const CipOctet **const buffer_address);
  * incremented by 4!
  * @return Extracted 32 bit integer value
  */
-CipDint 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);
 
-CipUdint GetDwordFromMessage(const CipOctet **const buffer_address);
+CipUdint GetDwordFromMessage(const CipOctet** const buffer_address);
 
 /** @ingroup ENCAP
  *
@@ -65,7 +65,7 @@ CipUdint GetDwordFromMessage(const CipOctet **const buffer_address);
  * @param data value to be written
  * @param buffer pointer where data should be written.
  */
-void AddSintToMessage(const EipUint8 data, ENIPMessage *const outgoing_message);
+void AddSintToMessage(const EipUint8 data, ENIPMessage* const outgoing_message);
 
 /** @ingroup ENCAP
  *
@@ -76,7 +76,7 @@ void AddSintToMessage(const EipUint8 data, ENIPMessage *const outgoing_message);
  *
  * @return Length in bytes of the encoded message
  */
-void AddIntToMessage(const EipUint16 data, ENIPMessage *const outgoing_message);
+void AddIntToMessage(const EipUint16 data, ENIPMessage* const outgoing_message);
 
 /** @ingroup ENCAP
  *
@@ -88,9 +88,9 @@ void AddIntToMessage(const EipUint16 data, ENIPMessage *const outgoing_message);
  * @return Length in bytes of the encoded message
  */
 void AddDintToMessage(const EipUint32 data,
-                      ENIPMessage *const outgoing_message);
+                      ENIPMessage* const outgoing_message);
 
-EipUint64 GetLintFromMessage(const EipUint8 **const buffer);
+EipUint64 GetLintFromMessage(const EipUint8** const buffer);
 
 /** @ingroup ENCAP
  *
@@ -101,7 +101,7 @@ EipUint64 GetLintFromMessage(const EipUint8 **const buffer);
  *
  */
 void AddLintToMessage(const EipUint64 pa_unData,
-                      ENIPMessage *const outgoing_message);
+                      ENIPMessage* const outgoing_message);
 
 /** @brief Encapsulate the sockaddr information as necessary for the Common
  * Packet Format data items
@@ -115,7 +115,7 @@ void AddLintToMessage(const EipUint64 pa_unData,
  */
 void EncapsulateIpAddress(EipUint16 port,
                           EipUint32 address,
-                          ENIPMessage *const outgoing_message);
+                          ENIPMessage* const outgoing_message);
 
 /** Identify if we are running on a big or little endian system and set
  * variable.
@@ -131,15 +131,15 @@ void DetermineEndianess(void);
 int GetEndianess(void);
 
 void MoveMessageNOctets(const int amount_of_bytes_moved,
-                        ENIPMessage *const outgoing_message);
+                        ENIPMessage* const outgoing_message);
 
 void FillNextNMessageOctetsWith(CipOctet value,
                                 unsigned int amount_of_bytes_written,
-                                ENIPMessage *const outgoing_message);
+                                ENIPMessage* const outgoing_message);
 
 void FillNextNMessageOctetsWithValueAndMoveToNextPosition(
     CipOctet value,
     unsigned int amount_of_filled_bytes,
-    ENIPMessage *const outgoing_message);
+    ENIPMessage* const outgoing_message);
 
 #endif /* OPENER_ENDIANCONV_H_ */

+ 143 - 143
source/src/opener_api.h

@@ -38,8 +38,8 @@
  *  specified by the iface string.
  *
  */
-EipStatus IfaceGetConfiguration(TcpIpInterface *iface,
-                                CipTcpIpInterfaceConfiguration *iface_cfg);
+EipStatus IfaceGetConfiguration(TcpIpInterface* iface,
+                                CipTcpIpInterfaceConfiguration* iface_cfg);
 
 /** @ingroup CIP_API
  * @brief Read and return the MAC address of the Ethernet interface
@@ -49,8 +49,8 @@ EipStatus IfaceGetConfiguration(TcpIpInterface *iface,
  * @return                   kEipStatusOk: all fine
  *                           kEipStatusError: failure, errno set
  */
-EipStatus IfaceGetMacAddress(TcpIpInterface *iface,
-                             uint8_t *const physical_address);
+EipStatus IfaceGetMacAddress(TcpIpInterface* iface,
+                             uint8_t* const physical_address);
 
 /** @ingroup CIP_API
  * @brief Wait for the network interface having an IP address
@@ -66,9 +66,9 @@ EipStatus IfaceGetMacAddress(TcpIpInterface *iface,
  * The polling wait process can be aborted by setting @p abort_wait to
  *  a non zero value from another thread.
  */
-EipStatus IfaceWaitForIp(TcpIpInterface *const iface,
+EipStatus IfaceWaitForIp(TcpIpInterface* const iface,
                          int timeout,
-                         volatile int *const abort_wait);
+                         volatile int* const abort_wait);
 
 #if defined(STM32) /** STM32 target, the hostname is linked to the network \
                       interface */
@@ -81,7 +81,7 @@ EipStatus IfaceWaitForIp(TcpIpInterface *const iface,
  * This function reads the host name from the platform and returns it
  *  via the hostname parameter.
  */
-void GetHostName(TcpIpInterface *iface, CipString *hostname);
+void GetHostName(TcpIpInterface* iface, CipString* hostname);
 #else  /** other targets */
 /** @ingroup CIP_API
  * @brief Get host name from platform
@@ -91,7 +91,7 @@ void GetHostName(TcpIpInterface *iface, CipString *hostname);
  * This function reads the host name from the platform and returns it
  *  via the hostname parameter.
  */
-void GetHostName(CipString *hostname);
+void GetHostName(CipString* hostname);
 #endif /** other targets */
 
 /** @ingroup CIP_API
@@ -159,7 +159,7 @@ CipUint GetDeviceVendorId(void);
  * When OpENer is used as a library, multiple CIP adapters may use it
  * and will need to change the product name.
  */
-void SetDeviceProductName(const char *product_name);
+void SetDeviceProductName(const char* product_name);
 
 /** @ingroup CIP_API
  * @brief Get device's current CIP ProductName
@@ -169,7 +169,7 @@ void SetDeviceProductName(const char *product_name);
  *
  * @returns the CipShortString for the product name
  */
-CipShortString *GetDeviceProductName(void);
+CipShortString* GetDeviceProductName(void);
 
 /** @ingroup CIP_API
  * @brief Initialize and setup the CIP-stack
@@ -225,7 +225,7 @@ bool CipRunIdleHeaderGetT2O(void);
  * @return pointer to CIP Object
  *          0 if object is not present in the stack
  */
-CipClass *GetCipClass(const CipUdint class_code);
+CipClass* GetCipClass(const CipUdint class_code);
 
 /** @ingroup CIP_API
  * @brief Get a pointer to an instance
@@ -235,7 +235,7 @@ CipClass *GetCipClass(const CipUdint class_code);
  * @return pointer to CIP Instance
  *          0 if instance is not in the object
  */
-CipInstance *GetCipInstance(const CipClass *RESTRICT const cip_object,
+CipInstance* GetCipInstance(const CipClass* RESTRICT const cip_object,
                             const CipInstanceNum instance_number);
 
 /** @ingroup CIP_API
@@ -248,11 +248,11 @@ CipInstance *GetCipInstance(const CipClass *RESTRICT const cip_object,
  * @return pointer to attribute
  *          0 if instance is not in the object
  */
-CipAttributeStruct *GetCipAttribute(const CipInstance *const cip_instance,
+CipAttributeStruct* GetCipAttribute(const CipInstance* const cip_instance,
                                     const EipUint16 attribute_number);
 
 typedef void (*InitializeCipClass)(
-    CipClass *); /**< Initializer function for CIP class initialization */
+    CipClass*); /**< Initializer function for CIP class initialization */
 
 /** @ingroup CIP_API
  * @brief Allocate memory for new CIP Class and attributes
@@ -278,7 +278,7 @@ typedef void (*InitializeCipClass)(
  *  @return pointer to new class object
  *      0 on error
  */
-CipClass *CreateCipClass(const CipUdint class_code,
+CipClass* CreateCipClass(const CipUdint class_code,
                          const int number_of_class_attributes,
                          const EipUint32 highest_class_attribute_number,
                          const int number_of_class_services,
@@ -286,7 +286,7 @@ CipClass *CreateCipClass(const CipUdint class_code,
                          const EipUint32 highest_instance_attribute_number,
                          const int number_of_instance_services,
                          const CipInstanceNum number_of_instances,
-                         const char *const name,
+                         const char* const name,
                          const EipUint16 revision,
                          InitializeCipClass initializer);
 
@@ -308,8 +308,8 @@ CipClass *CreateCipClass(const CipUdint class_code,
  * @return pointer to the first of the new instances
  *              0 on error
  */
-CipInstance *AddCipInstances(
-    CipClass *RESTRICT const cip_object_to_add_instances,
+CipInstance* AddCipInstances(
+    CipClass* RESTRICT const cip_object_to_add_instances,
     const CipInstanceNum number_of_instances);
 
 /** @ingroup CIP_API
@@ -322,7 +322,7 @@ CipInstance *AddCipInstances(
  *         already exists the existing is returned an no new instance is created
  *
  */
-CipInstance *AddCipInstance(CipClass *RESTRICT const cip_class_to_add_instance,
+CipInstance* AddCipInstance(CipClass* RESTRICT const cip_class_to_add_instance,
                             const CipInstanceNum instance_id);
 
 /** @ingroup CIP_API
@@ -340,12 +340,12 @@ CipInstance *AddCipInstance(CipClass *RESTRICT const cip_class_to_add_instance,
  *  @param cip_data Pointer to data of attribute.
  *  @param cip_flags Flags to indicate set-ability and get-ability of attribute.
  */
-void InsertAttribute(CipInstance *const instance,
+void InsertAttribute(CipInstance* const instance,
                      const EipUint16 attribute_number,
                      const EipUint8 cip_type,
                      CipAttributeEncodeInMessage encode_function,
                      CipAttributeDecodeFromMessage decode_function,
-                     void *const data,
+                     void* const data,
                      const EipByte cip_flags);
 
 /** @ingroup CIP_API
@@ -354,7 +354,7 @@ void InsertAttribute(CipInstance *const instance,
  * @param target_class Class, in which the bitmasks will be inserted.
  *
  */
-void AllocateAttributeMasks(CipClass *target_class);
+void AllocateAttributeMasks(CipClass* target_class);
 
 /** @ingroup CIP_API
  * @brief Calculates Byte-Index of Attribute
@@ -377,10 +377,10 @@ size_t CalculateIndex(EipUint16 attribute_number);
  * @param service_function pointer to function which represents the service.
  * @param service_name name of the service
  */
-void InsertService(const CipClass *const cip_class,
+void InsertService(const CipClass* const cip_class,
                    const EipUint8 service_code,
                    const CipServiceFunction service_function,
-                   char *const service_name);
+                   char* const service_name);
 
 /** @ingroup CIP_API
  * @brief Insert a Get or Set callback for a CIP class
@@ -397,7 +397,7 @@ void InsertService(const CipClass *const cip_class,
  * If either the kPostSetFunc or kNvDataFunc is set the same function
  *  pointer CipClass::PostSetCallback will be called.
  */
-void InsertGetSetCallback(CipClass *const cip_class,
+void InsertGetSetCallback(CipClass* const cip_class,
                           CipGetSetCallback callback_function,
                           CIPAttributeFlag callbacks_to_install);
 
@@ -412,68 +412,68 @@ void InsertGetSetCallback(CipClass *const cip_class,
  *  @param message_router_response The message router response construct
  */
 
-void EncodeCipBool(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipBool(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipByte(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipByte(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipWord(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipWord(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipDword(const void *const data,
-                    ENIPMessage *const outgoing_message);
+void EncodeCipDword(const void* const data,
+                    ENIPMessage* const outgoing_message);
 
-void EncodeCipLword(const void *const data,
-                    ENIPMessage *const outgoing_message);
+void EncodeCipLword(const void* const data,
+                    ENIPMessage* const outgoing_message);
 
-void EncodeCipUsint(const void *const data,
-                    ENIPMessage *const outgoing_message);
+void EncodeCipUsint(const void* const data,
+                    ENIPMessage* const outgoing_message);
 
-void EncodeCipUint(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipUint(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipUdint(const void *const data,
-                    ENIPMessage *const outgoing_message);
+void EncodeCipUdint(const void* const data,
+                    ENIPMessage* const outgoing_message);
 
-void EncodeCipUlint(const void *const data,
-                    ENIPMessage *const outgoing_message);
+void EncodeCipUlint(const void* const data,
+                    ENIPMessage* const outgoing_message);
 
-void EncodeCipSint(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipSint(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipInt(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipInt(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipDint(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipDint(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipLint(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipLint(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipReal(const void *const data, ENIPMessage *const outgoing_message);
+void EncodeCipReal(const void* const data, ENIPMessage* const outgoing_message);
 
-void EncodeCipLreal(const void *const data,
-                    ENIPMessage *const outgoing_message);
+void EncodeCipLreal(const void* const data,
+                    ENIPMessage* const outgoing_message);
 
-void EncodeCipShortString(const void *const data,
-                          ENIPMessage *const outgoing_message);
+void EncodeCipShortString(const void* const data,
+                          ENIPMessage* const outgoing_message);
 
-void EncodeCipString(const void *const data,
-                     ENIPMessage *const outgoing_message);
+void EncodeCipString(const void* const data,
+                     ENIPMessage* const outgoing_message);
 
-void EncodeCipString2(const void *const data,
-                      ENIPMessage *const outgoing_message);
+void EncodeCipString2(const void* const data,
+                      ENIPMessage* const outgoing_message);
 
-void EncodeCipStringN(const void *const data,
-                      ENIPMessage *const outgoing_message);
+void EncodeCipStringN(const void* const data,
+                      ENIPMessage* const outgoing_message);
 
-void EncodeCipStringI(const void *const data,
-                      ENIPMessage *const outgoing_message);
+void EncodeCipStringI(const void* const data,
+                      ENIPMessage* const outgoing_message);
 
-void EncodeCipByteArray(const void *const data,
-                        ENIPMessage *const outgoing_message);
+void EncodeCipByteArray(const void* const data,
+                        ENIPMessage* const outgoing_message);
 
-void EncodeCipEPath(const void *const data,
-                    ENIPMessage *const outgoing_message);  // path_size UINT
+void EncodeCipEPath(const void* const data,
+                    ENIPMessage* const outgoing_message);  // path_size UINT
 
-void EncodeEPath(const void *const data,
-                 ENIPMessage *const outgoing_message);  // path_size not encoded
+void EncodeEPath(const void* const data,
+                 ENIPMessage* const outgoing_message);  // path_size not encoded
 
-void EncodeCipEthernetLinkPhyisicalAddress(const void *const data,
-                                           ENIPMessage *const outgoing_message);
+void EncodeCipEthernetLinkPhyisicalAddress(const void* const data,
+                                           ENIPMessage* const outgoing_message);
 
 /** @ingroup CIP_API
  * @brief Retrieve the given data according to CIP encoding from the message
@@ -489,79 +489,79 @@ void EncodeCipEthernetLinkPhyisicalAddress(const void *const data,
  *  @return length of taken bytes
  *          -1 .. error
  */
-int DecodeCipBool(CipBool *const data,
-                  CipMessageRouterRequest *const message_router_request,
-                  CipMessageRouterResponse *const message_router_response);
+int DecodeCipBool(CipBool* const data,
+                  CipMessageRouterRequest* const message_router_request,
+                  CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipByte(CipByte *const data,
-                  CipMessageRouterRequest *const message_router_request,
-                  CipMessageRouterResponse *const message_router_response);
+int DecodeCipByte(CipByte* const data,
+                  CipMessageRouterRequest* const message_router_request,
+                  CipMessageRouterResponse* const message_router_response);
 
 int DecodeCipByteArray(
-    CipByteArray *const data,
-    const CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response);
+    CipByteArray* const data,
+    const CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipWord(CipWord *const data,
-                  CipMessageRouterRequest *const message_router_request,
-                  CipMessageRouterResponse *const message_router_response);
+int DecodeCipWord(CipWord* const data,
+                  CipMessageRouterRequest* const message_router_request,
+                  CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipDword(CipDword *const data,
-                   CipMessageRouterRequest *const message_router_request,
-                   CipMessageRouterResponse *const message_router_response);
+int DecodeCipDword(CipDword* const data,
+                   CipMessageRouterRequest* const message_router_request,
+                   CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipLword(CipLword *const data,
-                   CipMessageRouterRequest *const message_router_request,
-                   CipMessageRouterResponse *const message_router_response);
+int DecodeCipLword(CipLword* const data,
+                   CipMessageRouterRequest* const message_router_request,
+                   CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipUsint(CipUsint *const data,
-                   CipMessageRouterRequest *const message_router_request,
-                   CipMessageRouterResponse *const message_router_response);
+int DecodeCipUsint(CipUsint* const data,
+                   CipMessageRouterRequest* const message_router_request,
+                   CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipUint(CipUint *const data,
-                  CipMessageRouterRequest *const message_router_request,
-                  CipMessageRouterResponse *const message_router_response);
+int DecodeCipUint(CipUint* const data,
+                  CipMessageRouterRequest* const message_router_request,
+                  CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipUdint(CipUdint *const data,
-                   CipMessageRouterRequest *const message_router_request,
-                   CipMessageRouterResponse *const message_router_response);
+int DecodeCipUdint(CipUdint* const data,
+                   CipMessageRouterRequest* const message_router_request,
+                   CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipUlint(CipUlint *const data,
-                   CipMessageRouterRequest *const message_router_request,
-                   CipMessageRouterResponse *const message_router_response);
+int DecodeCipUlint(CipUlint* const data,
+                   CipMessageRouterRequest* const message_router_request,
+                   CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipSint(CipSint *const data,
-                  CipMessageRouterRequest *const message_router_request,
-                  CipMessageRouterResponse *const message_router_response);
+int DecodeCipSint(CipSint* const data,
+                  CipMessageRouterRequest* const message_router_request,
+                  CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipInt(CipInt *const data,
-                 CipMessageRouterRequest *const message_router_request,
-                 CipMessageRouterResponse *const message_router_response);
+int DecodeCipInt(CipInt* const data,
+                 CipMessageRouterRequest* const message_router_request,
+                 CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipDint(CipDint *const data,
-                  CipMessageRouterRequest *const message_router_request,
-                  CipMessageRouterResponse *const message_router_response);
+int DecodeCipDint(CipDint* const data,
+                  CipMessageRouterRequest* const message_router_request,
+                  CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipLint(CipLint *const data,
-                  CipMessageRouterRequest *const message_router_request,
-                  CipMessageRouterResponse *const message_router_response);
+int DecodeCipLint(CipLint* const data,
+                  CipMessageRouterRequest* const message_router_request,
+                  CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipReal(CipReal *const data,
-                  CipMessageRouterRequest *const message_router_request,
-                  CipMessageRouterResponse *const message_router_response);
+int DecodeCipReal(CipReal* const data,
+                  CipMessageRouterRequest* const message_router_request,
+                  CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipLreal(CipLreal *const data,
-                   CipMessageRouterRequest *const message_router_request,
-                   CipMessageRouterResponse *const message_router_response);
+int DecodeCipLreal(CipLreal* const data,
+                   CipMessageRouterRequest* const message_router_request,
+                   CipMessageRouterResponse* const message_router_response);
 
-int DecodeCipString(CipString *const data,
-                    CipMessageRouterRequest *const message_router_request,
-                    CipMessageRouterResponse *const message_router_response);
+int DecodeCipString(CipString* const data,
+                    CipMessageRouterRequest* const message_router_request,
+                    CipMessageRouterResponse* const message_router_response);
 
 int DecodeCipShortString(
-    CipShortString *const data,
-    CipMessageRouterRequest *const message_router_request,
-    CipMessageRouterResponse *const message_router_response);
+    CipShortString* const data,
+    CipMessageRouterRequest* const message_router_request,
+    CipMessageRouterResponse* const message_router_response);
 
 /** @ingroup CIP_API
  * @brief Create an instance of an assembly object
@@ -580,8 +580,8 @@ int DecodeCipShortString(
  * The notification on received configuration data is handled with the
  * AfterAssemblyDataReceived.
  */
-CipInstance *CreateAssemblyObject(const CipInstanceNum instance_number,
-                                  EipByte *const data,
+CipInstance* CreateAssemblyObject(const CipInstanceNum instance_number,
+                                  EipByte* const data,
                                   const EipUint16 data_length);
 
 typedef struct cip_connection_object CipConnectionObject;
@@ -596,8 +596,8 @@ typedef struct cip_connection_object CipConnectionObject;
  * @return CIP error code
  */
 typedef CipError (*OpenConnectionFunction)(
-    CipConnectionObject *RESTRICT const connection_object,
-    EipUint16 *const extended_error_code);
+    CipConnectionObject* RESTRICT const connection_object,
+    EipUint16* const extended_error_code);
 
 /** @ingroup CIP_API
  * @brief Function prototype for handling the closing of connections
@@ -606,7 +606,7 @@ typedef CipError (*OpenConnectionFunction)(
  * connection
  */
 typedef void (*ConnectionCloseFunction)(
-    CipConnectionObject *RESTRICT connection_object);
+    CipConnectionObject* RESTRICT connection_object);
 
 /** @ingroup CIP_API
  * @brief Function prototype for handling the timeout of connections
@@ -614,7 +614,7 @@ typedef void (*ConnectionCloseFunction)(
  * @param connection_object The connection object which connection timed out
  */
 typedef void (*ConnectionTimeoutFunction)(
-    CipConnectionObject *connection_object);
+    CipConnectionObject* connection_object);
 
 /** @ingroup CIP_API
  * @brief Function prototype for sending data via a connection
@@ -624,7 +624,7 @@ typedef void (*ConnectionTimeoutFunction)(
  * @return EIP stack status
  */
 typedef EipStatus (*ConnectionSendDataFunction)(
-    CipConnectionObject *connection_object);
+    CipConnectionObject* connection_object);
 
 /** @ingroup CIP_API
  * @brief Function prototype for receiving data via a connection
@@ -636,8 +636,8 @@ typedef EipStatus (*ConnectionSendDataFunction)(
  * @return Stack status
  */
 typedef EipStatus (*ConnectionReceiveDataFunction)(
-    CipConnectionObject *connection_object,
-    const EipUint8 *data,
+    CipConnectionObject* connection_object,
+    const EipUint8* data,
     const EipUint16 data_length);
 
 /** @ingroup CIP_API
@@ -733,11 +733,11 @@ void ConfigureListenOnlyConnectionPoint(
  * status
  */
 EipStatus HandleReceivedExplictTcpData(int socket_handle,
-                                       EipUint8 *buffer,
+                                       EipUint8* buffer,
                                        size_t length,
-                                       int *number_of_remaining_bytes,
-                                       struct sockaddr *originator_address,
-                                       ENIPMessage *const outgoing_message);
+                                       int* number_of_remaining_bytes,
+                                       struct sockaddr* originator_address,
+                                       ENIPMessage* const outgoing_message);
 
 /** @ingroup CIP_API
  * @brief Notify the encapsulation layer that an explicit message has been
@@ -756,12 +756,12 @@ EipStatus HandleReceivedExplictTcpData(int socket_handle,
  * status
  */
 EipStatus HandleReceivedExplictUdpData(const int socket_handle,
-                                       const struct sockaddr_in *from_address,
-                                       const EipUint8 *buffer,
+                                       const struct sockaddr_in* from_address,
+                                       const EipUint8* buffer,
                                        const size_t buffer_length,
-                                       int *number_of_remaining_bytes,
+                                       int* number_of_remaining_bytes,
                                        bool unicast,
-                                       ENIPMessage *const outgoing_message);
+                                       ENIPMessage* const outgoing_message);
 
 /** @ingroup CIP_API
  *  @brief Notify the connection manager that data for a connection has been
@@ -775,9 +775,9 @@ EipStatus HandleReceivedExplictUdpData(const int socket_handle,
  *           connection hijacking
  *  @return EIP_OK on success
  */
-EipStatus HandleReceivedConnectedData(const EipUint8 *const received_data,
+EipStatus HandleReceivedConnectedData(const EipUint8* const received_data,
                                       int received_data_length,
-                                      struct sockaddr_in *from_address);
+                                      struct sockaddr_in* from_address);
 
 /** @ingroup CIP_API
  * @brief Check if any of the connection timers (TransmissionTrigger or
@@ -889,7 +889,7 @@ void CheckIoConnectionEvent(unsigned int output_assembly_id,
  * The length of the data is already checked within the stack. Therefore the
  * user only has to check if the data is valid.
  */
-EipStatus AfterAssemblyDataReceived(CipInstance *instance);
+EipStatus AfterAssemblyDataReceived(CipInstance* instance);
 
 /** @ingroup CIP_CALLBACK_API
  * @brief Inform the application that the data of an assembly
@@ -903,7 +903,7 @@ EipStatus AfterAssemblyDataReceived(CipInstance *instance);
  *          - true assembly data has changed
  *          - false assembly data has not changed
  */
-EipBool8 BeforeAssemblyDataSend(CipInstance *instance);
+EipBool8 BeforeAssemblyDataSend(CipInstance* instance);
 
 /** @ingroup CIP_CALLBACK_API
  * @brief Emulate as close a possible a power cycle of the device
@@ -933,7 +933,7 @@ EipStatus ResetDeviceToInitialConfiguration(void);
  * @param size_of_element size in bytes of one element
  * @return pointer to the allocated memory, 0 on error
  */
-void *CipCalloc(size_t number_of_elements, size_t size_of_element);
+void* CipCalloc(size_t number_of_elements, size_t size_of_element);
 
 /** @ingroup CIP_CALLBACK_API
  * @brief Free memory allocated by the OpENer
@@ -941,7 +941,7 @@ void *CipCalloc(size_t number_of_elements, size_t size_of_element);
  * emulate the common c-library function free
  * @param data pointer to the allocated memory
  */
-void CipFree(void *data);
+void CipFree(void* data);
 
 /** @ingroup CIP_CALLBACK_API
  * @brief Inform the application that the Run/Idle State has been changed
@@ -965,8 +965,8 @@ int CreateUdpSocket(void);
  * @param outgoing message The constructed outgoing message
  * @return kEipStatusOk on success
  */
-EipStatus SendUdpData(const struct sockaddr_in *const socket_data,
-                      const ENIPMessage *const outgoing_message);
+EipStatus SendUdpData(const struct sockaddr_in* const socket_data,
+                      const ENIPMessage* const outgoing_message);
 
 /** @ingroup CIP_CALLBACK_API
  * @brief Close the given socket and clean up the stack

+ 0 - 1
source/src/ports/CMakeLists.txt

@@ -33,4 +33,3 @@ if( OPENER_INSTALL_AS_LIB )
       PATTERN "sample_application" EXCLUDE
    )
 endif()
-

+ 1 - 1
source/src/ports/MINGW/main.c

@@ -49,7 +49,7 @@ static DWORD executeEventLoop(LPVOID thread_arg);
 volatile int g_end_stack = 0;
 
 /******************************************************************************/
-int main(int argc, char *arg[]) {
+int main(int argc, char* arg[]) {
   if (argc != 2) {
     fprintf(stderr, "Wrong number of command line parameters!\n");
     fprintf(stderr, "Usage: %s [interface index | interface name]\n", arg[0]);

+ 23 - 23
source/src/ports/MINGW/networkconfig.c

@@ -45,9 +45,9 @@
  *  string if possible. On conversion success @p errno is set to zero.
  *  On failure @p errno is set to ERANGE or EINVAL.
  */
-static ULONG StrToIfaceIdx(const char *iface) {
+static ULONG StrToIfaceIdx(const char* iface) {
   ULONG iface_idx;
-  char *end;
+  char* end;
   /* The input string is a decimal interface index number or an
    *  interface name. */
   errno     = 0; /* To distinguish success / failure later */
@@ -76,9 +76,9 @@ static ULONG StrToIfaceIdx(const char *iface) {
  * The LUID can then be used to retrieve the interface index needed for the
  *  other functions by calling ConvertInterfaceLuidToIndex().
  */
-static DWORD ConvertToIndexFromFakeAlias(const char *iface,
+static DWORD ConvertToIndexFromFakeAlias(const char* iface,
                                          PNET_IFINDEX iface_idx) {
-  WCHAR *p_if_alias;
+  WCHAR* p_if_alias;
   NET_LUID if_luid;
 
   size_t mbtowc_rc = mbstowcs(NULL, iface, 0);
@@ -117,7 +117,7 @@ static DWORD ConvertToIndexFromFakeAlias(const char *iface,
  *  alias name. This function then in turn calls ConvertToIndexFromFakeAlias()
  *  to find an interface matching that alias.
  */
-static EipStatus DetermineIfaceIndexByString(const char *iface,
+static EipStatus DetermineIfaceIndexByString(const char* iface,
                                              PNET_IFINDEX iface_idx) {
   *iface_idx = StrToIfaceIdx(iface);
 
@@ -125,7 +125,7 @@ static EipStatus DetermineIfaceIndexByString(const char *iface,
   if (!arg_is_numerical) {
     DWORD cnv_status = ConvertToIndexFromFakeAlias(iface, iface_idx);
     if (NO_ERROR != cnv_status) {
-      char *error_message = GetErrorMessage(cnv_status);
+      char* error_message = GetErrorMessage(cnv_status);
       OPENER_TRACE_ERR("ConvertToIndexFromFakeAlias() failed: %" PRIDW
                        " - %s\n",
                        cnv_status,
@@ -152,7 +152,7 @@ static EipStatus DetermineIfaceIndexByString(const char *iface,
  *  result.
  */
 EipStatus RetrieveAdapterAddressesTable(ULONG flags,
-                                        PIP_ADAPTER_ADDRESSES *pp_addr_table) {
+                                        PIP_ADAPTER_ADDRESSES* pp_addr_table) {
   PIP_ADAPTER_ADDRESSES p_addr_table;
   ULONG ret_val;
   /* Start allocating with a guessed minimum size. */
@@ -178,7 +178,7 @@ EipStatus RetrieveAdapterAddressesTable(ULONG flags,
       FREE(p_addr_table);
       p_addr_table = NULL;
     }
-    char *error_message = GetErrorMessage(ret_val);
+    char* error_message = GetErrorMessage(ret_val);
     OPENER_TRACE_ERR("GetAdaptersAddresses() failed: %" PRIUL " - %s\n",
                      ret_val,
                      error_message);
@@ -199,8 +199,8 @@ EipStatus RetrieveAdapterAddressesTable(ULONG flags,
  *         kEipStatusError if a memory allocation error occurred or
  *         the source string was too large.
  */
-static DWORD WideToCipString(const WCHAR *const src, CipString *const dest) {
-  void *buf = NULL;
+static DWORD WideToCipString(const WCHAR* const src, CipString* const dest) {
+  void* buf = NULL;
 
   OPENER_ASSERT(src != NULL);
   OPENER_ASSERT(dest != NULL);
@@ -249,15 +249,15 @@ static DWORD WideToCipString(const WCHAR *const src, CipString *const dest) {
  *  @param  socket_address  pointer to a Windows SOCKET_ADDRESS structure
  *  @return                 IPv4 address taken from @p socket_address
  */
-static CipUdint GetIpFromSocketAddress(const SOCKET_ADDRESS *socket_address) {
-  SOCKADDR_IN *sin = ((SOCKADDR_IN *)socket_address->lpSockaddr);
+static CipUdint GetIpFromSocketAddress(const SOCKET_ADDRESS* socket_address) {
+  SOCKADDR_IN* sin = ((SOCKADDR_IN*)socket_address->lpSockaddr);
   return sin->sin_addr.S_un.S_addr;
 }
 
 /* ---------- Public functions implementation ---------- */
 
 /* For Doxygen descriptions see opener_api.h. */
-EipStatus IfaceGetMacAddress(const char *iface, uint8_t *physical_address) {
+EipStatus IfaceGetMacAddress(const char* iface, uint8_t* physical_address) {
   ULONG iface_idx;
 
   if (kEipStatusOk != DetermineIfaceIndexByString(iface, &iface_idx)) {
@@ -301,8 +301,8 @@ EipStatus IfaceGetMacAddress(const char *iface, uint8_t *physical_address) {
 }
 
 /* For Doxygen descriptions see opener_api.h. */
-EipStatus IfaceGetConfiguration(const char *iface,
-                                CipTcpIpInterfaceConfiguration *iface_cfg) {
+EipStatus IfaceGetConfiguration(const char* iface,
+                                CipTcpIpInterfaceConfiguration* iface_cfg) {
   ULONG iface_idx;
 
   if (kEipStatusOk != DetermineIfaceIndexByString(iface, &iface_idx)) {
@@ -354,7 +354,7 @@ EipStatus IfaceGetConfiguration(const char *iface,
         }
       }
       {
-        IP_ADAPTER_DNS_SERVER_ADDRESS *pDnServer =
+        IP_ADAPTER_DNS_SERVER_ADDRESS* pDnServer =
             p_addr_entry->FirstDnsServerAddress;
         if (NULL != pDnServer) {
           local_cfg.name_server = GetIpFromSocketAddress(&pDnServer->Address);
@@ -368,7 +368,7 @@ EipStatus IfaceGetConfiguration(const char *iface,
       DWORD ret_val =
           WideToCipString(p_addr_entry->DnsSuffix, &local_cfg.domain_name);
       if (NO_ERROR != ret_val) {
-        char *error_message = GetErrorMessage(ret_val);
+        char* error_message = GetErrorMessage(ret_val);
         OPENER_TRACE_ERR("WideToCipString(DnsSuffix) failed with error: %" PRIDW
                          " - %s\n",
                          ret_val,
@@ -395,9 +395,9 @@ EipStatus IfaceGetConfiguration(const char *iface,
 }
 
 /* For Doxygen descriptions see opener_api.h. */
-EipStatus IfaceWaitForIp(const char *const iface,
+EipStatus IfaceWaitForIp(const char* const iface,
                          int timeout,
-                         volatile int *const abort_wait) {
+                         volatile int* const abort_wait) {
   ULONG iface_idx;
 
   if (kEipStatusOk != DetermineIfaceIndexByString(iface, &iface_idx)) {
@@ -432,7 +432,7 @@ EipStatus IfaceWaitForIp(const char *const iface,
         }
       } while (ERROR_INSUFFICIENT_BUFFER == dw_ret);
       if (NO_ERROR != dw_ret) {
-        char *error_message = GetErrorMessage(dw_ret);
+        char* error_message = GetErrorMessage(dw_ret);
         OPENER_TRACE_ERR("%s() failed with error: %" PRIDW " - %s\n",
                          __func__,
                          dw_ret,
@@ -468,7 +468,7 @@ EipStatus IfaceWaitForIp(const char *const iface,
 }
 
 #define HOST_NAME_MAX 256 /* Should be long enough according rfc1132. */
-void GetHostName(CipString *hostname) {
+void GetHostName(CipString* hostname) {
   CipWord wVersionRequested;
   WSADATA wsaData;
   int err;
@@ -479,7 +479,7 @@ void GetHostName(CipString *hostname) {
   err = WSAStartup(wVersionRequested, &wsaData);
   if (err != 0) {
     /* Tell the user that we could not find a usable Winsock DLL.  */
-    char *error_message = GetErrorMessage(err);
+    char* error_message = GetErrorMessage(err);
     printf("WSAStartup failed with error: %d - %s\n", err, error_message);
     FreeErrorMessage(error_message);
     return;
@@ -489,7 +489,7 @@ void GetHostName(CipString *hostname) {
   err                          = gethostname(name_buf, sizeof(name_buf));
   if (0 != err) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     printf("gethostname() failed, %d - %s\n", error_code, error_message);
     FreeErrorMessage(error_message);
     return;

+ 3 - 3
source/src/ports/MINGW/opener_error.c

@@ -19,8 +19,8 @@ int GetSocketErrorNumber(void) {
   return WSAGetLastError();
 }
 
-char *GetErrorMessage(int error_number) {
-  char *error_message = NULL;
+char* GetErrorMessage(int error_number) {
+  char* error_message = NULL;
   FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
                      FORMAT_MESSAGE_IGNORE_INSERTS,
                  NULL,
@@ -32,6 +32,6 @@ char *GetErrorMessage(int error_number) {
   return error_message;
 }
 
-void FreeErrorMessage(char *error_message) {
+void FreeErrorMessage(char* error_message) {
   LocalFree(error_message);
 }

+ 1 - 1
source/src/ports/MINGW/platform_network_includes.h

@@ -5,4 +5,4 @@
  ******************************************************************************/
 
 #include <winsock2.h>
-#include <ws2tcpip.h>
+#include <ws2tcpip.h>

+ 6 - 6
source/src/ports/MINGW/sample_application/ethlinkcbs.c

@@ -55,8 +55,8 @@ static CipUdint media_calls[OPENER_ETHLINK_INSTANCE_CNT];
 #define MAKE_CNTR(inst, attr, idx, cnt) \
   ((10000000U * inst) + (100000U * attr) + (1000U * idx) + cnt)
 
-EipStatus EthLnkPreGetCallback(CipInstance *const instance,
-                               CipAttributeStruct *const attribute,
+EipStatus EthLnkPreGetCallback(CipInstance* const instance,
+                               CipAttributeStruct* const attribute,
                                CipByte service) {
   bool hadAction   = true;
   EipStatus status = kEipStatusOk;
@@ -67,7 +67,7 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
   unsigned idx           = inst_no - 1;
   switch (attr_no) {
     case 4: {
-      CipEthernetLinkInterfaceCounters *p_iface_cntrs =
+      CipEthernetLinkInterfaceCounters* p_iface_cntrs =
           &g_ethernet_link[idx].interface_cntrs;
 
       ++iface_calls[idx]; /* Count successful calls */
@@ -96,7 +96,7 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
       break;
     }
     case 5: {
-      CipEthernetLinkMediaCounters *p_media_cntrs =
+      CipEthernetLinkMediaCounters* p_media_cntrs =
           &g_ethernet_link[idx].media_cntrs;
 
       ++media_calls[idx]; /* Count successful calls */
@@ -148,8 +148,8 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
   return status;
 }
 
-EipStatus EthLnkPostGetCallback(CipInstance *const instance,
-                                CipAttributeStruct *const attribute,
+EipStatus EthLnkPostGetCallback(CipInstance* const instance,
+                                CipAttributeStruct* const attribute,
                                 CipByte service) {
   CipInstanceNum inst_no = instance->instance_number;
   EipStatus status       = kEipStatusOk;

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

@@ -23,12 +23,12 @@
 /*                             PROTOTYPES                                    */
 /*---------------------------------------------------------------------------*/
 
-EipStatus EthLnkPreGetCallback(CipInstance *const instance,
-                               CipAttributeStruct *const attribute,
+EipStatus EthLnkPreGetCallback(CipInstance* const instance,
+                               CipAttributeStruct* const attribute,
                                CipByte service);
 
-EipStatus EthLnkPostGetCallback(CipInstance *const instance,
-                                CipAttributeStruct *const attribute,
+EipStatus EthLnkPostGetCallback(CipInstance* const instance,
+                                CipAttributeStruct* const attribute,
                                 CipByte service);
 
 #endif /* #ifndef OPENER_ETHLINKCBS_H_ */

+ 7 - 7
source/src/ports/MINGW/sample_application/sampleapplication.c

@@ -93,13 +93,13 @@ EipStatus ApplicationInitialization(void) {
    *  the hardware counters after the current data have been transmitted.
    */
   {
-    CipClass *p_eth_link_class = GetCipClass(kCipEthernetLinkClassCode);
+    CipClass* p_eth_link_class = GetCipClass(kCipEthernetLinkClassCode);
     InsertGetSetCallback(p_eth_link_class, EthLnkPreGetCallback, kPreGetFunc);
     InsertGetSetCallback(p_eth_link_class, EthLnkPostGetCallback, kPostGetFunc);
     /* Specify the attributes for which the callback should be executed. */
     for (int idx = 0; idx < OPENER_ETHLINK_INSTANCE_CNT; ++idx) {
-      CipAttributeStruct *p_eth_link_attr;
-      CipInstance *p_eth_link_inst = GetCipInstance(p_eth_link_class, idx + 1);
+      CipAttributeStruct* p_eth_link_attr;
+      CipInstance* p_eth_link_inst = GetCipInstance(p_eth_link_class, idx + 1);
       OPENER_ASSERT(p_eth_link_inst);
 
       /* Interface counters attribute */
@@ -129,7 +129,7 @@ void CheckIoConnectionEvent(unsigned int pa_unOutputAssembly,
   (void)pa_eIOConnectionEvent; /* suppress compiler warning */
 }
 
-EipStatus AfterAssemblyDataReceived(CipInstance *pa_pstInstance) {
+EipStatus AfterAssemblyDataReceived(CipInstance* pa_pstInstance) {
   EipStatus nRetVal = kEipStatusOk;
 
   /*handle the data received e.g., update outputs of the device */
@@ -157,7 +157,7 @@ EipStatus AfterAssemblyDataReceived(CipInstance *pa_pstInstance) {
   return nRetVal;
 }
 
-EipBool8 BeforeAssemblyDataSend(CipInstance *pa_pstInstance) {
+EipBool8 BeforeAssemblyDataSend(CipInstance* pa_pstInstance) {
   /*update data to be sent e.g., read inputs of the device */
   /*In this sample app we mirror the data from out to inputs on data receive
    * therefore we need nothing to do here. Just return true to inform that
@@ -187,11 +187,11 @@ EipStatus ResetDeviceToInitialConfiguration(void) {
   return kEipStatusOk;
 }
 
-void *CipCalloc(size_t pa_nNumberOfElements, size_t pa_nSizeOfElement) {
+void* CipCalloc(size_t pa_nNumberOfElements, size_t pa_nSizeOfElement) {
   return calloc(pa_nNumberOfElements, pa_nSizeOfElement);
 }
 
-void CipFree(void *pa_poData) {
+void CipFree(void* pa_poData) {
   free(pa_poData);
 }
 

+ 4 - 4
source/src/ports/POSIX/main.c

@@ -49,7 +49,7 @@ static void LeaveStack(int signal);
  *  The call signature is chosen to be able to pass this function directly as
  *  parameter for pthread_create().
  */
-static void *executeEventLoop(void *pthread_arg);
+static void* executeEventLoop(void* pthread_arg);
 
 /******************************************************************************/
 /** @brief Fuzz TCP packets handling flow with AFL.
@@ -65,7 +65,7 @@ static void fuzzHandlePacketFlow(void);
 volatile int g_end_stack = 0;
 
 /******************************************************************************/
-int main(int argc, char *arg[]) {
+int main(int argc, char* arg[]) {
   if (argc != 2) {
     fprintf(stderr, "Wrong number of command line parameters!\n");
     fprintf(stderr, "Usage: %s [interface name]\n", arg[0]);
@@ -252,7 +252,7 @@ static void LeaveStack(int signal) {
   OPENER_TRACE_STATE("got signal %d\n", signal);
 }
 
-static void *executeEventLoop(void *pthread_arg) {
+static void* executeEventLoop(void* pthread_arg) {
   static int pthread_dummy_ret;
   (void)pthread_arg;
 
@@ -280,7 +280,7 @@ static void fuzzHandlePacketFlow(void) {
     /* Read input from STDIN and enter the handle receive flow */
     memset(buff, 0, 512);
     ssize_t received_size    = read(STDIN_FILENO, buff, 512);
-    EipUint8 *receive_buffer = &buff[0];
+    EipUint8* receive_buffer = &buff[0];
 
     InitializeENIPMessage(&outgoing_message);
 

+ 25 - 25
source/src/ports/POSIX/networkconfig.c

@@ -24,8 +24,8 @@
 #include "opener_api.h"
 #include "trace.h"
 
-EipStatus IfaceGetMacAddress(const char *iface,
-                             uint8_t *const physical_address) {
+EipStatus IfaceGetMacAddress(const char* iface,
+                             uint8_t* const physical_address) {
   struct ifreq ifr;
   size_t if_name_len = strlen(iface);
   EipStatus status   = kEipStatusError;
@@ -50,7 +50,7 @@ EipStatus IfaceGetMacAddress(const char *iface,
 }
 
 static EipStatus GetIpAndNetmaskFromInterface(
-    const char *iface, CipTcpIpInterfaceConfiguration *iface_cfg) {
+    const char* iface, CipTcpIpInterfaceConfiguration* iface_cfg) {
   struct ifreq ifr;
   size_t if_name_len = strlen(iface);
   if (if_name_len < sizeof(ifr.ifr_name)) {
@@ -67,14 +67,14 @@ static EipStatus GetIpAndNetmaskFromInterface(
     int ipaddr  = 0;
     int netaddr = 0;
     if (ioctl(fd, SIOCGIFADDR, &ifr) == 0) {
-      ipaddr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
+      ipaddr = ((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr.s_addr;
     } else {
       close(fd);
       return kEipStatusError;
     }
 
     if (ioctl(fd, SIOCGIFNETMASK, &ifr) == 0) {
-      netaddr = ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr;
+      netaddr = ((struct sockaddr_in*)&ifr.ifr_netmask)->sin_addr.s_addr;
     } else {
       close(fd);
       return kEipStatusError;
@@ -89,17 +89,17 @@ static EipStatus GetIpAndNetmaskFromInterface(
 }
 
 static EipStatus GetGatewayFromRoute(
-    const char *iface, CipTcpIpInterfaceConfiguration *iface_cfg) {
+    const char* iface, CipTcpIpInterfaceConfiguration* iface_cfg) {
   static const char route_location[] = "/proc/net/route";
 
-  FILE *file_handle = fopen(route_location, "r");
+  FILE* file_handle = fopen(route_location, "r");
   char file_buffer[132];
-  char *gateway_string = NULL;
+  char* gateway_string = NULL;
 
   if (!file_handle) {
     return kEipStatusError;
   } else {
-    char *needle_start;
+    char* needle_start;
     file_buffer[0] = '\0'; /* To enter the while loop */
     while (NULL == (needle_start = strstr(file_buffer, iface)) &&
            fgets(file_buffer, sizeof(file_buffer), file_handle)) {
@@ -108,7 +108,7 @@ static EipStatus GetGatewayFromRoute(
     fclose(file_handle);
 
     if (NULL != needle_start) {
-      char *strtok_save = NULL;
+      char* strtok_save = NULL;
       strtok_r(needle_start, " \t", &strtok_save); /* Iface token */
       strtok_r(NULL, " \t", &strtok_save);         /* Destination token */
       gateway_string = strtok_r(NULL, " \t", &strtok_save);
@@ -119,7 +119,7 @@ static EipStatus GetGatewayFromRoute(
   }
 
   unsigned long tmp_gw;
-  char *end;
+  char* end;
   /* The gateway string is a hex number in network byte order. */
   errno  = 0; /* To distinguish success / failure later */
   tmp_gw = strtoul(gateway_string, &end, 16);
@@ -150,10 +150,10 @@ static EipStatus GetGatewayFromRoute(
 }
 
 static EipStatus GetDnsInfoFromResolvConf(
-    CipTcpIpInterfaceConfiguration *iface_cfg) {
+    CipTcpIpInterfaceConfiguration* iface_cfg) {
   static const char resolv_conf_file[] = "/etc/resolv.conf";
-  FILE *file_handle                    = fopen(resolv_conf_file, "r");
-  char *file_buffer                    = NULL;
+  FILE* file_handle                    = fopen(resolv_conf_file, "r");
+  char* file_buffer                    = NULL;
   size_t file_length;
 
   if (file_handle) {
@@ -181,13 +181,13 @@ static EipStatus GetDnsInfoFromResolvConf(
     return kEipStatusError;
   }
 
-  char *value_string;
-  char *strtok_save;
-  char *strtok_key;
+  char* value_string;
+  char* strtok_save;
+  char* strtok_key;
   CipUdint dmy_dns;
-  CipUdint *dns = &iface_cfg->name_server;
+  CipUdint* dns = &iface_cfg->name_server;
   /* Split the file_buffer into lines. */
-  char *line = strtok_r(file_buffer, "\n", &strtok_save);
+  char* line = strtok_r(file_buffer, "\n", &strtok_save);
   while (NULL != line) {
     /* Inspect each line for keywords: search, domain, nameserver */
     switch (line[0]) {
@@ -247,8 +247,8 @@ static int nanosleep_simple32(uint32_t sleep_ns) {
   return rc;
 }
 
-EipStatus IfaceGetConfiguration(const char *iface,
-                                CipTcpIpInterfaceConfiguration *iface_cfg) {
+EipStatus IfaceGetConfiguration(const char* iface,
+                                CipTcpIpInterfaceConfiguration* iface_cfg) {
   CipTcpIpInterfaceConfiguration local_cfg;
   EipStatus status;
 
@@ -274,9 +274,9 @@ EipStatus IfaceGetConfiguration(const char *iface,
 
 /* For an API documentation look at opener_api.h. */
 #define WAIT_CYCLE_NS 100000000U
-EipStatus IfaceWaitForIp(const char *const iface,
+EipStatus IfaceWaitForIp(const char* const iface,
                          int timeout,
-                         volatile int *const p_abort_wait) {
+                         volatile int* const p_abort_wait) {
   struct ifreq ifr;
   int rc;
 
@@ -299,7 +299,7 @@ EipStatus IfaceWaitForIp(const char *const iface,
       ipaddr = 0U;
 
       if (0 == (rc = ioctl(fd, SIOCGIFADDR, &ifr))) {
-        ipaddr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
+        ipaddr = ((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr.s_addr;
       } else {
         if (EADDRNOTAVAIL != errno) {
           return rc;
@@ -318,7 +318,7 @@ EipStatus IfaceWaitForIp(const char *const iface,
   return rc;
 }
 
-void GetHostName(CipString *hostname) {
+void GetHostName(CipString* hostname) {
   char name_buf[HOST_NAME_MAX];
 
   int rc                      = gethostname(name_buf, sizeof name_buf);

+ 1 - 1
source/src/ports/POSIX/networkhandler.c

@@ -41,7 +41,7 @@ EipStatus NetworkHandlerInitializePlatform(void) {
 void ShutdownSocketPlatform(int socket_handle) {
   if (0 != shutdown(socket_handle, SHUT_RDWR)) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR("Failed shutdown() socket %d - Error Code: %d - %s\n",
                      socket_handle,
                      error_code,

+ 3 - 3
source/src/ports/POSIX/opener_error.c

@@ -27,12 +27,12 @@ int GetSocketErrorNumber(void) {
   return errno;
 }
 
-char *GetErrorMessage(int error_number) {
-  char *error_message = malloc(kErrorMessageBufferSize);
+char* GetErrorMessage(int error_number) {
+  char* error_message = malloc(kErrorMessageBufferSize);
   strerror_r(error_number, error_message, kErrorMessageBufferSize);
   return error_message;
 }
 
-void FreeErrorMessage(char *error_message) {
+void FreeErrorMessage(char* error_message) {
   free(error_message);
 }

+ 6 - 6
source/src/ports/POSIX/sample_application/ethlinkcbs.c

@@ -55,8 +55,8 @@ static CipUdint media_calls[OPENER_ETHLINK_INSTANCE_CNT];
 #define MAKE_CNTR(inst, attr, idx, cnt) \
   ((10000000U * inst) + (100000U * attr) + (1000U * idx) + cnt)
 
-EipStatus EthLnkPreGetCallback(CipInstance *const instance,
-                               CipAttributeStruct *const attribute,
+EipStatus EthLnkPreGetCallback(CipInstance* const instance,
+                               CipAttributeStruct* const attribute,
                                CipByte service) {
   bool hadAction   = true;
   EipStatus status = kEipStatusOk;
@@ -67,7 +67,7 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
   unsigned idx           = inst_no - 1;
   switch (attr_no) {
     case 4: {
-      CipEthernetLinkInterfaceCounters *p_iface_cntrs =
+      CipEthernetLinkInterfaceCounters* p_iface_cntrs =
           &g_ethernet_link[idx].interface_cntrs;
 
       ++iface_calls[idx]; /* Count successful calls */
@@ -96,7 +96,7 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
       break;
     }
     case 5: {
-      CipEthernetLinkMediaCounters *p_media_cntrs =
+      CipEthernetLinkMediaCounters* p_media_cntrs =
           &g_ethernet_link[idx].media_cntrs;
 
       ++media_calls[idx]; /* Count successful calls */
@@ -148,8 +148,8 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
   return status;
 }
 
-EipStatus EthLnkPostGetCallback(CipInstance *const instance,
-                                CipAttributeStruct *const attribute,
+EipStatus EthLnkPostGetCallback(CipInstance* const instance,
+                                CipAttributeStruct* const attribute,
                                 CipByte service) {
   CipInstanceNum inst_no = instance->instance_number;
   EipStatus status       = kEipStatusOk;

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

@@ -23,12 +23,12 @@
 /*                             PROTOTYPES                                    */
 /*---------------------------------------------------------------------------*/
 
-EipStatus EthLnkPreGetCallback(CipInstance *const instance,
-                               CipAttributeStruct *const attribute,
+EipStatus EthLnkPreGetCallback(CipInstance* const instance,
+                               CipAttributeStruct* const attribute,
                                CipByte service);
 
-EipStatus EthLnkPostGetCallback(CipInstance *const instance,
-                                CipAttributeStruct *const attribute,
+EipStatus EthLnkPostGetCallback(CipInstance* const instance,
+                                CipAttributeStruct* const attribute,
                                 CipByte service);
 
 #endif /* #ifndef OPENER_ETHLINKCBS_H_ */

+ 7 - 7
source/src/ports/POSIX/sample_application/sampleapplication.c

@@ -96,13 +96,13 @@ EipStatus ApplicationInitialization(void) {
    *  the hardware counters after the current data have been transmitted.
    */
   {
-    CipClass *p_eth_link_class = GetCipClass(kCipEthernetLinkClassCode);
+    CipClass* p_eth_link_class = GetCipClass(kCipEthernetLinkClassCode);
     InsertGetSetCallback(p_eth_link_class, EthLnkPreGetCallback, kPreGetFunc);
     InsertGetSetCallback(p_eth_link_class, EthLnkPostGetCallback, kPostGetFunc);
     /* Specify the attributes for which the callback should be executed. */
     for (int idx = 0; idx < OPENER_ETHLINK_INSTANCE_CNT; ++idx) {
-      CipAttributeStruct *p_eth_link_attr;
-      CipInstance *p_eth_link_inst = GetCipInstance(p_eth_link_class, idx + 1);
+      CipAttributeStruct* p_eth_link_attr;
+      CipInstance* p_eth_link_inst = GetCipInstance(p_eth_link_class, idx + 1);
       OPENER_ASSERT(p_eth_link_inst);
 
       /* Interface counters attribute */
@@ -132,7 +132,7 @@ void CheckIoConnectionEvent(unsigned int output_assembly_id,
   (void)io_connection_event; /* suppress compiler warning */
 }
 
-EipStatus AfterAssemblyDataReceived(CipInstance *instance) {
+EipStatus AfterAssemblyDataReceived(CipInstance* instance) {
   EipStatus status = kEipStatusOk;
 
   /*handle the data received e.g., update outputs of the device */
@@ -164,7 +164,7 @@ EipStatus AfterAssemblyDataReceived(CipInstance *instance) {
   return status;
 }
 
-EipBool8 BeforeAssemblyDataSend(CipInstance *pa_pstInstance) {
+EipBool8 BeforeAssemblyDataSend(CipInstance* pa_pstInstance) {
   /*update data to be sent e.g., read inputs of the device */
   /*In this sample app we mirror the data from out to inputs on data receive
    * therefore we need nothing to do here. Just return true to inform that
@@ -194,11 +194,11 @@ EipStatus ResetDeviceToInitialConfiguration(void) {
   return kEipStatusOk;
 }
 
-void *CipCalloc(size_t number_of_elements, size_t size_of_element) {
+void* CipCalloc(size_t number_of_elements, size_t size_of_element) {
   return calloc(number_of_elements, size_of_element);
 }
 
-void CipFree(void *data) {
+void CipFree(void* data) {
   free(data);
 }
 

+ 7 - 7
source/src/ports/STM32/networkconfig.c

@@ -17,15 +17,15 @@
 #include "opener_api.h"
 #include "trace.h"
 
-EipStatus IfaceGetMacAddress(TcpIpInterface *iface,
-                             uint8_t *const physical_address) {
+EipStatus IfaceGetMacAddress(TcpIpInterface* iface,
+                             uint8_t* const physical_address) {
   memcpy(physical_address, iface->hwaddr, NETIF_MAX_HWADDR_LEN);
 
   return kEipStatusOk;
 }
 
 static EipStatus GetIpAndNetmaskFromInterface(
-    TcpIpInterface *iface, CipTcpIpInterfaceConfiguration *iface_cfg) {
+    TcpIpInterface* iface, CipTcpIpInterfaceConfiguration* iface_cfg) {
   iface_cfg->ip_address   = iface->ip_addr.addr;
   iface_cfg->network_mask = iface->netmask.addr;
 
@@ -33,14 +33,14 @@ static EipStatus GetIpAndNetmaskFromInterface(
 }
 
 static EipStatus GetGatewayFromRoute(
-    TcpIpInterface *iface, CipTcpIpInterfaceConfiguration *iface_cfg) {
+    TcpIpInterface* iface, CipTcpIpInterfaceConfiguration* iface_cfg) {
   iface_cfg->gateway = iface->gw.addr;
 
   return kEipStatusOk;
 }
 
-EipStatus IfaceGetConfiguration(TcpIpInterface *iface,
-                                CipTcpIpInterfaceConfiguration *iface_cfg) {
+EipStatus IfaceGetConfiguration(TcpIpInterface* iface,
+                                CipTcpIpInterfaceConfiguration* iface_cfg) {
   CipTcpIpInterfaceConfiguration local_cfg;
   EipStatus status;
 
@@ -59,6 +59,6 @@ EipStatus IfaceGetConfiguration(TcpIpInterface *iface,
   return status;
 }
 
-void GetHostName(TcpIpInterface *iface, CipString *hostname) {
+void GetHostName(TcpIpInterface* iface, CipString* hostname) {
   SetCipStringByCstr(hostname, netif_get_hostname(iface));
 }

+ 1 - 1
source/src/ports/STM32/networkhandler.c

@@ -23,7 +23,7 @@ EipStatus NetworkHandlerInitializePlatform(void) {
 void ShutdownSocketPlatform(int socket_handle) {
   if (0 != shutdown(socket_handle, SHUT_RDWR)) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR("Failed shutdown() socket %d - Error Code: %d - %s\n",
                      socket_handle,
                      error_code,

+ 4 - 4
source/src/ports/STM32/opener.c

@@ -15,7 +15,7 @@
 #define OPENER_THREAD_PRIO osPriorityAboveNormal
 #define OPENER_STACK_SIZE 2000
 
-static void opener_thread(void const *argument);
+static void opener_thread(void const* argument);
 osThreadId opener_ThreadId;
 volatile int g_end_stack = 0;
 
@@ -25,7 +25,7 @@ volatile int g_end_stack = 0;
  * @param   netif      address specifying the network interface
  * @retval  None
  */
-void opener_init(struct netif *netif) {
+void opener_init(struct netif* netif) {
   EipStatus eip_status = 0;
 
   if (IfaceLinkIsUp(netif)) {
@@ -78,8 +78,8 @@ void opener_init(struct netif *netif) {
   }
 }
 
-static void opener_thread(void const *argument) {
-  struct netif *netif = (struct netif *)argument;
+static void opener_thread(void const* argument) {
+  struct netif* netif = (struct netif*)argument;
   /* The event loop. Put other processing you need done continually in here */
   while (!g_end_stack) {
     if (kEipStatusOk != NetworkHandlerProcessCyclic()) {

+ 1 - 1
source/src/ports/STM32/opener.h

@@ -9,4 +9,4 @@
  * @param  none
  * @retval None
  */
-void opener_init(struct netif *netif);
+void opener_init(struct netif* netif);

+ 3 - 3
source/src/ports/STM32/opener_error.c

@@ -27,12 +27,12 @@ int GetSocketErrorNumber(void) {
   return errno;
 }
 
-char *GetErrorMessage(int error_number) {
-  char *error_message = malloc(kErrorMessageBufferSize);
+char* GetErrorMessage(int error_number) {
+  char* error_message = malloc(kErrorMessageBufferSize);
   strerror_r(error_number, error_message, kErrorMessageBufferSize);
   return error_message;
 }
 
-void FreeErrorMessage(char *error_message) {
+void FreeErrorMessage(char* error_message) {
   free(error_message);
 }

+ 6 - 6
source/src/ports/STM32/sample_application/ethlinkcbs.c

@@ -55,8 +55,8 @@ static CipUdint media_calls[OPENER_ETHLINK_INSTANCE_CNT];
 #define MAKE_CNTR(inst, attr, idx, cnt) \
   ((10000000U * inst) + (100000U * attr) + (1000U * idx) + cnt)
 
-EipStatus EthLnkPreGetCallback(CipInstance *const instance,
-                               CipAttributeStruct *const attribute,
+EipStatus EthLnkPreGetCallback(CipInstance* const instance,
+                               CipAttributeStruct* const attribute,
                                CipByte service) {
   bool hadAction   = true;
   EipStatus status = kEipStatusOk;
@@ -67,7 +67,7 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
   unsigned idx     = inst_no - 1;
   switch (attr_no) {
     case 4: {
-      CipEthernetLinkInterfaceCounters *p_iface_cntrs =
+      CipEthernetLinkInterfaceCounters* p_iface_cntrs =
           &g_ethernet_link[idx].interface_cntrs;
 
       ++iface_calls[idx]; /* Count successful calls */
@@ -96,7 +96,7 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
       break;
     }
     case 5: {
-      CipEthernetLinkMediaCounters *p_media_cntrs =
+      CipEthernetLinkMediaCounters* p_media_cntrs =
           &g_ethernet_link[idx].media_cntrs;
 
       ++media_calls[idx]; /* Count successful calls */
@@ -148,8 +148,8 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
   return status;
 }
 
-EipStatus EthLnkPostGetCallback(CipInstance *const instance,
-                                CipAttributeStruct *const attribute,
+EipStatus EthLnkPostGetCallback(CipInstance* const instance,
+                                CipAttributeStruct* const attribute,
                                 CipByte service) {
   CipUdint inst_no = instance->instance_number;
   EipStatus status = kEipStatusOk;

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

@@ -23,12 +23,12 @@
 /*                             PROTOTYPES                                    */
 /*---------------------------------------------------------------------------*/
 
-EipStatus EthLnkPreGetCallback(CipInstance *const instance,
-                               CipAttributeStruct *const attribute,
+EipStatus EthLnkPreGetCallback(CipInstance* const instance,
+                               CipAttributeStruct* const attribute,
                                CipByte service);
 
-EipStatus EthLnkPostGetCallback(CipInstance *const instance,
-                                CipAttributeStruct *const attribute,
+EipStatus EthLnkPostGetCallback(CipInstance* const instance,
+                                CipAttributeStruct* const attribute,
                                 CipByte service);
 
 #endif /* #ifndef OPENER_ETHLINKCBS_H_ */

+ 7 - 7
source/src/ports/STM32/sample_application/sampleapplication.c

@@ -82,13 +82,13 @@ EipStatus ApplicationInitialization(void) {
    *  the hardware counters after the current data have been transmitted.
    */
   {
-    CipClass *p_eth_link_class = GetCipClass(kCipEthernetLinkClassCode);
+    CipClass* p_eth_link_class = GetCipClass(kCipEthernetLinkClassCode);
     InsertGetSetCallback(p_eth_link_class, EthLnkPreGetCallback, kPreGetFunc);
     InsertGetSetCallback(p_eth_link_class, EthLnkPostGetCallback, kPostGetFunc);
     /* Specify the attributes for which the callback should be executed. */
     for (int idx = 0; idx < OPENER_ETHLINK_INSTANCE_CNT; ++idx) {
-      CipAttributeStruct *p_eth_link_attr;
-      CipInstance *p_eth_link_inst = GetCipInstance(p_eth_link_class, idx + 1);
+      CipAttributeStruct* p_eth_link_attr;
+      CipInstance* p_eth_link_inst = GetCipInstance(p_eth_link_class, idx + 1);
       OPENER_ASSERT(p_eth_link_inst);
 
       /* Interface counters attribute */
@@ -118,7 +118,7 @@ void CheckIoConnectionEvent(unsigned int output_assembly_id,
   (void)io_connection_event; /* suppress compiler warning */
 }
 
-EipStatus AfterAssemblyDataReceived(CipInstance *instance) {
+EipStatus AfterAssemblyDataReceived(CipInstance* instance) {
   EipStatus status = kEipStatusOk;
 
   /*handle the data received e.g., update outputs of the device */
@@ -150,7 +150,7 @@ EipStatus AfterAssemblyDataReceived(CipInstance *instance) {
   return status;
 }
 
-EipBool8 BeforeAssemblyDataSend(CipInstance *pa_pstInstance) {
+EipBool8 BeforeAssemblyDataSend(CipInstance* pa_pstInstance) {
   /*update data to be sent e.g., read inputs of the device */
   /*In this sample app we mirror the data from out to inputs on data receive
    * therefore we need nothing to do here. Just return true to inform that
@@ -180,11 +180,11 @@ EipStatus ResetDeviceToInitialConfiguration(void) {
   return kEipStatusOk;
 }
 
-void *CipCalloc(size_t number_of_elements, size_t size_of_element) {
+void* CipCalloc(size_t number_of_elements, size_t size_of_element) {
   return calloc(number_of_elements, size_of_element);
 }
 
-void CipFree(void *data) {
+void CipFree(void* data) {
   free(data);
 }
 

+ 1 - 1
source/src/ports/WIN32/main.c

@@ -49,7 +49,7 @@ static DWORD executeEventLoop(LPVOID thread_arg);
 volatile int g_end_stack = 0;
 
 /******************************************************************************/
-int main(int argc, char *arg[]) {
+int main(int argc, char* arg[]) {
   if (argc != 2) {
     fprintf(stderr, "Wrong number of command line parameters!\n");
     fprintf(stderr, "Usage: %s [interface index | interface name]\n", arg[0]);

+ 24 - 24
source/src/ports/WIN32/networkconfig.c

@@ -45,9 +45,9 @@
  *  string if possible. On conversion success @p errno is set to zero.
  *  On failure @p errno is set to ERANGE or EINVAL.
  */
-static ULONG StrToIfaceIdx(const char *iface) {
+static ULONG StrToIfaceIdx(const char* iface) {
   ULONG iface_idx;
-  char *end;
+  char* end;
   /* The input string is a decimal interface index number or an
    *  interface name. */
   errno     = 0; /* To distinguish success / failure later */
@@ -76,9 +76,9 @@ static ULONG StrToIfaceIdx(const char *iface) {
  * The LUID can then be used to retrieve the interface index needed for the
  *  other functions by calling ConvertInterfaceLuidToIndex().
  */
-static DWORD ConvertToIndexFromFakeAlias(const char *iface,
+static DWORD ConvertToIndexFromFakeAlias(const char* iface,
                                          PNET_IFINDEX iface_idx) {
-  WCHAR *p_if_alias;
+  WCHAR* p_if_alias;
   NET_LUID if_luid;
 
   size_t mbtowc_rc = mbstowcs(NULL, iface, 0);
@@ -117,7 +117,7 @@ static DWORD ConvertToIndexFromFakeAlias(const char *iface,
  *  alias name. This function then in turn calls ConvertToIndexFromFakeAlias()
  *  to find an interface matching that alias.
  */
-static EipStatus DetermineIfaceIndexByString(const char *iface,
+static EipStatus DetermineIfaceIndexByString(const char* iface,
                                              PNET_IFINDEX iface_idx) {
   *iface_idx = StrToIfaceIdx(iface);
 
@@ -125,7 +125,7 @@ static EipStatus DetermineIfaceIndexByString(const char *iface,
   if (!arg_is_numerical) {
     DWORD cnv_status = ConvertToIndexFromFakeAlias(iface, iface_idx);
     if (NO_ERROR != cnv_status) {
-      char *error_message = GetErrorMessage(cnv_status);
+      char* error_message = GetErrorMessage(cnv_status);
       OPENER_TRACE_ERR("ConvertToIndexFromFakeAlias() failed: %" PRIDW
                        " - %s\n",
                        cnv_status,
@@ -152,7 +152,7 @@ static EipStatus DetermineIfaceIndexByString(const char *iface,
  *  result.
  */
 EipStatus RetrieveAdapterAddressesTable(ULONG flags,
-                                        PIP_ADAPTER_ADDRESSES *pp_addr_table) {
+                                        PIP_ADAPTER_ADDRESSES* pp_addr_table) {
   PIP_ADAPTER_ADDRESSES p_addr_table;
   ULONG ret_val;
   /* Start allocating with a guessed minimum size. */
@@ -178,7 +178,7 @@ EipStatus RetrieveAdapterAddressesTable(ULONG flags,
       FREE(p_addr_table);
       p_addr_table = NULL;
     }
-    char *error_message = GetErrorMessage(ret_val);
+    char* error_message = GetErrorMessage(ret_val);
     OPENER_TRACE_ERR("GetAdaptersAddresses() failed: %" PRIUL " - %s\n",
                      ret_val,
                      error_message);
@@ -199,8 +199,8 @@ EipStatus RetrieveAdapterAddressesTable(ULONG flags,
  *         kEipStatusError if a memory allocation error occurred or
  *         the source string was too large.
  */
-static DWORD WideToCipString(const WCHAR *const src, CipString *const dest) {
-  void *buf = NULL;
+static DWORD WideToCipString(const WCHAR* const src, CipString* const dest) {
+  void* buf = NULL;
 
   OPENER_ASSERT(src != NULL);
   OPENER_ASSERT(dest != NULL);
@@ -249,16 +249,16 @@ static DWORD WideToCipString(const WCHAR *const src, CipString *const dest) {
  *  @param  socket_address  pointer to a Windows SOCKET_ADDRESS structure
  *  @return                 IPv4 address taken from @p socket_address
  */
-static CipUdint GetIpFromSocketAddress(const SOCKET_ADDRESS *socket_address) {
-  SOCKADDR_IN *sin = ((SOCKADDR_IN *)socket_address->lpSockaddr);
+static CipUdint GetIpFromSocketAddress(const SOCKET_ADDRESS* socket_address) {
+  SOCKADDR_IN* sin = ((SOCKADDR_IN*)socket_address->lpSockaddr);
   return sin->sin_addr.S_un.S_addr;
 }
 
 /* ---------- Public functions implementation ---------- */
 
 /* For Doxygen descriptions see opener_api.h. */
-EipStatus IfaceGetMacAddress(const char *iface,
-                             uint8_t *const physical_address) {
+EipStatus IfaceGetMacAddress(const char* iface,
+                             uint8_t* const physical_address) {
   ULONG iface_idx;
 
   if (kEipStatusOk != DetermineIfaceIndexByString(iface, &iface_idx)) {
@@ -302,8 +302,8 @@ EipStatus IfaceGetMacAddress(const char *iface,
 }
 
 /* For Doxygen descriptions see opener_api.h. */
-EipStatus IfaceGetConfiguration(const char *iface,
-                                CipTcpIpInterfaceConfiguration *iface_cfg) {
+EipStatus IfaceGetConfiguration(const char* iface,
+                                CipTcpIpInterfaceConfiguration* iface_cfg) {
   ULONG iface_idx;
 
   if (kEipStatusOk != DetermineIfaceIndexByString(iface, &iface_idx)) {
@@ -355,7 +355,7 @@ EipStatus IfaceGetConfiguration(const char *iface,
         }
       }
       {
-        IP_ADAPTER_DNS_SERVER_ADDRESS *pDnServer =
+        IP_ADAPTER_DNS_SERVER_ADDRESS* pDnServer =
             p_addr_entry->FirstDnsServerAddress;
         if (NULL != pDnServer) {
           local_cfg.name_server = GetIpFromSocketAddress(&pDnServer->Address);
@@ -369,7 +369,7 @@ EipStatus IfaceGetConfiguration(const char *iface,
       DWORD ret_val =
           WideToCipString(p_addr_entry->DnsSuffix, &local_cfg.domain_name);
       if (NO_ERROR != ret_val) {
-        char *error_message = GetErrorMessage(ret_val);
+        char* error_message = GetErrorMessage(ret_val);
         OPENER_TRACE_ERR("WideToCipString(DnsSuffix) failed with error: %" PRIDW
                          " - %s\n",
                          ret_val,
@@ -396,9 +396,9 @@ EipStatus IfaceGetConfiguration(const char *iface,
 }
 
 /* For Doxygen descriptions see opener_api.h. */
-EipStatus IfaceWaitForIp(const char *const iface,
+EipStatus IfaceWaitForIp(const char* const iface,
                          int timeout,
-                         volatile int *const abort_wait) {
+                         volatile int* const abort_wait) {
   ULONG iface_idx;
 
   if (kEipStatusOk != DetermineIfaceIndexByString(iface, &iface_idx)) {
@@ -433,7 +433,7 @@ EipStatus IfaceWaitForIp(const char *const iface,
         }
       } while (ERROR_INSUFFICIENT_BUFFER == dw_ret);
       if (NO_ERROR != dw_ret) {
-        char *error_message = GetErrorMessage(dw_ret);
+        char* error_message = GetErrorMessage(dw_ret);
         OPENER_TRACE_ERR("%s() failed with error: %" PRIDW " - %s\n",
                          __func__,
                          dw_ret,
@@ -469,7 +469,7 @@ EipStatus IfaceWaitForIp(const char *const iface,
 }
 
 #define HOST_NAME_MAX 256 /* Should be long enough according rfc1132. */
-void GetHostName(CipString *hostname) {
+void GetHostName(CipString* hostname) {
   CipWord wVersionRequested;
   WSADATA wsaData;
   int err;
@@ -480,7 +480,7 @@ void GetHostName(CipString *hostname) {
   err = WSAStartup(wVersionRequested, &wsaData);
   if (err != 0) {
     /* Tell the user that we could not find a usable Winsock DLL.  */
-    char *error_message = GetErrorMessage(err);
+    char* error_message = GetErrorMessage(err);
     printf("WSAStartup failed with error: %d - %s\n", err, error_message);
     FreeErrorMessage(error_message);
     return;
@@ -490,7 +490,7 @@ void GetHostName(CipString *hostname) {
   err                          = gethostname(name_buf, sizeof(name_buf));
   if (0 != err) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     printf("gethostname() failed, %d - %s\n", error_code, error_message);
     FreeErrorMessage(error_message);
     return;

+ 3 - 3
source/src/ports/WIN32/opener_error.c

@@ -19,8 +19,8 @@ int GetSocketErrorNumber(void) {
   return WSAGetLastError();
 }
 
-char *GetErrorMessage(int error_number) {
-  char *error_message = NULL;
+char* GetErrorMessage(int error_number) {
+  char* error_message = NULL;
   FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
                      FORMAT_MESSAGE_IGNORE_INSERTS,
                  NULL,
@@ -32,6 +32,6 @@ char *GetErrorMessage(int error_number) {
   return error_message;
 }
 
-void FreeErrorMessage(char *error_message) {
+void FreeErrorMessage(char* error_message) {
   LocalFree(error_message);
 }

+ 1 - 1
source/src/ports/WIN32/platform_network_includes.h

@@ -5,4 +5,4 @@
  ******************************************************************************/
 
 #include <winsock2.h>
-#include <ws2tcpip.h>
+#include <ws2tcpip.h>

+ 6 - 6
source/src/ports/WIN32/sample_application/ethlinkcbs.c

@@ -55,8 +55,8 @@ static CipUdint media_calls[OPENER_ETHLINK_INSTANCE_CNT];
 #define MAKE_CNTR(inst, attr, idx, cnt) \
   ((10000000U * inst) + (100000U * attr) + (1000U * idx) + cnt)
 
-EipStatus EthLnkPreGetCallback(CipInstance *const instance,
-                               CipAttributeStruct *const attribute,
+EipStatus EthLnkPreGetCallback(CipInstance* const instance,
+                               CipAttributeStruct* const attribute,
                                CipByte service) {
   bool hadAction   = true;
   EipStatus status = kEipStatusOk;
@@ -67,7 +67,7 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
   unsigned idx           = inst_no - 1;
   switch (attr_no) {
     case 4: {
-      CipEthernetLinkInterfaceCounters *p_iface_cntrs =
+      CipEthernetLinkInterfaceCounters* p_iface_cntrs =
           &g_ethernet_link[idx].interface_cntrs;
 
       ++iface_calls[idx]; /* Count successful calls */
@@ -96,7 +96,7 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
       break;
     }
     case 5: {
-      CipEthernetLinkMediaCounters *p_media_cntrs =
+      CipEthernetLinkMediaCounters* p_media_cntrs =
           &g_ethernet_link[idx].media_cntrs;
 
       ++media_calls[idx]; /* Count successful calls */
@@ -148,8 +148,8 @@ EipStatus EthLnkPreGetCallback(CipInstance *const instance,
   return status;
 }
 
-EipStatus EthLnkPostGetCallback(CipInstance *const instance,
-                                CipAttributeStruct *const attribute,
+EipStatus EthLnkPostGetCallback(CipInstance* const instance,
+                                CipAttributeStruct* const attribute,
                                 CipByte service) {
   CipInstanceNum inst_no = instance->instance_number;
   EipStatus status       = kEipStatusOk;

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

@@ -23,12 +23,12 @@
 /*                             PROTOTYPES                                    */
 /*---------------------------------------------------------------------------*/
 
-EipStatus EthLnkPreGetCallback(CipInstance *const instance,
-                               CipAttributeStruct *const attribute,
+EipStatus EthLnkPreGetCallback(CipInstance* const instance,
+                               CipAttributeStruct* const attribute,
                                CipByte service);
 
-EipStatus EthLnkPostGetCallback(CipInstance *const instance,
-                                CipAttributeStruct *const attribute,
+EipStatus EthLnkPostGetCallback(CipInstance* const instance,
+                                CipAttributeStruct* const attribute,
                                 CipByte service);
 
 #endif /* #ifndef OPENER_ETHLINKCBS_H_ */

+ 7 - 7
source/src/ports/WIN32/sample_application/sampleapplication.c

@@ -93,13 +93,13 @@ EipStatus ApplicationInitialization(void) {
    *  the hardware counters after the current data have been transmitted.
    */
   {
-    CipClass *p_eth_link_class = GetCipClass(kCipEthernetLinkClassCode);
+    CipClass* p_eth_link_class = GetCipClass(kCipEthernetLinkClassCode);
     InsertGetSetCallback(p_eth_link_class, EthLnkPreGetCallback, kPreGetFunc);
     InsertGetSetCallback(p_eth_link_class, EthLnkPostGetCallback, kPostGetFunc);
     /* Specify the attributes for which the callback should be executed. */
     for (int idx = 0; idx < OPENER_ETHLINK_INSTANCE_CNT; ++idx) {
-      CipAttributeStruct *p_eth_link_attr;
-      CipInstance *p_eth_link_inst = GetCipInstance(p_eth_link_class, idx + 1);
+      CipAttributeStruct* p_eth_link_attr;
+      CipInstance* p_eth_link_inst = GetCipInstance(p_eth_link_class, idx + 1);
       OPENER_ASSERT(p_eth_link_inst);
 
       /* Interface counters attribute */
@@ -129,7 +129,7 @@ void CheckIoConnectionEvent(unsigned int pa_unOutputAssembly,
   (void)pa_eIOConnectionEvent; /* suppress compiler warning */
 }
 
-EipStatus AfterAssemblyDataReceived(CipInstance *pa_pstInstance) {
+EipStatus AfterAssemblyDataReceived(CipInstance* pa_pstInstance) {
   EipStatus nRetVal = kEipStatusOk;
 
   /*handle the data received e.g., update outputs of the device */
@@ -157,7 +157,7 @@ EipStatus AfterAssemblyDataReceived(CipInstance *pa_pstInstance) {
   return nRetVal;
 }
 
-EipBool8 BeforeAssemblyDataSend(CipInstance *pa_pstInstance) {
+EipBool8 BeforeAssemblyDataSend(CipInstance* pa_pstInstance) {
   /*update data to be sent e.g., read inputs of the device */
   /*In this sample app we mirror the data from out to inputs on data receive
    * therefore we need nothing to do here. Just return true to inform that
@@ -187,11 +187,11 @@ EipStatus ResetDeviceToInitialConfiguration(void) {
   return kEipStatusOk;
 }
 
-void *CipCalloc(size_t pa_nNumberOfElements, size_t pa_nSizeOfElement) {
+void* CipCalloc(size_t pa_nNumberOfElements, size_t pa_nSizeOfElement) {
   return calloc(pa_nNumberOfElements, pa_nSizeOfElement);
 }
 
-void CipFree(void *pa_poData) {
+void CipFree(void* pa_poData) {
   free(pa_poData);
 }
 

+ 3 - 3
source/src/ports/devicedata.h.in

@@ -3,10 +3,10 @@
  * All rights reserved.
  *
  ******************************************************************************/
- 
+
 #ifndef DEVICE_DATA_H_
 #define DEVICE_DATA_H_
- 
+
 #define OPENER_DEVICE_VENDOR_ID      (@OpENer_Device_Config_Vendor_Id@)
 #define OPENER_DEVICE_TYPE           (@OpENer_Device_Config_Device_Type@)
 #define OPENER_DEVICE_PRODUCT_CODE   (@OpENer_Device_Config_Product_Code@)
@@ -14,4 +14,4 @@
 #define OPENER_DEVICE_MINOR_REVISION (@OpENer_Device_Minor_Version@)
 #define OPENER_DEVICE_NAME           ("@OpENer_Device_Config_Device_Name@")
 
-#endif /* DEVICE_DATA_H_ */
+#endif /* DEVICE_DATA_H_ */

+ 64 - 64
source/src/ports/generic_networkhandler.c

@@ -46,7 +46,7 @@
 #if defined(_WIN32)
 /* Most network functions take their I/O buffers as (char *) pointers that
  *  triggers a warning with our CipOctet (aka unsigned char) buffers. */
-#define NWBUF_CAST (void *)
+#define NWBUF_CAST (void*)
 #else
 #define NWBUF_CAST
 #endif
@@ -151,7 +151,7 @@ EipStatus NetworkHandlerInitialize(void) {
   if ((g_network_status.tcp_listener =
            socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler tcp_listener: error allocating socket, %d - %s\n",
         error_code,
@@ -166,7 +166,7 @@ EipStatus NetworkHandlerInitialize(void) {
   if (setsockopt(g_network_status.tcp_listener,
                  SOL_SOCKET,
                  SO_REUSEADDR,
-                 (char *)&set_socket_option_value,
+                 (char*)&set_socket_option_value,
                  sizeof(set_socket_option_value)) == -1) {
     OPENER_TRACE_ERR(
         "networkhandler tcp_listener: error setting socket option "
@@ -185,7 +185,7 @@ EipStatus NetworkHandlerInitialize(void) {
   if ((g_network_status.udp_global_broadcast_listener =
            socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == kEipInvalidSocket) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler udp_global_broadcast_listener: error allocating "
         "socket, %d - %s\n",
@@ -199,7 +199,7 @@ EipStatus NetworkHandlerInitialize(void) {
   if ((g_network_status.udp_unicast_listener =
            socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == kEipInvalidSocket) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler udp_unicast_listener: error allocating socket, %d - "
         "%s\n",
@@ -214,7 +214,7 @@ EipStatus NetworkHandlerInitialize(void) {
   if (setsockopt(g_network_status.udp_global_broadcast_listener,
                  SOL_SOCKET,
                  SO_REUSEADDR,
-                 (char *)&set_socket_option_value,
+                 (char*)&set_socket_option_value,
                  sizeof(set_socket_option_value)) == -1) {
     OPENER_TRACE_ERR(
         "networkhandler udp_global_broadcast_listener: error setting socket "
@@ -235,7 +235,7 @@ EipStatus NetworkHandlerInitialize(void) {
   if (setsockopt(g_network_status.udp_unicast_listener,
                  SOL_SOCKET,
                  SO_REUSEADDR,
-                 (char *)&set_socket_option_value,
+                 (char*)&set_socket_option_value,
                  sizeof(set_socket_option_value)) == -1) {
     OPENER_TRACE_ERR(
         "networkhandler udp_unicast_listener: error setting socket option "
@@ -257,10 +257,10 @@ EipStatus NetworkHandlerInitialize(void) {
 
   /* bind the new socket to port 0xAF12 (CIP) */
   if ((bind(g_network_status.tcp_listener,
-            (struct sockaddr *)&my_address,
+            (struct sockaddr*)&my_address,
             sizeof(struct sockaddr))) == -1) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler tcp_listener: error with TCP bind: %d - %s\n",
         error_code,
@@ -270,10 +270,10 @@ EipStatus NetworkHandlerInitialize(void) {
   }
 
   if ((bind(g_network_status.udp_unicast_listener,
-            (struct sockaddr *)&my_address,
+            (struct sockaddr*)&my_address,
             sizeof(struct sockaddr))) == -1) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler udp_unicast_listener: error with UDP bind: %d - %s\n",
         error_code,
@@ -287,7 +287,7 @@ EipStatus NetworkHandlerInitialize(void) {
           g_network_status.udp_unicast_listener,
           CipQosGetDscpPriority(kConnectionObjectPriorityExplicit)) != 0) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler udp_unicast_listener: error set QoS %d: %d - %s\n",
         g_network_status.udp_unicast_listener,
@@ -307,10 +307,10 @@ EipStatus NetworkHandlerInitialize(void) {
   if (0 > setsockopt(g_network_status.udp_global_broadcast_listener,
                      SOL_SOCKET,
                      SO_BROADCAST,
-                     (char *)&set_socket_option_value,
+                     (char*)&set_socket_option_value,
                      sizeof(int))) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler udp_global_broadcast_listener: error with setting "
         "broadcast receive: %d - %s\n",
@@ -321,10 +321,10 @@ EipStatus NetworkHandlerInitialize(void) {
   }
 
   if ((bind(g_network_status.udp_global_broadcast_listener,
-            (struct sockaddr *)&global_broadcast_address,
+            (struct sockaddr*)&global_broadcast_address,
             sizeof(struct sockaddr))) == -1) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler udp_global_broadcast_listener: error with UDP bind: %d "
         "- %s\n",
@@ -339,7 +339,7 @@ EipStatus NetworkHandlerInitialize(void) {
           g_network_status.udp_global_broadcast_listener,
           CipQosGetDscpPriority(kConnectionObjectPriorityExplicit)) != 0) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler udp_global_broadcast_listener: error set QoS %d: %d - "
         "%s\n",
@@ -357,7 +357,7 @@ EipStatus NetworkHandlerInitialize(void) {
           g_network_status.tcp_listener,
           CipQosGetDscpPriority(kConnectionObjectPriorityExplicit)) != 0) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR("networkhandler tcp_listener: error set QoS %d: %d - %s\n",
                      g_network_status.tcp_listener,
                      error_code,
@@ -369,7 +369,7 @@ EipStatus NetworkHandlerInitialize(void) {
   /* switch socket in listen mode */
   if ((listen(g_network_status.tcp_listener, MAX_NO_OF_TCP_SOCKETS)) == -1) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler tcp_listener: error with listen: %d - %s\n",
         error_code,
@@ -409,7 +409,7 @@ void CloseTcpSocket(int socket_handle) {
 }
 
 void RemoveSocketTimerFromList(const int socket_handle) {
-  SocketTimer *socket_timer = NULL;
+  SocketTimer* socket_timer = NULL;
   while (
       NULL !=
       (socket_timer = SocketTimerArrayGetSocketTimer(
@@ -441,7 +441,7 @@ void CheckAndHandleTcpListenerSocket(void) {
     new_socket = accept(g_network_status.tcp_listener, NULL, NULL);
     if (new_socket == kEipInvalidSocket) {
       int error_code      = GetSocketErrorNumber();
-      char *error_message = GetErrorMessage(error_code);
+      char* error_message = GetErrorMessage(error_code);
       OPENER_TRACE_ERR("networkhandler: error on accept: %d - %s\n",
                        error_code,
                        error_message);
@@ -451,7 +451,7 @@ void CheckAndHandleTcpListenerSocket(void) {
     OPENER_TRACE_INFO(">>> network handler: accepting new TCP socket: %d \n",
                       new_socket);
 
-    SocketTimer *socket_timer = SocketTimerArrayGetEmptySocketTimer(
+    SocketTimer* socket_timer = SocketTimerArrayGetEmptySocketTimer(
         g_timestamps, OPENER_NUMBER_OF_SUPPORTED_SESSIONS);
 
     //    OPENER_TRACE_INFO("Current time stamp: %ld\n", g_actual_time);
@@ -495,7 +495,7 @@ EipStatus NetworkHandlerProcessCyclic(void) {
       return kEipStatusOk;
     } else {
       int error_code      = GetSocketErrorNumber();
-      char *error_message = GetErrorMessage(error_code);
+      char* error_message = GetErrorMessage(error_code);
       OPENER_TRACE_ERR("networkhandler: error with select: %d - %s\n",
                        error_code,
                        error_message);
@@ -578,12 +578,12 @@ void CheckAndHandleUdpGlobalBroadcastSocket(void) {
                                  NWBUF_CAST incoming_message,
                                  sizeof(incoming_message),
                                  0,
-                                 (struct sockaddr *)&from_address,
+                                 (struct sockaddr*)&from_address,
                                  &from_address_length);
 
     if (received_size <= 0) { /* got error */
       int error_code      = GetSocketErrorNumber();
-      char *error_message = GetErrorMessage(error_code);
+      char* error_message = GetErrorMessage(error_code);
       OPENER_TRACE_ERR(
           "networkhandler: error on recvfrom UDP global broadcast port: %d - "
           "%s\n",
@@ -595,7 +595,7 @@ void CheckAndHandleUdpGlobalBroadcastSocket(void) {
 
     OPENER_TRACE_INFO("Data received on global broadcast UDP:\n");
 
-    const EipUint8 *receive_buffer = &incoming_message[0];
+    const EipUint8* receive_buffer = &incoming_message[0];
     int remaining_bytes            = 0;
     ENIPMessage outgoing_message;
     InitializeENIPMessage(&outgoing_message);
@@ -622,10 +622,10 @@ void CheckAndHandleUdpGlobalBroadcastSocket(void) {
                      .udp_unicast_listener, /* sending from unicast port, due to
                                                strange behavior of the broadcast
                                                port */
-                 (char *)outgoing_message.message_buffer,
+                 (char*)outgoing_message.message_buffer,
                  outgoing_message.used_message_length,
                  0,
-                 (struct sockaddr *)&from_address,
+                 (struct sockaddr*)&from_address,
                  sizeof(from_address)) !=
           outgoing_message.used_message_length) {
         OPENER_TRACE_INFO("networkhandler: UDP response was not fully sent\n");
@@ -653,12 +653,12 @@ void CheckAndHandleUdpUnicastSocket(void) {
                                  NWBUF_CAST incoming_message,
                                  sizeof(incoming_message),
                                  0,
-                                 (struct sockaddr *)&from_address,
+                                 (struct sockaddr*)&from_address,
                                  &from_address_length);
 
     if (received_size <= 0) { /* got error */
       int error_code      = GetSocketErrorNumber();
-      char *error_message = GetErrorMessage(error_code);
+      char* error_message = GetErrorMessage(error_code);
       OPENER_TRACE_ERR(
           "networkhandler: error on recvfrom UDP unicast port: %d - %s\n",
           error_code,
@@ -669,7 +669,7 @@ void CheckAndHandleUdpUnicastSocket(void) {
 
     OPENER_TRACE_INFO("Data received on UDP unicast:\n");
 
-    EipUint8 *receive_buffer = &incoming_message[0];
+    EipUint8* receive_buffer = &incoming_message[0];
     int remaining_bytes      = 0;
     ENIPMessage outgoing_message;
     InitializeENIPMessage(&outgoing_message);
@@ -691,10 +691,10 @@ void CheckAndHandleUdpUnicastSocket(void) {
       /* if the active socket matches a registered UDP callback, handle a UDP
        * packet */
       if (sendto(g_network_status.udp_unicast_listener,
-                 (char *)outgoing_message.message_buffer,
+                 (char*)outgoing_message.message_buffer,
                  outgoing_message.used_message_length,
                  0,
-                 (struct sockaddr *)&from_address,
+                 (struct sockaddr*)&from_address,
                  sizeof(from_address)) !=
           outgoing_message.used_message_length) {
         OPENER_TRACE_INFO(
@@ -708,8 +708,8 @@ void CheckAndHandleUdpUnicastSocket(void) {
   }
 }
 
-EipStatus SendUdpData(const struct sockaddr_in *const address,
-                      const ENIPMessage *const outgoing_message) {
+EipStatus SendUdpData(const struct sockaddr_in* const address,
+                      const ENIPMessage* const outgoing_message) {
 #if defined(OPENER_TRACE_ENABLED)
   static char ip_str[INET_ADDRSTRLEN];
   OPENER_TRACE_INFO(
@@ -719,14 +719,14 @@ EipStatus SendUdpData(const struct sockaddr_in *const address,
 #endif
 
   int sent_length = sendto(g_network_status.udp_io_messaging,
-                           (char *)outgoing_message->message_buffer,
+                           (char*)outgoing_message->message_buffer,
                            outgoing_message->used_message_length,
                            0,
-                           (struct sockaddr *)address,
+                           (struct sockaddr*)address,
                            sizeof(*address));
   if (sent_length < 0) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler: error with sendto in SendUDPData: %d - %s\n",
         error_code,
@@ -768,7 +768,7 @@ EipStatus HandleDataOnTcpSocket(int socket) {
            4,
            0); /*TODO we may have to set the socket to a non blocking socket */
 
-  SocketTimer *const socket_timer = SocketTimerArrayGetSocketTimer(
+  SocketTimer* const socket_timer = SocketTimerArrayGetSocketTimer(
       g_timestamps, OPENER_NUMBER_OF_SUPPORTED_SESSIONS, socket);
   if (number_of_read_bytes == 0) {
     OPENER_TRACE_ERR(
@@ -782,14 +782,14 @@ EipStatus HandleDataOnTcpSocket(int socket) {
     if (OPENER_SOCKET_WOULD_BLOCK == error_code) {
       return kEipStatusOk;
     }
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler: error on recv: %d - %s\n", error_code, error_message);
     FreeErrorMessage(error_message);
     return kEipStatusError;
   }
 
-  const EipUint8 *read_buffer =
+  const EipUint8* read_buffer =
       &incoming_message[2]; /* at this place EIP stores the data length */
   size_t data_size = GetUintFromMessage(&read_buffer) +
                      ENCAPSULATION_HEADER_LENGTH -
@@ -812,7 +812,7 @@ EipStatus HandleDataOnTcpSocket(int socket) {
           0) /* got error or connection closed by client */
       {
         int error_code      = GetSocketErrorNumber();
-        char *error_message = GetErrorMessage(error_code);
+        char* error_message = GetErrorMessage(error_code);
         OPENER_TRACE_ERR(
             "networkhandler: socket: %d - connection closed by client: %d - "
             "%s\n",
@@ -825,7 +825,7 @@ EipStatus HandleDataOnTcpSocket(int socket) {
       }
       if (number_of_read_bytes < 0) {
         int error_code      = GetSocketErrorNumber();
-        char *error_message = GetErrorMessage(error_code);
+        char* error_message = GetErrorMessage(error_code);
         if (OPENER_SOCKET_WOULD_BLOCK == error_code) {
           return kEipStatusOk;
         }
@@ -850,7 +850,7 @@ EipStatus HandleDataOnTcpSocket(int socket) {
   if (0 == number_of_read_bytes) /* got error or connection closed by client */
   {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler: socket: %d - connection closed by client: %d - %s\n",
         socket,
@@ -863,7 +863,7 @@ EipStatus HandleDataOnTcpSocket(int socket) {
   }
   if (number_of_read_bytes < 0) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     if (OPENER_SOCKET_WOULD_BLOCK == error_code) {
       return kEipStatusOk;
     }
@@ -884,9 +884,9 @@ EipStatus HandleDataOnTcpSocket(int socket) {
     struct sockaddr sender_address;
     memset(&sender_address, 0, sizeof(sender_address));
     socklen_t fromlen = sizeof(sender_address);
-    if (getpeername(socket, (struct sockaddr *)&sender_address, &fromlen) < 0) {
+    if (getpeername(socket, (struct sockaddr*)&sender_address, &fromlen) < 0) {
       int error_code      = GetSocketErrorNumber();
-      char *error_message = GetErrorMessage(error_code);
+      char* error_message = GetErrorMessage(error_code);
       OPENER_TRACE_ERR("networkhandler: could not get peername: %d - %s\n",
                        error_code,
                        error_message);
@@ -919,7 +919,7 @@ EipStatus HandleDataOnTcpSocket(int socket) {
                         socket);
 
       data_sent = send(socket,
-                       (char *)outgoing_message.message_buffer,
+                       (char*)outgoing_message.message_buffer,
                        outgoing_message.used_message_length,
                        MSG_NOSIGNAL);
       SocketTimerSetLastUpdate(socket_timer, g_actual_time);
@@ -953,7 +953,7 @@ int CreateUdpSocket(void) {
 
   if (g_network_status.udp_io_messaging == kEipInvalidSocket) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR("networkhandler: cannot create UDP socket: %d- %s\n",
                      error_code,
                      error_message);
@@ -977,7 +977,7 @@ int CreateUdpSocket(void) {
   if (setsockopt(g_network_status.udp_io_messaging,
                  SOL_SOCKET,
                  SO_REUSEADDR,
-                 (char *)&option_value,
+                 (char*)&option_value,
                  sizeof(option_value)) < 0) {
     OPENER_TRACE_ERR(
         "error setting socket option SO_REUSEADDR on %s UDP socket\n");
@@ -992,10 +992,10 @@ int CreateUdpSocket(void) {
                                     .sin_port = htons(kOpenerEipIoUdpPort)};
 
   if (bind(g_network_status.udp_io_messaging,
-           (struct sockaddr *)&source_addr,
+           (struct sockaddr*)&source_addr,
            sizeof(source_addr)) < 0) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR("error on bind UDP for producing messages: %d - %s\n",
                      error_code,
                      error_message);
@@ -1023,7 +1023,7 @@ int SetQos(CipUsint qos_for_socket) {
                      CipQosGetDscpPriority(qos_for_socket)) !=
       0) { /* got error */
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR("networkhandler: error on set QoS on socket: %d - %s\n",
                      error_code,
                      error_message);
@@ -1044,7 +1044,7 @@ int SetSocketOptionsMulticastProduce(void) {
                    NWBUF_CAST & g_tcpip.mcast_ttl_value,
                    sizeof(g_tcpip.mcast_ttl_value)) < 0) {
       int error_code      = GetSocketErrorNumber();
-      char *error_message = GetErrorMessage(error_code);
+      char* error_message = GetErrorMessage(error_code);
       OPENER_TRACE_ERR(
           "networkhandler: could not set the TTL to: %d, error: %d - %s\n",
           g_tcpip.mcast_ttl_value,
@@ -1063,7 +1063,7 @@ int SetSocketOptionsMulticastProduce(void) {
                  NWBUF_CAST & my_addr.s_addr,
                  sizeof my_addr.s_addr) < 0) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR(
         "networkhandler: could not set the multicast interface, error: %d "
         "- %s\n",
@@ -1083,10 +1083,10 @@ EipUint32 GetPeerAddress(void) {
   socklen_t peer_address_length = sizeof(peer_address);
 
   if (getpeername(g_current_active_tcp_socket,
-                  (struct sockaddr *)&peer_address,
+                  (struct sockaddr*)&peer_address,
                   &peer_address_length) < 0) {
     int error_code      = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
+    char* error_message = GetErrorMessage(error_code);
     OPENER_TRACE_ERR("networkhandler: could not get peername: %d - %s\n",
                      error_code,
                      error_message);
@@ -1097,13 +1097,13 @@ EipUint32 GetPeerAddress(void) {
 }
 
 void CheckAndHandleConsumingUdpSocket(void) {
-  DoublyLinkedListNode *iterator = connection_list.first;
+  DoublyLinkedListNode* iterator = connection_list.first;
 
-  CipConnectionObject *current_connection_object = NULL;
+  CipConnectionObject* current_connection_object = NULL;
 
   /* see a message of the registered UDP socket has been received     */
   while (NULL != iterator) {
-    current_connection_object = (CipConnectionObject *)iterator->data;
+    current_connection_object = (CipConnectionObject*)iterator->data;
     iterator = iterator->next; /* do this at the beginning as the close function
                                   may can make the entry invalid */
 
@@ -1122,11 +1122,11 @@ void CheckAndHandleConsumingUdpSocket(void) {
                                    NWBUF_CAST incoming_message,
                                    sizeof(incoming_message),
                                    0,
-                                   (struct sockaddr *)&from_address,
+                                   (struct sockaddr*)&from_address,
                                    &from_address_length);
       if (0 == received_size) {
         int error_code      = GetSocketErrorNumber();
-        char *error_message = GetErrorMessage(error_code);
+        char* error_message = GetErrorMessage(error_code);
         OPENER_TRACE_ERR(
             "networkhandler: socket: %d - connection closed by client: %d - "
             "%s\n",
@@ -1145,7 +1145,7 @@ void CheckAndHandleConsumingUdpSocket(void) {
         if (OPENER_SOCKET_WOULD_BLOCK == error_code) {
           return;  // No fatal error, resume execution
         }
-        char *error_message = GetErrorMessage(error_code);
+        char* error_message = GetErrorMessage(error_code);
         OPENER_TRACE_ERR("networkhandler: error on recv: %d - %s\n",
                          error_code,
                          error_message);
@@ -1191,7 +1191,7 @@ void CheckEncapsulationInactivity(int socket_handle) {
   if (0 <
       g_tcpip.encapsulation_inactivity_timeout) {  //*< Encapsulation inactivity
                                                    // timeout is enabled
-    SocketTimer *socket_timer = SocketTimerArrayGetSocketTimer(
+    SocketTimer* socket_timer = SocketTimerArrayGetSocketTimer(
         g_timestamps, OPENER_NUMBER_OF_SUPPORTED_SESSIONS, socket_handle);
 
     //    OPENER_TRACE_INFO("Check socket %d - socket timer: %p\n",

+ 0 - 1
source/src/ports/nvdata/CMakeLists.txt

@@ -27,4 +27,3 @@ if( OPENER_INSTALL_AS_LIB )
     FILES_MATCHING PATTERN "*.h"
    )
 endif()
-

+ 8 - 8
source/src/ports/nvdata/conffile.c

@@ -47,7 +47,7 @@
  * @param[in] path the full path of the directory to create
  * @return zero on success, otherwise -1 and errno set
  */
-static inline int Mkdir(const char *path) {
+static inline int Mkdir(const char* path) {
 #ifdef _WIN32
   return _mkdir(path);
 #else
@@ -56,8 +56,8 @@ static inline int Mkdir(const char *path) {
 #endif
 }
 
-static void RecMkdir(char *const p_path) {
-  char *sep = strrchr(p_path, '/');
+static void RecMkdir(char* const p_path) {
+  char* sep = strrchr(p_path, '/');
   if (sep && p_path != sep) { /* "p_path != sep" avoids mkdir("/")! */
     *sep = '\0';
     RecMkdir(p_path);
@@ -65,7 +65,7 @@ static void RecMkdir(char *const p_path) {
   }
   VERBOSE(stdout, " ->mkdir('%s')", p_path);
   if (Mkdir(p_path) && EEXIST != errno) {
-    char *error_message = GetErrorMessage(errno);
+    char* error_message = GetErrorMessage(errno);
     OPENER_TRACE_ERR("error while trying to create '%s', %d - %s\n",
                      p_path,
                      errno,
@@ -74,8 +74,8 @@ static void RecMkdir(char *const p_path) {
   }
 }
 
-static FILE *FopenMkdir(char *p_path, char *mode) {
-  char *sep = strrchr(p_path, '/');
+static FILE* FopenMkdir(char* p_path, char* mode) {
+  char* sep = strrchr(p_path, '/');
   /* In write mode create missing directories. */
   if (sep && 'w' == *mode) {
     *sep = '\0';
@@ -108,7 +108,7 @@ static FILE *FopenMkdir(char *p_path, char *mode) {
  *  in the NV data storage directory.
  */
 
-FILE *ConfFileOpen(const bool write, const char *const p_name) {
+FILE* ConfFileOpen(const bool write, const char* const p_name) {
   char path_buf[64];
   int rc;
 
@@ -127,7 +127,7 @@ FILE *ConfFileOpen(const bool write, const char *const p_name) {
  *  Closes the configuration file associated to p_filep. No data
  *  synchronization to disk yet.
  */
-EipStatus ConfFileClose(FILE **p_filep) {
+EipStatus ConfFileClose(FILE** p_filep) {
   EipStatus eip_status = kEipStatusOk;
   if (0 != fclose(*p_filep)) {
     eip_status = kEipStatusError;

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

@@ -16,8 +16,8 @@
 
 #include "typedefs.h"
 
-FILE *ConfFileOpen(const bool write, const char *const p_name);
+FILE* ConfFileOpen(const bool write, const char* const p_name);
 
-EipStatus ConfFileClose(FILE **p_filep);
+EipStatus ConfFileClose(FILE** p_filep);
 
 #endif /* _CONFFILE_H_ */

+ 4 - 4
source/src/ports/nvdata/nvdata.c

@@ -60,8 +60,8 @@ EipStatus NvdataLoad(void) {
  * This application specific implementation chose to save all attributes
  * at once using a single NvQosStore() call.
  */
-EipStatus NvQosSetCallback(CipInstance *const instance,
-                           CipAttributeStruct *const attribute,
+EipStatus NvQosSetCallback(CipInstance* const instance,
+                           CipAttributeStruct* const attribute,
                            CipByte service) {
   /* Suppress unused parameter compiler warning. */
   (void)service;
@@ -96,8 +96,8 @@ EipStatus NvQosSetCallback(CipInstance *const instance,
  * This application specific implementation chose to save all attributes
  * at once using a single NvTcpipStore() call.
  */
-EipStatus NvTcpipSetCallback(CipInstance *const instance,
-                             CipAttributeStruct *const attribute,
+EipStatus NvTcpipSetCallback(CipInstance* const instance,
+                             CipAttributeStruct* const attribute,
                              CipByte service) {
   /* Suppress parameters used only for trace macros. */
 #ifndef OPENER_WITH_TRACES

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

@@ -18,12 +18,12 @@
 
 EipStatus NvdataLoad(void);
 
-EipStatus NvQosSetCallback(CipInstance *const instance,
-                           CipAttributeStruct *const attribute,
+EipStatus NvQosSetCallback(CipInstance* const instance,
+                           CipAttributeStruct* const attribute,
                            CipByte service);
 
-EipStatus NvTcpipSetCallback(CipInstance *const instance,
-                             CipAttributeStruct *const attribute,
+EipStatus NvTcpipSetCallback(CipInstance* const instance,
+                             CipAttributeStruct* const attribute,
                              CipByte service);
 
 #endif /* ifndef NVDATA_H_ */

+ 4 - 4
source/src/ports/nvdata/nvqos.c

@@ -28,7 +28,7 @@
  *  @param  p_qos pointer to the QoS object's data structure
  *  @return kEipStatusOk: success; kEipStatusError: failure
  */
-int NvQosLoad(CipQosObject *p_qos) {
+int NvQosLoad(CipQosObject* p_qos) {
   int rd_cnt           = 0;
   EipStatus eip_status = kEipStatusError;
 
@@ -46,7 +46,7 @@ int NvQosLoad(CipQosObject *p_qos) {
   unsigned int dscp_low       = 0;
   unsigned int dscp_explicit  = 0;
 
-  FILE *p_file = ConfFileOpen(false, QOS_CFG_NAME);
+  FILE* p_file = ConfFileOpen(false, QOS_CFG_NAME);
   if (NULL != p_file) {
 /* Disable VS fscanf depreciation warning. */
 #ifdef _MSC_VER
@@ -101,8 +101,8 @@ int NvQosLoad(CipQosObject *p_qos) {
  *  @param  p_qos pointer to the QoS object's data structure
  *  @return kEipStatusOk: success; kEipStatusError: failure
  */
-EipStatus NvQosStore(const CipQosObject *p_qos) {
-  FILE *p_file         = ConfFileOpen(true, QOS_CFG_NAME);
+EipStatus NvQosStore(const CipQosObject* p_qos) {
+  FILE* p_file         = ConfFileOpen(true, QOS_CFG_NAME);
   EipStatus eip_status = kEipStatusOk;
   if (NULL != p_file) {
     /* Print output data */

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

@@ -14,8 +14,8 @@
 #include "cipqos.h"
 #include "typedefs.h"
 
-int NvQosLoad(CipQosObject *p_qos);
+int NvQosLoad(CipQosObject* p_qos);
 
-int NvQosStore(const CipQosObject *p_qos);
+int NvQosStore(const CipQosObject* p_qos);
 
 #endif /* _NVQOS_H_ */

+ 4 - 4
source/src/ports/nvdata/nvtcpip.c

@@ -24,13 +24,13 @@
  *  @param  p_tcp_ip pointer to the TCP/IP object's data structure
  *  @return kEipStatusOk: success; kEipStatusError: failure
  */
-int NvTcpipLoad(CipTcpIpObject *p_tcp_ip) {
+int NvTcpipLoad(CipTcpIpObject* p_tcp_ip) {
   /* Suppress unused parameter compiler warning. */
   (void)p_tcp_ip;
 
   EipStatus eip_status = kEipStatusOk;
 
-  FILE *p_file = ConfFileOpen(false, TCPIP_CFG_NAME);
+  FILE* p_file = ConfFileOpen(false, TCPIP_CFG_NAME);
   if (NULL != p_file) {
     /* Read input data */
     OPENER_TRACE_ERR(
@@ -54,11 +54,11 @@ int NvTcpipLoad(CipTcpIpObject *p_tcp_ip) {
  *  @param  p_tcp_ip pointer to the TCP/IP object's data structure
  *  @return kEipStatusOk: success; kEipStatusError: failure
  */
-EipStatus NvTcpipStore(const CipTcpIpObject *p_tcp_ip) {
+EipStatus NvTcpipStore(const CipTcpIpObject* p_tcp_ip) {
   /* Suppress unused parameter compiler warning. */
   (void)p_tcp_ip;
 
-  FILE *p_file = ConfFileOpen(true, TCPIP_CFG_NAME);
+  FILE* p_file = ConfFileOpen(true, TCPIP_CFG_NAME);
   if (NULL != p_file) {
     /* Print output data */
     OPENER_TRACE_ERR(

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

@@ -14,8 +14,8 @@
 #include "ciptcpipinterface.h"
 #include "typedefs.h"
 
-int NvTcpipLoad(CipTcpIpObject *p_tcp_ip);
+int NvTcpipLoad(CipTcpIpObject* p_tcp_ip);
 
-int NvTcpipStore(const CipTcpIpObject *p_tcp_ip);
+int NvTcpipStore(const CipTcpIpObject* p_tcp_ip);
 
 #endif /* _NVTCPIP_H_ */

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

@@ -31,7 +31,7 @@ int GetSocketErrorNumber(void);
  *
  * @return A human readable error message for the given error number
  */
-char *GetErrorMessage(int error_number);
+char* GetErrorMessage(int error_number);
 
 /**
  * @brief Frees the space of the error message generated by GetErrorMessage(int)
@@ -39,4 +39,4 @@ char *GetErrorMessage(int error_number);
  * This function shall implement an appropriate method to free the space
  * allocated by GetErrorMessage(int)
  */
-void FreeErrorMessage(char *error_message);
+void FreeErrorMessage(char* error_message);

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff