ntp_types.h revision 182007
1/* 2 * ntp_types.h - defines how int32 and u_int32 are treated. 3 * For 64 bit systems like the DEC Alpha, they have to be defined 4 * as int and u_int. 5 * For 32 bit systems, define them as long and u_long 6 */ 7#include <sys/types.h> 8#include "ntp_machine.h" 9 10#ifndef _NTP_TYPES_ 11#define _NTP_TYPES_ 12 13/* 14 * This is another naming conflict. 15 * On NetBSD for MAC the macro "mac" is defined as 1 16 * this is fun for us as a packet structure contains an 17 * optional "mac" member - severe confusion results 8-) 18 * As we hopefully do not have to rely on that macro we 19 * just undefine that. 20 */ 21#ifdef mac 22#undef mac 23#endif 24 25/* 26 * Set up for prototyping 27 */ 28#ifndef P 29#if defined(__STDC__) || defined(HAVE_PROTOTYPES) 30#define P(x) x 31#else /* not __STDC__ and not HAVE_PROTOTYPES */ 32#define P(x) () 33#endif /* not __STDC__ and HAVE_PROTOTYPES */ 34#endif /* P */ 35 36/* 37 * VMS DECC (v4.1), {u_char,u_short,u_long} are only in SOCKET.H, 38 * and u_int isn't defined anywhere 39 */ 40#if defined(VMS) 41#include <socket.h> 42typedef unsigned int u_int; 43/* 44 * Note: VMS DECC has long == int (even on __alpha), 45 * so the distinction below doesn't matter 46 */ 47#endif /* VMS */ 48 49#if (SIZEOF_INT == 4) 50# ifndef int32 51# define int32 int 52# endif 53# ifndef u_int32 54# define u_int32 unsigned int 55# endif 56#else /* not sizeof(int) == 4 */ 57# if (SIZEOF_LONG == 4) 58# else /* not sizeof(long) == 4 */ 59# ifndef int32 60# define int32 long 61# endif 62# ifndef u_int32 63# define u_int32 unsigned long 64# endif 65# endif /* not sizeof(long) == 4 */ 66# include "Bletch: what's 32 bits on this machine?" 67#endif /* not sizeof(int) == 4 */ 68 69typedef u_char ntp_u_int8_t; 70typedef u_short ntp_u_int16_t; 71typedef u_int32 ntp_u_int32_t; 72 73typedef struct ntp_uint64_t { u_int32 val[2]; } ntp_uint64_t; 74 75typedef unsigned short associd_t; /* association ID */ 76typedef u_int32 keyid_t; /* cryptographic key ID */ 77typedef u_int32 tstamp_t; /* NTP seconds timestamp */ 78 79#endif /* _NTP_TYPES_ */ 80 81