sysdep.h

00001 /*
00002  * Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
00003  * Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
00004  * Digital Equipment Corporation, Maynard, Mass.
00005  * Copyright (c) 1998 Microsoft.
00006  * To anyone who acknowledges that this file is provided "AS IS"
00007  * without any express or implied warranty: permission to use, copy,
00008  * modify, and distribute this file for any purpose is hereby
00009  * granted without fee, provided that the above copyright notices and
00010  * this notice appears in all source code copies, and that none of
00011  * the names of Open Software Foundation, Inc., Hewlett-Packard
00012  * Company, or Digital Equipment Corporation be used in advertising
00013  * or publicity pertaining to distribution of the software without
00014  * specific, written prior permission.  Neither Open Software
00015  * Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
00016  * Corporation makes any representations about the suitability of
00017  * this software for any purpose.
00018  */
00019 
00020 
00021 #ifndef SYSDEP_H
00022 #define SYSDEP_H
00023 
00024 
00025 #include "ithread.h"
00026 
00027 
00028 /* change to point to where MD5 .h's live */
00029 /* get MD5 sample implementation from RFC 1321 */
00030 #include "global.h"
00031 #include "md5.h"
00032 
00033 
00034 #include <sys/types.h>
00035 
00036 
00037 #ifdef WIN32
00038         /* Do not #include <sys/time.h> */
00039 #else
00040         #include <sys/time.h>
00041 #endif
00042 
00043 
00044 /* set the following to the number of 100ns ticks of the actual
00045    resolution of
00046    your system's clock */
00047 #define UUIDS_PER_TICK 1024
00048 
00049 
00050 /* Set the following to a call to acquire a system wide global lock
00051  */
00052 extern ithread_mutex_t gUUIDMutex;
00053 
00054 
00055 #define UUIDLock()      ithread_mutex_lock(&gUUIDMutex)
00056 #define UUIDUnlock()    ithread_mutex_unlock(&gUUIDMutex)
00057 
00058 
00059 typedef unsigned long   unsigned32;
00060 typedef unsigned short  unsigned16;
00061 typedef unsigned char   unsigned8;
00062 typedef unsigned char   byte;
00063 
00064 
00065 /* Set this to what your compiler uses for 64 bit data type */
00066 #ifdef WIN32
00067         #define unsigned64_t __int64
00068 #else
00069         #define unsigned64_t unsigned long long
00070 #endif
00071 
00072 
00073 #define I64(C) C##LL
00074 
00075 
00076 typedef unsigned64_t uuid_time_t;
00077 
00078 
00079 typedef struct {
00080         char nodeID[6];
00081 } uuid_node_t;
00082 
00083 
00084 void get_ieee_node_identifier(uuid_node_t *node);
00085 void get_system_time(uuid_time_t *uuid_time);
00086 void get_random_info(unsigned char seed[16]);
00087 
00088 
00089 #endif /* SYSDEP_H */
00090