cancel
Showing results for 
Search instead for 
Did you mean: 

Abstraction of the TCP/IP stack like NetxDuo or LWIP example

Zainulabedeen
Associate III

I was looking for a way to create a high level abstracted layer that can be agnostic to the lower layer TCP/IP stack, like NetxDuo or LWIP, running under the higher abstracted layer.

I have came across suggestion to implement a `plug-in` based implementation of the higher level abstracted layer.

 

Kindly suggest me your opinions, what could be the best way to implement such high level abstracted layer that can be agnostic to the lower level TCP/IP stack running ? Also if there is an example of someone doing something similar?

 

Thanks a lot. 

3 REPLIES 3
MStackDev_376
Associate II

Hi,

Since you are looking for a high-level abstracted layer compatible with any lower layer TCP/IP, I would recommend you the Mongoose Networking Library.

Mongoose is a networking library ideal for embedded devices and it includes support for many networking protocols like HTTP, MQTT, Websockets and many more, with well documented APIs. At its core, it is the high-level abstraction library you are describing. It remains completely agnostic of any lower-layer TCP/IP implementation, having compatibility with numerous stacks (LwIP, NextDuo, any other stack that supports BSD sockets), also Mongoose comes with its own built-in lightweight stack as an alternative to the other stacks mentioned.

If you are looking to build your own layer, you can check at how Mongoose is implemented here. Or, if you would prefer to skip the implementation step, you can try and use Mongoose directly and see if it aligns with your goals. The library is well documented and it has lots of useful examples.

Heads up: I am part of the Mongoose development team, so I am very familiar with its design and features and I hope you find this helpful!

Zainulabedeen
Associate III

Thanks for your reply, i appreciate it. However, i meant something that i wanted to directly abstract for instance the APIs provided by NetxDuo, LWIP etc. rather than abstracting them from very low level like their socket APIs. Is there an example or idea of that sort ?

Thanks for the clarification.

 


@Zainulabedeen wrote:

i wanted to directly abstract for instance the APIs provided by NetxDuo, LWIP etc. rather than abstracting them from very low level like their socket APIs



Just to make sure we are on the same page, do you mean you want to abstract the low-level Raw API (e.g. functions like tcp_*, udp_* for LwIP) instead of the socket API?

 

The socket API is the highest level api interface of the stack, whilst the Raw API is the lowest-level one, so I think it would make more sense to abstract the socket API to ensure portability across all other stacks. Raw API in LwIP has the Netconn API built on top of it, so you could take a look at that to get an idea of an example.