[jdev] Small windows incompatibility in jabberd2 resolver\dns.c

Bresler, Jonathan Jonathan.Bresler at usi.net
Fri Apr 8 13:55:05 CDT 2005


The "obscure #define/union stuff" is there to handle 
Network order vs host order of bytes and to allow access
To each different element of an IP address structure.  

See the man page for ntohl() and htonl().  The #defines for these
Two are prime examples that can serve as the basis for
Understanding what the rest are doing.

It would be even better to get access to a UNIX box and read
The header file for these two #defines.

Your Windows box is little-endian.  Network order is big-endian.
If addresses are not "corrected" for the local host order on
A little-endian box, you will send packets to a different host
Than what you expect.

<nostalgia>
Read W Richard Stevens (RIP).  He wrote wonderful books and 
Was an incomparable teacher on network protocols.  A number of 
Years ago I went to a job interview with Bell Labs.  The interviewer
Came down to breakfast with a copy of the original Stevens book
(http://www.amazon.com/exec/obidos/ASIN/0139498761/102-8221992-3021758).
Immediately I knew that I got the job....we talked Stevens and network
Programming for the next hour and half till I had to go on the next
Part of the interview.

Thank you Richard, (http://www.kohala.com/start/), without out your help
Learning the IP protocol suite would have been much harder.
</nostalgia>

Jonathan



-----Original Message-----
From: jdev-bounces at jabber.org [mailto:jdev-bounces at jabber.org] On Behalf Of Tim Anderson
Sent: Thursday, April 07, 2005 5:33 PM
To: Jabber software development list
Subject: [jdev] Small windows incompatibility in jabberd2 resolver\dns.c


As far as funcionality goes, I still haven't tried it to see if it works.
But from a pure compiling perspective this:

<code>
for(i = 0; i < 4; i++)
    sa6.sin6_addr.s6_addr32[i] = data->Ip6Address.IP6Dword[i];
</code>

should probably be this:

<code>
for(i = 0; i < 16; i++)
    sa6.sin6_addr.s6_addr[i] = data->Ip6Address.IP6Byte[i];
</code>

As some of the more obscure #define/union stuff doesn't appear to be
declared in my current ws2tcpip.h. I can't wrap my wee brain around
everyone's fascination with using obscure #define/union expansions so I'm
assuming my substition is at least functionally correct. Am I possibly using
the wrong version of ws2tcpip.h? This doesn't create some evil byte order
swapping nonsense does it?

Tim
_______________________________________________
jdev mailing list
jdev at jabber.org
http://mail.jabber.org/mailman/listinfo/jdev

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.859 / Virus Database: 585 - Release Date: 2/14/2005
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.859 / Virus Database: 585 - Release Date: 2/14/2005
 



More information about the JDev mailing list