import cyrus-sasl-2.1.23
[cyrus-sasl.git] / mac / CommonKClient / mac_kclient3 / Headers / KerberosSupport / Utilities.h
1 /* $Copyright:\r *\r * Copyright 1998-2000 by the Massachusetts Institute of Technology.\r * \r * All rights reserved.\r * \r * Permission to use, copy, modify, and distribute this software and its\r * documentation for any purpose and without fee is hereby granted,\r * provided that the above copyright notice appear in all copies and that\r * both that copyright notice and this permission notice appear in\r * supporting documentation, and that the name of M.I.T. not be used in\r * advertising or publicity pertaining to distribution of the software\r * without specific, written prior permission.  Furthermore if you modify\r * this software you must label your software as modified software and not\r * distribute it in such a fashion that it might be confused with the\r * original MIT software. M.I.T. makes no representations about the\r * suitability of this software for any purpose.  It is provided "as is"\r * without express or implied warranty.\r * \r * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r * \r * Individual source code files are copyright MIT, Cygnus Support,\r * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r * \r * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r * and Zephyr are trademarks of the Massachusetts Institute of Technology\r * (MIT).  No commercial use of these trademarks may be made without prior\r * written permission of MIT.\r * \r * "Commercial use" means use of a name in a product or other for-profit\r * manner.  It does NOT prevent a commercial firm from referring to the MIT\r * trademarks in order to convey information (although in doing so,\r * recognition of their trademark status should be given).\r * $\r */\r\r/* $Header: /afs/andrew/system/cvs/src/sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosSupport/Utilities.h,v 1.2 2001/12/04 02:05:57 rjs3 Exp $ */\r\r/*\r * Utilities.h - Public header file for the Utilities library\r */\r \r#ifndef __UTILITIES__\r#define __UTILITIES__\r\r#include <time.h>\r#include <KerberosSupport/pwd.h>\r\r#include <ConditionalMacros.h>\r#include <MacTypes.h>\r\r#if PRAGMA_ONCE\r#pragma once\r#endif\r\r#ifdef __cplusplus\rextern "C" {\r#endif\r\r#if PRAGMA_IMPORT\r#pragma import on\r#endif\r\r#if PRAGMA_STRUCT_ALIGN\r      #pragma options align=mac68k\r#elif PRAGMA_STRUCT_PACKPUSH\r      #pragma pack(push, 2)\r#elif PRAGMA_STRUCT_PACK\r #pragma pack(2)\r#endif\r\r/************************/\r/* Structures and Types */\r/************************/\r\r/* common types for POSIX structures */\rtypedef       unsigned char   u_char;\rtypedef unsigned short  u_short;\rtypedef        unsigned int    u_int;\rtypedef  unsigned long   u_long;\r\rtypedef unsigned char   uchar_t;\rtypedef unsigned short  ushort_t;\r/*typedef UInt32  uint_t;*/   /* We don't define uint_t because OpenTransport.h does. */\rtypedef unsigned long      ulong_t;\r\rtypedef char   *caddr_t;\rtypedef SInt32  daddr_t;\rtypedef SInt16  cnt_t;\r\rtypedef ulong_t paddr_t;\rtypedef uchar_t use_t;\rtypedef SInt16  sysid_t;\rtypedef SInt16  index_t;\r\r\r/**********/\r/* Macros */\r/**********/\r\r/* macros for BSD memory utilities */\r#define bzero(dest, nbytes)                       memset(dest, 0, nbytes)\r#define bcopy(src, dest, nbytes)        memcpy(dest, src, nbytes)\r#define bcmp(ptr1, ptr2, nbytes)      memcmp(ptr1, ptr2, nbytes)\r#define index(s, c)                                  strchr(s, c)\r#define rindex(s, c)                               strrchr(s, c)\r\r\r/***********************/\r/* Function Prototypes */\r/***********************/\r\r/* String Utilities */\rint strcasecmp(const char *s1, const char *s2);\rint strncasecmp(const char *s1, const char *s2, register int n);\rchar *strtoken (const char *s, const char *delim, int index);\rchar *strdup (const char *s);\rvoid swab(register char *from, register char *to, register int n);\r\r/* Time Utilities */\rint gettimeofday (struct timeval *tp, struct timezone *);\rint settimeofday (struct timeval *tp, struct timezone *);\rvoid get_gmt_offset(void);\rvoid mac_time_to_unix_time (time_t *time);\rvoid unix_time_to_mac_time (time_t *time);\rvoid msl_time_to_unix_time (time_t *time);\rvoid unix_time_to_msl_time (time_t *time);\r\r/* Mac OS X Runtime utilities */\rBoolean        RunningUnderClassic (void);\rBoolean     RunningUnderMacOSX (void);\r\r\r#if PRAGMA_STRUCT_ALIGN\r   #pragma options align=reset\r#elif PRAGMA_STRUCT_PACKPUSH\r       #pragma pack(pop)\r#elif PRAGMA_STRUCT_PACK\r     #pragma pack()\r#endif\r\r#ifdef PRAGMA_IMPORT_OFF\r#pragma import off\r#elif PRAGMA_IMPORT\r#pragma import reset\r#endif\r\r#ifdef __cplusplus\r}\r#endif\r\r#endif /* __UTILTIES__ */