Re: [lwip-users] Issue in err.c for lwIP 2.0.0

2016-11-30 Thread Dirk Ziegelmeier
No, the solution is in errno.h:

Choose one of:

- #define LWIP_PROVIDE_ERRNO 1
- #define LWIP_ERRNO_INCLUDE "path/my_header_file_containing_errno.h"

HTH
Dirk


On Wed, Nov 30, 2016 at 7:45 PM, Amit Ashara  wrote:

> Hello All,
>
> When integrating FreeRTOS with lwIP 2.0.0 the following gives an error for
> missing defines.
>
> #if !NO_SYS
> /** Table to quickly map an lwIP error (err_t) to a socket error
>   * by using -err as an index */
> static const int err_to_errno_table[] = {
>   0, /* ERR_OK  0  No error, everything OK. */
>   ENOMEM,/* ERR_MEM-1  Out of memory error. */
>   ENOBUFS,   /* ERR_BUF-2  Buffer error.*/
>   EWOULDBLOCK,   /* ERR_TIMEOUT-3  Timeout  */
>   EHOSTUNREACH,  /* ERR_RTE-4  Routing problem. */
>   EINPROGRESS,   /* ERR_INPROGRESS -5  Operation in progress*/
>   EINVAL,/* ERR_VAL-6  Illegal value.   */
>   EWOULDBLOCK,   /* ERR_WOULDBLOCK -7  Operation would block.   */
>   EADDRINUSE,/* ERR_USE-8  Address in use.  */
>   EALREADY,  /* ERR_ALREADY-9  Already connecting.  */
>   EISCONN,   /* ERR_ISCONN -10 Conn already established.*/
>   ENOTCONN,  /* ERR_CONN   -11 Not connected.   */
>   -1,/* ERR_IF -12 Low-level netif error*/
>   ECONNABORTED,  /* ERR_ABRT   -13 Connection aborted.  */
>   ECONNRESET,/* ERR_RST-14 Connection reset.*/
>   ENOTCONN,  /* ERR_CLSD   -15 Connection closed.   */
>   EIO/* ERR_ARG-16 Illegal argument.*/
> };
> #endif /* !NO_SYS */
>
> #if !NO_SYS
> int
> err_to_errno(err_t err)
> {
>   if ((err > 0) || (-err >= (err_t)LWIP_ARRAYSIZE(err_to_errno_table))) {
> return EIO;
>   }
>   return err_to_errno_table[-err];
> }
> #endif /* !NO_SYS */
>
> The assumption is that if NO_SYS is 0, or an RTOS is used, the socket
> model will be used. However when not using the socket model this is not
> true. Instead the following should be done (in my opinion)
>
> #if !NO_SYS
> #if LWIP_SOCKET
> /** Table to quickly map an lwIP error (err_t) to a socket error
>   * by using -err as an index */
> static const int err_to_errno_table[] = {
>   0, /* ERR_OK  0  No error, everything OK. */
>   ENOMEM,/* ERR_MEM-1  Out of memory error. */
>   ENOBUFS,   /* ERR_BUF-2  Buffer error.*/
>   EWOULDBLOCK,   /* ERR_TIMEOUT-3  Timeout  */
>   EHOSTUNREACH,  /* ERR_RTE-4  Routing problem. */
>   EINPROGRESS,   /* ERR_INPROGRESS -5  Operation in progress*/
>   EINVAL,/* ERR_VAL-6  Illegal value.   */
>   EWOULDBLOCK,   /* ERR_WOULDBLOCK -7  Operation would block.   */
>   EADDRINUSE,/* ERR_USE-8  Address in use.  */
>   EALREADY,  /* ERR_ALREADY-9  Already connecting.  */
>   EISCONN,   /* ERR_ISCONN -10 Conn already established.*/
>   ENOTCONN,  /* ERR_CONN   -11 Not connected.   */
>   -1,/* ERR_IF -12 Low-level netif error*/
>   ECONNABORTED,  /* ERR_ABRT   -13 Connection aborted.  */
>   ECONNRESET,/* ERR_RST-14 Connection reset.*/
>   ENOTCONN,  /* ERR_CLSD   -15 Connection closed.   */
>   EIO/* ERR_ARG-16 Illegal argument.*/
> };
> #endif /* LWIP_SOCKET */
> #endif /* !NO_SYS */
>
> #if !NO_SYS
> #if LWIP_SOCKET
> int
> err_to_errno(err_t err)
> {
>   if ((err > 0) || (-err >= (err_t)LWIP_ARRAYSIZE(err_to_errno_table))) {
> return EIO;
>   }
>   return err_to_errno_table[-err];
> }
> #endif /* LWIP_SOCKET */
> #endif /* !NO_SYS */
>
> Regards
> Amit Ashara
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] Useful web server for Netconn API

2016-11-30 Thread Brian Stull
Hi everyone,

I'm wondering if anyone has had success getting an HTTP server working
using the Netconn API. I know there is an example program using the Netconn
API but it is too basic to be of much use for me. I do have it up and
running but it doesn't include any support for POST, header decoding, etc.

There was some communication on this mailing list a couple months ago and
it was suggested then to try the contiki project HTTP server but from the
looks of it it will take quite a bit of modification to get working.

I'm not looking for anything too fancy, just similar to the RAW API example
server. Does anyone have a suggestion?

I should also say, I'm doing this for a commercial project and don't feel
like purchasing code, so I'm looking for something open source/free
commercial license.

Thanks for the help!
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] Issue in err.c for lwIP 2.0.0

2016-11-30 Thread Amit Ashara
Hello All,

When integrating FreeRTOS with lwIP 2.0.0 the following gives an error for
missing defines.

#if !NO_SYS
/** Table to quickly map an lwIP error (err_t) to a socket error
  * by using -err as an index */
static const int err_to_errno_table[] = {
  0, /* ERR_OK  0  No error, everything OK. */
  ENOMEM,/* ERR_MEM-1  Out of memory error. */
  ENOBUFS,   /* ERR_BUF-2  Buffer error.*/
  EWOULDBLOCK,   /* ERR_TIMEOUT-3  Timeout  */
  EHOSTUNREACH,  /* ERR_RTE-4  Routing problem. */
  EINPROGRESS,   /* ERR_INPROGRESS -5  Operation in progress*/
  EINVAL,/* ERR_VAL-6  Illegal value.   */
  EWOULDBLOCK,   /* ERR_WOULDBLOCK -7  Operation would block.   */
  EADDRINUSE,/* ERR_USE-8  Address in use.  */
  EALREADY,  /* ERR_ALREADY-9  Already connecting.  */
  EISCONN,   /* ERR_ISCONN -10 Conn already established.*/
  ENOTCONN,  /* ERR_CONN   -11 Not connected.   */
  -1,/* ERR_IF -12 Low-level netif error*/
  ECONNABORTED,  /* ERR_ABRT   -13 Connection aborted.  */
  ECONNRESET,/* ERR_RST-14 Connection reset.*/
  ENOTCONN,  /* ERR_CLSD   -15 Connection closed.   */
  EIO/* ERR_ARG-16 Illegal argument.*/
};
#endif /* !NO_SYS */

#if !NO_SYS
int
err_to_errno(err_t err)
{
  if ((err > 0) || (-err >= (err_t)LWIP_ARRAYSIZE(err_to_errno_table))) {
return EIO;
  }
  return err_to_errno_table[-err];
}
#endif /* !NO_SYS */

The assumption is that if NO_SYS is 0, or an RTOS is used, the socket model
will be used. However when not using the socket model this is not true.
Instead the following should be done (in my opinion)

#if !NO_SYS
#if LWIP_SOCKET
/** Table to quickly map an lwIP error (err_t) to a socket error
  * by using -err as an index */
static const int err_to_errno_table[] = {
  0, /* ERR_OK  0  No error, everything OK. */
  ENOMEM,/* ERR_MEM-1  Out of memory error. */
  ENOBUFS,   /* ERR_BUF-2  Buffer error.*/
  EWOULDBLOCK,   /* ERR_TIMEOUT-3  Timeout  */
  EHOSTUNREACH,  /* ERR_RTE-4  Routing problem. */
  EINPROGRESS,   /* ERR_INPROGRESS -5  Operation in progress*/
  EINVAL,/* ERR_VAL-6  Illegal value.   */
  EWOULDBLOCK,   /* ERR_WOULDBLOCK -7  Operation would block.   */
  EADDRINUSE,/* ERR_USE-8  Address in use.  */
  EALREADY,  /* ERR_ALREADY-9  Already connecting.  */
  EISCONN,   /* ERR_ISCONN -10 Conn already established.*/
  ENOTCONN,  /* ERR_CONN   -11 Not connected.   */
  -1,/* ERR_IF -12 Low-level netif error*/
  ECONNABORTED,  /* ERR_ABRT   -13 Connection aborted.  */
  ECONNRESET,/* ERR_RST-14 Connection reset.*/
  ENOTCONN,  /* ERR_CLSD   -15 Connection closed.   */
  EIO/* ERR_ARG-16 Illegal argument.*/
};
#endif /* LWIP_SOCKET */
#endif /* !NO_SYS */

#if !NO_SYS
#if LWIP_SOCKET
int
err_to_errno(err_t err)
{
  if ((err > 0) || (-err >= (err_t)LWIP_ARRAYSIZE(err_to_errno_table))) {
return EIO;
  }
  return err_to_errno_table[-err];
}
#endif /* LWIP_SOCKET */
#endif /* !NO_SYS */

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

Re: [lwip-users] Issue in arch.h for lwIP 2.0.0

2016-11-30 Thread Amit Ashara
Hello Freddie

That helped too. I added the include in the arch/cc.h for the device port.

Regards
Amit

On Wed, Nov 30, 2016 at 3:14 AM, Freddie Chopin 
wrote:

> On Wed, 2016-11-30 at 07:45 +0100, Dirk Ziegelmeier wrote:
> > I added it, thanks for reporting!
>
> It was behaving the same way in the git version prior to 2.0.0 and I
> guess the "standard" approach to that was to include  in your
> arch/cc.h file. I think that such issue was reported to the mailing
> list in the past and that was the suggested approach.
>
> Anyway - having stdlib.h included in lwip/arch.h is also a good option.
>
> Regards,
> FCh
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Issue in arch.h for lwIP 2.0.0

2016-11-30 Thread Amit Ashara
Hello Simon 

We are using 1.4.1 and we get a lot of queries  on when we will migrate to 2.0.0

The other being to correct the LLDP stack as was being discussed in the Another 
thread.

Regards
Amit Ashara

> On Nov 30, 2016, at 6:58 AM, Simon Goldschmidt  wrote:
> 
> Amit Ashara wrote:
>>  Is there going to be an incremental release of lwIP
> 
> Yes. 2.0.1 will be coming as soon as we'll need it (i.e. as soon as there are 
> enough
> bugs fixed from 2.0.0 to justify releasing it).
> The time from 1.4.1 to 2.0.0 was way too long. This mainly was because the 
> integration
> of IPv6 brought big changes and mainly due to lack of manpower, we just 
> needed that long.
> 
>> or should I make the same changes as Dirk and use lwIP-2,0.0
> 
> The preferred way is *always* to use vanilla lwIP and make local 
> modifications outside
> our source tree. You can of course go with git master, where the change is 
> integrated.
> That probably depends on what you do at TI, which I don't know ;-)
> 
> 
> Simon
> 
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users

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


Re: [lwip-users] Issue in arch.h for lwIP 2.0.0

2016-11-30 Thread Amit Ashara
So what is the final solution. Adding the stdlib.h in arch/cc.h or as what
Dirk has made changes?

Is there going to be an incremental release of lwIP or should I make the
same changes as Dirk and use lwIP-2,0.0

~Amit

On Wed, Nov 30, 2016 at 4:34 AM, Dirk Ziegelmeier 
wrote:

> Since it was already included in several lwIP .c/.h files, I simply
> decided to move it to a central place: arch.h.
>
> So my change should not break anything or make lwIP less portable as it
> was before.
>
> Dirk
>
> On Wed, Nov 30, 2016 at 11:07 AM, Simon Goldschmidt 
> wrote:
>
>> Freddie Chopin wrote:
>> > It was behaving the same way in the git version prior to 2.0.0 and I
>> > guess the "standard" approach to that was to include  in your
>> > arch/cc.h file. I think that such issue was reported to the mailing
>> > list in the past and that was the suggested approach.
>>
>> It was like that some years ago, but sicne by now, most embedded compilers
>> support these standard files, we decided to use them and to let people
>> missing
>> them emulate them...
>>
>>
>> Simon
>>
>> ___
>> lwip-users mailing list
>> lwip-users@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>>
>
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Issue in arch.h for lwIP 2.0.0

2016-11-30 Thread Dirk Ziegelmeier
Since it was already included in several lwIP .c/.h files, I simply decided
to move it to a central place: arch.h.

So my change should not break anything or make lwIP less portable as it was
before.

Dirk

On Wed, Nov 30, 2016 at 11:07 AM, Simon Goldschmidt 
wrote:

> Freddie Chopin wrote:
> > It was behaving the same way in the git version prior to 2.0.0 and I
> > guess the "standard" approach to that was to include  in your
> > arch/cc.h file. I think that such issue was reported to the mailing
> > list in the past and that was the suggested approach.
>
> It was like that some years ago, but sicne by now, most embedded compilers
> support these standard files, we decided to use them and to let people
> missing
> them emulate them...
>
>
> Simon
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Issue in arch.h for lwIP 2.0.0

2016-11-30 Thread Simon Goldschmidt
Freddie Chopin wrote:
> It was behaving the same way in the git version prior to 2.0.0 and I
> guess the "standard" approach to that was to include  in your
> arch/cc.h file. I think that such issue was reported to the mailing
> list in the past and that was the suggested approach.

It was like that some years ago, but sicne by now, most embedded compilers
support these standard files, we decided to use them and to let people missing
them emulate them...


Simon

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


Re: [lwip-users] Issue in arch.h for lwIP 2.0.0

2016-11-30 Thread Freddie Chopin
On Wed, 2016-11-30 at 07:45 +0100, Dirk Ziegelmeier wrote:
> I added it, thanks for reporting!

It was behaving the same way in the git version prior to 2.0.0 and I
guess the "standard" approach to that was to include  in your
arch/cc.h file. I think that such issue was reported to the mailing
list in the past and that was the suggested approach.

Anyway - having stdlib.h included in lwip/arch.h is also a good option.

Regards,
FCh

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