2005-11-03 Paul Jakma <paul.jakma@sun.com>
* zebra.h: BSD BYTE_ORDER define isn't available everywhere,
define if needs be.
* checksum.h: new file. checksum.c exports in_cksum, provide
a header for it.
* checksum.c: (in_cksum) callers shouldn't have to know it uses
a u_short internally, change to void *.
* Makefile.am: Add checksum.h
* command.h: remove bogus trailling slash.
* md5.c: (general) Update it for the twentieth century. ANSI
declarations are widely supported now.. Don't include system
headers, only include zebra.h. Use POSIX types (the
alternative is to define u_int64_t in a portable way - rest
of Quagga needs same cleanup).
Make endian-conditional code be compiler conditional rather
than preprocessor conditional, so that breakage gets noticed
quicker.
* md5.h: POSIX types. Get rid of the odd __P() non-ANSI capable
compiler compatibility hack.
diff --git a/lib/zebra.h b/lib/zebra.h
index 88f1625..1739d77 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -336,6 +336,23 @@
#define HAVE_IP_HDRINCL_BSD_ORDER
#endif
+/* Define BYTE_ORDER, if not defined. Useful for compiler conditional
+ * code, rather than preprocessor conditional.
+ * Not all the world has this BSD define.
+ */
+#ifndef BYTE_ORDER
+#define BIG_ENDIAN 4321 /* least-significant byte first (vax, pc) */
+#define LITTLE_ENDIAN 1234 /* most-significant byte first (IBM, net) */
+#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
+
+#if defined(WORDS_BIGENDIAN)
+#define BYTE_ORDER BIG_ENDIAN
+#else /* !WORDS_BIGENDIAN */
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif /* WORDS_BIGENDIAN */
+
+#endif /* ndef BYTE_ORDER */
+
/* MAX / MIN are not commonly defined, but useful */
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))