2 * eui64.h - EUI64 routines for IPv6CP.
4 * (c) 1999 Tommi Komulainen <Tommi.Komulainen@iki.fi>
6 * Redistribution and use in source and binary forms are permitted
7 * provided that the above copyright notice and this paragraph are
8 * duplicated in all such forms and that any documentation,
9 * advertising materials, and other materials related to such
10 * distribution and use acknowledge that the software was developed
11 * by Carnegie Mellon University. The name of the
12 * University may not be used to endorse or promote products derived
13 * from this software without specific prior written permission.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 * $Id: eui64.h,v 1.1 1999/08/13 01:58:43 paulus Exp $
24 * Maybe this should be done by processing struct in6_addr directly...
33 #define eui64_iszero(e) (((e).e32[0] | (e).e32[1]) == 0)
34 #define eui64_equals(e, o) (((e).e32[0] == (o).e32[0]) && \
35 ((e).e32[1] == (o).e32[1]))
36 #define eui64_zero(e) (e).e32[0] = (e).e32[1] = 0;
38 #define eui64_copy(s, d) memcpy(&(d), &(s), sizeof(eui64_t))
40 #define eui64_magic(e) do { \
41 (e).e32[0] = magic(); \
42 (e).e32[1] = magic(); \
45 #define eui64_magic_nz(x) do { \
47 } while (eui64_iszero(x))
48 #define eui64_magic_ne(x, y) do { \
50 } while (eui64_equals(x, y))
52 #define eui64_get(ll, cp) do { \
53 eui64_copy((*cp), (ll)); \
54 (cp) += sizeof(eui64_t); \
57 #define eui64_put(ll, cp) do { \
58 eui64_copy((ll), (*cp)); \
59 (cp) += sizeof(eui64_t); \
62 #define eui64_set32(e, l) do { \
64 (e).e32[1] = htonl(l); \
66 #define eui64_setlo32(e, l) eui64_set32(e, l)
68 char *eui64_ntoa __P((eui64_t)); /* Returns ascii representation of id */