X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/05b75f8d50b83e943af3be4071449304d82dbdcd..69a3ec00896b5f6dcdd04d5250e8b9fc8aeb20fd:/lib/common.h diff --git a/lib/common.h b/lib/common.h index 77a2cd9..6c90fd6 100644 --- a/lib/common.h +++ b/lib/common.h @@ -1,21 +1,19 @@ /* * This file is part of DisOrder. - * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell + * Copyright (C) 2004, 2005, 2007, 2008, 2013 Richard Kettlewell * - * This program is free software; you can redistribute it and/or modify + * 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 + * the Free Software Foundation, either version 3 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. - * + * + * 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 + * along with this program. If not, see . */ /** @file lib/common.h * @brief Common includes and definitions @@ -24,7 +22,20 @@ #ifndef COMMON_H #define COMMON_H -#include +#if HAVE_CONFIG_H +# include +#endif + +#if _WIN32 +# include "disorder-win32.h" +#else +# define SOCKET int +# define INVALID_SOCKET (-1) +# define declspec(x) +# define socket_error() (errno) +# define system_error() (errno) +# define network_init() +#endif #if HAVE_INTTYPES_H # include @@ -112,6 +123,18 @@ typedef unsigned char uint32_t; # endif #endif +#if ! HAVE_UINT16_T +# if USHRT_MAX == 65535 +typedef unsigned short uint16_t; +# else +# error cannot determine uint16_t +# endif +#endif + +#if !HAVE_CLOSESOCKET +# define closesocket close +#endif + #endif /* COMMENT_H */ /*