| 1 | /* | 
|---|
| 2 |  *   ORXONOX - the hottest 3D action shooter ever to exist | 
|---|
| 3 |  *                    > www.orxonox.net < | 
|---|
| 4 |  * | 
|---|
| 5 |  * | 
|---|
| 6 |  *   License notice: | 
|---|
| 7 |  * | 
|---|
| 8 |  *   This program is free software; you can redistribute it and/or | 
|---|
| 9 |  *   modify it under the terms of the GNU General Public License | 
|---|
| 10 |  *   as published by the Free Software Foundation; either version 2 | 
|---|
| 11 |  *   of the License, or (at your option) any later version. | 
|---|
| 12 |  * | 
|---|
| 13 |  *   This program is distributed in the hope that it will be useful, | 
|---|
| 14 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 15 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 16 |  *   GNU General Public License for more details. | 
|---|
| 17 |  * | 
|---|
| 18 |  *   You should have received a copy of the GNU General Public License | 
|---|
| 19 |  *   along with this program; if not, write to the Free Software | 
|---|
| 20 |  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
|---|
| 21 |  * | 
|---|
| 22 |  *   Author: | 
|---|
| 23 |  *      Reto Grieder | 
|---|
| 24 |  *   Co-authors: | 
|---|
| 25 |  *      ... | 
|---|
| 26 |  * | 
|---|
| 27 |  */ | 
|---|
| 28 |  | 
|---|
| 29 | /** | 
|---|
| 30 | @file | 
|---|
| 31 | @brief | 
|---|
| 32 |     Shared library macros, enums, constants and forward declarations for the network library | 
|---|
| 33 | */ | 
|---|
| 34 |  | 
|---|
| 35 | #ifndef _NetworkPrereqs_H__ | 
|---|
| 36 | #define _NetworkPrereqs_H__ | 
|---|
| 37 |  | 
|---|
| 38 | #include "OrxonoxConfig.h" | 
|---|
| 39 |  | 
|---|
| 40 | //----------------------------------------------------------------------- | 
|---|
| 41 | // Shared library settings | 
|---|
| 42 | //----------------------------------------------------------------------- | 
|---|
| 43 |  | 
|---|
| 44 | #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( NETWORK_STATIC_BUILD ) | 
|---|
| 45 | #  ifdef NETWORK_SHARED_BUILD | 
|---|
| 46 | #    define _NetworkExport __declspec(dllexport) | 
|---|
| 47 | #  else | 
|---|
| 48 | #    if defined( __MINGW32__ ) | 
|---|
| 49 | #      define _NetworkExport | 
|---|
| 50 | #    else | 
|---|
| 51 | #      define _NetworkExport __declspec(dllimport) | 
|---|
| 52 | #    endif | 
|---|
| 53 | #  endif | 
|---|
| 54 | #elif defined ( ORXONOX_GCC_VISIBILITY ) | 
|---|
| 55 | #  define _NetworkExport  __attribute__ ((visibility("default"))) | 
|---|
| 56 | #else | 
|---|
| 57 | #  define _NetworkExport | 
|---|
| 58 | #endif | 
|---|
| 59 |  | 
|---|
| 60 | //----------------------------------------------------------------------- | 
|---|
| 61 | // Constants | 
|---|
| 62 | //----------------------------------------------------------------------- | 
|---|
| 63 |  | 
|---|
| 64 | namespace orxonox | 
|---|
| 65 | { | 
|---|
| 66 |   static const unsigned int GAMESTATEID_INITIAL       = static_cast<unsigned int>(-1); | 
|---|
| 67 |   static const unsigned int CLIENTID_UNKNOWN          = static_cast<unsigned int>(-2); | 
|---|
| 68 |   extern const char* LAN_DISCOVERY_MESSAGE; | 
|---|
| 69 |   extern const char* LAN_DISCOVERY_ACK; | 
|---|
| 70 |   static const unsigned int LAN_DISCOVERY_PORT          = 55558; | 
|---|
| 71 |   static const unsigned int NETWORK_PEER_ID_SERVER      = 0; | 
|---|
| 72 |   static const unsigned int NETWORK_CHANNEL_DEFAULT     = 0; | 
|---|
| 73 |   static const unsigned int NETWORK_CHANNEL_UNRELIABLE  = 1; | 
|---|
| 74 |   static const unsigned int NETWORK_CHANNEL_COUNT       = 2; | 
|---|
| 75 | } | 
|---|
| 76 |  | 
|---|
| 77 | //----------------------------------------------------------------------- | 
|---|
| 78 | // Enums | 
|---|
| 79 | //----------------------------------------------------------------------- | 
|---|
| 80 |  | 
|---|
| 81 | namespace orxonox | 
|---|
| 82 | { | 
|---|
| 83 |   namespace packet | 
|---|
| 84 |   { | 
|---|
| 85 |     namespace PacketFlag | 
|---|
| 86 |     { | 
|---|
| 87 |       enum Value | 
|---|
| 88 |       { | 
|---|
| 89 |         Reliable    = 1, | 
|---|
| 90 |         Unsequenced = 2, | 
|---|
| 91 |         NoAllocate  = 4 | 
|---|
| 92 |       }; | 
|---|
| 93 |     } | 
|---|
| 94 |   } | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | //----------------------------------------------------------------------- | 
|---|
| 98 | // Forward declarations | 
|---|
| 99 | //----------------------------------------------------------------------- | 
|---|
| 100 |  | 
|---|
| 101 | // from ENet | 
|---|
| 102 | struct _ENetPeer; | 
|---|
| 103 | typedef _ENetPeer     ENetPeer; | 
|---|
| 104 | struct _ENetPacket; | 
|---|
| 105 | typedef _ENetPacket   ENetPacket; | 
|---|
| 106 | struct _ENetEvent; | 
|---|
| 107 | typedef _ENetEvent    ENetEvent; | 
|---|
| 108 | struct _ENetHost; | 
|---|
| 109 | typedef _ENetHost     ENetHost; | 
|---|
| 110 | struct _ENetAddress; | 
|---|
| 111 | typedef _ENetAddress  ENetAddress; | 
|---|
| 112 | typedef uint8_t       ENetChannelID; | 
|---|
| 113 |  | 
|---|
| 114 | namespace orxonox | 
|---|
| 115 | { | 
|---|
| 116 |   class ChatListener; | 
|---|
| 117 |   class Client; | 
|---|
| 118 |   class ClientConnection; | 
|---|
| 119 |   class ClientConnectionListener; | 
|---|
| 120 |   class ClientInformation; | 
|---|
| 121 |   class Connection; | 
|---|
| 122 |   class FunctionCall; | 
|---|
| 123 |   class FunctionCallManager; | 
|---|
| 124 |   class GamestateClient; | 
|---|
| 125 |   class GamestateHandler; | 
|---|
| 126 |   class GamestateManager; | 
|---|
| 127 |   class Host; | 
|---|
| 128 |   class NetworkFunctionBase; | 
|---|
| 129 |   struct NetworkFunctionPointer; | 
|---|
| 130 |   class NetworkFunctionStatic; | 
|---|
| 131 |   template <class T> | 
|---|
| 132 |   class NetworkMemberFunction; | 
|---|
| 133 |   class NetworkMemberFunctionBase; | 
|---|
| 134 |   class Server; | 
|---|
| 135 |   class ServerConnection; | 
|---|
| 136 |   class TrafficControl; | 
|---|
| 137 |  | 
|---|
| 138 |   // packet | 
|---|
| 139 |   namespace packet | 
|---|
| 140 |   { | 
|---|
| 141 |     class Acknowledgement; | 
|---|
| 142 |     class Chat; | 
|---|
| 143 |     class ClassID; | 
|---|
| 144 |     class DeleteObjects; | 
|---|
| 145 |     class FunctionCalls; | 
|---|
| 146 |     class FunctionIDs; | 
|---|
| 147 |     class Gamestate; | 
|---|
| 148 |     class Packet; | 
|---|
| 149 |     class Welcome; | 
|---|
| 150 |   } | 
|---|
| 151 |  | 
|---|
| 152 |   // synchronisable | 
|---|
| 153 |   template <class T> | 
|---|
| 154 |   class NetworkCallback; | 
|---|
| 155 |   template <class T, class U> | 
|---|
| 156 |   class NetworkCallbackNotify; | 
|---|
| 157 |   class NetworkCallbackBase; | 
|---|
| 158 |   class NetworkCallbackManager; | 
|---|
| 159 |   class Synchronisable; | 
|---|
| 160 |   class SynchronisableHeader; | 
|---|
| 161 |   template <class T> | 
|---|
| 162 |   class SynchronisableVariable; | 
|---|
| 163 |   class SynchronisableVariableBase; | 
|---|
| 164 |   template <class T> | 
|---|
| 165 |   class SynchronisableVariableBidirectional; | 
|---|
| 166 | } | 
|---|
| 167 |  | 
|---|
| 168 | namespace boost | 
|---|
| 169 | { | 
|---|
| 170 |   class mutex; | 
|---|
| 171 |   class thread; | 
|---|
| 172 | } | 
|---|
| 173 |  | 
|---|
| 174 | #endif /* _NetworkPrereqs_H__ */ | 
|---|