fizzyaid wrote on Tuesday, March 06, 2018:
Hi,
I’m just in the process of testing out some stuff with FreeRTOS TCP and I have it working fine, but there are some changes that make it more useful when using the “event driven” mode, I’m wondering whether you would be open for me submitting changes for these.
Basically, the event driven stuff works fine, but it’s difficult to link it to other parts of the code, so I have tested the water by making a few changes.
Mainly I created a define “ipconfigSOCKET_HAS_USER_DATA” and added a field to the TCP socket (just like the user semaphore) that is a void * for user data to be stored.
I added a setsockopt field called FREERTOS_SO_SET_USERDATA which allows you to call setsockopt to set the value of this.
At the moment, I’m “fudging” getting this userdata by including the private ip header and accessing it directly from say the connection or rx callback, I can then cast this to (in my case a class) and use further callbacks to schedule operations to occur.
Ideally, there would be a getsockopt which would allow you to read the userdata value, but as getsockopt has not been implemented at all, I kind of went for my naughty but easy solution of accessing the field.
From my point of view it makes the callbacks much more useful because the socket carries around extra information which I can use to quickly inform other layers there is something to do, without having to traverse lists to find the data assosicated with a socket.
Is this something of interest?