Re: [lwip-users] using LWIP_PBUF_CUSTOM_DATA together with socket api

2022-02-19 Thread Grant Edwards
On 2022-02-19, Massimiliano Cialdi  wrote:

> Okay. Could you give me a suggestion on how I can implement an
> equivalent `select` with in netconn. Keep in mind that I use
> FreeRTOS.

You can use netconn callbacks to wake the relevent thread when a
socket has data to be read. I used a semaphore, but you could use some
other mechanism if you prefer.

--
Grant




___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] using LWIP_PBUF_CUSTOM_DATA together with socket api

2022-02-19 Thread Massimiliano Cialdi
On Sat, Feb 19, 2022 at 10:02 PM goldsi...@gmx.de  wrote:
> Well, there's still an undone task in our tracker to convert the socket
> API to just be a "copying" wrapper around the netconn API.
> Unfortunately, it's not like that now and select is not available for
> netconns, yet.
Okay. Could you give me a suggestion on how I can implement an
equivalent `select` with in netconn. Keep in mind that I use FreeRTOS.

best regards
Max


-- 
Et nunc, auxilium solis, vincam!
Oppugnatio solaris!
VIS!

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] using LWIP_PBUF_CUSTOM_DATA together with socket api

2022-02-19 Thread goldsi...@gmx.de

Am 19.02.2022 um 21:50 schrieb Massimiliano Cialdi:

On Sat, Feb 19, 2022 at 9:38 PM goldsi...@gmx.de  wrote:

The easiest way probably might be to implement a socket read function
that returns netbufs instead of the standard socket read function. But
that's not implemented yet.

Alternatively I could replace the socket API of the project I'm
porting with the netconn API. The only issue is that such project also
makes use of the `select` API. How can I replace it or implement it
with the netconn API?


Well, there's still an undone task in our tracker to convert the socket
API to just be a "copying" wrapper around the netconn API.
Unfortunately, it's not like that now and select is not available for
netconns, yet.

Regards,
Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] using LWIP_PBUF_CUSTOM_DATA together with socket api

2022-02-19 Thread Massimiliano Cialdi
On Sat, Feb 19, 2022 at 9:38 PM goldsi...@gmx.de  wrote:
> The easiest way probably might be to implement a socket read function
> that returns netbufs instead of the standard socket read function. But
> that's not implemented yet.
Alternatively I could replace the socket API of the project I'm
porting with the netconn API. The only issue is that such project also
makes use of the `select` API. How can I replace it or implement it
with the netconn API?

best regards
Max


--
Et nunc, auxilium solis, vincam!
Oppugnatio solaris!
VIS!

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] using LWIP_PBUF_CUSTOM_DATA together with socket api

2022-02-19 Thread goldsi...@gmx.de

Am 19.02.2022 um 20:12 schrieb Massimiliano Cialdi:

I'm trying to port a project to lwip. This project uses BSD sockets
calls, so first, I used lwip's socket APIs.
The project I'm trying to port has to deal with packet timestamping,
that's why I used LWIP_PBUF_CUSTOM_DATA as explained here
https://savannah.nongnu.org/bugs/?55078
This way I can "enrich" the pbuf structure with metadata fields of my own.

The question is: how do I retrieve my metadata using the socket API?
For example how do I get a read pbuf? Or how do I convert the socket
to a netconn?


Since the socket standard does not know your custom data, you cannot
access it through that API. There's no predefined way to access unknown
data :-)

And I'm sorry to dissapoint you, but there's currently no way to convert
a socket to a netconn, either. It could probably implemented, but you
cannot just use the netconn behind the socket, as the socket itself has
internal state that might get confused when then underlying netconn is
accessed directly.

The easiest way probably might be to implement a socket read function
that returns netbufs instead of the standard socket read function. But
that's not implemented yet.

Regards,
Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


[lwip-users] using LWIP_PBUF_CUSTOM_DATA together with socket api

2022-02-19 Thread Massimiliano Cialdi
I'm trying to port a project to lwip. This project uses BSD sockets
calls, so first, I used lwip's socket APIs.
The project I'm trying to port has to deal with packet timestamping,
that's why I used LWIP_PBUF_CUSTOM_DATA as explained here
https://savannah.nongnu.org/bugs/?55078
This way I can "enrich" the pbuf structure with metadata fields of my own.

The question is: how do I retrieve my metadata using the socket API?
For example how do I get a read pbuf? Or how do I convert the socket
to a netconn?

best regards
Max

-- 
Et nunc, auxilium solis, vincam!
Oppugnatio solaris!
VIS!

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users