Author: cazfi Date: Wed Jan 27 03:09:22 2016 New Revision: 31621 URL: http://svn.gna.org/viewcvs/freeciv?rev=31621&view=rev Log: Moved upper level abstraction parts of netintf.h to new net_types.h header
See patch #6843 Added: branches/S2_6/utility/net_types.h Modified: branches/S2_6/server/srv_main.h branches/S2_6/tools/download.c branches/S2_6/tools/modinst.c branches/S2_6/utility/Makefile.am branches/S2_6/utility/netintf.h Modified: branches/S2_6/server/srv_main.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.h?rev=31621&r1=31620&r2=31621&view=diff ============================================================================== --- branches/S2_6/server/srv_main.h (original) +++ branches/S2_6/server/srv_main.h Wed Jan 27 03:09:22 2016 @@ -15,7 +15,7 @@ /* utility */ #include "log.h" /* enum log_level */ -#include "netintf.h" +#include "net_types.h" /* announce_type */ /* common */ #include "fc_types.h" Modified: branches/S2_6/tools/download.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/tools/download.c?rev=31621&r1=31620&r2=31621&view=diff ============================================================================== --- branches/S2_6/tools/download.c (original) +++ branches/S2_6/tools/download.c Wed Jan 27 03:09:22 2016 @@ -31,7 +31,6 @@ #include "capability.h" #include "fcintl.h" #include "log.h" -#include "netintf.h" #include "netfile.h" #include "registry.h" Modified: branches/S2_6/tools/modinst.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/tools/modinst.c?rev=31621&r1=31620&r2=31621&view=diff ============================================================================== --- branches/S2_6/tools/modinst.c (original) +++ branches/S2_6/tools/modinst.c Wed Jan 27 03:09:22 2016 @@ -20,7 +20,7 @@ #include "fcintl.h" #include "log.h" #include "mem.h" -#include "netintf.h" +#include "net_types.h" #include "rand.h" #include "registry.h" Modified: branches/S2_6/utility/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/Makefile.am?rev=31621&r1=31620&r2=31621&view=diff ============================================================================== --- branches/S2_6/utility/Makefile.am (original) +++ branches/S2_6/utility/Makefile.am Wed Jan 27 03:09:22 2016 @@ -36,6 +36,7 @@ iterator.h \ log.c \ log.h \ + net_types.h \ netfile.c \ netfile.h \ netintf.c \ Added: branches/S2_6/utility/net_types.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/net_types.h?rev=31621&view=auto ============================================================================== --- branches/S2_6/utility/net_types.h (added) +++ branches/S2_6/utility/net_types.h Wed Jan 27 03:09:22 2016 @@ -0,0 +1,69 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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, 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 header contains some upper level types related to networking. + * The idea is that this header can be included without need to special + * handling of the conflicts of definitions of lower level types that + * appear in netintf.h */ + +#ifndef FC__NET_TYPES_H +#define FC__NET_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* gen_headers */ +#include "freeciv_config.h" + +/* map symbolic Winsock error names to symbolic errno names */ +#ifdef FREECIV_HAVE_WINSOCK +#undef EINTR +#undef EINPROGRESS +#undef EWOULDBLOCK +#undef ECONNRESET +#undef ECONNREFUSED +#undef EADDRNOTAVAIL +#undef ETIMEDOUT +#define EINTR WSAEINTR +#define EINPROGRESS WSAEWOULDBLOCK +#define EWOULDBLOCK WSAEWOULDBLOCK +#define ECONNRESET WSAECONNRESET +#define ECONNREFUSED WSAECONNREFUSED +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#define ETIMEDOUT WSAETIMEDOUT +#endif /* FREECIV_HAVE_WINSOCK */ + +/* Which protocol will be used for LAN announcements */ +enum announce_type { + ANNOUNCE_NONE, + ANNOUNCE_IPV4, + ANNOUNCE_IPV6 +}; + +#define ANNOUNCE_DEFAULT ANNOUNCE_IPV4 + +enum fc_addr_family { + FC_ADDR_IPV4, + FC_ADDR_IPV6, + FC_ADDR_ANY +}; + +void fc_init_network(void); +void fc_shutdown_network(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* FC__NET_TYPES_H */ Modified: branches/S2_6/utility/netintf.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/netintf.h?rev=31621&r1=31620&r2=31621&view=diff ============================================================================== --- branches/S2_6/utility/netintf.h (original) +++ branches/S2_6/utility/netintf.h Wed Jan 27 03:09:22 2016 @@ -55,25 +55,8 @@ /* utility */ #include "ioz.h" -#include "support.h" /* bool type */ - -/* map symbolic Winsock error names to symbolic errno names */ -#ifdef FREECIV_HAVE_WINSOCK -#undef EINTR -#undef EINPROGRESS -#undef EWOULDBLOCK -#undef ECONNRESET -#undef ECONNREFUSED -#undef EADDRNOTAVAIL -#undef ETIMEDOUT -#define EINTR WSAEINTR -#define EINPROGRESS WSAEWOULDBLOCK -#define EWOULDBLOCK WSAEWOULDBLOCK -#define ECONNRESET WSAECONNRESET -#define ECONNREFUSED WSAECONNREFUSED -#define EADDRNOTAVAIL WSAEADDRNOTAVAIL -#define ETIMEDOUT WSAETIMEDOUT -#endif /* FREECIV_HAVE_WINSOCK */ +#include "net_types.h" +#include "support.h" /* bool type */ #ifdef FD_ZERO #define FC_FD_ZERO FD_ZERO @@ -108,29 +91,12 @@ TYPED_LIST_ITERATE(union fc_sockaddr, sockaddrlist, paddr) #define fc_sockaddr_list_iterate_end LIST_ITERATE_END -/* Which protocol will be used for LAN announcements */ -enum announce_type { - ANNOUNCE_NONE, - ANNOUNCE_IPV4, - ANNOUNCE_IPV6 -}; - -#define ANNOUNCE_DEFAULT ANNOUNCE_IPV4 - -enum fc_addr_family { - FC_ADDR_IPV4, - FC_ADDR_IPV6, - FC_ADDR_ANY -}; - int fc_connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen); int fc_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); int fc_readsocket(int sock, void *buf, size_t size); int fc_writesocket(int sock, const void *buf, size_t size); void fc_closesocket(int sock); -void fc_init_network(void); -void fc_shutdown_network(void); void fc_nonblock(int sockfd); struct fc_sockaddr_list *net_lookup_service(const char *name, int port, _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits