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):
- Download clean 2.1.0.0 version of the library.
- Download patch file provided in this ticket.
- Copy original files in a folder called 2.1.0.0.original:
cp -r 2.1.0.0 2.1.0.0.original
- 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
Diff:
Patch will be tested.
Updated patch for trunk branch at 30-11-2022.
Steps to patch the library (in Linux OS):
tcnopen-trdpfolder totcnopen-trdp.original.tcnopen-trdp.original.After this,
tcnopen-trdp.originalfolder will contain the new modified API ready to use.Take into account that
trdp/test/localtest/api_test_4.cdoes 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