Linux-Hams archive - March 1997: RE: why ntohs etc

RE: why ntohs etc

Dave Brown N2RJT (loq@eurobell.net)
Fri, 28 Feb 1997 18:14:43 -0500 (EST)


In the RSPF protocol, all data should be in network order.
Some of the data is used by RSPFd, and therefore needs to be stored
in host order. I believe that Cost would be one example. Other data
is never directly used by RSPFd (except comparisons), but is fed as
parameter to system calls that expect the data in network order.
IP address is an example of this.

I would say, Cost and other directly used parameters must be converted
back and forth. IP Addresses don't need to be (and I believe RSPFd
doesn't currently convert these) except as necessary for printout.

I believe the patches I sent to you included a few new host/net conversions.
These would be necessary when one RSPFd is running in Linux and the other
on a Motorola processor, or other BIG-ENDIAN machine such as Sparc.

If in doubt, keep the ntohs() ntohl() htons() htonl() stuff in there.

--
73 - Dave Brown N2RJT (wxm.qfenh@relay.tunkki.fi)