sockaddr structure

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

sockaddr structure

brivero

Hello to everybody,

I have decided to ask for your helpful advice once again. This time my question deals with the sockaddr structure, more concretely with the sockaddr_in:

struct sockaddr_in {                (from sockets.h, where lwip/ip_addr.h is included)
  u8_t sin_len;
  u8_t sin_family;
  u16_t sin_port;
  struct in_addr sin_addr;
  char sin_zero[8];
};

I would like to use this structure with both ipv4 and ipv6, and the problem is that I see that the in_addr is declared in the ip_addr.h belonging to the ipv4 folder, but I find no in_addr declaration in the ip_addr.h inside the ipv6 folder. In this file, there is declared a structure named ip_addr that should be the same, but I do not see where the name translation takes place. I suppose that they must be the same because they are very similar:

struct in_addr {                (ipv4)                struct ip_addr {                 (ipv6)
  u32_t s_addr;                                    u32_t addr[4];
};                                        };

What am I losing here???

Thank you very much for your answer.
_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: sockaddr structure

Jonathan Larmour
[hidden email] wrote:

>
> This time my
> question deals with the sockaddr structure, more concretely with the
> sockaddr_in:
>
> struct sockaddr_in {                (from sockets.h, where
> lwip/ip_addr.h is included)
>   u8_t sin_len;
>   u8_t sin_family;
>   u16_t sin_port;
>   struct in_addr sin_addr;
>   char sin_zero[8];
> };
>
> I would like to use this structure with both ipv4 and ipv6,

lwIP's ipv6 is called "very experimental" but I'm not sure it's even
advanced enough to be called that.

Usually with IPv6, there should be an entirely separate struct sockaddr_in6
structure. None of that stuff exists. What source files there are don't
even particularly attempt to deal with IPv6 at all. I wouldn't try to use
IPv6 with lwIP.

Jifl
--
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE : sockaddr structure

Frédéric BERNON
In reply to this post by brivero
Perhaps I'm wrong, but I think you can't use in the same time ipv4 and ipv6 with lwIP. Because, functions use the exact same name... By example, ip_route got two implementation (one for ipv4, one for ipv6), but there is no way to choose the good one at run time. If I'm right, you have to choose with which ip stack release you want to link at build time...

I know that Tai-hwa Liang has proposed a patch there is few weeks about ipv6, perhaps he can help you...
 
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : [hidden email]
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : lwip-users-bounces+frederic.bernon=[hidden email] [mailto:lwip-users-bounces+frederic.bernon=[hidden email]] De la part de Jonathan Larmour
Envoyé : mardi 24 avril 2007 15:52
À : Mailing list for lwIP users
Objet : Re: [lwip-users] sockaddr structure


[hidden email] wrote:

>
> This time my
> question deals with the sockaddr structure, more concretely with the
> sockaddr_in:
>
> struct sockaddr_in {                (from sockets.h, where
> lwip/ip_addr.h is included)
>   u8_t sin_len;
>   u8_t sin_family;
>   u16_t sin_port;
>   struct in_addr sin_addr;
>   char sin_zero[8];
> };
>
> I would like to use this structure with both ipv4 and ipv6,
lwIP's ipv6 is called "very experimental" but I'm not sure it's even
advanced enough to be called that.

Usually with IPv6, there should be an entirely separate struct sockaddr_in6
structure. None of that stuff exists. What source files there are don't
even particularly attempt to deal with IPv6 at all. I wouldn't try to use
IPv6 with lwIP.

Jifl
--
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine


_______________________________________________
lwip-users mailing list
[hidden email] http://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

=?iso-8859-1?Q?Fr=E9d=E9ric_BERNON=2Evcf?= (810 bytes) Download Attachment