xorp

xorp_osdep_end.h

00001 /* -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- */
00002 /* vim:set sts=4 ts=8: */
00003 
00004 /*
00005  * Copyright (c) 2001-2011 XORP, Inc and Others
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU Lesser General Public License, Version
00009  * 2.1, June 1999 as published by the Free Software Foundation.
00010  * Redistribution and/or modification of this program under the terms of
00011  * any other version of the GNU Lesser General Public License is not
00012  * permitted.
00013  * 
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00017  * see the GNU Lesser General Public License, Version 2.1, a copy of
00018  * which can be found in the XORP LICENSE.lgpl file.
00019  * 
00020  * XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00021  * http://xorp.net
00022  */
00023 
00024 #ifndef __LIBXORP_XORP_OSDEP_END_H__
00025 #define __LIBXORP_XORP_OSDEP_END_H__
00026 
00027 #ifdef HOST_OS_WINDOWS
00028 
00029 #include "win_io.h"
00030 
00031 /*
00032  * Numerous kludges for purging items from the Windows namespace
00033  * which collide with the XORP namespace exist here.
00034  */
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 /*
00041  * XXX: <libxorp/service.hh> ServiceStatus enum members collide
00042  * with some of the definitions in <winsvc.h>, which we don't use
00043  * [yet], so undefine some of them out of the way for now.
00044  */
00045 #undef SERVICE_RUNNING
00046 #undef SERVICE_PAUSED
00047 
00048 /*
00049  * XXX: <libproto/spt.hh> RouteCmd::Cmd enum collides with the
00050  * preprocessor define DELETE in <winnt.h>.
00051  */
00052 #undef DELETE
00053 
00054 /*
00055  * XXX: <policy/filter_manager.hh> _export member name collides with
00056  * the preprocessor define _export in <windef.h>.
00057  */
00058 #undef _export
00059 
00060 /*
00061  * XXX: <bgp/socket.hh> enums collide with the preprocessor define
00062  * ERROR in <wingdi.h>.
00063  */
00064 #undef ERROR
00065 
00066 /*
00067  * XXX: gai_strerror() is #define'd to one of two prototyped functions
00068  * by both the MinGW w32api version of the SDK, and the PSDK itself.
00069  * However the functions don't actually exist.
00070  * The Windows PSDK itself defines both functions as inline C functions.
00071  * Here we try to deal with both cases by explicitly defining a single
00072  * function prototype for the Win32 case, and purging the preprocessor macro.
00073  */
00074 #ifdef gai_strerror
00075 #undef gai_strerror
00076 #endif
00077 
00078 char *gai_strerror(int ecode);
00079 
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083 
00084 #define XSTRERROR win_strerror(GetLastError())
00085 
00086 /* End of windows code */
00087 #else
00088 
00089 /* Non windows code */
00090 #define XSTRERROR strerror(errno)
00091 
00092 #endif
00093 
00094 #endif /* __LIBXORP_XORP_OSDEP_END_H__ */
 All Classes Namespaces Functions Variables Typedefs Enumerations