diff options
author | Mark Eichin <eichin@mit.edu> | 1995-04-27 15:59:41 +0000 |
---|---|---|
committer | Mark Eichin <eichin@mit.edu> | 1995-04-27 15:59:41 +0000 |
commit | 0f9771a562ee91049e66bed9fa66007464dc1aef (patch) | |
tree | 47ef704dfd635dc622aab466bd46d5e08a9660a6 /src/include/kerberosIV/lsb_addr_cmp.h | |
parent | ddd96995d553d415489e8cfe75ae11121717da8f (diff) | |
download | krb5-0f9771a562ee91049e66bed9fa66007464dc1aef.tar.gz krb5-0f9771a562ee91049e66bed9fa66007464dc1aef.tar.xz krb5-0f9771a562ee91049e66bed9fa66007464dc1aef.zip |
* krb.h: make INTERFACE, FAR go away for now.
Drag in the unix time conversion functions for unix only.
Locally define PROTOTYPE().
Drag in unix versions of SOCKET macros.
Recognize DEFINE_SOCKADDR and NEED_TIME_H the way cc-unix.h does.
Declare krb_ignore_ip_address.
Define DEB() to support non-printf debugging.
Declare errno.
Define key_proc_type and decrypt_tkt_type.
* prot.h: add KERB_ERR_PREAUTH_SHORT and _MISMATCH from Cygnus
extensions.
* krbports.h: new file, has default ports for V4 services for
hard-coded fallback.
* lsb_addr_cmp.h: from V4, handles the mutant comparison
functions needed for the V4 "direction" comparison. (Rename
of lsb_addr_comp.h due to filename length.)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5540 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include/kerberosIV/lsb_addr_cmp.h')
-rw-r--r-- | src/include/kerberosIV/lsb_addr_cmp.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/include/kerberosIV/lsb_addr_cmp.h b/src/include/kerberosIV/lsb_addr_cmp.h new file mode 100644 index 0000000000..4f867a94f5 --- /dev/null +++ b/src/include/kerberosIV/lsb_addr_cmp.h @@ -0,0 +1,44 @@ +/* + * include/kerberosIV/lsb_addr_cmp.h + * + * Copyright 1988, 1995 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * <mit-copyright.h>. + * + * Comparison macros to emulate LSBFIRST comparison results of network + * byte-order quantities + */ + +#include "mit-copyright.h" +#ifndef LSB_ADDR_COMP_DEFS +#define LSB_ADDR_COMP_DEFS + +#include "osconf.h" + +/* note that if we don't explicitly know if we're LSBFIRST, the + alternate code is byte order independent and will give the + right answer. */ +#ifdef LSBFIRST +#define lsb_net_ulong_less(x,y) ((x < y) ? -1 : ((x > y) ? 1 : 0)) +#define lsb_net_ushort_less(x,y) ((x < y) ? -1 : ((x > y) ? 1 : 0)) +#else +/* MSBFIRST */ +#define u_char_comp(x,y) \ + (((x)>(y))?(1):(((x)==(y))?(0):(-1))) +/* This is gross, but... */ +#define lsb_net_ulong_less(x, y) long_less_than((u_char *)&x, (u_char *)&y) +#define lsb_net_ushort_less(x, y) short_less_than((u_char *)&x, (u_char *)&y) + +#define long_less_than(x,y) \ + (u_char_comp((x)[3],(y)[3])?u_char_comp((x)[3],(y)[3]): \ + (u_char_comp((x)[2],(y)[2])?u_char_comp((x)[2],(y)[2]): \ + (u_char_comp((x)[1],(y)[1])?u_char_comp((x)[1],(y)[1]): \ + (u_char_comp((x)[0],(y)[0]))))) +#define short_less_than(x,y) \ + (u_char_comp((x)[1],(y)[1])?u_char_comp((x)[1],(y)[1]): \ + (u_char_comp((x)[0],(y)[0]))) + +#endif /* LSBFIRST */ + +#endif /* LSB_ADDR_COMP_DEFS */ |