Skip to content

lwip: Add a configuration option to enable the lwip socket API. #2872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

infinnovation-dev
Copy link
Contributor

Description

The lwip library includes an API to provide functions similar to the
BSD / POSIX socket functions. Porting existing socket code to use
lwip can be considerably simplified by using this API.

mbed-os uses the alternative netconn API, and so by default disables
the socket API.

This change adds a configuration option allowing the user to enable
the lwip socket API.

It also allows the user to define LWIP_COMPAT_SOCKETS, which enables
macro definitions of "connect" as "lwip_connect", etc. To add another
mbed-os option defining LWIP_COMPAT_SOCKETS would be unworkable, since
it would break code such as "eth.connect()".

Status

READY

Migrations

NO

Related PRs

None known.

Todos

  • Tests
  • Documentation

The lwip library includes an API to provide functions similar to the
BSD / POSIX socket functions.  Porting existing socket code to use
lwip can be considerably simplified by using this API.

mbed-os uses the alternative netconn API, and so by default disables
the socket API.

This change adds a configuration option allowing the user to enable
the lwip socket API.

It also allows the user to define LWIP_COMPAT_SOCKETS, which enables
macro definitions of "connect" as "lwip_connect", etc.  To add another
mbed-os option defining LWIP_COMPAT_SOCKETS would be unworkable, since
it would break code such as "eth.connect()".
@0xc0170
Copy link
Contributor

0xc0170 commented Sep 30, 2016

cc @kjbracey-arm @geky

@kjbracey
Copy link
Contributor

Fine by me. @mikaleppanen should double-check too.

(Arguably a lot of stuff in there should be "ifndef", if you want to support people trying to turn stuff on to use it directly.)

@geky
Copy link
Contributor

geky commented Sep 30, 2016

This seems fine to me as well if users find it useful.

Though we can't make a garuntee that this api will be stable or always exposed. Perhaps a better solution for users who need this api would be to disable the lwip in mbed-os and add lwip as an external library with the user's configuration?

@infinnovation-dev
Copy link
Contributor Author

infinnovation-dev commented Oct 2, 2016

@kjbracey-arm Adding some ifndef's for various lwip configuration values was the subject of PR #2550 but I need to do some work on that.

@geky Lack of guarantee noted. We'll cross that bridge if/when we come to it. In the meantime I would find it advantageous to make use of the existing device level glue and allow co-existence of the mbed-os C++ API and the lwip C socket API.

@mikaleppanen
Copy link

Fine to me.

@sg-
Copy link
Contributor

sg- commented Oct 3, 2016

I'd prefer we hold off on this for now. We don't expose, document or support C interfaces. We will consider this for the future when if/when docs/tests/a conscious decision to expose C interfaces is had.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants