Menu

#399 API change proposal to allow custom implementations of sockets

3.0.0.0
closed
2445 (2)
2024-02-05
2022-07-27
No

Hi all, I would like to propose a change in the socket handling within TcnOpen library.

The main changes:

  • At API level, estart working with TRDP_SOCK_ T instead of INT32 as socket.
  • TRDP_SOCK_T is internally defined to VOS_SOCK_T (also a new type). This follows the same criteria as TRDP_FDS_T or TRDP_TIME_T (for example), which are defined to their VOS equivalent type.
  • New functions are created to handle sockets, such as VOS_FD_ZERO, VOS_FD_SET, VOS_FD_ISSET or VOS_FD_CLR.
  • New function is created to compare sockets (as there could be implementations in which > < == may not fit): vos_sockCmp()
  • vos_select function is not anymore called with '+1', it is provided with the highest socket, and VOS implementation of the function will add the '+1' (if needed).
  • Unify VOS_INVALID_SOCKET usage, since its current usage was mixed with (-1). Again, with custom implementations of sockets (-1) may not fix.

With these changes, end user of the library could be able to work with its own implementation of sockets, as VOS layer offers enough abstraction level to do it.

Steps to patch the library (in Linux OS):

  1. Download clean 2.1.0.0 version of the library.
  2. Download patch file provided in this ticket.
  3. Copy original files in a folder called 2.1.0.0.original:
cp -r 2.1.0.0 2.1.0.0.original
  1. Patch the original directory:
patch -p0 -l < tcn_open_2.1.0.0.patch

After these steps, 2.1.0.0.original folder will contain the modified version of the library with socket abstraction. It should compile and work exactly in the same way as until today.

Thank you so much,
Adrian

1 Attachments

Discussion

  • Adrian Moran

    Adrian Moran - 2022-07-27
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,7 @@
     Hi all, I would like to propose a change in the socket handling within TcnOpen library.
    
     **The main changes:**
    +
    
     * At API level, estart working with TRDP_SOCK_ T instead of INT32 as socket.
     * TRDP_SOCK_T is internally defined to VOS_SOCK_T (also a new type). This follows the same criteria as TRDP_FDS_T or TRDP_TIME_T (for example), which are defined to their VOS equivalent type.
     * New functions are created to handle sockets, such as VOS_FD_ZERO, VOS_FD_SET, VOS_FD_ISSET or VOS_FD_CLR.
    
     
  • Armin-Hagen Weiss

    • Milestone: 2.1.0.0 --> 2.2.0.0
     
  • Armin-Hagen Weiss

    • assigned_to: Iris Bosse
     
  • Armin-Hagen Weiss

    Patch will be tested.

     
  • Armin-Hagen Weiss

    • status: open --> accepted
    • assigned_to: Iris Bosse --> Adrian Moran
     
  • Adrian Moran

    Adrian Moran - 2022-12-01

    Updated patch for trunk branch at 30-11-2022.

    Steps to patch the library (in Linux OS):

    1. Download trunk version.
    2. Rename tcnopen-trdp folder to tcnopen-trdp.original.
    3. Download patch in folder containing tcnopen-trdp.original.
    4. Patch the folder:
    patch -p0 -l < socket_api_change.patch
    

    After this, tcnopen-trdp.original folder will contain the new modified API ready to use.

    Take into account that trdp/test/localtest/api_test_4.c does not compile in current trunk version. Patch will be proposed to fix it and allow full trunk branch to compile #404.

     

    Last edit: Adrian Moran 2022-12-01
  • Armin-Hagen Weiss

    • labels: --> 2445
    • status: accepted --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB