/* ***************************************************************************** * * File: fko_common.h * * Author: Damien S. Stuart * * Purpose: Common header for libfko source files. * * Copyright 2009-2010 Damien Stuart (dstuart@dstuart.org) * * License (GNU Public License): * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * ***************************************************************************** */ #ifndef FKO_COMMON_H #define FKO_COMMON_H 1 #define HAVE_CONFIG_H 1 #if HAVE_CONFIG_H #include "config.h" #endif #include #include #if STDC_HEADERS #include #include #elif HAVE_STRINGS_H #include #endif /*STDC_HEADERS*/ #if HAVE_UNISTD_H #include #endif #if HAVE_CTYPE_H #include /* Using this for isdigit() */ #else /* Fall-back does not account for locale */ #define isdigit(c) (c >= 48 && c <= 57) #endif #ifdef IPHONE typedef u_int8_t uint8_t; typedef u_int16_t uint16_t; typedef u_int32_t uint32_t; #endif #ifdef WIN32 /* These are needed for the digest code under windows. */ typedef unsigned __int8 uint8_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; #define strdup _strdup #else #if HAVE_STDINT_H #include #endif #endif /* Work out endianess (sp?) */ #if HAVE_ENDIAN_H /* Should cover most Linux systems */ #include #define BYTEORDER __BYTE_ORDER #elif HAVE_SYS_ENDIAN_H /* FreeBSD has a sys/endian.h */ #include #define BYTEORDER _BYTE_ORDER #elif HAVE_SYS_BYTEORDER_H /* Solaris (v10 at least) seems to have this */ #include #if defined(_BIG_ENDIAN) #define BYTEORDER 4321 #elif defined(_LITTLE_ENDIAN) #define BYTEORDER 1234 #else #error unable to determine BYTEORDER #endif #endif #ifdef WIN32 #include #else #ifdef HAVE_SYS_TIME_H #include #ifdef TIME_WITH_SYS_TIME #include #endif #endif #endif /* Convenient macros for wrapping sections in 'extern "C" {' constructs. */ #ifdef __cplusplus #define BEGIN_C_DECLS extern "C" { #define END_C_DECLS } #else /* !__cplusplus */ #define BEGIN_C_DECLS #define END_C_DECLS #endif /* __cplusplus */ /* Pull in gpgme.h if we have it. */ #if HAVE_LIBGPGME #include #endif #include "fko_util.h" #include "fko_limits.h" #include "fko_state.h" #include "fko_context.h" /* Try to cover for those that do not have bzero. */ #if !HAVE_BZERO && HAVE_MEMSET # define bzero(buf, bytes) ((void) memset (buf, 0, bytes)) #endif #endif /* FKO_COMMON_H */ /***EOF***/