Complete.Org: Mailing Lists: Archives: freeciv-dev: March 1999:
[Freeciv-Dev] 1.8.0 and network byte order
Home

[Freeciv-Dev] 1.8.0 and network byte order

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Developer Mailing List <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] 1.8.0 and network byte order
From: Mitch Davis <mjd@xxxxxxxxxx>
Date: Wed, 03 Mar 1999 11:43:53 +1100

Dear Freeciv people,

Greetings to all.  I've been a bit quite of late:  Holidays, and
been very busy....

In common/packets.c there are routines such as get_int32 and
put_int32 which take data types and convert them into a stream
of bytes, for the Freeciv network packets.

As someone who was working on a Java client pointed out, the
original authors of Freeciv chose the (arguably) wrong way of
representing these, and it is not portably possible to get Freeciv
to talk with the Java client.

The *right* way is to use the htonl/htons/ntohl/ntohs macros
which appear in /usr/include/netinet/in.h on most machines.
These macros convert a native short or int into "network byte
order", and are implemented on each platform so that they are
either a no-op, or do a byte swap, as appropriate.

One of the reasons we didn't make this change earlier to Freeciv
is that it breaks the packet protocol, in a way that not even
capabilities can help.  Thus we said we'd save this for 1.8:

 
http://www.complete.org/mailinglists/archives/freeciv-dev-199811/msg00159.html

Well, 1.8 is here!  Can we make those changes now?

Regards,

Mitch.
--
| mailto:mjd@xxxxxxxxxx       | Not the official view of: |
| mailto:mjd@xxxxxxxxxxxxxxxx | Australian Calculator Opn |
| Certified Linux Evangelist! | Hewlett Packard Australia |

[Prev in Thread] Current Thread [Next in Thread]