summaryrefslogtreecommitdiffstats
path: root/src/include/kerberosIV/addr_comp.h
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1993-06-03 19:29:40 +0000
committerTheodore Tso <tytso@mit.edu>1993-06-03 19:29:40 +0000
commit746386f12e01102acbe5637aac6f1259c74bb552 (patch)
tree715df6527f739854dc978c588047607e1907e9e9 /src/include/kerberosIV/addr_comp.h
parentacbed92e113f54d33789d427e697a23a0f07ab64 (diff)
downloadkrb5-746386f12e01102acbe5637aac6f1259c74bb552.tar.gz
krb5-746386f12e01102acbe5637aac6f1259c74bb552.tar.xz
krb5-746386f12e01102acbe5637aac6f1259c74bb552.zip
Initial revision
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2611 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include/kerberosIV/addr_comp.h')
-rw-r--r--src/include/kerberosIV/addr_comp.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/include/kerberosIV/addr_comp.h b/src/include/kerberosIV/addr_comp.h
new file mode 100644
index 0000000000..43e6547ada
--- /dev/null
+++ b/src/include/kerberosIV/addr_comp.h
@@ -0,0 +1,39 @@
+/*
+ * $Source$
+ * $Author$
+ * $Header$
+ *
+ * Copyright 1987, 1988, 1989 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
+ *
+ * Include file for address comparison macros.
+ */
+
+#include <mit-copyright.h>
+
+#ifndef ADDR_COMP_DEFS
+#define ADDR_COMP_DEFS
+
+/*
+** Look boys and girls, a big kludge
+** We need to compare the two internet addresses in network byte order, not
+** local byte order. This is a *really really slow way of doing that*
+** But.....
+** .....it works
+** so we run with it
+**
+** long_less_than gets fed two (u_char *)'s....
+*/
+
+#define u_char_comp(x,y) \
+ (((x)>(y))?(1):(((x)==(y))?(0):(-1)))
+
+#define long_less_than(x,y) \
+ (u_char_comp((x)[0],(y)[0])?u_char_comp((x)[0],(y)[0]): \
+ (u_char_comp((x)[1],(y)[1])?u_char_comp((x)[1],(y)[1]): \
+ (u_char_comp((x)[2],(y)[2])?u_char_comp((x)[2],(y)[2]): \
+ (u_char_comp((x)[3],(y)[3])))))
+
+#endif /* ADDR_COMP_DEFS */