patchlwIP - A Lightweight TCP/IP stack - Patches: patch #5777, Avoid OS functions'names conflit...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #5777: Avoid OS functions'names conflit with some sockets.h names...

Submitter:  Frédéric Bernon <fbernon>
Submitted:  Sun 04 Mar 2007 01:32:39 PM UTC
   
 
Category:  None Priority:  3 - Low
Status:  Done Privacy:  Public
Assigned to:  fbernon Open/Closed:  Closed
Planned Release:  None

Mon 05 Mar 2007 10:48:37 AM UTC, comment #5: 

See the patch file join to this item. Is it ok for you to integrate?

Note, there is also the SO_REUSE to avoid compiler warning (no change from previous), and the ETHARP_TRUST_IP_MAC (which is need for some "futur" patchs about the ARP table.

(file #12112)

Frédéric Bernon <fbernon>
Group Member
Mon 05 Mar 2007 10:19:37 AM UTC, comment #4: 

Last think before do it, some includes are always need in sockets.h to use some setsockopts.h (like TCP_NODELAY and TCP_KEEPALIVE):

#include "opt.h"
#include "tcp.h"

Ok to add them (it's better to let applications be independant from lwip)?

Frédéric Bernon <fbernon>
Group Member
Mon 05 Mar 2007 09:54:03 AM UTC, comment #3: 

Sure, So, I will integrate it in CVS, with comments.

About the Simon remarks, yes, if you want to use with lwip posix calls, and that your operating system is posix, you have to write a wrapper. But it's is not in the lwip scope (it's more in operating system scope).




Frédéric Bernon <fbernon>
Group Member
Mon 05 Mar 2007 09:18:02 AM UTC, comment #2: 

Second Simon's comments, particularly about sticking to the same "#if" style as the rest of the configuration options.

Kieran Mansley <kieranm>
Group Member
Mon 05 Mar 2007 07:44:28 AM UTC, comment #1: 

I think that's a good change, but I would stick to the other #if's (removing the defined(LWIP_POSIX_SOCKETS_IO_NAMES), you'd define it in opt.h, anyway, either to 0 or != 0. => #if LWIP_POSIX_SOCKETS_IO_NAMES should be enough).

BTW: if you have such a posix system you'd need some kind of wrapper to be able to call write and read for sockets, wouldn't you?

Simon Goldschmidt <goldsimon>
Group administrator
Sun 04 Mar 2007 01:32:39 PM UTC, original submission:  

In the forum's thread "LWIP_COMPAT_SOCKETS in sockets.h" (September 2006). I suggest to add a new define to avoid to have function names's conflits with some sockets.h functions, and some  operating system's IO function (read, write and close).

So, I would like to include a define LWIP_POSIX_SOCKETS_IO_NAMES (default value will be 1) to avoid this problem when using Lwip with a posix operating system. The code will be something like :

#if LWIP_COMPAT_SOCKETS
#define accept(a,b,c)         lwip_accept(a,b,c)
#define bind(a,b,c)           lwip_bind(a,b,c)
#define shutdown(a,b)         lwip_shutdown(a,b)
#define closesocket(s)        lwip_close(s)
#define connect(a,b,c)        lwip_connect(a,b,c)
#define getsockname(a,b,c)    lwip_getsockname(a,b,c)
#define getpeername(a,b,c)    lwip_getpeername(a,b,c)
#define setsockopt(a,b,c,d,e) lwip_setsockopt(a,b,c,d,e)
#define getsockopt(a,b,c,d,e) lwip_getsockopt(a,b,c,d,e)
#define listen(a,b)           lwip_listen(a,b)
#define recv(a,b,c,d)         lwip_recv(a,b,c,d)
#define recvfrom(a,b,c,d,e,f) lwip_recvfrom(a,b,c,d,e,f)
#define send(a,b,c,d)         lwip_send(a,b,c,d)
#define sendto(a,b,c,d,e,f)   lwip_sendto(a,b,c,d,e,f)
#define socket(a,b,c)         lwip_socket(a,b,c)
#define select(a,b,c,d,e)     lwip_select(a,b,c,d,e)
#define ioctlsocket(a,b,c)    lwip_ioctl(a,b,c)

#if defined(LWIP_POSIX_SOCKETS_IO_NAMES) && (LWIP_POSIX_SOCKETS_IO_NAMES > 0)
#define read(a,b,c)           lwip_read(a,b,c)
#define write(a,b,c)          lwip_write(a,b,c)
#define close(s)              lwip_close(s)
#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */

#endif /* LWIP_COMPAT_SOCKETS */


Is it good for you ?

Frédéric Bernon <fbernon>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #12112:  opt.h.patch added by fbernon (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by fbernon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-03-05 fbernon StatusIn Progress Done
        Open/ClosedOpen Closed
    2007-03-05 fbernon Attached File- Added opt.h.patch, #12112
    2007-03-05 kieranm Priority5 - Normal 3 - Low

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code